Commit fc481b9e by luoqi

fix(ingest): 纠偏宿主 ICD 怪码 K07.303(牙体缺损,非正畸)→ K03 + 新增 recode op

鉴定:K07.303 在中文临床版 ICD 系统性指派给'牙体缺损'(WHO K07=错颌畸形),全院 1083 患者。
PAC substring(0,3) 截成 K07 + coalesce 优先 stdCode 丢掉 message → 误当正畸召回。
这也是'画像=潜在修复 vs 召回=正畸'矛盾的真根因(沈静芳/许龄心)。

- 新增 derive 'recode' op(覆盖表,未命中透传)— 通用的宿主 ICD 怪码纠偏机制。
- manifest B.1:substring 前 recode {K07.303: K03},再截短;其余 K07.3xx(牙列不齐/牙拥挤/异位牙)确是正畸不动。
- 验证(本地 905,重摄重算):K07-牙体缺损残留 0 → K03 牙体缺损 285;沈静芳召回'正畸82'消失、只剩'修复30',
  跟画像一致(矛盾从源头解决,年龄门 band-aid 不再需要);ortho 召回降、hard_tissue 升;
  交叉测试 FP 0/0、真·无法解释 FN 0,零回归。
- 注:服务器需随部署重摄才生效(reparse)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
parent 53467054
......@@ -315,9 +315,17 @@ transforms:
message_norm:
op: normalize
from: message
# ⚠️ 宿主 ICD 怪码纠偏:中文临床版把 K07.303 指派给"牙体缺损"(WHO K07=错颌畸形),
# naive 截前3位会误成 K07→正畸(全院 1083 患者)。recode 先把 K07.303 改 K03(牙体缺损/修复),
# 再截短。其余 K07.3xx(牙列不齐/牙拥挤/异位牙)确是正畸,不动。
std_code_fixed:
op: recode
from: std_code
map:
K07.303: K03
std_code_k:
op: substring
from: std_code
from: std_code_fixed
start: 0
end: 3
......
......@@ -109,5 +109,10 @@ function evalExpr(expr: DeriveExpr, row: Row): unknown {
}
return null;
}
case 'recode': {
const v = row[expr.from];
if (typeof v !== 'string') return v ?? null;
return Object.prototype.hasOwnProperty.call(expr.map, v) ? expr.map[v] : v;
}
}
}
......@@ -168,6 +168,15 @@ export const DeriveCoalesceSchema = z.object({
from: z.array(z.string().min(1)).min(1).describe('按顺序取第一个非空字段值'),
});
/// recode — 按覆盖表把字段值替换成另一个值(命中 map → 用 map 值;否则原样透传)。
/// 用途:宿主 ICD 字典怪码纠偏。例 K07.303 在中文临床版=牙体缺损(WHO K07=错颌畸形),
/// { from: std_code, map: { 'K07.303': 'K03' } } → K07.303 改 K03,再交 substring 截短;其余码不变。
export const DeriveRecodeSchema = z.object({
op: z.literal('recode'),
from: z.string().min(1),
map: z.record(z.string(), z.string()).describe('原值 → 目标值;未命中则透传原值'),
});
export const DeriveExprSchema = z.discriminatedUnion('op', [
DeriveSubstringSchema,
DeriveConcatSchema,
......@@ -177,6 +186,7 @@ export const DeriveExprSchema = z.discriminatedUnion('op', [
DeriveTrimSchema,
DeriveNormalizeSchema,
DeriveCoalesceSchema,
DeriveRecodeSchema,
]);
export type DeriveExpr = z.infer<typeof DeriveExprSchema>;
......
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