Commit 4fbc08a7 by luoqi

fix(ingest): 宿主 ICD 错标纠偏 K00后天缺失→K08 — 修"萌出异常"误召(一线反馈⑭)

关平 BJ0U007377 牙25:残根拔除后缺失,宿主把"牙齿缺少"标 std_code K00(=牙发育/
萌出障碍)→ 误召"萌出异常未处置"。全库 1044 例同类错标。

区分符=「先天」:K00 真覆盖先天缺牙(462 例,发育障碍)+ 萌出/多生牙;后天缺失的
"牙齿缺少/缺失/缺牙"被错标 → 应 K08。
- types reconcileDiagnosisCode(code,name):code=K00 且 name 含缺(牙/失/少)且无"先天"
  → K08;其余 K00 不动(单一源,与 K07.303→K03 同类纠偏);
- diagnosis.parser 落码前调用纠偏。

验证(本地重摄 21 人):关平25 K00→K08,召回从"萌出异常"(66)改判"缺失牙未修复"
(81,正确);21 人里 9 条诊断纠偏;前四类修复回归全保留。需 reparse 存量诊断。
仅本地,未部署。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
parent d0e76a61
......@@ -5,6 +5,7 @@ import {
FactStatus,
FactType,
PACDiagnosisCodeSchema,
reconcileDiagnosisCode,
} from '@pac/types';
import type { Parser, ParserContext, FactDraft } from './parser.interface';
import { normalizeToothPosition } from './tooth-position.util';
......@@ -42,7 +43,11 @@ export class DiagnosisParser implements Parser {
// code 校验:命中 PAC 闭集 → 用;否则置 null(不丢 fact,留 message 给 LLM 补码)
const rawCode = String(c.code ?? '').trim();
const codeParsed = PACDiagnosisCodeSchema.safeParse(rawCode);
const code = codeParsed.success ? codeParsed.data : null;
const validCode = codeParsed.success ? codeParsed.data : null;
// 宿主 std_code 错标纠偏(K00 后天缺失 → K08;详见 reconcileDiagnosisCode)
const reconciled = reconcileDiagnosisCode(validCode, cleanName((c.name as string | undefined) ?? null));
const code = (reconciled ? PACDiagnosisCodeSchema.safeParse(reconciled) : { success: false }) as { success: boolean; data?: string };
const resolvedCode = code.success ? (code.data as typeof validCode) : validCode;
// code_source 溯源:① 上游显式声明(如影像 AI codeSource='image_ai')优先;
// ② 否则按 stdCode 有无推断(std_code / name_map);③ 无码 → null。通用,非宿主特化。
......@@ -50,7 +55,7 @@ export class DiagnosisParser implements Parser {
const hasStdCode = !!String(c.stdCodeRaw ?? '').trim();
const codeSource: string | null = explicitSource
? explicitSource
: code
: resolvedCode
? hasStdCode
? 'std_code'
: 'name_map'
......@@ -70,10 +75,10 @@ export class DiagnosisParser implements Parser {
status: FactStatus.ACTIVE,
clinicId: ctx.transaction.clinicId,
occurredAt: ctx.transaction.occurredAt,
title: `诊断 ${code ?? nameZh ?? '未定码'}${toothPosition ? ` · 牙位 ${toothPosition}` : ''}`,
title: `诊断 ${resolvedCode ?? nameZh ?? '未定码'}${toothPosition ? ` · 牙位 ${toothPosition}` : ''}`,
summary: nameZh,
content: {
code,
code: resolvedCode,
code_source: codeSource,
name_zh: nameZh,
tooth_position: toothPosition,
......
......@@ -282,6 +282,17 @@ export const RESTORATION_INELIGIBLE_DX_NAMES = ['废用牙', '无功能牙'] as
/// 「间隙不足」(李强 BJ0U017401 牙36;46:缺牙十年邻牙倾倒,空间不够直接修复 → 需先正畸)
/// 也归此类:对 K08 缺牙召回效果一致(不该推"快去种植修复")。共现"缺牙"护栏已挡掉正畸
/// 拥挤语境(全库 844 段「间隙不足」仅 246 段共现缺牙,均为真·缺牙无空间)。
/// 宿主 std_code 错标纠偏:K00=牙发育/萌出障碍(含先天缺牙),但宿主常把【后天缺失】的
/// "牙齿缺少/缺失/缺牙"也错标成 K00(全库 1044 例)→ 冒出"萌出异常"误召(关平 BJ0U007377 牙25:
/// 残根拔除后缺失,宿主标 K00 → 误召萌出处置)。区分符=「先天」:有先天 → 真 K00(发育障碍),
/// 无先天的缺牙义 → 后天缺失 = K08。萌出/多生牙等其它 K00 不动。
export function reconcileDiagnosisCode(code: string | null, nameZh: string | null): string | null {
if (code === 'K00' && nameZh && /缺(牙|失|少)/.test(nameZh) && !/先天/.test(nameZh)) {
return 'K08';
}
return code;
}
/// 治疗记录 subtype 里"患者拒绝该类治疗"的说法(余奕铭 BJ0F022277:planned 治疗
/// "正畸取资料,患者无意愿"/"洁牙,患者无意愿"→ 患者当场拒绝该 category)。
/// 语义=对【本次诊断】排除该治疗类目(同"已启动治疗"对称,靠时间方向;新诊断不受影响)。
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment