Skip to content

Commit

Permalink
WIP picdb death_icu
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelburger committed Apr 5, 2024
1 parent 866f52b commit 9a91a7d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
16 changes: 16 additions & 0 deletions R/callback-icu-mortality.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,19 @@ miiv_death_icu <- function(x, env, ...){
mi_death_icu(x, transfers, icu_wards, ...)
}

picdb_death_icu <- function(x, env, ...){

icu_stays <- env[["icustays"]]

# For each "hadm_id" we find the "icustay_id" of the last ICU stay based on the "intime"
last_icu_stay <- icu_stays[ , .(icustay_id = icustay_id[which.max(intime)]), by = hadm_id]
print(last_icu_stay)
print(x)

# icu_wards <- sort(unique(env[["icustays"]]$first_careunit))
# transfers <- load_ts(env[["icustays"]], id_var = "hadm_id", index_var = "intime", interval = mins(1L))
# transfers <- change_id(transfers, "icustay", as_src_cfg(env), id_type = TRUE)

# rename_cols(transfers, "ward", "curr_careunit", by_ref = TRUE)
# mi_death_icu(x, transfers, icu_wards, ...)
}
18 changes: 18 additions & 0 deletions inst/extdata/config/concept-dict/outcome.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@
"callback": "transform_fun(comp_na(`==`, 1L))",
"class": "col_itm"
}
],
"picdb": [
{
"table": "admissions",
"index_var": "deathtime",
"val_var": "hospital_expire_flag",
"callback": "transform_fun(comp_na(`==`, 1L))",
"class": "col_itm"
}
]
}
},
Expand Down Expand Up @@ -222,6 +231,15 @@
"callback": "sic_death",
"class": "col_itm"
}
],
"picdb": [
{
"table": "admissions",
"index_var": "deathtime",
"val_var": "hospital_expire_flag",
"callback": "mimic_death_icu",
"class": "col_itm"
}
]
}
},
Expand Down

0 comments on commit 9a91a7d

Please sign in to comment.