fix(application-form-fill): 过滤申请表噪声冲突内容

This commit is contained in:
2026-06-07 20:34:24 +08:00
parent d640ced748
commit 003ff59268
4 changed files with 81 additions and 6 deletions

View File

@@ -17,11 +17,11 @@ from review_agent.regulatory_review.services.text_extract import extract_text
FIELD_ALIASES = {
"product_name": ["产品名称"],
"applicant_name": ["注册人名称", "生产企业名称", "企业名称", "生产企业"],
"applicant_address": ["注册人住所", "生产企业住所", "企业住所", "住所"],
"applicant_name": ["注册人名称", "申请人名称", "生产企业名称"],
"applicant_address": ["注册人住所", "申请人住所", "生产企业住所"],
"manufacturer_address": ["生产地址", "生产企业地址", "生产场所"],
"agent_name": ["代理人名称", "生产企业名称", "企业名称", "生产企业", "注册人名称"],
"agent_address": ["代理人住所", "生产企业住所", "企业住所", "住所", "注册人住所"],
"agent_name": ["代理人名称", "生产企业名称", "注册人名称", "申请人名称"],
"agent_address": ["代理人住所", "生产企业住所", "注册人住所", "申请人住所"],
"package_specification": ["包装规格", "规格"],
"main_components": ["主要组成成分", "主要组成", "组成成分"],
"intended_use": ["预期用途"],
@@ -35,6 +35,14 @@ STATIC_STOP_LABELS = [
"",
"保证书",
"应附资料",
"优先通道申请",
"分类编码",
"医疗器械唯一标识",
"注册产品目前是否",
"临床评价路径",
"临床试验",
"其他需要说明的问题",
"国家药监局器审中心医疗器械",
]

View File

@@ -22,10 +22,11 @@ def build_assistant_summary(batch: ApplicationFormFillBatch, exports: list[Expor
lines.extend(["", "| 冲突字段 | 采用值 | 冲突来源 | 处理 |", "| --- | --- | --- | --- |"])
for item in conflicts:
conflict_sources = "".join(
f"{value.get('source_file', '')}{value.get('value', '')}" for value in item.get("conflict_values", [])
f"{_compact_table_text(value.get('source_file', ''))}{_compact_table_text(value.get('value', ''))}"
for value in item.get("conflict_values", [])
)
lines.append(
f"| {item.get('field_label', item.get('field_key', ''))} | {item.get('selected_value', '')} | {conflict_sources or '-'} | {item.get('handling', '')} |"
f"| {_compact_table_text(item.get('field_label', item.get('field_key', '')))} | {_compact_table_text(item.get('selected_value', ''))} | {_compact_table_text(conflict_sources or '-')} | {_compact_table_text(item.get('handling', ''))} |"
)
if trace_exports:
@@ -33,3 +34,10 @@ def build_assistant_summary(batch: ApplicationFormFillBatch, exports: list[Expor
for export in trace_exports:
lines.append(f"[下载{export.file_name}](/api/review-agent/file-summary/exports/{export.pk}/download/)")
return "\n".join(lines).strip()
def _compact_table_text(value: object, *, limit: int = 80) -> str:
text = " ".join(str(value or "").replace("|", " ").split())
if len(text) <= limit:
return text
return f"{text[:limit]}..."