Closed vmoitra closed 8 months ago
As far as I know, ICD coding is only available for the US datasets, MIMIC (III and IV) and eICU. Using this, I believe it shouldn't be hard to calculate the various comorbidity scores using for example the icd package. In the examples sections of the JSS vignette, there is some demo code for construction a diabetes concept. The reason for not including something like this out of the box, is the support would be limited to the US datasets. For HiRID, you're pretty much out of luck in terms of diagnosis information and for AUMC something like this also is not straight forward. I believe there might be some diagnosis information available there, but it's not coded and it is in Dutch.
Thanks for the question, this is an overdue answer, but I will add it in case it interests someone else.
The icd package mentioned by @nbenn is a useful tool for this. In particular, you can use the functions comorbid_charlson()
and comorbid_elix()
for extracting the Charlson and Elixhauser indices from ICD-9/ICD-10 codes.
However, as @nbenn also points out -- there are no comorbidities reported in aumc
, hirid
, or sic
(Salzburg DB). Therefore, these analyses can only be ran on MIMIC-III, MIMIC-IV, or eICU (although there you will note a lower data quality on the recorded comorbidities).
I am attaching a callback that I used for constructing Elixhauser for a project. We will however not add this to ricu
:
Concept specification:
"elix": {
"description": "Elixhauser Index",
"category": "Misc.",
"target": "id_tbl",
"sources": {
"miiv": [
{
"table": "diagnoses_icd",
"class": "col_itm",
"group_var": "icd_version",
"callback": "elix_miiv"
}
]
}
}
Callback function:
elix_miiv <- function(x, group_var, ...) {
sub_var <- setdiff(names(x), c(meta_vars(x), group_var))
get_elix <- function(x, sub_var) {
intm <- data.frame(
pid = id_col(x),
icd = x[[sub_var]]
)
intm <- comorbid_elix(intm)
rm_cols <- which(colnames(intm) %in% rm_cols)
intm <- rowSums(intm[, -rm_cols])
res <- id_tbl(
id = as.integer(names(intm)),
val = intm, id_vars = "id"
)
names(res) <- c(id_var(x), "icd_code")
res
}
rbind(
get_elix(x[get(group_var) == 9], sub_var),
get_elix(x[get(group_var) == 10], sub_var)
)
}
Then, you can load the data by running
> load_concepts("elix", "miiv")
── Loading 1 concept ────────────────────────────────────────────────────────────
• elix
─────────────────────────────────────────────────────────────────────────────────
# An `id_tbl`: 76,504 ✖ 2
# Id var: `stay_id`
stay_id elix
<int> <dbl>
1 30000153 1
2 30000213 7
3 30000484 3
4 30000646 3
5 30001148 3
…
76,500 39999301 2
76,501 39999384 4
76,502 39999552 4
76,503 39999562 2
76,504 39999810 3
# ℹ 76,499 more rows
# ℹ Use `print(n = ...)` to see more rows
In order to analyze data across datasets (MIMIC, eICU, HiRID, and Amsterdam), are there equivalent comorbidity measures across these datasets, ie classification schemas and scores using ICD-9/10 codes defined by Charlson and Elixhauser?