From 8e5c0609ca111034c19c3bd2ab019e4d35e641a5 Mon Sep 17 00:00:00 2001 From: Malte Londschien <61679398+mlondschien@users.noreply.github.com> Date: Wed, 6 Mar 2024 15:20:35 +0100 Subject: [PATCH] Integrate PICDB into RICU (#5) * Add picdb.json. * Some fewer rows. * Add "easy" entries to concept dicts. * Add 'sub_var': 'itemid' * Add some 'defaults' values. * Get rid of surgery vital signs. * load_difftime and id_win_helper for picdb. * Add picdb to startup datasets * Update row counts: chartevents, labevents --------- Co-authored-by: Manuel Burger --- R/data-load.R | 12 + R/data-utils.R | 29 + R/utils-file.R | 2 +- .../config/concept-dict/blood_gas.json | 79 +- .../config/concept-dict/chemistry.json | 139 ++- .../config/concept-dict/demographics.json | 41 +- .../config/concept-dict/hematology.json | 149 ++- .../config/concept-dict/medications.json | 48 +- .../config/concept-dict/microbiology.json | 3 +- .../config/concept-dict/neurological.json | 15 +- inst/extdata/config/concept-dict/outcome.json | 9 +- inst/extdata/config/concept-dict/output.json | 9 + .../config/concept-dict/respiratory.json | 37 +- inst/extdata/config/concept-dict/vitals.json | 33 + inst/extdata/config/data-sources/picdb.json | 847 ++++++++++++++++++ 15 files changed, 1404 insertions(+), 48 deletions(-) create mode 100644 inst/extdata/config/data-sources/picdb.json diff --git a/R/data-load.R b/R/data-load.R index 80b57ee4..071a8195 100644 --- a/R/data-load.R +++ b/R/data-load.R @@ -178,6 +178,18 @@ load_difftime.sic_tbl <- function(x, rows, cols = colnames(x), load_eiau(x, {{ rows }}, cols, id_hint, time_vars, sec_as_mins) } +#' @rdname load_src +#' @export +# copy-pasted from mimic_tbl +load_difftime.picdb_tbl <- function(x, rows, cols = colnames(x), + id_hint = id_vars(x), + time_vars = ricu::time_vars(x), ...) { + + warn_dots(...) + + load_mihi(x, {{ rows }}, cols, id_hint, time_vars) +} + #' @rdname load_src #' @export load_difftime.character <- function(x, src, ...) { diff --git a/R/data-utils.R b/R/data-utils.R index 0d2b73cc..31fa02df 100644 --- a/R/data-utils.R +++ b/R/data-utils.R @@ -361,6 +361,35 @@ id_win_helper.miiv_env <- function(x) { order_rename(res, ids, sta, end) } +#' @rdname data_utils +#' @export +# copy-pasted from mimic +id_win_helper.picdb_env <- function(x) { + + merge_inter <- function(x, y) { + merge(x, y, by = intersect(colnames(x), colnames(y))) + } + + get_id_tbl <- function(tbl, id, start, end, aux) { + as_src_tbl(x, tbl)[, c(id, start, end, aux)] + } + + cfg <- sort(as_id_cfg(x), decreasing = TRUE) + + ids <- field(cfg, "id") + sta <- field(cfg, "start") + end <- field(cfg, "end") + + res <- Map(get_id_tbl, field(cfg, "table"), ids, sta, + end, c(as.list(ids[-1L]), list(NULL))) + res <- Reduce(merge_inter, res) + + res <- res[, c(sta, end) := lapply(.SD, as_dt_min, get(sta[1L])), + .SDcols = c(sta, end)] + + order_rename(res, ids, sta, end) +} + #' @export id_win_helper.default <- function(x) stop_generic(x, .Generic) diff --git a/R/utils-file.R b/R/utils-file.R index 18c49cba..e83393a1 100644 --- a/R/utils-file.R +++ b/R/utils-file.R @@ -193,7 +193,7 @@ auto_attach_srcs <- function() { res <- sys_env("RICU_SRC_LOAD", unset = NA_character_) if (is.na(res)) { - c("mimic", "mimic_demo", "eicu", "eicu_demo", "hirid", "aumc", "miiv", "sic") + c("mimic", "mimic_demo", "eicu", "eicu_demo", "hirid", "aumc", "miiv", "sic", "picdb") } else { strsplit(res, ",")[[1L]] } diff --git a/inst/extdata/config/concept-dict/blood_gas.json b/inst/extdata/config/concept-dict/blood_gas.json index 41fe1747..04b7854d 100644 --- a/inst/extdata/config/concept-dict/blood_gas.json +++ b/inst/extdata/config/concept-dict/blood_gas.json @@ -71,6 +71,16 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5211, + 5249 + ], + "sub_var": "itemid" + } ] } }, @@ -144,7 +154,8 @@ "table": "laboratory", "sub_var": "LaboratoryID" } - ] + ], + "picdb": [] } }, "fio2": { @@ -246,7 +257,8 @@ "table": "data_float_h", "sub_var": "DataID" } - ] + ], + "picdb": [] } }, "hbco": { @@ -282,6 +294,15 @@ "sub_var": "variableid", "class": "hrd_itm" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5219 + ], + "sub_var": "itemid" + } ] } }, @@ -356,6 +377,15 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5227 + ], + "sub_var": "itemid" + } ] } }, @@ -416,6 +446,15 @@ "table": "labevents", "sub_var": "itemid" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5228 + ], + "sub_var": "itemid" + } ] } }, @@ -490,6 +529,16 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5235, + 5236 + ], + "sub_var": "itemid" + } ] } }, @@ -559,6 +608,19 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5237, + 5238, + 5373, + 5374, + 5386 + ], + "sub_var": "itemid" + } ] } }, @@ -636,6 +698,16 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5239, + 5244 + ], + "sub_var": "itemid" + } ] } }, @@ -683,7 +755,8 @@ "table": "labevents", "sub_var": "itemid" } - ] + ], + "picdb": [] } } } \ No newline at end of file diff --git a/inst/extdata/config/concept-dict/chemistry.json b/inst/extdata/config/concept-dict/chemistry.json index 31667de6..bae0b17c 100644 --- a/inst/extdata/config/concept-dict/chemistry.json +++ b/inst/extdata/config/concept-dict/chemistry.json @@ -68,6 +68,15 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5024 + ], + "sub_var": "itemid" + } ] } }, @@ -140,6 +149,15 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5025 + ], + "sub_var": "itemid" + } ] } }, @@ -212,7 +230,8 @@ "table": "laboratory", "sub_var": "LaboratoryID" } - ] + ], + "picdb": [] } }, "ast": { @@ -284,7 +303,8 @@ "table": "laboratory", "sub_var": "LaboratoryID" } - ] + ], + "picdb": [] } }, "bicar": { @@ -357,6 +377,15 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5248 + ], + "sub_var": "itemid" + } ] } }, @@ -429,7 +458,8 @@ "table": "laboratory", "sub_var": "LaboratoryID" } - ] + ], + "picdb": [] } }, "bili_dir": { @@ -498,7 +528,8 @@ "table": "laboratory", "sub_var": "LaboratoryID" } - ] + ], + "picdb": [] } }, "bun": { @@ -571,7 +602,8 @@ "sub_var": "LaboratoryID", "callback": "transform_fun(binary_op(`*`, 2.14))" } - ] + ], + "picdb": [] } }, "ca": { @@ -646,7 +678,8 @@ "sub_var": "LaboratoryID", "callback": "transform_fun(binary_op(`*`, 4.008))" } - ] + ], + "picdb": [] } }, "ck": { @@ -718,7 +751,8 @@ "table": "laboratory", "sub_var": "LaboratoryID" } - ] + ], + "picdb": [] } }, "ckmb": { @@ -784,7 +818,8 @@ "table": "laboratory", "sub_var": "LaboratoryID" } - ] + ], + "picdb": [] } }, "cl": { @@ -860,7 +895,8 @@ "table": "laboratory", "sub_var": "LaboratoryID" } - ] + ], + "picdb": [] } }, "crea": { @@ -933,6 +969,17 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5032, + 5041, + 6954 + ], + "sub_var": "itemid" + } ] } }, @@ -1000,6 +1047,16 @@ "sub_var": "itemid", "callback": "convert_unit(binary_op(`*`, 10), 'mg/L', 'mg/dl')" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5626, + 5821 + ], + "sub_var": "itemid" + } ] } }, @@ -1099,6 +1156,16 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5047, + 5223 + ], + "sub_var": "itemid" + } ] } }, @@ -1182,6 +1249,15 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5226 + ], + "sub_var": "itemid" + } ] } }, @@ -1257,6 +1333,15 @@ "sub_var": "LaboratoryID", "callback": "transform_fun(binary_op(`*`, 2.431))" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5059 + ], + "sub_var": "itemid" + } ] } }, @@ -1341,6 +1426,15 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5062 + ], + "sub_var": "itemid" + } ] } }, @@ -1414,6 +1508,15 @@ "sub_var": "LaboratoryID", "callback": "transform_fun(binary_op(`*`, 3.097521))" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5072 + ], + "sub_var": "itemid" + } ] } }, @@ -1482,6 +1585,15 @@ "sub_var": "LaboratoryID", "callback": "transform_fun(binary_op(`/`, 1000))" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 6525 + ], + "sub_var": "itemid" + } ] } }, @@ -1533,6 +1645,15 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 6192 + ], + "sub_var": "itemid" + } ] } } diff --git a/inst/extdata/config/concept-dict/demographics.json b/inst/extdata/config/concept-dict/demographics.json index 390ab6dc..6f156f78 100644 --- a/inst/extdata/config/concept-dict/demographics.json +++ b/inst/extdata/config/concept-dict/demographics.json @@ -57,7 +57,8 @@ "callback": "apply_map(\n c(MED = 'med', SURG = 'surg', CMED = 'med', CSURG = 'surg',\n VSURG = 'surg', NSURG = 'surg', NB = 'other', NMED = 'med',\n ORTHO = 'surg', TRAUM = 'surg', OMED = 'med', GU = 'other',\n NBB = 'other', TSURG = 'surg', GYN = 'other', PSURG = 'surg',\n OBS = 'other', ENT = 'surg', DENT = 'surg', PSYCH = 'other')\n )", "class": "col_itm" } - ] + ], + "picdb": [] } }, "age": { @@ -129,7 +130,8 @@ "val_var": "AgeOnAdmission", "class": "col_itm" } - ] + ], + "picdb": [] } }, "bmi": { @@ -229,6 +231,22 @@ "val_var": "HeightOnAdmission", "class": "col_itm" } + ], + "picdb": [ + { + "table": "chartevents", + "ids": [ + "1013" + ], + "sub_var": "itemid" + }, + { + "table": "labevents", + "ids": [ + 6322 + ], + "sub_var": "itemid" + } ] } }, @@ -304,7 +322,8 @@ "callback": "apply_map(c(`735` = 'Male', `736` = 'Female'))", "class": "col_itm" } - ] + ], + "picdb": [] } }, "weight": { @@ -382,6 +401,22 @@ "class": "col_itm", "callback": "transform_fun(binary_op(`/`, 1000))" } + ], + "picdb": [ + { + "table": "chartevents", + "ids": [ + "1014" + ], + "sub_var": "itemid" + }, + { + "table": "labevents", + "ids": [ + 6323 + ], + "sub_var": "itemid" + } ] } } diff --git a/inst/extdata/config/concept-dict/hematology.json b/inst/extdata/config/concept-dict/hematology.json index 09e52eab..4cd8d094 100644 --- a/inst/extdata/config/concept-dict/hematology.json +++ b/inst/extdata/config/concept-dict/hematology.json @@ -61,6 +61,15 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5492 + ], + "sub_var": "itemid" + } ] } }, @@ -122,7 +131,8 @@ "table": "labevents", "sub_var": "itemid" } - ] + ], + "picdb": [] } }, "eos": { @@ -187,6 +197,15 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5002 + ], + "sub_var": "itemid" + } ] } }, @@ -239,7 +258,8 @@ "table": "labevents", "sub_var": "itemid" } - ] + ], + "picdb": [] } }, "fgn": { @@ -312,7 +332,8 @@ "table": "laboratory", "sub_var": "LaboratoryID" } - ] + ], + "picdb": [] } }, "hba1c": { @@ -351,7 +372,8 @@ "table": "labevents", "sub_var": "itemid" } - ] + ], + "picdb": [] } }, "hct": { @@ -418,6 +440,16 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5097, + 5225 + ], + "sub_var": "itemid" + } ] } }, @@ -500,6 +532,16 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5099, + 5257 + ], + "sub_var": "itemid" + } ] } }, @@ -557,7 +599,8 @@ "table": "labevents", "sub_var": "itemid" } - ] + ], + "picdb": [] } }, "lymph": { @@ -631,7 +674,8 @@ "table": "laboratory", "sub_var": "LaboratoryID" } - ] + ], + "picdb": [] } }, "mch": { @@ -698,6 +742,15 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5113 + ], + "sub_var": "itemid" + } ] } }, @@ -767,6 +820,15 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5114 + ], + "sub_var": "itemid" + } ] } }, @@ -834,6 +896,15 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5115 + ], + "sub_var": "itemid" + } ] } }, @@ -910,6 +981,15 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5094 + ], + "sub_var": "itemid" + } ] } }, @@ -985,6 +1065,15 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5129 + ], + "sub_var": "itemid" + } ] } }, @@ -1043,6 +1132,16 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5186, + 6890 + ], + "sub_var": "itemid" + } ] } }, @@ -1109,6 +1208,15 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5161 + ], + "sub_var": "itemid" + } ] } }, @@ -1171,6 +1279,17 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5379, + 5381, + 6515 + ], + "sub_var": "itemid" + } ] } }, @@ -1230,6 +1349,15 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 5136 + ], + "sub_var": "itemid" + } ] } }, @@ -1302,6 +1430,15 @@ "table": "laboratory", "sub_var": "LaboratoryID" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 6516 + ], + "sub_var": "itemid" + } ] } } diff --git a/inst/extdata/config/concept-dict/medications.json b/inst/extdata/config/concept-dict/medications.json index 1fd24e4c..3ad798e8 100644 --- a/inst/extdata/config/concept-dict/medications.json +++ b/inst/extdata/config/concept-dict/medications.json @@ -437,7 +437,8 @@ "sub_var": "DrugID", "callback": "transform_fun(set_val(TRUE))" } - ] + ], + "picdb": [] } }, "adh_rate": { @@ -529,7 +530,8 @@ "stop_var": "endtime", "callback": "combine_callbacks(\n convert_unit(binary_op(`/`, 60), 'units/min', 'units/hour'),\n mimic_rate_mv\n )" } - ] + ], + "picdb": [] } }, "cort": { @@ -577,7 +579,8 @@ "sub_var": "pharmaid", "callback": "transform_fun(set_val(TRUE))" } - ] + ], + "picdb": [] } }, "dex": { @@ -733,7 +736,8 @@ "interval": "00:01:00", "callback": "combine_callbacks(\n grp_mount_to_rate(mins(1L), hours(1L)),\n dex_to_10(30017L, 2)\n )" } - ] + ], + "picdb": [] }, "class": [ "unt_cncpt", @@ -842,7 +846,8 @@ "stop_var": "OffsetDrugEnd", "callback": "sic_dur" } - ] + ], + "picdb": [] } }, "dobu_rate": { @@ -952,7 +957,8 @@ "stop_var": "OffsetDrugEnd", "callback": "sic_rate_kg" } - ] + ], + "picdb": [] } }, "dobu60": { @@ -1059,7 +1065,8 @@ "stop_var": "OffsetDrugEnd", "callback": "sic_dur" } - ] + ], + "picdb": [] } }, "dopa_rate": { @@ -1162,7 +1169,8 @@ "stop_var": "OffsetDrugEnd", "callback": "sic_rate_kg" } - ] + ], + "picdb": [] } }, "epi_dur": { @@ -1275,7 +1283,8 @@ "stop_var": "OffsetDrugEnd", "callback": "sic_dur" } - ] + ], + "picdb": [] } }, "epi_rate": { @@ -1393,7 +1402,8 @@ "stop_var": "OffsetDrugEnd", "callback": "sic_rate_kg" } - ] + ], + "picdb": [] } }, "ins": { @@ -1495,6 +1505,15 @@ "end_var": "endtime", "callback": "distribute_amount" } + ], + "picdb": [ + { + "table": "labevents", + "ids": [ + 6172 + ], + "sub_var": "itemid" + } ] } }, @@ -1605,7 +1624,8 @@ "stop_var": "OffsetDrugEnd", "callback": "sic_dur" } - ] + ], + "picdb": [] } }, "norepi_equiv": { @@ -1733,7 +1753,8 @@ "stop_var": "OffsetDrugEnd", "callback": "sic_rate_kg" } - ] + ], + "picdb": [] } }, "phn_rate": { @@ -1816,7 +1837,8 @@ "stop_var": "endtime", "callback": "mimic_rate_mv" } - ] + ], + "picdb": [] } }, "vaso_ind": { diff --git a/inst/extdata/config/concept-dict/microbiology.json b/inst/extdata/config/concept-dict/microbiology.json index be37ecb0..d3313efb 100644 --- a/inst/extdata/config/concept-dict/microbiology.json +++ b/inst/extdata/config/concept-dict/microbiology.json @@ -76,7 +76,8 @@ "aux_time": "charttime", "class": "col_itm" } - ] + ], + "picdb": [] } } } \ No newline at end of file diff --git a/inst/extdata/config/concept-dict/neurological.json b/inst/extdata/config/concept-dict/neurological.json index 2f1036ac..22a714b6 100644 --- a/inst/extdata/config/concept-dict/neurological.json +++ b/inst/extdata/config/concept-dict/neurological.json @@ -76,7 +76,8 @@ "table": "chartevents", "sub_var": "itemid" } - ] + ], + "picdb": [] } }, "gcs": { @@ -169,7 +170,8 @@ "table": "chartevents", "sub_var": "itemid" } - ] + ], + "picdb": [] } }, "rass": { @@ -230,7 +232,8 @@ "table": "chartevents", "sub_var": "itemid" } - ] + ], + "picdb": [] } }, "tgcs": { @@ -267,7 +270,8 @@ "table": "chartevents", "sub_var": "itemid" } - ] + ], + "picdb": [] } }, "vgcs": { @@ -339,7 +343,8 @@ "table": "chartevents", "sub_var": "itemid" } - ] + ], + "picdb": [] } } } \ No newline at end of file diff --git a/inst/extdata/config/concept-dict/outcome.json b/inst/extdata/config/concept-dict/outcome.json index 13acf349..fef255ff 100644 --- a/inst/extdata/config/concept-dict/outcome.json +++ b/inst/extdata/config/concept-dict/outcome.json @@ -70,7 +70,8 @@ "callback": "transform_fun(comp_na(`==`, 1L))", "class": "col_itm" } - ] + ], + "picdb": [] } }, "dopa60": { @@ -137,7 +138,8 @@ "win_type": "hadm", "class": "fun_itm" } - ] + ], + "picdb": [] } }, "los_icu": { @@ -195,7 +197,8 @@ "win_type": "icustay", "class": "fun_itm" } - ] + ], + "picdb": [] } }, "mews": { diff --git a/inst/extdata/config/concept-dict/output.json b/inst/extdata/config/concept-dict/output.json index 64dddb81..1d3796ae 100644 --- a/inst/extdata/config/concept-dict/output.json +++ b/inst/extdata/config/concept-dict/output.json @@ -150,6 +150,15 @@ "table": "data_float_h", "sub_var": "DataID" } + ], + "picdb": [ + { + "table": "chartevents", + "ids": [ + "1008" + ], + "sub_var": "itemid" + } ] } }, diff --git a/inst/extdata/config/concept-dict/respiratory.json b/inst/extdata/config/concept-dict/respiratory.json index 64381980..d71d24ef 100644 --- a/inst/extdata/config/concept-dict/respiratory.json +++ b/inst/extdata/config/concept-dict/respiratory.json @@ -65,7 +65,8 @@ "target": "ts_tbl", "callback": "combine_callbacks(\n transform_fun(set_val(TRUE)),\n ts_to_win_tbl(mins(1L))\n )" } - ] + ], + "picdb": [] } }, "mech_vent": { @@ -114,7 +115,8 @@ "dur_var": "endtime", "callback": "apply_map(c(`225792` = 'invasive',\n `225794` = 'noninvasive'),\n var = 'sub_var')" } - ] + ], + "picdb": [] } }, "o2sat": { @@ -223,6 +225,22 @@ "table": "data_float_h", "sub_var": "DataID" } + ], + "picdb": [ + { + "table": "chartevents", + "ids": [ + "1006" + ], + "sub_var": "itemid" + }, + { + "table": "labevents", + "ids": [ + 5252 + ], + "sub_var": "itemid" + } ] } }, @@ -333,6 +351,15 @@ "table": "data_float_h", "sub_var": "DataID" } + ], + "picdb": [ + { + "table": "chartevents", + "ids": [ + "1004" + ], + "sub_var": "itemid" + } ] } }, @@ -459,7 +486,8 @@ "sub_var": "itemid", "callback": "transform_fun(set_val(TRUE))" } - ] + ], + "picdb": [] } }, "vent_ind": { @@ -682,7 +710,8 @@ "sub_var": "itemid", "callback": "transform_fun(set_val(TRUE))" } - ] + ], + "picdb": [] } } } \ No newline at end of file diff --git a/inst/extdata/config/concept-dict/vitals.json b/inst/extdata/config/concept-dict/vitals.json index a2de125d..91dfcc08 100644 --- a/inst/extdata/config/concept-dict/vitals.json +++ b/inst/extdata/config/concept-dict/vitals.json @@ -84,6 +84,8 @@ "table": "data_float_h", "sub_var": "DataID" } + ], + "picdb": [ ] } }, @@ -151,6 +153,8 @@ "table": "chartevents", "sub_var": "itemid" } + ], + "picdb": [ ] } }, @@ -227,6 +231,15 @@ "table": "data_float_h", "sub_var": "DataID" } + ], + "picdb": [ + { + "table": "chartevents", + "ids": [ + "1003" + ], + "sub_var": "itemid" + } ] } }, @@ -333,6 +346,8 @@ "table": "data_float_h", "sub_var": "DataID" } + ], + "picdb": [ ] } }, @@ -421,6 +436,8 @@ "table": "data_float_h", "sub_var": "DataID" } + ], + "picdb": [ ] } }, @@ -538,6 +555,22 @@ "table": "data_float_h", "sub_var": "DataID" } + ], + "picdb": [ + { + "table": "chartevents", + "ids": [ + "1001" + ], + "sub_var": "itemid" + }, + { + "table": "labevents", + "ids": [ + 5253 + ], + "sub_var": "itemid" + } ] } } diff --git a/inst/extdata/config/data-sources/picdb.json b/inst/extdata/config/data-sources/picdb.json new file mode 100644 index 00000000..adce0b71 --- /dev/null +++ b/inst/extdata/config/data-sources/picdb.json @@ -0,0 +1,847 @@ +[ + { + "name": "picdb", + "url": "https://physionet.org/files/picdb/1.1.0", + "id_cfg": { + "patient": { + "id": "subject_id", + "position": 1, + "start": "dob", + "end": "dod", + "table": "patients" + }, + "hadm": { + "id": "hadm_id", + "position": 2, + "start": "admittime", + "end": "dischtime", + "table": "admissions" + }, + "icustay": { + "id": "icustay_id", + "position": 3, + "start": "intime", + "end": "outtime", + "table": "icustays" + } + }, + "tables": { + "admissions": { + "files": "V1.1.0/ADMISSIONS.csv", + "defaults": { + "time_vars": [ + "admittime", + "dischtime", + "deathtime", + "edregtime", + "edouttime" + ] + }, + "num_rows": 13449, + "cols": { + "row_id": { + "name": "ROW_ID", + "spec": "col_integer" + }, + "subject_id": { + "name": "SUBJECT_ID", + "spec": "col_integer" + }, + "hadm_id": { + "name": "HADM_ID", + "spec": "col_integer" + }, + "admittime": { + "name": "ADMITTIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "dischtime": { + "name": "DISCHTIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "deathtime": { + "name": "DEATHTIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "admission_department": { + "name": "ADMISSION_DEPARTMENT", + "spec": "col_character" + }, + "discharge_department": { + "name": "DISCHARGE_DEPARTMENT", + "spec": "col_character" + }, + "insurance": { + "name": "INSURANCE", + "spec": "col_character" + }, + "language": { + "name": "LANGUAGE", + "spec": "col_character" + }, + "religion": { + "name": "RELIGION", + "spec": "col_character" + }, + "marital_status": { + "name": "MARITAL_STATUS", + "spec": "col_character" + }, + "ethnicity": { + "name": "ETHNICITY", + "spec": "col_character" + }, + "edregtime": { + "name": "EDREGTIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "edouttime": { + "name": "EDOUTTIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "diagnosis": { + "name": "DIAGNOSIS", + "spec": "col_character" + }, + "icd10_code_cn": { + "name": "ICD10_CODE_CN", + "spec": "col_character" + }, + "hospital_expire_flag": { + "name": "HOSPITAL_EXPIRE_FLAG", + "spec": "col_integer" + }, + "has_chartevents_data": { + "name": "HAS_CHARTEVENTS_DATA", + "spec": "col_integer" + } + } + }, + "chartevents": { + "files": "V1.1.0/CHARTEVENTS.csv", + "defaults": { + "time_vars": [ + "charttime", + "storetime" + ], + "index_var": "charttime", + "val_var": "valuenum", + "unit_var": "valueuom" + }, + "num_rows": 2278978, + "cols": { + "row_id": { + "name": "ROW_ID", + "spec": "col_integer" + }, + "subject_id": { + "name": "SUBJECT_ID", + "spec": "col_integer" + }, + "hadm_id": { + "name": "HADM_ID", + "spec": "col_integer" + }, + "icustay_id": { + "name": "ICUSTAY_ID", + "spec": "col_double" + }, + "itemid": { + "name": "ITEMID", + "spec": "col_integer" + }, + "charttime": { + "name": "CHARTTIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "storetime": { + "name": "STORETIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "value": { + "name": "VALUE", + "spec": "col_double" + }, + "valuenum": { + "name": "VALUENUM", + "spec": "col_double" + }, + "valueuom": { + "name": "VALUEUOM", + "spec": "col_character" + } + } + }, + "diagnoses_icd": { + "files": "V1.1.0/DIAGNOSES_ICD.csv", + "defaults": { + "val_var": "ICD10_CODE_CN" + }, + "num_rows": 22712, + "cols": { + "row_id": { + "name": "ROW_ID", + "spec": "col_integer" + }, + "subject_id": { + "name": "SUBJECT_ID", + "spec": "col_integer" + }, + "hadm_id": { + "name": "HADM_ID", + "spec": "col_integer" + }, + "seq_num": { + "name": "SEQ_NUM", + "spec": "col_integer" + }, + "icd10_code_cn": { + "name": "ICD10_CODE_CN", + "spec": "col_character" + }, + "diag_category": { + "name": "Diag_Category", + "spec": "col_character" + } + } + }, + "d_icd_diagnoses": { + "files": "V1.1.0/D_ICD_DIAGNOSES.csv", + "defaults": { + }, + "num_rows": 25379, + "cols": { + "row_id": { + "name": "ROW_ID", + "spec": "col_integer" + }, + "icd10_code_cn": { + "name": "ICD10_CODE_CN", + "spec": "col_character" + }, + "icd10_code": { + "name": "ICD10_CODE", + "spec": "col_character" + }, + "title_cn": { + "name": "TITLE_CN", + "spec": "col_character" + }, + "title": { + "name": "TITLE", + "spec": "col_character" + } + } + }, + "d_items": { + "files": "V1.1.0/D_ITEMS.csv", + "defaults": { + }, + "num_rows": 479, + "cols": { + "row_id": { + "name": "ROW_ID", + "spec": "col_integer" + }, + "itemid": { + "name": "ITEMID", + "spec": "col_character" + }, + "label_cn": { + "name": "LABEL_CN", + "spec": "col_character" + }, + "label": { + "name": "LABEL", + "spec": "col_character" + }, + "linksto": { + "name": "LINKSTO", + "spec": "col_character" + }, + "category": { + "name": "CATEGORY", + "spec": "col_character" + }, + "unitname": { + "name": "UNITNAME", + "spec": "col_character" + } + } + }, + "d_labitems": { + "files": "V1.1.0/D_LABITEMS.csv", + "defaults": { + }, + "num_rows": 832, + "cols": { + "row_id": { + "name": "ROW_ID", + "spec": "col_integer" + }, + "itemid": { + "name": "ITEMID", + "spec": "col_integer" + }, + "label_cn": { + "name": "LABEL_CN", + "spec": "col_character" + }, + "label": { + "name": "LABEL", + "spec": "col_character" + }, + "fluid": { + "name": "FLUID", + "spec": "col_character" + }, + "category": { + "name": "CATEGORY", + "spec": "col_character" + }, + "loinc_code": { + "name": "LOINC_CODE", + "spec": "col_character" + } + } + }, + "emr_symptoms": { + "files": "V1.1.0/EMR_SYMPTOMS.csv", + "defaults": { + "time_vars": [ + "recordtime" + ] + }, + "num_rows": 402142, + "cols": { + "row_id": { + "name": "ROW_ID", + "spec": "col_integer" + }, + "subject_id": { + "name": "SUBJECT_ID", + "spec": "col_integer" + }, + "hadm_id": { + "name": "HADM_ID", + "spec": "col_integer" + }, + "emr_id": { + "name": "EMR_ID", + "spec": "col_integer" + }, + "recordtime": { + "name": "RECORDTIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "symptom_name_cn": { + "name": "SYMPTOM_NAME_CN", + "spec": "col_character" + }, + "symptom_name": { + "name": "SYMPTOM_NAME", + "spec": "col_character" + }, + "symptom_attribute": { + "name": "SYMPTOM_ATTRIBUTE", + "spec": "col_character" + } + } + }, + "icustays": { + "files": "V1.1.0/ICUSTAYS.csv", + "defaults": { + "time_vars": [ + "intime", + "outtime" + ], + "index_var": "intime", + "val_var": "last_careunit" + }, + "num_rows": 13941, + "cols": { + "row_id": { + "name": "ROW_ID", + "spec": "col_integer" + }, + "subject_id": { + "name": "SUBJECT_ID", + "spec": "col_integer" + }, + "hadm_id": { + "name": "HADM_ID", + "spec": "col_integer" + }, + "icustay_id": { + "name": "ICUSTAY_ID", + "spec": "col_integer" + }, + "first_careunit": { + "name": "FIRST_CAREUNIT", + "spec": "col_character" + }, + "last_careunit": { + "name": "LAST_CAREUNIT", + "spec": "col_character" + }, + "first_wardid": { + "name": "FIRST_WARDID", + "spec": "col_integer" + }, + "last_wardid": { + "name": "LAST_WARDID", + "spec": "col_integer" + }, + "intime": { + "name": "INTIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "outtime": { + "name": "OUTTIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "los": { + "name": "LOS", + "spec": "col_double" + } + } + }, + "inputevents": { + "files": "V1.1.0/INPUTEVENTS.csv", + "defaults": { + "time_vars": [ + "charttime", + "storetime" + ], + "index_var": "charttime", + "val_var": "amount", + "unit_var": "amountuom" + }, + "num_rows": 26884, + "cols": { + "row_id": { + "name": "ROW_ID", + "spec": "col_integer" + }, + "subject_id": { + "name": "SUBJECT_ID", + "spec": "col_integer" + }, + "hadm_id": { + "name": "HADM_ID", + "spec": "col_integer" + }, + "icustay_id": { + "name": "ICUSTAY_ID", + "spec": "col_double" + }, + "charttime": { + "name": "CHARTTIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "amount": { + "name": "AMOUNT", + "spec": "col_double" + }, + "amountuom": { + "name": "AMOUNTUOM", + "spec": "col_character" + }, + "storetime": { + "name": "STORETIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + } + } + }, + "labevents": { + "files": "V1.1.0/LABEVENTS.csv", + "defaults": { + "time_vars": [ + "charttime" + ], + "index_var": "charttime", + "val_var": "valuenum", + "unit_var": "valueuom" + }, + "num_rows": 10094117, + "cols": { + "row_id": { + "name": "ROW_ID", + "spec": "col_integer" + }, + "subject_id": { + "name": "SUBJECT_ID", + "spec": "col_integer" + }, + "hadm_id": { + "name": "HADM_ID", + "spec": "col_integer" + }, + "itemid": { + "name": "ITEMID", + "spec": "col_integer" + }, + "charttime": { + "name": "CHARTTIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "value": { + "name": "VALUE", + "spec": "col_character" + }, + "valuenum": { + "name": "VALUENUM", + "spec": "col_double" + }, + "valueuom": { + "name": "VALUEUOM", + "spec": "col_character" + }, + "flag": { + "name": "FLAG", + "spec": "col_character" + } + } + }, + "microbiologyevents": { + "files": "V1.1.0/MICROBIOLOGYEVENTS.csv", + "defaults": { + "time_vars": [ + "charttime" + ], + "index_var": "charttime" + }, + "num_rows": 183869, + "cols": { + "row_id": { + "name": "ROW_ID", + "spec": "col_integer" + }, + "subject_id": { + "name": "SUBJECT_ID", + "spec": "col_integer" + }, + "hadm_id": { + "name": "HADM_ID", + "spec": "col_integer" + }, + "charttime": { + "name": "CHARTTIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "spec_itemid": { + "name": "SPEC_ITEMID", + "spec": "col_character" + }, + "spec_type_desc": { + "name": "SPEC_TYPE_DESC", + "spec": "col_character" + }, + "org_itemid": { + "name": "ORG_ITEMID", + "spec": "col_character" + }, + "org_name": { + "name": "ORG_NAME", + "spec": "col_character" + }, + "ab_itemid": { + "name": "AB_ITEMID", + "spec": "col_character" + }, + "ab_name": { + "name": "AB_NAME", + "spec": "col_character" + }, + "dilution_text": { + "name": "DILUTION_TEXT", + "spec": "col_character" + }, + "dilution_comparison": { + "name": "DILUTION_COMPARISON", + "spec": "col_character" + }, + "dilution_value": { + "name": "DILUTION_VALUE", + "spec": "col_double" + }, + "interpretation": { + "name": "INTERPRETATION", + "spec": "col_character" + } + } + }, + "or_exam_reports": { + "files": "V1.1.0/OR_EXAM_REPORTS.csv", + "defaults": { + "time_vars": [ + "examtime", + "reporttime" + ] + }, + "num_rows": 183809, + "cols": { + "row_id": { + "name": "ROW_ID", + "spec": "col_integer" + }, + "subject_id": { + "name": "SUBJECT_ID", + "spec": "col_integer" + }, + "hadm_id": { + "name": "HADM_ID", + "spec": "col_integer" + }, + "examtime": { + "name": "EXAMTIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "reporttime": { + "name": "REPORTTIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "exam_item_type_name": { + "name": "EXAM_ITEM_TYPE_NAME", + "spec": "col_character" + }, + "exam_item_name": { + "name": "EXAM_ITEM_NAME", + "spec": "col_character" + }, + "exam_part_name": { + "name": "EXAM_PART_NAME", + "spec": "col_character" + } + } + }, + "outputevents": { + "files": "V1.1.0/OUTPUTEVENTS.csv", + "defaults": { + "time_vars": [ + "charttime", + "storetime" + ], + "index_var": "charttime", + "val_var": "value", + "unit_var": "valueuom" + }, + "num_rows": 39891, + "cols": { + "row_id": { + "name": "ROW_ID", + "spec": "col_integer" + }, + "subject_id": { + "name": "SUBJECT_ID", + "spec": "col_integer" + }, + "hadm_id": { + "name": "HADM_ID", + "spec": "col_integer" + }, + "icustay_id": { + "name": "ICUSTAY_ID", + "spec": "col_double" + }, + "charttime": { + "name": "CHARTTIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "itemid": { + "name": "ITEMID", + "spec": "col_integer" + }, + "value": { + "name": "VALUE", + "spec": "col_double" + }, + "valueuom": { + "name": "VALUEUOM", + "spec": "col_character" + }, + "storetime": { + "name": "STORETIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + } + } + }, + "patients": { + "files": "V1.1.0/PATIENTS.csv", + "defaults": { + "time_vars": [ + "dob", + "dod" + ], + "val_var": "expire_flag" + }, + "num_rows": 12881, + "cols": { + "row_id": { + "name": "ROW_ID", + "spec": "col_integer" + }, + "subject_id": { + "name": "SUBJECT_ID", + "spec": "col_integer" + }, + "gender": { + "name": "GENDER", + "spec": "col_character" + }, + "dob": { + "name": "DOB", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "dod": { + "name": "DOD", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "expire_flag": { + "name": "EXPIRE_FLAG", + "spec": "col_integer" + } + } + }, + "prescriptions": { + "files": "V1.1.0/PRESCRIPTIONS.csv", + "defaults": { + "time_vars": [ + "startdate", + "enddate" + ], + "index_var": "startdate", + "val_var": "dose_val_rx", + "unit_var": "dose_unit_rx" + }, + "num_rows": 1256591, + "cols": { + "row_id": { + "name": "ROW_ID", + "spec": "col_integer" + }, + "subject_id": { + "name": "SUBJECT_ID", + "spec": "col_integer" + }, + "hadm_id": { + "name": "HADM_ID", + "spec": "col_integer" + }, + "icustay_id": { + "name": "ICUSTAY_ID", + "spec": "col_double" + }, + "startdate": { + "name": "STARTDATE", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "enddate": { + "name": "ENDDATE", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "drug_name": { + "name": "DRUG_NAME", + "spec": "col_character" + }, + "drug_name_en": { + "name": "DRUG_NAME_EN", + "spec": "col_character" + }, + "prod_strength": { + "name": "PROD_STRENGTH", + "spec": "col_character" + }, + "drug_name_generic": { + "name": "DRUG_NAME_GENERIC", + "spec": "col_character" + }, + "dose_val_rx": { + "name": "DOSE_VAL_RX", + "spec": "col_double" + }, + "dose_unit_rx": { + "name": "DOSE_UNIT_RX", + "spec": "col_character" + }, + "drug_form": { + "name": "DRUG_FORM", + "spec": "col_character" + } + } + }, + "surgery_vital_signs": { + "files": "V1.1.0/SURGERY_VITAL_SIGNS.csv", + "defaults": { + "time_vars": [ + "monitor_time" + ], + "index_var": "oper_id", + "val_var": "value" + }, + "num_rows": 1944187, + "cols": { + "row_id": { + "name": "ROW_ID", + "spec": "col_integer" + }, + "subject_id": { + "name": "SUBJECT_ID", + "spec": "col_integer" + }, + "hadm_id": { + "name": "HADM_ID", + "spec": "col_integer" + }, + "visit_id": { + "name": "VISIT_ID", + "spec": "col_integer" + }, + "oper_id": { + "name": "OPER_ID", + "spec": "col_integer" + }, + "item_no": { + "name": "ITEM_NO", + "spec": "col_integer" + }, + "monitor_time": { + "name": "MONITOR_TIME", + "spec": "col_datetime", + "format": "%Y-%m-%d %H:%M:%S" + }, + "itemid": { + "name": "ITEMID", + "spec": "col_character" + }, + "value": { + "name": "VALUE", + "spec": "col_double" + } + } + } + } + } +] \ No newline at end of file