Closed janickweberpals closed 2 years ago
Hi, thanks for your kind words!
Regarding your question, do you mean running the comorbidity()
function with both ICD-9 and ICD-10 codes that are both used to determine conditions?
If so, that is not supported – when using ICD-10 only ICD-10 codes are used, and viceversa; however, you can still pass the dataset, and only relevant codes will be picked up by default (unless there is some odd collision, but I don't think there is).
If you want to use both coding systems, I would actually recommend running comorbidity()
twice, once with ICD-9 and once with ICD-10, and then combine the results.
Let me know if this makes sense, thanks!
Hi,
I have a follow-up question. Based on your advice to run comorbidity()
twice to capture ICD-9 and ICD-10 systems, what is the correct way to calculate the total unweighted and weighted scores?
Thanks!
Hi, Sorry for the delayed response. Combining the scores would require quite a bit of data wrangling, I suspect you'd have to:
I can't think of a single, straightforward way of doing that, sorry! Hope this helps,
Alessandro
I tried doing this with code below, following your advice. However, by combining/summarizing by personid, the dataframe loses its "comorbidity" property. Any advice on how to combine without losing this.
df.diagnoses.icd10 <- df.condition.icd10 %>% comorbidity(id = "personid", code = "condition_code_id", map = "elixhauser_icd10_quan", assign0 = FALSE)
df.diagnoses.icd9 <- df.condition.icd9 %>% comorbidity(id = "personid", code = "condition_code_id", map = "elixhauser_icd9_quan", assign0 = FALSE)
df.diagnoses.icd9_10 <- bind_rows(df.diagnoses.icd9, df.diagnoses.icd10)
df.diagnoses.icd9_10 <- df.diagnoses.icd9_10 %>% group_by(personid) %>% summarise(across(chf:depre, ~max(.))) %>% mutate(Elixhauser = score(x = ., weights = NULL, assign0 = FALSE))
Hi @davigood1, I think you have to to first run the score()
function to df.diagnoses.icd10
and df.diagnoses.icd9
, and then combine them using some logic similar to the one you use. I think it would be easy to combine comorbid conditions (just take the max), but I suspect you would have to be a bit more careful with the weighted scores.
Hi there, First of all, thanks for the great package which has worked for me like a charm so far. I was wondering if the comorbidity function can also handle if both ICD-9 and ICD-10 codes co-exist in the same column? From the documentation I assumed that this is supported (with the option to apply different mappings using the map parameter) but wanted to double check that this is correct. Thanks!