feat: expand ClaML Modifier/ModifierClass into terminal 5th-digit codes
ICD-10-GM models the 4th/5th sub-digits of many groups (incl. all E10-E14 diabetes) via <Modifier>/<ModifierClass> referenced by ordered <ModifiedBy> on the parent <Class>, not as nested <Class> elements. load() previously returned nothing for codes like E11.90/E11.72/I10.91, so ~1.7k corpus codes (incl. ~1.2k billable) fell back to the non-billable 3-digit root and were silently dropped under --billable-only. Collect per-Class ModifiedBy refs and all ModifierClass defs during the existing single stream, then expand: cartesian product of the referenced modifiers' ModifierClass codes in ModifiedBy order, concatenated verbatim onto the parent code (E11 + .9 + 0 = E11.90), matching the Alpha-ID corpus format exactly. Terminal leaves are billable (Para295/Para301=P); description = parent label + each ModifierClass label joined by ' - '; chapter/group/exotic/ifsg/content inherited from parent. Purely additive: explicit <Class> entries always win. Generic over every modifier group. Map size 12334 -> 17249 (+4915 synthesized). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
use alpha_id::claml;
|
||||
|
||||
#[test]
|
||||
fn expands_diabetes_5th_digit_codes_as_billable() {
|
||||
let map = claml::load("icd-claml/Klassifikationsdateien/icd10gm2026syst_claml_20250912.xml").unwrap();
|
||||
let e1190 = map.get("E11.90").expect("E11.90 synthesized from ModifierClass");
|
||||
assert_eq!(e1190.para295, "P", "terminal 5th-digit diabetes code must be billable");
|
||||
assert!(e1190.description.to_lowercase().contains("diabetes"),
|
||||
"composed description from parent + modifier labels: {:?}", e1190.description);
|
||||
let e1172 = map.get("E11.72").expect("E11.72 synthesized");
|
||||
assert_eq!(e1172.para295, "P");
|
||||
let a010 = map.get("A01.0").expect("A01.0 explicit");
|
||||
assert_eq!(a010.para295, "P");
|
||||
assert!(a010.description.contains("Typhus abdominalis"));
|
||||
assert_eq!(map.get("E11").expect("E11 root").para295, "V");
|
||||
}
|
||||
Reference in New Issue
Block a user