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"); } /// Regression test: a category with a single `` expands /// correctly into its terminal 5th-digit leaves. /// /// `C88.0` (Makroglobulinämie Waldenström) has exactly one `` with two `` codes ("0" and /// "1"), yielding `C88.00` and `C88.01`. Both codes appear in the /// Alpha-ID corpus (`data/icd10gm2026_alphaidse_edvtxt_20250926.txt`). /// /// The parent `C88.0` carries `Para295 = "P"` (already billable at the 4th /// digit) and `Para301 = "V"`. The synthesized terminals therefore inherit /// `para295 = "P"` (parent value, not "V") and `para301 = "P"` ("V" promoted). #[test] fn expands_single_modifier_chain() { let map = claml::load("icd-claml/Klassifikationsdateien/icd10gm2026syst_claml_20250912.xml").unwrap(); // C88.00 – verified in corpus (e.g. Alpha-ID I30531 "Makroglobulinämie Waldenström"). let c8800 = map.get("C88.00").expect("C88.00 synthesized from single ModifiedBy"); assert_eq!(c8800.para295, "P", "para295 inherited from parent C88.0 (which is already P, not V)"); // Parent label + modifier label joined by " - ". assert!(c8800.description.contains("Waldenström"), "description must contain parent label: {:?}", c8800.description); assert!(c8800.description.contains("Remission"), "description must contain modifier label: {:?}", c8800.description); // C88.01 – verified in corpus (Alpha-ID I31044 "Makroglobulinämie in kompletter Remission"). let c8801 = map.get("C88.01").expect("C88.01 synthesized"); assert_eq!(c8801.para295, "P"); assert!(c8801.description.contains("kompletter Remission"), "description must include modifier label: {:?}", c8801.description); // The 4th-digit parent itself must still be present and unchanged. let c880 = map.get("C88.0").expect("C88.0 explicit parent still present"); assert_eq!(c880.para295, "P", "explicit parent entry must not be overwritten"); }