jackwasey / icd

Fast ICD-10 and ICD-9 comorbidities, decoding and validation in R. NB use main instead of master for default branch.
https://jackwasey.github.io/icd/
GNU General Public License v3.0
242 stars 60 forks source link

comorbid_hcc() with ICD9 and ICD10 mixed data set #183

Closed bhbrantley closed 5 years ago

bhbrantley commented 5 years ago

(posting here in lieu of email). As a general approach, how do you suggest handling a data set with both ICD 9 and ICD 10 codes when trying to map HCC comorbidities?

For example:

df <- data.frame(patient_id = c("1", "2", "3", "4", "5"),
                 icd_code = c("042", "042", "B20", "B20", "B20"),
                 date = as.POSIXct("2018-01-01"),
                 stringsAsFactors = FALSE)

Would return HCC 1 for only the first two. Would I need to split the df using is_valid and then re-join the two at the patient level?

jackwasey commented 5 years ago

In general, it is difficult when there is only one column with mixed ICD-9 and ICD-10 codes.

If possible, try to use metadata to separate them out. e.g. were ICD-9 codes only used before a certain date, and ICD-10 after?

If you have to use is_valid, be aware that some codes will be valid ICD-9 and ICD-10 codes e.g. some V... and E... codes.

Once you've done this, I would generate the HCC (or any comorbidity) results: one for the patients with ICD-9 codes, and one for the ICD-10 codes.

If you have patients with both types, you'll have to decide how to merge.

Hope this helps. I don't use HCC myself. Maybe somebody else with some experience can help.

bhbrantley commented 5 years ago

Thanks for the validation. Metadata likely to be pre-processing best bet.