Last active
September 14, 2018 21:18
-
-
Save fny/39fe4664967930bb9e452a982ae486e6 to your computer and use it in GitHub Desktop.
ICD10 to Charlson Comorbidity Index Crosswalk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# icd10_map_charlson from https://github.com/jackwasey/icd/blob/master/data/icd10_map_charlson.RData | |
df = data.frame("comorbidity" = character(0), "icd10" = character(0), "score" = numeric(0), stringsAsFactors = FALSE) | |
scores = data.frame( | |
MI = 1, | |
CHF = 1, | |
PVD = 1, | |
Stroke = 1, | |
Dementia = 1, | |
Pulmonary = 1, | |
Rheumatic = 1, | |
PUD = 1, | |
LiverMild = 1, | |
DM = 1, | |
DMcx = 2, | |
Paralysis = 2, | |
Renal = 2, | |
Cancer = 2, | |
LiverSevere = 3, | |
Mets = 6, | |
HIV = 6 | |
) | |
for (name in attributes(icd10_map_charlson)$names) { | |
for (icd10 in icd10_map_charlson[[name]]) { | |
df[nrow(df) + 1,] = list("icd10" = icd10, "comorbidity" = name, "score" = scores[[name]]) | |
} | |
} | |
write.csv(df, file = "icd10_to_charlson_comorbidity_index.csv", row.names = FALSE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment