CUD2V / pccc

Pediatric Complex Chronic Conditions: An R Package
5 stars 8 forks source link

Error in ICD9 codes for metabolic #41

Open stephenrho opened 2 years ago

stephenrho commented 2 years ago

I think I've noticed some errors in the ICD9 procedure codes for the metabolic CCC.

> pccc::get_codes(9)["metabolic", ]$pc
 [1] "064"  "0652" "0681" "073"  "0764" "0765" "0768" "0769" "6241" "645"  "6551" "6553"
[13] "6561" "6563" "6841" "6849" "6851" "6859" "6861" "6869" "6871" "6879" "8606"

Shouldn't '064' and '073' be '0064' and '0073', respectively? Otherwise I match 64.0/0640 = circumcision or 73.0 = procedures during delivery.

Thanks

stephenrho commented 2 years ago

Ok I looked some more and it looks like all ICD 9 procedure codes in src/pccc.cpp are not padded in accordance with the documentation

ICD 9 codes: Codes less than 10 should be left padded with 2 zeros. Codes less than 100 should be left padded with 1 zero.

Is this deliberate? I can't see anywhere that says the padding is specific to diagnosis codes. Also for codes < 1 I would assume they should be padded by "000": e.g.,

> icd::decimal_to_short("00.93")
[1] "00093"
magic-lantern commented 2 years ago

Thanks! I'll review this and our test suite and let you know if I see any issues.

I seem to recall a reason for not padding - could have just been how the original SAS code did it. Will have to think about it a bit.