fix(regulatory): 优先从附件字段识别适用条件
This commit is contained in:
@@ -49,6 +49,39 @@ def test_detect_regulatory_condition_candidates_from_summary_items(django_user_m
|
||||
assert candidates["product_name"]["suggested"] == "甲胎蛋白检测试剂盒"
|
||||
|
||||
|
||||
def test_detect_regulatory_condition_prefers_attachment_fields_over_chapter_title(settings, tmp_path, django_user_model):
|
||||
settings.MEDIA_ROOT = tmp_path
|
||||
user = django_user_model.objects.create_user(username="owner", password="pass")
|
||||
conversation = Conversation.objects.create(user=user, title="会话")
|
||||
summary = FileSummaryBatch.objects.create(
|
||||
conversation=conversation,
|
||||
user=user,
|
||||
batch_no="FS-COND",
|
||||
status=FileSummaryBatch.Status.SUCCESS,
|
||||
product_name="第1章 监管信息",
|
||||
)
|
||||
application = tmp_path / "application.txt"
|
||||
application.write_text(
|
||||
"产品名称:甲胎蛋白检测试剂盒\n型号规格:20人份/盒\n预期用途:用于人血清中甲胎蛋白检测\n注册类型:首次注册\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
FileSummaryItem.objects.create(
|
||||
batch=summary,
|
||||
file_index=1,
|
||||
directory_level="1. 监管信息 / 1.2 申请表",
|
||||
file_name="申请表.txt",
|
||||
file_type="txt",
|
||||
relative_path="1.监管信息/申请表.txt",
|
||||
storage_path=str(application),
|
||||
)
|
||||
|
||||
candidates = detect_regulatory_condition_candidates(summary)
|
||||
|
||||
assert candidates["product_name"]["suggested"] == "甲胎蛋白检测试剂盒"
|
||||
assert candidates["model_spec"]["suggested"] == "20人份/盒"
|
||||
assert candidates["intended_use"]["suggested"] == "用于人血清中甲胎蛋白检测"
|
||||
|
||||
|
||||
def test_workflow_pauses_before_rule_scope_until_conditions_confirmed(settings, tmp_path, django_user_model):
|
||||
settings.MEDIA_ROOT = tmp_path
|
||||
user = django_user_model.objects.create_user(username="owner", password="pass")
|
||||
|
||||
Reference in New Issue
Block a user