From 2b07f95687a2c5fa8448f946e2ed26e08b71e89c Mon Sep 17 00:00:00 2001 From: Malte Londschien Date: Fri, 22 Mar 2024 09:09:12 +0100 Subject: [PATCH] Remove R scripts generating configs. --- inst/extdata/config/concept-dict.R | 3275 ---------------------------- inst/extdata/config/data-sources.R | 1791 --------------- 2 files changed, 5066 deletions(-) delete mode 100644 inst/extdata/config/concept-dict.R delete mode 100644 inst/extdata/config/data-sources.R diff --git a/inst/extdata/config/concept-dict.R b/inst/extdata/config/concept-dict.R deleted file mode 100644 index 5a51be41..00000000 --- a/inst/extdata/config/concept-dict.R +++ /dev/null @@ -1,3275 +0,0 @@ - -strip_ws <- function(x) gsub("\\s+", " ", x) - -cfg <- list( - hr = list( - unit = c("bpm", "/min"), - min = 0, - max = 300, - description = "heart rate", - omopid = 4239408L, - category = "vitals", - sources = list( - mimic = list( - list(ids = c(211L, 220045L), table = "chartevents", sub_var = "itemid") - ), - eicu = list( - list(table = "vitalperiodic", val_var = "heartrate", - class = "col_itm") - ), - hirid = list( - list(ids = 200L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = 6640L, table = "numericitems", sub_var = "itemid") - ), - miiv = list( - list(ids = 220045L, table = "chartevents", sub_var = "itemid") - ), - sic = list( - list(ids = 708L, table = "data_float_h", sub_var = "DataID") - ) - ) - ), - sbp = list( - unit = c("mmHg", "mm Hg"), - min = 0, - max = 300, - description = "systolic blood pressure", - omopid = 4152194L, - category = "vitals", - sources = list( - mimic = list( - list(ids = c(51L, 455L, 6701L, 220050L, 220179L), - table = "chartevents", sub_var = "itemid") - ), - eicu = list( - list(table = "vitalperiodic", val_var = "systemicsystolic", - class = "col_itm") - ), - hirid = list( - list(ids = 100L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = 6641L, table = "numericitems", sub_var = "itemid") - ), - miiv = list( - list(ids = c(220050L, 220179L), table = "chartevents", - sub_var = "itemid") - ), - sic = list( - list(ids = c(701L, 704L), table = "data_float_h", sub_var = "DataID") - ) - ) - ), - dbp = list( - unit = c("mmHg", "mm Hg"), - min = 0, - max = 200, - description = "diastolic blood pressure", - omopid = 4154790L, - category = "vitals", - sources = list( - mimic = list( - list(ids = c(8368L, 8441L, 8555L, 220051L, 220180L), - table = "chartevents", sub_var = "itemid") - ), - eicu = list( - list(table = "vitalperiodic", val_var = "systemicdiastolic", - class = "col_itm") - ), - hirid = list( - list(ids = 120L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = 6643L, table = "numericitems", sub_var = "itemid") - ), - miiv = list( - list(ids = c(220051L, 220180L), table = "chartevents", - sub_var = "itemid") - ), - sic = list( - list(ids = c(702L, 705L), table = "data_float_h", sub_var = "DataID") - ) - ) - ), - map = list( - unit = c("mmHg", "mm Hg"), - min = 0, - max = 250, - description = "mean arterial pressure", - omopid = 4239021L, - category = "vitals", - sources = list( - mimic = list( - list(ids = c(52L, 443L, 456L, 6072L, 220052L, 220181L, 225312L), - table = "chartevents", sub_var = "itemid") - ), - eicu = list( - list(table = "vitalperiodic", val_var = "systemicmean", - class = "col_itm"), - list(table = "vitalaperiodic", val_var = "noninvasivemean", - class = "col_itm") - ), - hirid = list( - list(ids = c(110L, 610L), table = "observations", - sub_var = "variableid", class = "hrd_itm") - ), - aumc = list( - list(ids = 6642L, table = "numericitems", sub_var = "itemid") - ), - miiv = list( - list(ids = c(220052L, 220181L, 225312L), table = "chartevents", - sub_var = "itemid") - ), - sic = list( - list(ids = c(703L, 706L), table = "data_float_h", sub_var = "DataID") - ) - ) - ), - resp = list( - unit = c("insp/min", "/min"), - min = 0, - max = 120, - description = "respiratory rate", - omopid = 4313591L, - category = "respiratory", - sources = list( - mimic = list( - list(ids = c(618L, 619L, 220210L, 224688L, 224689L, 224690L), - table = "chartevents", sub_var = "itemid") - ), - eicu = list( - list(table = "vitalperiodic", val_var = "respiration", - class = "col_itm") - ), - hirid = list( - list(ids = c(300L, 310L), table = "observations", - sub_var = "variableid", class = "hrd_itm") - ), - aumc = list( - list(ids = c(8874L, 12266L), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = c(220210L, 224688L, 224689L, 224690L), - table = "chartevents", sub_var = "itemid") - ), - sic = list( - list(ids = 719L, table = "data_float_h", sub_var = "DataID") - ) - ) - ), - o2sat = list( - unit = c("%", "% Sat."), - min = 50, - max = 100, - description = "oxygen saturation", - omopid = 40483579L, - category = "respiratory", - sources = list( - mimic = list( - list(ids = c(646L, 220277L, 226253L, 50817L), table = "chartevents", - sub_var = "itemid") - ), - eicu = list( - list(table = "vitalperiodic", val_var = "sao2", unit_val = "%", - class = "col_itm"), - list(ids = "O2 Sat (%)", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = c(4000L, 8280L, 20000800L), table = "observations", - sub_var = "variableid", class = "hrd_itm") - ), - aumc = list( - list(ids = c(6709L, 8903L), table = "numericitems", - sub_var = "itemid"), - list(ids = 12311L, table = "numericitems", sub_var = "itemid", - callback = "transform_fun(binary_op(`*`, 100))") - ), - miiv = list( - list(ids = c(220277L, 226253L, 50817L), table = "chartevents", - sub_var = "itemid") - ), - sic = list( - list(ids = 710L, table = "data_float_h", sub_var = "DataID") - ) - ) - ), - fio2 = list( - unit = "%", - min = 21, - max = 100, - description = "fraction of inspired oxygen", - omopid = 4353936L, - category = "blood gas", - sources = list( - mimic = list( - list(ids = c(3420L, 223835L), table = "chartevents", - sub_var = "itemid"), - list(ids = 50816L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "FiO2", table = "respiratorycharting", - sub_var = "respchartvaluelabel", - callback = "transform_fun(percent_as_numeric)"), - list(ids = "FiO2", table = "lab", sub_var = "labname", - callback = "convert_unit(set_val(NA), '%', 'mm\\\\(hg\\\\)')") - ), - hirid = list( - list(ids = 2010L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = 12279L, table = "numericitems", sub_var = "itemid") - ), - miiv = list( - list(ids = 223835L, table = "chartevents", sub_var = "itemid"), - list(ids = 50816L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 2283L, table = "data_float_h", sub_var = "DataID") - ) - ) - ), - tco2 = list( - unit = "mEq/L", - min = 5, - max = 60, - description = "totcal CO2", - omopid = 4193415L, - category = "blood gas", - sources = list( - mimic = list( - list(ids = 50804L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "Total CO2", table = "lab", sub_var = "labname", - callback = "convert_unit(set_val(NA), 'mEq/L', 'lpm')") - ), - miiv = list( - list(ids = 50804L, table = "labevents", sub_var = "itemid") - ) - ) - ), - alt = list( - unit = c("IU/L", "U/l"), - min = 0, - description = "alanine aminotransferase", - omopid = 4146380L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 50861L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "ALT (SGPT)", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 20002600L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6800L, 11978L), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 50861L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 617L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - ast = list( - unit = c("IU/L", "U/l"), - min = 0, - description = "aspartate aminotransferase", - omopid = 4263457L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 50878L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "AST (SGOT)", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000330L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6806L, 11990L), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 50878L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 616L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - phos = list( - unit = "mg/dL", - min = 0, - max = 40, - description = "phosphate", - omopid = 4017907L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 50970L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "phosphate", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 20002500L, table = "observations", sub_var = "variableid", - callback = "convert_unit(binary_op(`*`, 3.097521), 'mg/dL')", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6828L, 9935L), table = "numericitems", - sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 3.097521), 'mg/dL')") - ), - miiv = list( - list(ids = 50970L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 471L, table = "laboratory", sub_var = "LaboratoryID", - callback = "transform_fun(binary_op(`*`, 3.097521))") - ) - ) - ), - bun = list( - unit = "mg/dL", - min = 0, - max = 200, - description = "blood urea nitrogen", - omopid = 4017361L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 51006L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "BUN", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 20004100L, table = "observations", sub_var = "variableid", - callback = "convert_unit(binary_op(`*`, 2.8), 'mg/dL')", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6850L, 9943L), table = "numericitems", - sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 2.8), 'mg/dL')") - ), - miiv = list( - list(ids = 51006L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 355L, table = "laboratory", sub_var = "LaboratoryID", - callback = "transform_fun(binary_op(`*`, 2.14))") - ) - ) - ), - ph = list( - min = 6.8, - max = 8, - description = "pH of blood", - omopid = 4097822L, - category = "blood gas", - sources = list( - mimic = list( - list(ids = 50820L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "pH", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 20000300L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6848L, 12310L), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 50820L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 688L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - bili = list( - unit = "mg/dL", - min = 0, - max = 100, - description = "total bilirubin", - omopid = 4118986L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 50885L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "total bilirubin", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 20004300L, table = "observations", sub_var = "variableid", - callback = "convert_unit(binary_op(`*`, 0.058467), 'mg/dL')", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6813L, 9945L), table = "numericitems", - sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 0.058467), 'mg/dL')") - ), - miiv = list( - list(ids = 50885L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 333L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - inr_pt = list( - description = "prothrombin time/international normalized ratio", - omopid = 4306239L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51237L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "PT - INR", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000567L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = 11893L, table = "numericitems", sub_var = "itemid") - ), - miiv = list( - list(ids = 51237L, table = "labevents", sub_var = "itemid") - ) - ) - ), - plt = list( - unit = c("K/uL", "G/l"), - min = 5, - max = 1200, - description = "platelet count", - omopid = 4267147L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51265L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "platelets x 1000", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 20000110L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6797L, 9964L, 10409L, 14252L), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 51265L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 314L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - lact = list( - unit = "mmol/L", - min = 0, - max = 50, - description = "lactate", - omopid = 4191725L, - category = "blood gas", - sources = list( - mimic = list( - list(ids = 50813L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "lactate", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000524L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6837L, 9580L, 10053L), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 50813L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = c(657L, 454L), table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - lymph = list( - unit = "%", - min = 0, - max = 100, - description = "lymphocytes", - omopid = 4254663L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51244L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "-lymphs", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000480L, table = "observations", sub_var = "variableid", - callback = "blood_cell_ratio", class = "hrd_itm") - ), - aumc = list( - list(ids = 11846L, table = "numericitems", sub_var = "itemid"), - list(ids = 14258L, table = "numericitems", sub_var = "itemid", - callback = "blood_cell_ratio") - ), - miiv = list( - list(ids = 51244L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 223L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - bicar = list( - unit = c("mEq/L", "mmol/l"), - min = 5, - max = 50, - description = "bicarbonate", - omopid = 4194291L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 50882L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "bicarbonate", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 20004200L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6810L, 9992L), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 50882L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 456L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - crea = list( - unit = "mg/dL", - min = 0, - max = 15, - description = "creatinine", - omopid = 4013964L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 50912L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "creatinine", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 20000600L, table = "observations", sub_var = "variableid", - callback = "convert_unit(binary_op(`*`, 0.011312), 'mg/dL')", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6836L, 9941L, 14216L), table = "numericitems", - sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 0.011309), 'mg/dL')") - ), - miiv = list( - list(ids = 50912L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 367L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - pt = list( - unit = "sec", - min = 0, - description = "prothrombine time", - omopid = 4245261L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51274L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "PT", table = "lab", sub_var = "labname") - ), - aumc = list( - list(ids = 6789L, table = "numericitems", sub_var = "itemid") - ), - miiv = list( - list(ids = 51274L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 598L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - rdw = list( - unit = "%", - min = 0, - max = 100, - description = "erythrocyte distribution width", - omopid = 4281085L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51277L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "RDW", table = "lab", sub_var = "labname") - ), - aumc = list( - list(ids = 18952L, table = "numericitems", sub_var = "itemid") - ), - miiv = list( - list(ids = 51277L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 3319L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - alp = list( - unit = c("IU/L", "U/l"), - min = 0, - description = "alkaline phosphatase", - omopid = 4275206L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 50863L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "alkaline phos.", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 20002700L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6803L, 11984L), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 50863L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 609L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - wbc = list( - unit = c("K/uL", "G/l"), - min = 0, - description = "white blood cell count", - omopid = 4298431L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51301L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "WBC x 1000", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 20000700L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6779L, 9965L), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 51301L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 301L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - hgb = list( - unit = "g/dL", - min = 4, - max = 18, - description = "hemoglobin", - omopid = 4118981L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51222L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "Hgb", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = c(24000548L, 24000836L, 20000900L), table = "observations", - sub_var = "variableid", - callback = "convert_unit(binary_op(`*`, 0.1), 'g/dL', 'g/l')", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6778L, 9553L, 9960L, 10286L, 19703L), - table = "numericitems", sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 1.611344), 'g/dL')") - ), - miiv = list( - list(ids = 51222L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = c(658L, 289L), table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - hct = list( - unit = "%", - min = 15, - max = 60, - description = "hematocrit", - omopid = 4151358L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51221L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "Hct", table = "lab", sub_var = "labname") - ), - aumc = list( - list(ids = c(6777L, 11423L, 11545L), table = "numericitems", - sub_var = "itemid", - callback = "transform_fun(binary_op(`*`, 100))") - ), - miiv = list( - list(ids = 51221L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = c(217L, 682L), table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - pco2 = list( - unit = c("mmHg", "mm Hg"), - min = 10, - max = 150, - description = "CO2 partial pressure", - omopid = 4097882L, - category = "blood gas", - sources = list( - mimic = list( - list(ids = 50818L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "paCO2", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 20001200L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6846L, 9990L, 21213L), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 50818L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 687L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - po2 = list( - unit = c("mmHg", "mm Hg"), - min = 40, - max = 600, - description = "O2 partial pressure", - omopid = 4094581L, - category = "blood gas", - sources = list( - mimic = list( - list(ids = 50821L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "paO2", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 20000200L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(7433L, 9996L, 21214L), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 50821L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = c(664L, 689L), table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - mch = list( - unit = "pg", - min = 0, - description = "mean corpuscular hemoglobin", - omopid = 4182871L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51248L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "MCH", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000160L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = 11679L, table = "numericitems", sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 0.016113), 'pg')") - ), - miiv = list( - list(ids = 51248L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 566L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - mchc = list( - unit = "%", - min = 20, - max = 50, - description = "mean corpuscular hemoglobin concentration", - omopid = 4290193L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51249L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "MCHC", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000170L, table = "observations", sub_var = "variableid", - callback = "convert_unit(binary_op(`*`, 0.16114), '%')", - class = "hrd_itm") - ), - aumc = list( - list(ids = 18666L, table = "numericitems", sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 1.611), '%')") - ), - miiv = list( - list(ids = 51249L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 290L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - mcv = list( - unit = "fL", - min = 50, - max = 150, - description = "mean corpuscular volume", - omopid = 4016239L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51250L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "MCV", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000150L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = 9968L, table = "numericitems", sub_var = "itemid") - ), - miiv = list( - list(ids = 51250L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 286L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - ptt = list( - unit = "sec", - min = 0, - description = "partial thromboplastin time", - omopid = 4175016L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51275L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "PTT", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 20004410L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = 17982L, table = "numericitems", sub_var = "itemid") - ), - miiv = list( - list(ids = 51275L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 597L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - ca = list( - unit = "mg/dL", - min = 4, - max = 20, - description = "calcium", - omopid = 4216722L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 50893L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "calcium", table = "lab", sub_var = "labname", - callback = "convert_unit(binary_op(`*`, 4), 'mg/dL', 'mmol/l')") - ), - hirid = list( - list(ids = 20005100L, table = "observations", sub_var = "variableid", - callback = "convert_unit(binary_op(`*`, 4.008), 'mg/dL')", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6817L, 9933L), table = "numericitems", sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 4.008), 'mg/dL')") - ), - miiv = list( - list(ids = 50893L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 457L, table = "laboratory", sub_var = "LaboratoryID", - callback = "transform_fun(binary_op(`*`, 4.008))") - ) - ) - ), - cl = list( - unit = c("mEq/L", "mmol/l"), - min = 80, - max = 130, - description = "chloride", - omopid = 4188066L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 50902L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "chloride", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = c(24000439L, 24000521L), table = "observations", - sub_var = "variableid", class = "hrd_itm") - ), - aumc = list( - list(ids = 9930L, table = "numericitems", sub_var = "itemid") - ), - miiv = list( - list(ids = 50902L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = c(683L, 450L), table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - mg = list( - unit = "mg/dL", - min = 0.5, - max = 5, - description = "magnesium", - omopid = 4243005L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 50960L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "magnesium", table = "lab", sub_var = "labname", - callback = "convert_unit(binary_op(`/`, 1.215), 'mg/dL', 'mEq/L')" - ) - ), - hirid = list( - list(ids = 24000230L, table = "observations", sub_var = "variableid", - callback = "convert_unit(binary_op(`*`, 2.431), 'mg/dL')", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6839L, 9952L), table = "numericitems", sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 2.431), 'mg/dL')") - ), - miiv = list( - list(ids = 50960L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 468L, table = "laboratory", sub_var = "LaboratoryID", - callback = "transform_fun(binary_op(`*`, 2.431))") - ) - ) - ), - k = list( - unit = c("mEq/L", "mmol/l"), - min = 0, - max = 10, - description = "potassium", - omopid = 4207483L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 50971L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "potassium", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = c(20000500L, 24000520L, 24000833L, 24000867L), - table = "observations", sub_var = "variableid", class = "hrd_itm") - ), - aumc = list( - list(ids = c(6835, 9556, 9927, 10285), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 50971L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = c(463L, 685L), table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - na = list( - unit = c("mEq/L", "mmol/l"), - min = 110, - max = 165, - description = "sodium", - omopid = 4208938L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 50983L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "sodium", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = c(20000400L, 24000519L, 24000658L, 24000835L, 24000866L), - table = "observations", sub_var = "variableid", class = "hrd_itm") - ), - aumc = list( - list(ids = c(6840, 9555, 9924, 10284), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 50983L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = c(469L, 686L), table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - basos = list( - unit = "%", - min = 0, - max = 50, - description = "basophils", - omopid = 4172647L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51146L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "-basos", table = "lab", sub_var = "labname") - ), - aumc = list( - list(ids = 11710L, table = "numericitems", sub_var = "itemid"), - list(ids = 14256L, table = "numericitems", sub_var = "itemid", - callback = "blood_cell_ratio") - ), - miiv = list( - list(ids = 51146L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 174L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - eos = list( - unit = "%", - min = 0, - max = 50, - description = "eosinophils", - omopid = 4216098L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51200L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "-eos", table = "lab", sub_var = "labname") - ), - aumc = list( - list(ids = 6773L, table = "numericitems", sub_var = "itemid"), - list(ids = 9967L, table = "numericitems", sub_var = "itemid", - callback = "blood_cell_ratio") - ), - miiv = list( - list(ids = 51200L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 197L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - neut = list( - unit = "%", - min = 0, - max = 100, - description = "neutrophils", - omopid = 4148615L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51256L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "-polys", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000550L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6786L, 11856L), table = "numericitems", - sub_var = "itemid"), - list(ids = 14254L, table = "numericitems", sub_var = "itemid", - callback = "blood_cell_ratio") - ), - miiv = list( - list(ids = 51256L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 230L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - glu = list( - unit = "mg/dL", - min = 0, - max = 1000, - description = "glucose", - omopid = 4144235L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = c(50809L, 50931L), table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "glucose", table = "lab", sub_var = "labname"), - list(ids = "bedside glucose", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = c(20005110L, 24000523L, 24000585L), table = "observations", - sub_var = "variableid", - callback = "convert_unit(binary_op(`*`, 18.016), 'mg/dL')", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6833L, 9557L, 9947L), table = "numericitems", - sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 18.016), 'mg/dL')") - ), - miiv = list( - list(ids = c(50809L, 50931L), table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = c(348L, 656L), table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - cai = list( - unit = "mmol/L", - min = 0.5, - max = 2, - description = "calcium ionized", - omopid = 46272910L, - category = "blood gas", - sources = list( - mimic = list( - list(ids = 50808L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "ionized calcium", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000522L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6815L, 8915L, 9560L, 9561L, 10267L), - table = "numericitems", sub_var = "itemid") - ), - miiv = list( - list(ids = 50808L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 655L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - crp = list( - unit = "mg/L", - min = 0, - description = "C-reactive protein", - omopid = 4208414L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 50889L, table = "labevents", sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 10), 'mg/L', 'mg/dl')") - ), - eicu = list( - list(ids = "CRP", table = "lab", sub_var = "labname", - callback = "convert_unit(binary_op(`*`, 10), 'mg/L', 'mg/dl')") - ), - hirid = list( - list(ids = 20002200L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6825L, 10079L), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 50889L, table = "labevents", sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 10), 'mg/L', 'mg/dl')") - ) - ) - ), - esr = list( - unit = c("mm/hr", "mm/1h"), - min = 0, - max = 200, - description = "erythrocyte sedimentation rate", - omopid = 4212065L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51288L, table = "labevents", sub_var = "itemid") - ), - hirid = list( - list(ids = 24000668L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6808L, 11902L), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 51288L, table = "labevents", sub_var = "itemid") - ) - ) - ), - hbco = list( - description = "carboxyhemoglobin", - omopid = 4056787L, - category = "blood gas", - sources = list( - eicu = list( - list(ids = "Carboxyhemoglobin", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000526L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = 11690L, table = "numericitems", sub_var = "itemid") - ) - ) - ), - methb = list( - unit = "%", - min = 0, - max = 100, - description = "methemoglobin", - omopid = 4204561L, - category = "blood gas", - sources = list( - mimic = list( - list(ids = 50814L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "Methemoglobin", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000549L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = 11692L, table = "numericitems", sub_var = "itemid") - ), - miiv = list( - list(ids = 50814L, table = "labevents", sub_var = "itemid") - ) - ) - ), - tnt = list( - unit = "ng/mL", - min = 0, - description = "troponin t", - omopid = 4005525L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 51003L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "troponin - T", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000806L, table = "observations", sub_var = "variableid", - callback = "convert_unit(binary_op(`/`, 1000), 'ng/mL')", - class = "hrd_itm") - ), - aumc = list( - list(ids = 10407L, table = "numericitems", sub_var = "itemid") - ), - miiv = list( - list(ids = 51003L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 481L, table = "laboratory", sub_var = "LaboratoryID", - callback = "transform_fun(binary_op(`/`, 1000))") - ) - ) - ), - alb = list( - unit = "g/dL", - min = 0, - max = 6, - description = "albumin", - omopid = 4017497L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 50862L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "albumin", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000605L, table = "observations", sub_var = "variableid", - callback = "convert_unit(binary_op(`*`, 0.1), 'g/dL')", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6801L, 9937L), table = "numericitems", - sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 0.1), 'g/dL')") - ), - miiv = list( - list(ids = 50862L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 287L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - fgn = list( - unit = "mg/dL", - min = 0, - max = 1500, - description = "fibrinogen", - omopid = 4094436L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51214L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "fibrinogen", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000536L, table = "observations", sub_var = "variableid", - callback = "convert_unit(binary_op(`*`, 100), 'mg/dL')", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6776L, 9989L, 10175L), table = "numericitems", - sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 100), 'mg/dL')") - ), - miiv = list( - list(ids = 51214L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 344L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - be = list( - unit = c("mEq/L", "mmol/l"), - min = -25, - max = 25, - description = "base excess", - omopid = 4284393L, - category = "blood gas", - sources = list( - mimic = list( - list(ids = 50802L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "Base Excess", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 20001300L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6807L, 9994L), table = "numericitems", - sub_var = "itemid", dir_var = "tag", callback = "aumc_bxs") - ), - miiv = list( - list(ids = 50802L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 668L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - rbc = list( - unit = "m/uL", - min = 0, - max = 20, - description = "red blood cell count", - omopid = 4030871L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51279L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "RBC", table = "lab", sub_var = "labname") - ), - aumc = list( - list(ids = c(6774L, 9962L), table = "numericitems", sub_var = "itemid") - ), - miiv = list( - list(ids = 51279L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 599L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - ck = list( - unit = c("IU/L", "U/l"), - min = 0, - description = "creatine kinase", - omopid = 4265595L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 50910L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "CPK", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000210L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6822L, 11998L), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 50910L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 611L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - ckmb = list( - unit = "ng/mL", - min = 0, - description = "creatine kinase MB", - omopid = 4017058L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 50911L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "CPK-MB", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000220L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = 6824L, table = "numericitems", sub_var = "itemid") - ), - miiv = list( - list(ids = 50911L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 253L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - egcs = list( - min = 1, - max = 4, - description = "GCS eye", - omopid = 4084277L, - category = "neurological", - sources = list( - mimic = list( - list(ids = c(184L, 220739L), table = "chartevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "Eyes", table = "nursecharting", - sub_var = "nursingchartcelltypevalname") - ), - hirid = list( - list(ids = 10000300L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = 6732L, table = "listitems", sub_var = "itemid", - callback = strip_ws("apply_map( - c(`Geen reactie` = 1, - `Reactie op pijnprikkel` = 2, - `Reactie op verbale prikkel` = 3, - `Spontane reactie` = 4) - )")), - list(ids = 13077L, table = "listitems", sub_var = "itemid", - callback = strip_ws("apply_map( - c(`Niet` = 1, - `Op pijn` = 2, - `Op aanspreken` = 3, - `Spontaan` = 4) - )")) - ), - miiv = list( - list(ids = 220739L, table = "chartevents", sub_var = "itemid") - ) - ) - ), - vgcs = list( - min = 1, - max = 5, - description = "GCS verbal", - omopid = 4084912L, - category = "neurological", - sources = list( - mimic = list( - list(ids = c(723L, 223900L), table = "chartevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "Verbal", table = "nursecharting", - sub_var = "nursingchartcelltypevalname") - ), - hirid = list( - list(ids = 10000100L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = 6735L, table = "listitems", sub_var = "itemid", - callback = strip_ws("apply_map( - c(`Geen reactie (geen zichtbare poging tot praten)` = 1, - `Onbegrijpelijke geluiden` = 2, - `Onduidelijke woorden (pogingen tot communicatie, - maar onduidelijk)` = 3, - `Verwarde conversatie` = 4, - `Helder en adequaat (communicatie mogelijk)` = 5) - )")), - list(ids = 13066L, table = "listitems", sub_var = "itemid", - callback = strip_ws("apply_map( - c(`Geen geluid` = 1, - `Onverstaanbare woorden` = 2, - `Onjuiste woorden` = 3, - `Verwarde taal` = 4, - `GeoriĆ«nteerd` = 5) - )")) - ), - miiv = list( - list(ids = 223900L, table = "chartevents", sub_var = "itemid") - ) - ) - ), - mgcs = list( - min = 1, - max = 6, - description = "GCS motor", - omopid = 4083352L, - category = "neurological", - sources = list( - mimic = list( - list(ids = c(454L, 223901L), table = "chartevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "Motor", table = "nursecharting", - sub_var = "nursingchartcelltypevalname") - ), - hirid = list( - list(ids = 10000200L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = 6734L, table = "listitems", sub_var = "itemid", - callback = strip_ws("apply_map( - c(`Geen reactie` = 1, - `Strekken` = 2, - `Decortatie reflex (abnormaal buigen)` = 3, - `Spastische reactie (terugtrekken)` = 4, - `Localiseert pijn` = 5, - `Volgt verbale commando's op` = 6) - )")), - list(ids = 13072L, table = "listitems", sub_var = "itemid", - callback = strip_ws("apply_map( - c(`Geen reactie` = 1, - `Strekken op pijn` = 2, - `Abnormaal buigen bij pijn` = 3, - `Terugtrekken bij pijn` = 4, - `Localiseren pijn` = 5, - `Voert opdrachten uit` = 6) - )")) - ), - miiv = list( - list(ids = 223901L, table = "chartevents", sub_var = "itemid") - ) - ) - ), - tgcs = list( - min = 3, - max = 15, - description = "GCS total", - omopid = 4093836L, - category = "neurological", - sources = list( - mimic = list( - list(ids = 198L, table = "chartevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "GCS Total", table = "nursecharting", - sub_var = "nursingchartcelltypevalname") - ) - ) - ), - urine = list( - unit = "mL", - min = 0, - max = 2000, - aggregate = "sum", - description = "urine output", - omopid = 4264378L, - category = "output", - sources = list( - mimic = list( - list(ids = c(40055L, 40056L, 40057L, 40065L, 40069L, 40085L, - 40086L, 40094L, 40096L, 40405L, 40428L, 40473L, - 40715L, 43175L, 226557L, 226558L, 226559L, 226560L, - 226561L, 226563L, 226564L, 226565L, 226566L, 226567L, - 226584L, 227510L), - table = "outputevents", sub_var = "itemid") - ), - eicu = list( - list(ids = c("Urine", "URINE CATHETER"), table = "intakeoutput", - sub_var = "celllabel"), - list(regex = c("catheter.+output|output.+catheter"), - table = "intakeoutput", sub_var = "celllabel", class = "rgx_itm") - ), - hirid = list( - list(ids = 30005110L, table = "observations", sub_var = "variableid", - callback = "hirid_urine", class = "hrd_itm") - ), - aumc = list( - list(ids = 8794L, table = "numericitems", sub_var = "itemid") - ), - miiv = list( - list(ids = c(226557L, 226558L, 226559L, 226560L, 226561L, 226563L, - 226564L, 226565L, 226566L, 226567L, 226584L, 227510L), - table = "outputevents", sub_var = "itemid") - ), - sic = list( - list(ids = 725L, table = "data_float_h", sub_var = "DataID") - ) - ) - ), - dobu_rate = list( - unit = c("mcg/kg/min", "mcgkgmin"), - min = 0, - max = 50, - description = "dobutamine rate", - omopid = 1337720L, - category = "medications", - sources = list( - mimic = list( - list(ids = c(30042L, 30306L), table = "inputevents_cv", - sub_var = "itemid", grp_var = "linkorderid", - callback = "mimic_rate_cv"), - list(ids = 221653L, table = "inputevents_mv", sub_var = "itemid", - stop_var = "endtime", callback = "mimic_rate_mv") - ), - eicu = list( - list(regex = "^dobu.*\\(.+\\)$", table = "infusiondrug", - sub_var = "drugname", weight_var = "patientweight", - callback = "eicu_rate_kg(ml_to_mcg = 2000)", class = "rgx_itm") - ), - hirid = list( - list(ids = 426L, table = "pharma", sub_var = "pharmaid", - grp_var = "infusionid", callback = "hirid_rate_kg") - ), - aumc = list( - list(ids = 7178L, table = "drugitems", sub_var = "itemid", - rel_weight = "doserateperkg", rate_uom = "doserateunit", - stop_var = "stop", callback = "aumc_rate_kg") - ), - miiv = list( - list(ids = 221653L, table = "inputevents", sub_var = "itemid", - stop_var = "endtime", callback = "mimic_rate_mv") - ), - sic = list( - list(ids = 1559L, table = "medication", sub_var = "DrugID", - val_var = "AmountPerMinute", stop_var = "OffsetDrugEnd", - callback = "sic_rate_kg") - ) - ) - ), - dobu_dur = list( - description = "dobutamine duration", - category = "medications", - aggregate = "max", - sources = list( - mimic = list( - list(ids = c(30042L, 30306L), table = "inputevents_cv", - sub_var = "itemid", grp_var = "linkorderid", - callback = "mimic_dur_incv"), - list(ids = 221653L, table = "inputevents_mv", sub_var = "itemid", - stop_var = "endtime", grp_var = "linkorderid", - callback = "mimic_dur_inmv") - ), - eicu = list( - list(regex = "^dobu", table = "infusiondrug", sub_var = "drugname", - callback = "eicu_duration(gap_length = hours(5L))", - class = "rgx_itm") - ), - hirid = list( - list(ids = 426L, table = "pharma", sub_var = "pharmaid", - grp_var = "infusionid", callback = "hirid_duration") - ), - aumc = list( - list(ids = 7178L, table = "drugitems", sub_var = "itemid", - stop_var = "stop", grp_var = "orderid", callback = "aumc_dur") - ), - miiv = list( - list(ids = 221653L, table = "inputevents", sub_var = "itemid", - stop_var = "endtime", grp_var = "linkorderid", - callback = "mimic_dur_inmv") - ), - sic = list( - list(ids = list(1559L), table = "medication", - sub_var = "DrugID", stop_var = "OffsetDrugEnd", - callback = "sic_dur") - ) - ) - ), - dobu60 = list( - concepts = c("dobu_rate", "dobu_dur"), - description = "dobutamine administration for min 1h", - category = "medications", - interval = "00:01:00", - callback = "vaso60", - class = "rec_cncpt" - ), - dopa_rate = list( - unit = c("mcg/kg/min", "mcgkgmin"), - min = 0, - max = 50, - description = "dopamine rate", - omopid = 1337860L, - category = "medications", - sources = list( - mimic = list( - list(ids = c(30043L, 30125L, 30307L), table = "inputevents_cv", - sub_var = "itemid", grp_var = "linkorderid", - callback = "mimic_rate_cv"), - list(ids = 221662L, table = "inputevents_mv", sub_var = "itemid", - stop_var = "endtime", callback = "mimic_rate_mv") - ), - eicu = list( - list(regex = "^dopa.*\\(.+\\)$", table = "infusiondrug", - sub_var = "drugname", weight_var = "patientweight", - callback = "eicu_rate_kg(ml_to_mcg = 1600)", class = "rgx_itm") - ), - aumc = list( - list(ids = 7179L, table = "drugitems", sub_var = "itemid", - rel_weight = "doserateperkg", rate_uom = "doserateunit", - stop_var = "stop", callback = "aumc_rate_kg") - ), - miiv = list( - list(ids = 221662L, table = "inputevents", sub_var = "itemid", - stop_var = "endtime", callback = "mimic_rate_mv") - ), - sic = list( - list(ids = 1618L, table = "medication", sub_var = "DrugID", - val_var = "AmountPerMinute", stop_var = "OffsetDrugEnd", - callback = "sic_rate_kg") - ) - ) - ), - dopa_dur = list( - description = "dopamine duration", - category = "medications", - aggregate = "max", - sources = list( - mimic = list( - list(ids = c(30043L, 30125L, 30307L), table = "inputevents_cv", - sub_var = "itemid", grp_var = "linkorderid", - callback = "mimic_dur_incv"), - list(ids = 221662L, table = "inputevents_mv", sub_var = "itemid", - stop_var = "endtime", grp_var = "linkorderid", - callback = "mimic_dur_inmv") - ), - eicu = list( - list(regex = "^dopa", table = "infusiondrug", sub_var = "drugname", - callback = "eicu_duration(gap_length = hours(5L))", - class = "rgx_itm") - ), - aumc = list( - list(ids = 7179L, table = "drugitems", sub_var = "itemid", - stop_var = "stop", grp_var = "orderid", callback = "aumc_dur") - ), - miiv = list( - list(ids = 221662L, table = "inputevents", sub_var = "itemid", - stop_var = "endtime", grp_var = "linkorderid", - callback = "mimic_dur_inmv") - ), - sic = list( - list(ids = 1618L, table = "medication", - sub_var = "DrugID", stop_var = "OffsetDrugEnd", - callback = "sic_dur") - ) - ) - ), - dopa60 = list( - concepts = c("dopa_rate", "dopa_dur"), - description = "dopamine administration for min 1h", - category = "outcome", - interval = "00:01:00", - callback = "vaso60", - class = "rec_cncpt" - ), - norepi_rate = list( - unit = c("mcg/kg/min", "mcgkgmin"), - min = 0, - max = 3, - description = "norepinephrine rate", - omopid = 1321341, - category = "medications", - sources = list( - mimic = list( - list(ids = c(30047L, 30120L), table = "inputevents_cv", - sub_var = "itemid", grp_var = "linkorderid", - callback = "mimic_rate_cv"), - list(ids = 221906L, table = "inputevents_mv", sub_var = "itemid", - stop_var = "endtime", callback = "mimic_rate_mv") - ), - eicu = list( - list(regex = "^norepi.*\\(.+\\)$", table = "infusiondrug", - sub_var = "drugname", weight_var = "patientweight", - callback = "eicu_rate_kg(ml_to_mcg = 32)", class = "rgx_itm") - ), - hirid = list( - list(ids = c(1000462L, 1000656L, 1000657L, 1000658L), table = "pharma", - sub_var = "pharmaid", grp_var = "infusionid", - callback = "hirid_rate_kg") - ), - aumc = list( - list(ids = 7229L, table = "drugitems", sub_var = "itemid", - rel_weight = "doserateperkg", rate_uom = "doserateunit", - stop_var = "stop", callback = "aumc_rate_kg") - ), - miiv = list( - list(ids = 221906L, table = "inputevents", sub_var = "itemid", - stop_var = "endtime", callback = "mimic_rate_mv") - ), - sic = list( - list(ids = 1562L, table = "medication", sub_var = "DrugID", - val_var = "AmountPerMinute", stop_var = "OffsetDrugEnd", - callback = "sic_rate_kg") - ) - ) - ), - norepi_dur = list( - description = "norepinephrine duration", - category = "medications", - aggregate = "max", - sources = list( - mimic = list( - list(ids = c(30047L, 30120L), table = "inputevents_cv", - sub_var = "itemid", grp_var = "linkorderid", - callback = "mimic_dur_incv"), - list(ids = 221906L, table = "inputevents_mv", sub_var = "itemid", - stop_var = "endtime", grp_var = "linkorderid", - callback = "mimic_dur_inmv") - ), - eicu = list( - list(regex = "^norepi", table = "infusiondrug", sub_var = "drugname", - callback = "eicu_duration(gap_length = hours(5L))", - class = "rgx_itm") - ), - hirid = list( - list(ids = c(1000462L, 1000656L, 1000657L, 1000658L), table = "pharma", - sub_var = "pharmaid", grp_var = "infusionid", - callback = "hirid_duration") - ), - aumc = list( - list(ids = 7229L, table = "drugitems", sub_var = "itemid", - stop_var = "stop", grp_var = "orderid", callback = "aumc_dur") - ), - miiv = list( - list(ids = 221906L, table = "inputevents", sub_var = "itemid", - stop_var = "endtime", grp_var = "linkorderid", - callback = "mimic_dur_inmv") - ), - sic = list( - list(ids = list(1562L), table = "medication", - sub_var = "DrugID", stop_var = "OffsetDrugEnd", - callback = "sic_dur") - ) - ) - ), - norepi60 = list( - concepts = c("norepi_rate", "norepi_dur"), - description = "norepinephrine administration for min 1h", - category = "outcome", - interval = "00:01:00", - callback = "vaso60", - class = "rec_cncpt" - ), - epi_rate = list( - unit = c("mcg/kg/min", "mcgkgmin"), - min = 0, - max = 1.5, - description = "epinephrine rate", - omopid = 1343916L, - category = "medications", - sources = list( - mimic = list( - list(ids = c(30044L, 30119L, 30309L), table = "inputevents_cv", - sub_var = "itemid", grp_var = "linkorderid", - callback = "mimic_rate_cv"), - list(ids = 221289L, table = "inputevents_mv", sub_var = "itemid", - stop_var = "endtime", callback = "mimic_rate_mv") - ), - eicu = list( - list(regex = "^epi( |n).*\\(.+\\)$", table = "infusiondrug", - sub_var = "drugname", weight_var = "patientweight", - callback = "eicu_rate_kg(ml_to_mcg = 40)", class = "rgx_itm") - ), - hirid = list( - list(ids = c(71L, 1000649L, 1000650L, 1000655L, 1000750L), - table = "pharma", sub_var = "pharmaid", - grp_var = "infusionid", callback = "hirid_rate_kg") - ), - aumc = list( - list(ids = 6818L, table = "drugitems", sub_var = "itemid", - rel_weight = "doserateperkg", rate_uom = "doserateunit", - stop_var = "stop", callback = "aumc_rate_kg") - ), - miiv = list( - list(ids = 221289L, table = "inputevents", sub_var = "itemid", - stop_var = "endtime", callback = "mimic_rate_mv") - ), - sic = list( - list(ids = 1502L, table = "medication", sub_var = "DrugID", - val_var = "AmountPerMinute", stop_var = "OffsetDrugEnd", - callback = "sic_rate_kg") - ) - ) - ), - epi_dur = list( - description = "epinephrine duration", - category = "medications", - aggregate = "max", - sources = list( - mimic = list( - list(ids = c(30044L, 30119L, 30309L), table = "inputevents_cv", - sub_var = "itemid", grp_var = "linkorderid", - callback = "mimic_dur_incv"), - list(ids = 221289L, table = "inputevents_mv", sub_var = "itemid", - stop_var = "endtime", grp_var = "linkorderid", - callback = "mimic_dur_inmv") - ), - eicu = list( - list(regex = "^epi( |n)", table = "infusiondrug", sub_var = "drugname", - callback = "eicu_duration(gap_length = hours(5L))", - class = "rgx_itm") - ), - hirid = list( - list(ids = c(71L, 1000649L, 1000650L, 1000655L, 1000750L), - table = "pharma", sub_var = "pharmaid", grp_var = "infusionid", - callback = "hirid_duration") - ), - aumc = list( - list(ids = 6818L, table = "drugitems", sub_var = "itemid", - stop_var = "stop", grp_var = "orderid", callback = "aumc_dur") - ), - miiv = list( - list(ids = 221289L, table = "inputevents", sub_var = "itemid", - stop_var = "endtime", grp_var = "linkorderid", - callback = "mimic_dur_inmv") - ), - sic = list( - list(ids = list(1502L), table = "medication", - sub_var = "DrugID", stop_var = "OffsetDrugEnd", - callback = "sic_dur") - ) - ) - ), - epi60 = list( - concepts = c("epi_rate", "epi_dur"), - description = "epinephrine administration for min 1h", - category = "outcome", - interval = "00:01:00", - callback = "vaso60", - class = "rec_cncpt" - ), - vent_start = list( - class = "lgl_cncpt", - description = "ventilation start", - category = "respiratory", - sources = list( - mimic = list( - list( - ids = c( - 1L, 60L, 218L, 221L, 223L, 436L, 437L, - 444L, 445L, 448L, 449L, 450L, 459L, 501L, - 502L, 503L, 505L, 506L, 535L, 543L, 639L, - 654L, 667L, 668L, 669L, 670L, 671L, 672L, - 681L, 682L, 683L, 684L, 686L, 1211L, 1340L, - 1486L, 1600L, 1655L, 2000L, 3459L, 5865L, 5866L, - 220339L, 223848L, 223849L, 224419L, 224684L, 224685L, 224686L, - 224687L, 224695L, 224696L, 224697L, 224700L, 224701L, 224702L, - 224703L, 224704L, 224705L, 224706L, 224707L, 224709L, 224738L, - 224746L, 224747L, 224750L, 226873L, 227187L), - table = "chartevents", sub_var = "itemid", - callback = "transform_fun(set_val(TRUE))" - ) - ), - eicu = list( - list(table = "respiratorycare", val_var = "ventstartoffset", - callback = "vent_flag", class = "col_itm"), - list(table = "respiratorycare", val_var = "priorventstartoffset", - callback = "vent_flag", class = "col_itm"), - list(ids = c("Start", "Continued", "respFlowPtVentData"), - table = "respiratorycharting", sub_var = "respcharttypecat", - callback = "transform_fun(set_val(TRUE))") - ) - ) - ), - vent_end = list( - class = "lgl_cncpt", - description = "ventilation end", - category = "respiratory", - sources = list( - mimic = list( - list(ids = c(225468L, 225477L, 227194L), table = "procedureevents_mv", - sub_var = "itemid", callback = "transform_fun(set_val(TRUE))"), - list(ids = c(467L, 469L, 226732L), table = "chartevents", - sub_var = "itemid", callback = "transform_fun(set_val(TRUE))") - ), - eicu = list( - list(table = "respiratorycare", val_var = "ventendoffset", - callback = "vent_flag", class = "col_itm"), - list(table = "respiratorycare", val_var = "priorventendoffset", - callback = "vent_flag", class = "col_itm"), - list(ids = c("off", "Off", "Suspended"), table = "respiratorycharting", - sub_var = "respchartvalue", val_var = "respchartvaluelabel", - callback = "transform_fun(set_val(TRUE))") - ) - ) - ), - mech_vent = list( - class = "fct_cncpt", - target = "win_tbl", - levels = c("invasive", "noninvasive"), - description = "mechanical ventilation windows", - omopid = 4230167L, - category = "respiratory", - sources = list( - aumc = list( - list(ids = c(9328L, 10740L, 12635L), table = "processitems", - sub_var = "itemid", dur_var = "stop", - callback = "apply_map(c(`Beademen` = 'invasive', - `Beademen non-invasief` = 'noninvasive', - `Tracheostoma` = 'invasive'))" - ) - ), - miiv = list( - list(ids = c(225792L, 225794L), table = "procedureevents", - sub_var = "itemid", dur_var = "endtime", - callback = "apply_map(c(`225792` = 'invasive', - `225794` = 'noninvasive'), - var = 'sub_var')") - ), - hirid = list( - list(ids = 15001552L, table = "observations", sub_var = "variableid", - target = "ts_tbl", interval = "00:01:00", class = "hrd_itm", - callback = "combine_callbacks(hirid_vent, - apply_map(c(`1` = 'invasive', - `2` = 'invasive', - `3` = 'noninvasive', - `4` = 'noninvasive', - `5` = 'noninvasive', - `6` = 'noninvasive')))") - ) - ) - ), - ett_gcs = list( - class = "lgl_cncpt", - description = "tracheostomy", - omopid = 4097216L, - category = "respiratory", - target = "win_tbl", - sources = list( - mimic = list( - list(ids = c("1.0 ET/Trach", "No Response-ETT"), table = "chartevents", - sub_var = "value", target = "ts_tbl", - callback = "combine_callbacks( - transform_fun(set_val(TRUE)), - ts_to_win_tbl(mins(1L)) - )") - ), - hirid = list( - list(class = "fun_itm", callback = "combine_callbacks( - fwd_concept('mech_vent'), - transform_fun(comp_na(`==`, 'invasive')) - )") - ), - aumc = list( - list(ids = 6735L, table = "listitems", sub_var = "itemid", - target = "ts_tbl", callback = "combine_callbacks( - transform_fun(comp_na(`==`, 'GeĆÆntubeerd')), - ts_to_win_tbl(mins(1L)) - )") - ), - miiv = list( - list(ids = "No Response-ETT", table = "chartevents", sub_var = "value", - target = "ts_tbl", callback = "combine_callbacks( - transform_fun(set_val(TRUE)), - ts_to_win_tbl(mins(1L)) - )") - ), - eicu = list( - list(class = "fun_itm", callback = "combine_callbacks( - fwd_concept('rass'), - transform_fun(comp_na(`<=`, -3)), - ts_to_win_tbl(mins(360L)) - )") - ) - ) - ), - rass = list( - min = -5, - max = 4, - description = "Richmond agitation sedation scale", - omopid = 36684829L, - category = "neurological", - sources = list( - mimic = list( - list(ids = 228096L, table = "chartevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "Sedation Score", table = "nursecharting", - sub_var = "nursingchartcelltypevalname") - ), - hirid = list( - list(ids = 15001565L, table = "observations", sub_var = "variableid", - callback = "transform_fun(floor)", class = "hrd_itm") - ), - aumc = list( - list(ids = 14444L, sub_var = "itemid", table = "listitems", - callback = "transform_fun(aumc_rass)") - ), - miiv = list( - list(ids = 228096L, table = "chartevents", sub_var = "itemid") - ) - ) - ), - abx = list( - class = "lgl_cncpt", - description = "antibiotics", - omopid = 4085730L, - category = "medications", - sources = list( - mimic = list( - list(regex = paste( - "aztreonam", "bactrim", "cephalexin", "chloramphenicol", "cipro", - "flagyl", "metronidazole", "nitrofurantoin", "tazobactam", - "rifampin", "sulfadiazine", "timentin", "trimethoprim", "(amika", - "gentami", "vanco)cin", "(amoxi", "ampi", "dicloxa", "naf", "oxa", - "peni", "pipera)cillin", "(azithro", "clarithro", "erythro", - "clinda", "strepto", "tobra", "vanco)mycin", "cef(azolin", - "tazidime", "adroxil", "epime", "otetan", "otaxime", "podoxime", - "uroxime)", "(doxy", "mino", "tetra)cycline", "(levofl", "moxifl", - "ofl)oxacin", "macro(bid", "dantin)", "(una", "zo)syn", sep = "|"), - table = "prescriptions", sub_var = "drug", interval = "00:01:00", - callback = "mimic_abx_presc", class = "rgx_itm" - ), - list(ids = c( - 225798L, 225837L, 225838L, 225840L, 225842L, 225843L, 225844L, - 225845L, 225847L, 225848L, 225850L, 225851L, 225853L, 225855L, - 225857L, 225859L, 225860L, 225862L, 225863L, 225865L, 225866L, - 225868L, 225869L, 225871L, 225873L, 225875L, 225876L, 225877L, - 225879L, 225881L, 225882L, 225883L, 225884L, 225885L, 225886L, - 225888L, 225889L, 225890L, 225892L, 225893L, 225895L, 225896L, - 225897L, 225898L, 225899L, 225900L, 225902L, 225903L, 225905L, - 227691L, 228003L), table = "inputevents_mv", sub_var = "itemid", - callback = "transform_fun(set_val(TRUE))" - ) - ), - eicu = list( - list(regex = paste( - "bactrim", "cipro", "flagyl", "metronidazole", "zithromax", "zosyn", - "(((amika", "cleo", "ofloxa)", "(azithro", "clinda", "tobra", - "vanco)my)c", "(ampi", "oxa", "peni", "pipera)cill", "cefazol", - "levaqu", "rifamp)in", sep = "|"), table = "infusiondrug", - sub_var = "drugname", callback = "transform_fun(set_val(TRUE))", - class = "rgx_itm" - ), - list(regex = paste( - "cipro", "flagyl", "maxipime", "metronidazole", "tazobactam", - "zosyn", "cef(azolin", "epime)", "(((azithro", "clinda", "vanco)my", - "ofloxa", "vanco)c", "levaqu", "piperacill", "roceph)in", sep = "|"), - table = "medication", sub_var = "drugname", - callback = "transform_fun(set_val(TRUE))", class = "rgx_itm" - ) - ), - hirid = list( - list(ids = c( - 163L, 176L, 181L, 186L, 189L, 300L, 326L, - 331L, 351L, 405L, 1000234L, 1000272L, 1000273L, 1000274L, - 1000284L, 1000299L, 1000300L, 1000302L, 1000304L, 1000305L, 1000306L, - 1000315L, 1000317L, 1000318L, 1000320L, 1000321L, 1000322L, 1000335L, - 1000348L, 1000352L, 1000363L, 1000365L, 1000390L, 1000407L, 1000408L, - 1000424L, 1000425L, 1000426L, 1000437L, 1000483L, 1000507L, 1000508L, - 1000518L, 1000519L, 1000549L, 1000601L, 1000648L, 1000666L, 1000670L, - 1000671L, 1000760L, 1000781L, 1000791L, 1000797L, 1000812L, 1000825L, - 1000829L, 1000830L, 1000837L, 1000838L, 1000854L, 1000855L, 1000893L, - 1000894L, 1001005L, 1001068L, 1001075L, 1001079L, 1001084L, 1001086L, - 1001095L, 1001096L, 1001097L, 1001098L, 1001168L, 1001169L, 1001170L, - 1001171L, 1001173L, 1001193L, 1001198L), table = "pharma", - sub_var = "pharmaid", callback = "transform_fun(set_val(TRUE))") - ), - aumc = list( - list(ids = c( - 2L, 13L, 19L, 24L, 28L, 29L, 57L, 59L, - 82L, 103L, 240L, 247L, 333L, 1133L, 1199L, 1300L, - 1371L, 1795L, 2284L, 2834L, 3237L, 3741L, 5576L, 6834L, - 6847L, 6871L, 6919L, 6948L, 6953L, 6958L, 7044L, 7064L, - 7185L, 7187L, 7208L, 7227L, 7235L, 8064L, 8394L, 8942L, - 9029L, 9030L, 9052L, 9070L, 9117L, 9128L, 9133L, 9142L, - 9151L, 9152L, 12262L, 12389L, 12398L, 12956L, 12997L, 13057L, - 13094L, 13102L, 15591L, 18860L, 19137L, 19773L, 20563L, 23166L, - 24241L, 25776L, 27617L, 29321L), table = "drugitems", - sub_var = "itemid", callback = "transform_fun(set_val(TRUE))") - ), - miiv = list( - list(regex = paste( - "aztreonam", "bactrim", "cephalexin", "chloramphenicol", "cipro", - "flagyl", "metronidazole", "nitrofurantoin", "tazobactam", - "rifampin", "sulfadiazine", "timentin", "trimethoprim", "(amika", - "gentami", "vanco)cin", "(amoxi", "ampi", "dicloxa", "naf", "oxa", - "peni", "pipera)cillin", "(azithro", "clarithro", "erythro", - "clinda", "strepto", "tobra", "vanco)mycin", "cef(azolin", - "tazidime", "adroxil", "epime", "otetan", "otaxime", "podoxime", - "uroxime)", "(doxy", "mino", "tetra)cycline", "(levofl", "moxifl", - "ofl)oxacin", "macro(bid", "dantin)", "(una", "zo)syn", sep = "|"), - table = "prescriptions", sub_var = "drug", - callback = "transform_fun(set_val(TRUE))", class = "rgx_itm" - ), - list(ids = c( - 225798L, 225837L, 225838L, 225840L, 225842L, 225843L, 225844L, - 225845L, 225847L, 225848L, 225850L, 225851L, 225853L, 225855L, - 225857L, 225859L, 225860L, 225862L, 225863L, 225865L, 225866L, - 225868L, 225869L, 225871L, 225873L, 225875L, 225876L, 225877L, - 225879L, 225881L, 225882L, 225883L, 225884L, 225885L, 225886L, - 225888L, 225889L, 225890L, 225892L, 225893L, 225895L, 225896L, - 225897L, 225898L, 225899L, 225900L, 225902L, 225903L, 225905L, - 227691L, 228003L), table = "inputevents", sub_var = "itemid", - callback = "transform_fun(set_val(TRUE))" - ) - ), - sic = list( - list(ids = c( - 1406L, 1408L, 1410L, 1418L, 1421L, 1422L, - 1423L, 1428L, 1431L, 1433L, 1436L, 1449L, 1454L, - 1457L, 1458L, 1459L, 1460L, 1461L, 1603L, 1795L, - 1913L, 1927L), table = "medication", sub_var = "DrugID", - callback = "transform_fun(set_val(TRUE))" - ) - ) - ) - ), - samp = list( - class = "lgl_cncpt", - category = "microbiology", - description = "body fluid sampling", - omopid = 4133843L, - sources = list( - mimic = list( - list(table = "microbiologyevents", val_var = "org_itemid", - callback = "mimic_sampling", aux_time = "charttime", - class = "col_itm") - ), - eicu = list( - list(table = "microlab", val_var = "organism", - callback = "transform_fun(comp_na(`!=`, 'no growth'))", - class = "col_itm") - ), - aumc = list( - list(ids = c( - 8097L, 8418L, 8588L, 9189L, 9190L, 9191L, 9192L, 9193L, 9194L, - 9195L, 9197L, 9198L, 9200L, 9202L, 9203L, 9204L, 9205L, 13024L, - 19663L, 19664L), table = "procedureorderitems", sub_var = "itemid", - callback = "transform_fun(set_val(TRUE))") - ), - miiv = list( - list(table = "microbiologyevents", val_var = "org_itemid", - callback = "mimic_sampling", aux_time = "charttime", - class = "col_itm") - ) - ) - ), - tri = list( - unit = "ng/mL", - min = 0, - description = "troponin I", - omopid = 4007805L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 51002L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "troponin - I", table = "lab", sub_var = "labname") - ), - miiv = list( - list(ids = 51002L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 270L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - bili_dir = list( - unit = "mg/dL", - min = 0, - max = 50, - description = "bilirubin direct", - omopid = 4216632L, - category = "chemistry", - sources = list( - mimic = list( - list(ids = 50883L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "direct bilirubin", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000560L, table = "observations", sub_var = "variableid", - callback = "convert_unit(binary_op(`*`, 0.058467), 'mg/dL')", - class = "hrd_itm") - ), - aumc = list( - list(ids = 6812L, table = "numericitems", sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 0.058467), 'mg/dL')") - ), - miiv = list( - list(ids = 50883L, table = "labevents", sub_var = "itemid") - ), - sic = list( - list(ids = 332L, table = "laboratory", sub_var = "LaboratoryID") - ) - ) - ), - temp = list( - unit = c("C", "Ā°C"), - min = 32, - max = 42, - description = "temperature", - omopid = 4302666L, - category = "vitals", - sources = list( - mimic = list( - list(ids = c(676L, 677L, 223762L), table = "chartevents", - sub_var = "itemid"), - list(ids = c(678L, 679L, 223761L, 224027L), table = "chartevents", - sub_var = "itemid", - callback = "convert_unit(fahr_to_cels, 'C', 'f')") - ), - eicu = list( - list(table = "vitalperiodic", val_var = "temperature", - class = "col_itm") - ), - hirid = list( - list(ids = c(410L, 400L, 7100L), table = "observations", - sub_var = "variableid", class = "hrd_itm") - ), - aumc = list( - list(ids = c(8658L, 13952L, 16110L), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 223762L, table = "chartevents", sub_var = "itemid"), - list(ids = c(223761L, 224027L), table = "chartevents", - sub_var = "itemid", - callback = "convert_unit(fahr_to_cels, 'C', 'f')") - ), - sic = list( - list(ids = 709L, table = "data_float_h", sub_var = "DataID") - ) - ) - ), - etco2 = list( - unit = c("mmHg", "mm Hg"), - min = 10, - max = 60, - description = "endtidal CO2", - omopid = 4353940L, - category = "vitals", - sources = list( - mimic = list( - list(ids = c(1817L, 228640L), table = "chartevents", - sub_var = "itemid") - ), - hirid = list( - list(ids = c(2200L, 8290L, 30010009L), table = "observations", - sub_var = "variableid", class = "hrd_itm") - ), - aumc = list( - list( - ids = c(6707L, 8884L, 8885L, 9658L, 12805L, 12356L), - table = "numericitems", sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 7.6), 'mmHg', 'None|Geen')" - ) - ), - miiv = list( - list(ids = 228640L, table = "chartevents", sub_var = "itemid") - ) - ) - ), - ins = list( - unit = "units/hr", - min = 0, - description = "insulin", - omopid = 42537007L, - category = "medications", - sources = list( - mimic = list( - list(ids = c(30045L, 30100L), table = "inputevents_cv", - sub_var = "itemid"), - list(ids = c(223258L, 223260L), table = "inputevents_mv", - sub_var = "itemid", val_var = "amount", end_var = "endtime", - callback = "distribute_amount") - ), - eicu = list( - list(regex = "^insulin (250.+)?\\(((ml|units)/hr)?\\)$", - table = "infusiondrug", sub_var = "drugname", class = "rgx_itm") - ), - hirid = list( - list(ids = c(15L, 1000724L), table = "pharma", sub_var = "pharmaid", - callback = "aggregate_fun('sum', 'units')") - ), - aumc = list( - list(ids = c(7624L, 9014L, 19129L), sub_var = "itemid", - table = "drugitems") - ), - miiv = list( - list(ids = c(223258L, 223260L), table = "inputevents", - sub_var = "itemid", val_var = "amount", end_var = "endtime", - callback = "distribute_amount") - ) - ) - ), - sex = list( - target = "id_tbl", - levels = c("Female", "Male"), - class = "fct_cncpt", - description = "patient sex", - omopid = 37116947L, - category = "demographics", - sources = list( - mimic = list( - list(table = "patients", val_var = "gender", - callback = "apply_map(c(M = 'Male', F = 'Female'))", - class = "col_itm") - ), - eicu = list( - list(table = "patient", val_var = "gender", class = "col_itm") - ), - hirid = list( - list(table = "general", val_var = "sex", - callback = "apply_map(c(M = 'Male', F = 'Female'))", - class = "col_itm") - ), - aumc = list( - list(val_var = "gender", table = "admissions", - callback = strip_ws("apply_map(c(Vrouw = 'Female', - Man = 'Male'))"), - class = "col_itm") - ), - miiv = list( - list(table = "patients", val_var = "gender", - callback = "apply_map(c(M = 'Male', F = 'Female'))", - class = "col_itm") - ), - sic = list( - list(table = "cases", val_var = "Sex", - callback = "apply_map(c(`735` = 'Male', `736` = 'Female'))", - class = "col_itm") - ) - ) - ), - age = list( - unit = "years", - min = 0, - max = 100, - target = "id_tbl", - description = "patient age", - omopid = 4314456L, - category = "demographics", - sources = list( - mimic = list( - list(table = "patients", val_var = "dob", - callback = "transform_fun(mimic_age)", class = "col_itm") - ), - eicu = list( - list(table = "patient", val_var = "age", - callback = "transform_fun(eicu_age)", class = "col_itm") - ), - hirid = list( - list(table = "general", val_var = "age", class = "col_itm") - ), - aumc = list( - list(val_var = "agegroup", table = "admissions", - callback = strip_ws("apply_map(c(`18-39` = 30, - `40-49` = 45, - `50-59` = 55, - `60-69` = 65, - `70-79` = 75, - `80+` = 90))"), - class = "col_itm") - ), - miiv = list( - list(table = "patients", val_var = "anchor_age", class = "col_itm") - ), - sic = list( - list(table = "cases", val_var = "AgeOnAdmission", class = "col_itm") - ) - ) - ), - weight = list( - unit = "kg", - min = 1, - max = 500, - target = "id_tbl", - description = "patient weight", - omopid = 4099154L, - category = "demographics", - sources = list( - mimic = list( - list(ids = c(762L, 4183L, 226512L), table = "chartevents", - sub_var = "itemid") - ), - eicu = list( - list(table = "patient", val_var = "admissionweight", - class = "col_itm") - ), - hirid = list( - list(ids = 10000400L, table = "observations", - sub_var = "variableid", class = "hrd_itm") - ), - aumc = list( - list(val_var = "weightgroup", table = "admissions", - callback = strip_ws("apply_map(c(`59-` = 50, - `60-69` = 65, - `70-79` = 75, - `80-89` = 85, - `90-99` = 95, - `100-109` = 105, - `110+` = 120))"), - class = "col_itm") - ), - miiv = list( - list(ids = 226512L, table = "chartevents", sub_var = "itemid") - ), - sic = list( - list(table = "cases", val_var = "WeightOnAdmission", class = "col_itm", - callback = "transform_fun(binary_op(`/`, 1000))") - ) - ) - ), - height = list( - unit = "cm", - min = 10, - max = 230, - target = "id_tbl", - description = "patient height", - omopid = 607590L, - category = "demographics", - sources = list( - mimic = list( - list(ids = c(920L, 1394L, 3485L, 4187L, 4188L, 3486L, 226707L), - table = "chartevents", sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 2.54), 'cm', '^in')") - ), - eicu = list( - list(table = "patient", val_var = "admissionheight", - class = "col_itm") - ), - hirid = list( - list(ids = 10000450L, table = "observations", - sub_var = "variableid", class = "hrd_itm") - ), - aumc = list( - list(val_var = "heightgroup", table = "admissions", - callback = strip_ws("apply_map(c(`159-` = 150, - `160-169` = 165, - `170-179` = 175, - `180-189` = 185, - `190+` = 200))"), - class = "col_itm") - ), - miiv = list( - list(ids = 226707L, table = "chartevents", sub_var = "itemid", - callback = "convert_unit(binary_op(`*`, 2.54), 'cm', '^in')") - ), - sic = list( - list(table = "cases", val_var = "HeightOnAdmission", class = "col_itm") - ) - ) - ), - death = list( - class = "lgl_cncpt", - description = "in hospital mortality", - omopid = 4306655L, - category = "outcome", - sources = list( - mimic = list( - list(table = "admissions", index_var = "deathtime", - val_var = "hospital_expire_flag", - callback = "transform_fun(comp_na(`==`, 1L))", class = "col_itm") - ), - eicu = list( - list(table = "patient", index_var = "unitdischargeoffset", - val_var = "hospitaldischargestatus", - callback = "transform_fun(comp_na(`==`, 'Expired'))", - class = "col_itm") - ), - hirid = list( - list(ids = c(110L, 200L), table = "observations", - sub_var = "variableid", callback = "hirid_death", - class = "hrd_itm") - ), - aumc = list( - list(table = "admissions", index_var = "dateofdeath", - val_var = "dischargedat", callback = "aumc_death", - class = "col_itm") - ), - miiv = list( - list(table = "admissions", index_var = "deathtime", - val_var = "hospital_expire_flag", - callback = "transform_fun(comp_na(`==`, 1L))", class = "col_itm") - ) - ) - ), - adm = list( - target = "id_tbl", - levels = c("med", "surg", "other"), - class = "fct_cncpt", - description = "patient admission type", - category = "demographics", - sources = list( - mimic = list( - list(table = "services", val_var = "curr_service", - callback = "apply_map( - c(MED = 'med', SURG = 'surg', CMED = 'med', CSURG = 'surg', - VSURG = 'surg', NSURG = 'surg', NB = 'other', NMED = 'med', - ORTHO = 'surg', TRAUM = 'surg', OMED = 'med', GU = 'other', - NBB = 'other', TSURG = 'surg', GYN = 'other', PSURG = 'surg', - OBS = 'other', ENT = 'surg', DENT = 'surg', PSYCH = 'other') - )", - class = "col_itm" - ) - ), - eicu = list( - list(table = "admissiondx", val_var = "admitdxpath", - callback = "eicu_adx", class = "col_itm") - ), - aumc = list( - list(val_var = "specialty", table = "admissions", - callback = strip_ws("apply_map( - c(Cardiochirurgie = 'surg', - Cardiologie = 'med', - ders = 'other', - Gynaecologie = 'other', - `Heelkunde Gastro-enterologie` = 'surg', - `Heelkunde Longen/Oncologie` = 'surg', - `Heelkunde Oncologie` = 'surg', - Hematologie = 'med', - `Intensive Care Volwassenen` = 'other', - Inwendig = 'med', - `Keel, Neus & Oorarts` = 'surg', - Longziekte = 'med', - `Maag-,Darm-,Leverziekten` = 'med', - Mondheelkunde = 'surg', - Nefrologie = 'med', - Neurochirurgie = 'surg', - Neurologie = 'med', - Obstetrie = 'other', - `Oncologie Inwendig` = 'med', - Oogheelkunde = 'surg', - Orthopedie = 'surg', - `Plastische chirurgie` = 'surg', - Reumatologie = 'med', - Traumatologie = 'surg', - Urologie = 'surg', - Vaatchirurgie = 'surg', - Verloskunde = 'other'))"), - class = "col_itm") - ), - miiv = list( - list(table = "services", val_var = "curr_service", - callback = "apply_map( - c(MED = 'med', SURG = 'surg', CMED = 'med', CSURG = 'surg', - VSURG = 'surg', NSURG = 'surg', NB = 'other', NMED = 'med', - ORTHO = 'surg', TRAUM = 'surg', OMED = 'med', GU = 'other', - NBB = 'other', TSURG = 'surg', GYN = 'other', PSURG = 'surg', - OBS = 'other', ENT = 'surg', DENT = 'surg', PSYCH = 'other') - )", - class = "col_itm" - ) - ) - ) - ), - los_icu = list( - unit = "days", - min = 0, - target = "id_tbl", - description = "ICU length of stay", - category = "outcome", - sources = list( - mimic = list( - list(callback = "los_callback", win_type = "icustay", - class = "fun_itm") - ), - eicu = list( - list(callback = "los_callback", win_type = "icustay", - class = "fun_itm") - ), - hirid = list( - list(callback = "los_callback", win_type = "icustay", - class = "fun_itm") - ), - aumc = list( - list(callback = "los_callback", win_type = "icustay", - class = "fun_itm") - ), - miiv = list( - list(callback = "los_callback", win_type = "icustay", - class = "fun_itm") - ) - ) - ), - los_hosp = list( - unit = "days", - min = 0, - target = "id_tbl", - description = "hospital length of stay", - omopid = 462369952L, - category = "outcome", - sources = list( - mimic = list( - list(callback = "los_callback", win_type = "hadm", class = "fun_itm") - ), - eicu = list( - list(callback = "los_callback", win_type = "hadm", class = "fun_itm") - ), - miiv = list( - list(callback = "los_callback", win_type = "hadm", class = "fun_itm") - ) - ) - ), - pafi = list( - concepts = c("po2", "fio2"), - description = "Horowitz index", - omopid = 4233883L, - category = "respiratory", - aggregate = c("min", "max"), - callback = "pafi", - class = "rec_cncpt" - ), - safi = list( - concepts = c("o2sat", "fio2"), - description = "SaO2/FiO2", - category = "respiratory", - aggregate = c("min", "max"), - callback = "safi", - class = "rec_cncpt" - ), - vent_ind = list( - concepts = c("vent_start", "vent_end", "mech_vent"), - description = "ventilation durations", - omopid = 4230167L, - category = "respiratory", - interval = "00:01:00", - callback = "vent_ind", - target = "win_tbl", - class = "rec_cncpt" - ), - vaso_ind = list( - concepts = c("dopa_dur", "norepi_dur", "dobu_dur", "epi_dur"), - description = "vasopressor indicator", - omopid = 3655896L, - category = "medications", - callback = "vaso_ind", - class = "rec_cncpt" - ), - gcs = list( - concepts = c("egcs", "mgcs", "vgcs", "tgcs", "ett_gcs"), - description = "Glasgow coma scale (non-sedated)", - omopid = 4093836L, - category = "neurological", - aggregate = c("min", "min", "min", "min", "any"), - callback = "gcs", - class = "rec_cncpt" - ), - urine24 = list( - concepts = "urine", - description = "urine output per 24h", - omopid = 4191836L, - category = "output", - callback = "urine24", - class = "rec_cncpt" - ), - sofa_resp = list( - concepts = c("pafi", "vent_ind"), - description = "SOFA respiratory component", - omopid = 1616907L, - category = "outcome", - callback = "sofa_resp", - class = "rec_cncpt" - ), - sofa_coag = list( - concepts = "plt", - description = "SOFA coagulation component", - omopid = 1616896L, - category = "outcome", - aggregate = "min", - callback = "sofa_coag", - class = "rec_cncpt" - ), - sofa_liver = list( - concepts = "bili", - description = "SOFA liver component", - omopid = 1617043L, - category = "outcome", - aggregate = "max", - callback = "sofa_liver", - class = "rec_cncpt" - ), - sofa_cardio = list( - concepts = c("map", "dopa60", "norepi60", "dobu60", "epi60"), - description = "SOFA cardiovascular component", - omopid = 1617534L, - category = "outcome", - aggregate = c("min", "max", "max", "max", "max"), - callback = "sofa_cardio", - class = "rec_cncpt" - ), - sofa_cns = list( - concepts = "gcs", - description = "SOFA central nervous system component", - omopid = 1616439L, - category = "outcome", - callback = "sofa_cns", - class = "rec_cncpt" - ), - sofa_renal = list( - concepts = c("crea", "urine24"), - description = "SOFA renal component", - omopid = 1616355L, - category = "outcome", - aggregate = c("max", NA), - callback = "sofa_renal", - class = "rec_cncpt" - ), - sofa = list( - concepts = c("sofa_resp", "sofa_coag", "sofa_liver", "sofa_cardio", - "sofa_cns", "sofa_renal"), - description = "sequential organ failure assessment score", - omopid = 1616852L, - category = "outcome", - callback = "sofa_score", - class = "rec_cncpt" - ), - qsofa = list( - concepts = c("gcs", "sbp", "resp"), - description = "quick SOFA score", - omopid = 1616732L, - category = "outcome", - callback = "qsofa_score", - class = "rec_cncpt" - ), - susp_inf = list( - concepts = c("abx", "samp"), - description = "suspected infection", - omopid = 43021378L, - category = "outcome", - aggregate = lapply(list("sum", FALSE), list), - callback = "susp_inf", - class = "rec_cncpt" - ), - sep3 = list( - concepts = c("sofa", "susp_inf"), - description = "sepsis-3 criterion", - omopid = 132797L, - category = "outcome", - callback = "sep3", - keep_components = c(FALSE, TRUE), - class = "rec_cncpt" - ), - bnd = list( - unit = "%", - description = "band form neutrophils", - omopid = 4100147L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 51144L, table = "labevents", sub_var = "itemid") - ), - eicu = list( - list(ids = "-bands", table = "lab", sub_var = "labname") - ), - hirid = list( - list(ids = 24000557L, table = "observations", sub_var = "variableid", - class = "hrd_itm") - ), - aumc = list( - list(ids = c(6796L, 11586L), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 51144L, table = "labevents", sub_var = "itemid") - ) - ) - ), - sirs = list( - concepts = c("temp", "hr", "resp", "pco2", "wbc", "bnd"), - description = "systemic inflammatory response syndrome score", - omopid = 4140444L, - category = "outcome", - callback = "sirs_score", - class = "rec_cncpt" - ), - supp_o2 = list( - concepts = c("vent_ind", "fio2"), - description = "supplemental oxygen", - omopid = 36304401L, - category = "respiratory", - callback = "supp_o2", - class = "rec_cncpt" - ), - avpu = list( - concepts = "gcs", - description = "AVPU scale", - omopid = 40493498L, - category = "neurological", - callback = "avpu", - class = "rec_cncpt" - ), - news = list( - concepts = c("resp", "o2sat", "supp_o2", "temp", "sbp", "hr", "avpu"), - description = "national early warning score", - omopid = 44808550, - category = "outcome", - callback = "news_score", - class = "rec_cncpt" - ), - mews = list( - concepts = c("sbp", "hr", "resp", "temp","avpu"), - description = "modified early warning score", - omopid = 40484211L, - category = "outcome", - callback = "mews_score", - class = "rec_cncpt" - ), - hba1c = list( - unit = "%", - description = "Hemoglobin A1C", - omopid = 4184637L, - category = "hematology", - sources = list( - mimic = list( - list(ids = 50852L, table = "labevents", sub_var = "itemid") - ), - aumc = list( - list(ids = c(11812L, 16166L), table = "numericitems", - sub_var = "itemid") - ), - miiv = list( - list(ids = 50852L, table = "labevents", sub_var = "itemid") - ) - ) - ), - bmi = list( - concepts = c("weight", "height"), - description = "patient body mass index", - omopid = 4245997L, - category = "demographics", - callback = "bmi", - target = "id_tbl", - class = "rec_cncpt" - ), - adh_rate = list( - unit = c("units/min", "U/min"), - description = "vasopressin rate", - omopid = 1507835L, - category = "medications", - sources = list( - mimic = list( - list(ids = 30051L, table = "inputevents_cv", sub_var = "itemid", - grp_var = "linkorderid", callback = "combine_callbacks( - convert_unit(binary_op(`/`, 60), 'units/min', 'Uhr'), - mimic_rate_cv - )"), - list(ids = 222315L, table = "inputevents_mv", sub_var = "itemid", - stop_var = "endtime", callback = "combine_callbacks( - convert_unit(binary_op(`/`, 60), 'units/min', 'units/hour'), - mimic_rate_mv - )") - ), - eicu = list( - list(regex = "^vasopressin.*\\(.+/.+\\)$", - table = "infusiondrug", sub_var = "drugname", - callback = "eicu_rate_units(2.65, 0.53)", - class = "rgx_itm") - ), - hirid = list( - list(ids = c(112L, 113L), table = "pharma", sub_var = "pharmaid", - grp_var = "infusionid", callback = "hirid_rate") - ), - aumc = list( - list(ids = 12467L, table = "drugitems", sub_var = "itemid", - rate_uom = "doserateunit", stop_var = "stop", - callback = "aumc_rate_units(0.53)") - ), - miiv = list( - list(ids = 222315L, table = "inputevents", sub_var = "itemid", - stop_var = "endtime", callback = "combine_callbacks( - convert_unit(binary_op(`/`, 60), 'units/min', 'units/hour'), - mimic_rate_mv - )") - ) - ) - ), - phn_rate = list( - unit = "mcg/kg/min", - description = "phenylephrine rate", - omopid = 1135766L, - category = "medications", - sources = list( - mimic = list( - list(ids = 30127L, table = "inputevents_cv", sub_var = "itemid", - grp_var = "linkorderid", callback = "combine_callbacks( - mimic_kg_rate, mimic_rate_cv) - "), - list(ids = 30128L, table = "inputevents_cv", sub_var = "itemid", - grp_var = "linkorderid", callback = "mimic_rate_cv"), - list(ids = 221749L, table = "inputevents_mv", sub_var = "itemid", - stop_var = "endtime", callback = "mimic_rate_mv") - ), - eicu = list( - list(regex = "^phenylephrine.*\\(.+\\)$", table = "infusiondrug", - sub_var = "drugname", weight_var = "patientweight", - callback = "eicu_rate_kg(ml_to_mcg = 200)", class = "rgx_itm") - ), - miiv = list( - list(ids = 221749L, table = "inputevents", sub_var = "itemid", - stop_var = "endtime", callback = "mimic_rate_mv") - ) - ) - ), - norepi_equiv = list( - description = "norepinephrine equivalents", - category = "medications", - concepts = c("epi_rate", "norepi_rate", "dopa_rate", "adh_rate", - "phn_rate"), - callback = "norepi_equiv", - class = "rec_cncpt" - ), - cort = list( - class = "lgl_cncpt", - description = "corticosteroids", - omopid = 304275008L, - category = "medications", - sources = list( - hirid = list( - list(ids = c( 146L, 151L, 1000325L, 1000383L, 1000431L, - 1000432L, 1000433L, 1000434L, 1000435L, 1000486L, - 1000487L, 1000488L, 1000769L, 1000770L, 1000929L), - table = "pharma", sub_var = "pharmaid", - callback = "transform_fun(set_val(TRUE))") - ), - aumc = list( - list(ids = c(6922L, 6995L, 7106L, 8132L, 9042L, 9130L, 10628L), - table = "drugitems", sub_var = "itemid", - callback = "transform_fun(set_val(TRUE))") - ) - ) - ), - dex = list( - min = 0, - unit = "ml/hr", - description = "dextrose (as D10)", - omopid = 4197597L, - category = "medications", - target = "win_tbl", - sources = list( - mimic = list( - list(ids = c(220950L, 228140L, 220952L), table = "inputevents_mv", - sub_var = "itemid", dur_var = "endtime", amount_var = "amount", - auom_var = "amountuom", callback = "combine_callbacks( - mimv_rate, - dex_to_10(c(228140L, 220952L), c(2, 5)) - )"), - list(ids = c(30016L, 30017L), table = "inputevents_cv", - sub_var = "itemid", grp_var = "linkorderid", val_var = "amount", - unit_var = "amountuom", target = "ts_tbl", interval = "00:01:00", - callback = "combine_callbacks( - grp_mount_to_rate(mins(1L), hours(1L)), - dex_to_10(30017L, 2) - )") - ), - eicu = list( - list(regex = "(d50|dextrose.+50 ?%)", table = "medication", - sub_var = "drugname", dur_var = "drugstopoffset", - callback = "eicu_dex_med", class = "rgx_itm"), - list(regex = "(d10|dextrose.+10 ?%).+ml/hr", table = "infusiondrug", - sub_var = "drugname", callback = "eicu_dex_inf", target = "ts_tbl", - class = "rgx_itm") - ), - hirid = list( - list(ids = c(1000022L, 1000690L, 1000689L, 1000544L, 1000746L, - 1000835L, 1000060L, 1000545L, 1000567L), - table = "pharma", sub_var = "pharmaid", grp_var = "infusionid", - target = "ts_tbl", interval = "00:01:00", - callback = "combine_callbacks( - grp_mount_to_rate(mins(1L), hours(1L)), - dex_to_10(list(c(1000689L, 1000544L, 1000746L, 1000835L), - 1000060L, 1000545L, 1000567L), c(2, 3, 4, 5)) - )") - ), - aumc = list( - list(ids = c(7254L, 7255L, 7256L, 8940L, 9571L), table = "drugitems", - sub_var = "itemid", dur_var = "stop", rate_var = "doserateunit", - callback = "combine_callbacks( - aumc_rate, - dex_to_10(list(7255L, 7256L, c(8940L, 9571L)), - c(2, 3, 4)) - )" - ) - ), - miiv = list( - list(ids = c(220950L, 228140L, 220952L), table = "inputevents", - sub_var = "itemid", dur_var = "endtime", amount_var = "amount", - auom_var = "amountuom", callback = "combine_callbacks( - mimv_rate, - dex_to_10(c(228140L, 220952L), c(2, 5)) - )") - ) - ), - class = c("unt_cncpt", "num_cncpt") - ) -) - -cfg <- lapply(cfg, function(x) { - - if ("sources" %in% names(x)) { - - if ("mimic" %in% names(x[["sources"]])) - x[["sources"]] <- c(x[["sources"]], - mimic_demo = list(x[["sources"]][["mimic"]])) - - if ("eicu" %in% names(x[["sources"]])) - x[["sources"]] <- c(x[["sources"]], - eicu_demo = list(x[["sources"]][["eicu"]])) - - x[["sources"]] <- x[["sources"]][order(names(x[["sources"]]))] - } - - x -}) - - -pkg_dir <- rprojroot::find_root(rprojroot::is_r_package) -cfg_dir <- file.path(pkg_dir, "inst", "extdata", "config") - -ricu::set_config(cfg[order(names(cfg))], "concept-dict", cfg_dir) - -devtools::install(pkg_dir) diff --git a/inst/extdata/config/data-sources.R b/inst/extdata/config/data-sources.R deleted file mode 100644 index 1a578b1e..00000000 --- a/inst/extdata/config/data-sources.R +++ /dev/null @@ -1,1791 +0,0 @@ - -download_pysionet_schema <- function(url) { - - dat <- ricu:::download_pysionet_file( - url, dest = NULL, user = NULL, pass = NULL - ) - - message("downloading schema at ", url) - - xml2::as_list(xml2::read_xml(rawToChar(dat))) -} - -get_table_info <- function(url) { - - res <- download_pysionet_schema(url) - res <- res[["database"]][["tables"]] - - res <- lapply(res, function(x) { - cols <- names(x) == "column" - names <- vapply(x[cols], attr, character(1L), "name") - types <- vapply(x[cols], attr, character(1L), "type") - list( - table_name = tolower(attr(x, "name")), - num_rows = as.integer(attr(x, "numRows")), - cols = as_col_spec(names, types) - ) - }) - - unname(res) -} - -col_spec_map <- function(type) { - switch(type, - bool = list(spec = "col_logical"), - int2 = , - int4 = list(spec = "col_integer"), - int8 = , - numeric = , - float8 = list(spec = "col_double"), - bpchar = , - text = , - varchar = list(spec = "col_character"), - timestamp = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - stop("unknown type") - ) -} - -as_col_spec <- function(names, types) { - Map(c, Map(list, name = tolower(names), col = names), - lapply(types, col_spec_map)) -} - -as_tbl_spec <- function(files, defaults, time_vars, tbl_info, partitioning) { - - mod_col <- function(x) { - x[["name"]] <- x[["col"]] - x[["col"]] <- NULL - x - } - - do_as <- function(file, default, time, tbl, part) { - - all_cols <- vapply(tbl[["cols"]], `[[`, character(1L), "name") - - stopifnot(all(vapply(default, `%in%`, logical(1L), all_cols))) - - if (length(time)) { - default <- c(default, list(time_vars = unname(time))) - } - - tbl <- c(list(files = file, defaults = default), tbl) - - tbl[["table_name"]] <- NULL - tbl[["cols"]] <- setNames(lapply(tbl[["cols"]], mod_col), all_cols) - - if (!is.null(part)) { - stopifnot(isTRUE(names(part) %in% all_cols)) - tbl <- c(tbl, list(partitioning = list(col = names(part), - breaks = part[[1L]]))) - } - - tbl - } - - tbls <- vapply(tbl_info, `[[`, character(1L), "table_name") - - res <- Map(do_as, files[tbls], defaults[tbls], time_vars[tbls], tbl_info, - partitioning[tbls]) - names(res) <- tolower(tbls) - - res -} - -as_minimal_tbl_spec <- function(x) { - x[setdiff(names(x), c("files", "num_rows", "cols"))] -} - -eicu_tbl_cfg <- function(info, is_demo = FALSE) { - - files <- c("admissionDrug.csv.gz", - "admissionDx.csv.gz", - "allergy.csv.gz", - "apacheApsVar.csv.gz", - "apachePatientResult.csv.gz", - "apachePredVar.csv.gz", - "carePlanCareProvider.csv.gz", - "carePlanEOL.csv.gz", - "carePlanGeneral.csv.gz", - "carePlanGoal.csv.gz", - "carePlanInfectiousDisease.csv.gz", - "customLab.csv.gz", - "diagnosis.csv.gz", - "hospital.csv.gz", - "infusionDrug.csv.gz", - "intakeOutput.csv.gz", - "lab.csv.gz", - "medication.csv.gz", - "microLab.csv.gz", - "note.csv.gz", - "nurseAssessment.csv.gz", - "nurseCare.csv.gz", - "nurseCharting.csv.gz", - "pastHistory.csv.gz", - "patient.csv.gz", - "physicalExam.csv.gz", - "respiratoryCare.csv.gz", - "respiratoryCharting.csv.gz", - "treatment.csv.gz", - "vitalAperiodic.csv.gz", - "vitalPeriodic.csv.gz") - names(files) <- sub("\\.csv\\.gz", "", tolower(files)) - - if (is_demo) { - files <- sub("Drug\\.csv\\.gz", "drug.csv.gz", files) - } - - defaults <- list( - admissiondrug = list( - index_var = "drugoffset", - val_var = "drugdosage", - unit_var = "drugunit" - ), - admissiondx = list( - index_var = "admitdxenteredoffset", - val_var = "admitdxtext" - ), - allergy = list( - index_var = "allergyoffset", - val_var = "allergyname" - ), - apacheapsvar = list(), - apachepatientresult = list( - val_var = "apachescore" - ), - apachepredvar = list(), - careplancareprovider = list( - index_var = "careprovidersaveoffset", - val_var = "specialty" - ), - careplaneol = list( - index_var = "cpleoldiscussionoffset" - ), - careplangeneral = list( - index_var = "cplitemoffset", - val_var = "cplitemvalue" - ), - careplangoal = list( - index_var = "cplgoaloffset", - val_var = "cplgoalvalue" - ), - careplaninfectiousdisease = list( - index_var = "cplinfectdiseaseoffset", - val_var = "infectdiseasesite" - ), - customlab = list( - index_var = "labotheroffset", - val_var = "labotherresult" - ), - diagnosis = list( - index_var = "diagnosisoffset", - val_var = "icd9code" - ), - hospital = list( - id_var = "hospitalid", - val_var = "numbedscategory" - ), - infusiondrug = list( - index_var = "infusionoffset", - val_var = "drugrate" - ), - intakeoutput = list( - index_var = "intakeoutputoffset", - val_var = "cellvaluenumeric" - ), - lab = list( - index_var = "labresultoffset", - val_var = "labresult", - unit_var = "labmeasurenameinterface" - ), - medication = list( - index_var = "drugstartoffset", - val_var = "dosage" - ), - microlab = list( - index_var = "culturetakenoffset", - val_var = "organism" - ), - note = list( - index_var = "noteoffset", - val_var = "notetext" - ), - nurseassessment = list( - index_var = "nurseassessoffset", - val_var = "cellattributevalue" - ), - nursecare = list( - index_var = "nursecareoffset", - val_var = "cellattributevalue" - ), - nursecharting = list( - index_var = "nursingchartoffset", - val_var = "nursingchartvalue" - ), - pasthistory = list( - index_var = "pasthistoryoffset", - val_var = "pasthistoryvalue" - ), - patient = list( - val_var = "unitdischargestatus" - ), - physicalexam = list( - index_var = "physicalexamoffset", - val_var = "physicalexamvalue" - ), - respiratorycare = list( - index_var = "respcarestatusoffset" - ), - respiratorycharting = list( - index_var = "respchartoffset", - val_var = "respchartvalue" - ), - treatment = list( - index_var = "treatmentoffset", - val_var = "treatmentstring" - ), - vitalaperiodic = list( - index_var = "observationoffset" - ), - vitalperiodic = list( - index_var = "observationoffset" - ) - ) - - part <- list( - nursecharting = list( - patientunitstayid = `if`(is_demo, - 1775421L, - c(514528L, 1037072L, 1453997L, 1775421L, 2499831L, 2937948L, 3213286L) - ) - ), - vitalperiodic = list( - patientunitstayid = `if`(is_demo, - 1775421L, - c(514528L, 1037072L, 1453997L, 1775421L, 2499831L, 2937948L, 3213286L) - ) - ) - ) - - if (is_demo) { - - info <- lapply(info, `[[<-`, "num_rows", NULL) - - } else { - - tbl <- vapply(info, `[[`, character(1L), "table_name") == "respiratorycare" - new <- info[[which(tbl)]][["cols"]] - col <- vapply(new, `[[`, character(1L), "col") == "apneaparams" - - new[[which(col)]][["col"]] <- "apneaparms" - info[[which(tbl)]][["cols"]] <- new - } - - time_vars <- lapply(info, function(x) { - nme <- vapply(x[["cols"]], `[[`, character(1L), "name") - typ <- vapply(x[["cols"]], `[[`, character(1L), "spec") - nme[typ == "col_integer" & grepl("offset$", nme)] - }) - - names(time_vars) <- vapply(info, `[[`, character(1L), "table_name") - - as_tbl_spec(files, defaults, time_vars, info, part) -} - -mimic_tbl_cfg <- function(info, is_demo = FALSE) { - - find_entry <- function(x, what, name) { - which(vapply(x, `[[`, character(1L), what) == name) - } - - files <- c("ADMISSIONS.csv.gz", - "CALLOUT.csv.gz", - "CAREGIVERS.csv.gz", - "CHARTEVENTS.csv.gz", - "CPTEVENTS.csv.gz", - "DATETIMEEVENTS.csv.gz", - "DIAGNOSES_ICD.csv.gz", - "DRGCODES.csv.gz", - "D_CPT.csv.gz", - "D_ICD_DIAGNOSES.csv.gz", - "D_ICD_PROCEDURES.csv.gz", - "D_ITEMS.csv.gz", - "D_LABITEMS.csv.gz", - "ICUSTAYS.csv.gz", - "INPUTEVENTS_CV.csv.gz", - "INPUTEVENTS_MV.csv.gz", - "LABEVENTS.csv.gz", - "MICROBIOLOGYEVENTS.csv.gz", - "NOTEEVENTS.csv.gz", - "OUTPUTEVENTS.csv.gz", - "PATIENTS.csv.gz", - "PRESCRIPTIONS.csv.gz", - "PROCEDUREEVENTS_MV.csv.gz", - "PROCEDURES_ICD.csv.gz", - "SERVICES.csv.gz", - "TRANSFERS.csv.gz") - names(files) <- sub("\\.csv\\.gz", "", tolower(files)) - - if (is_demo) { - files <- sub("\\.gz$", "", files) - } - - defaults <- list( - admissions = list( - val_var = "admission_type" - ), - callout = list( - index_var = "outcometime", - val_var = "callout_outcome" - ), - caregivers = list( - id_var = "cgid", - val_var = "label" - ), - chartevents = list( - index_var = "charttime", - val_var = "valuenum", - unit_var = "valueuom" - ), - cptevents = list( - index_var = "chartdate", - val_var = "cpt_cd" - ), - d_cpt = list( - id_var = "subsectionrange", - val_var = "subsectionheader" - ), - d_icd_diagnoses = list( - id_var = "icd9_code", - val_var = "short_title" - ), - d_icd_procedures = list( - id_var = "icd9_code", - val_var = "short_title" - ), - d_items = list( - id_var = "itemid", - val_var = "label" - ), - d_labitems = list( - id_var = "itemid", - val_var = "label" - ), - datetimeevents = list( - index_var = "charttime", - val_var = "itemid" - ), - diagnoses_icd = list( - val_var = "icd9_code" - ), - drgcodes = list( - val_var = "drg_code" - ), - icustays = list( - index_var = "intime", - val_var = "last_careunit" - ), - inputevents_cv = list( - index_var = "charttime", - val_var = "rate", - unit_var = "rateuom" - ), - inputevents_mv = list( - index_var = "starttime", - val_var = "rate", - unit_var = "rateuom" - ), - labevents = list( - index_var = "charttime", - val_var = "valuenum", - unit_var = "valueuom" - ), - microbiologyevents = list( - index_var = "chartdate", - val_var = "isolate_num" - ), - noteevents = list( - index_var = "chartdate", - val_var = "text" - ), - outputevents = list( - index_var = "charttime", - val_var = "value", - unit_var = "valueuom" - ), - patients = list( - val_var = "expire_flag" - ), - prescriptions = list( - index_var = "startdate", - val_var = "dose_val_rx", - unit_var = "dose_unit_rx" - ), - procedureevents_mv = list( - index_var = "starttime", - val_var = "value", - unit_var = "valueuom" - ), - procedures_icd = list( - val_var = "icd9_code" - ), - services = list( - index_var = "transfertime", - val_var = "curr_service" - ), - transfers = list( - index_var = "intime", - val_var = "curr_careunit" - ) - ) - - part <- list( - chartevents = list( - itemid = `if`(is_demo, - 100000L, - c( 127L, 210L, 425L, 549L, 643L, 741L, 1483L, - 3458L, 3695L, 8440L, 8553L, 220274L, 223921L, 224085L, - 224859L, 227629L - ) - ) - ) - ) - - info <- info[ - !grepl("^chartevents_", vapply(info, `[[`, character(1L), "table_name")) - ] - - if (is_demo) { - - info <- lapply(info, `[[<-`, "num_rows", NULL) - - info <- info[ - vapply(info, `[[`, character(1L), "table_name") != "noteevents" - ] - - } else { - - info <- lapply(info, function(x) { - x[["cols"]] <- Map(`[[<-`, x[["cols"]], "col", - toupper(vapply(x[["cols"]], `[[`, character(1L), "col")) - ) - x - }) - - icd_diag <- find_entry(info, "table_name", "d_icd_diagnoses") - info[[icd_diag]]$num_rows <- 14567L - - icd_proc <- find_entry(info, "table_name", "d_icd_procedures") - info[[icd_proc]]$num_rows <- 3882L - - note <- find_entry(info, "table_name", "noteevents") - date <- find_entry(info[[note]]$cols, "name", "chartdate") - info[[note]]$cols[[date]]$format <- "%Y-%m-%d" - } - - time_vars <- lapply(info, function(x) { - nme <- vapply(x[["cols"]], `[[`, character(1L), "name") - typ <- vapply(x[["cols"]], `[[`, character(1L), "spec") - nme[typ == "col_datetime"] - }) - - names(time_vars) <- vapply(info, `[[`, character(1L), "table_name") - - as_tbl_spec(files, defaults, time_vars, info, part) -} - -hirid_tbl_cfg <- function() { - - info <- list( - general = list( - patientid = list(spec = "col_integer"), - admissiontime = list(spec = "col_datetime", - format = "%Y-%m-%d %H:%M:%S"), - sex = list(spec = "col_character"), - age = list(spec = "col_integer"), - discharge_status = list(spec = "col_character") - ), - observations = list( - patientid = list(spec = "col_integer"), - datetime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - entertime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - status = list(spec = "col_integer"), - stringvalue = list(spec = "col_character"), - type = list(spec = "col_character"), - value = list(spec = "col_double"), - variableid = list(spec = "col_integer") - ), - ordinal = list( - variableid = list(spec = "col_integer"), - code = list(spec = "col_integer"), - stringvalue = list(spec = "col_character") - ), - pharma = list( - patientid = list(spec = "col_integer"), - pharmaid = list(spec = "col_integer"), - givenat = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - enteredentryat = list(spec = "col_datetime", - format = "%Y-%m-%d %H:%M:%S"), - givendose = list(spec = "col_double"), - cumulativedose = list(spec = "col_double"), - fluidamount_calc = list(spec = "col_double"), - cumulfluidamount_calc = list(spec = "col_double"), - doseunit = list(spec = "col_character"), - route = list(spec = "col_character"), - infusionid = list(spec = "col_integer"), - typeid = list(spec = "col_integer"), - subtypeid = list(spec = "col_double"), - recordstatus = list(spec = "col_integer") - ), - variables = list( - `Source Table` = list(spec = "col_character"), - ID = list(spec = "col_integer"), - `Variable Name` = list(spec = "col_character"), - Unit = list(spec = "col_character"), - `Additional information` = list(spec = "col_character") - ) - ) - - files <- list( - general = "general_table.csv", - observations = file.path( - "observation_tables", "csv", paste0("part-", 0L:249L, ".csv") - ), - ordinal = "ordinal_vars_ref.csv", - pharma = file.path( - "pharma_records", "csv", paste0("part-", 0L:249L, ".csv") - ), - variables = "hirid_variable_reference.csv" - ) - - defaults <- list( - general = list( - index_var = "admissiontime" - ), - observations = list( - index_var = "datetime", - val_var = "value" - ), - ordinal = list( - id_var = "variableid" - ), - pharma = list( - index_var = "givenat", - val_var = "givendose", - unit_var = "doseunit" - ), - variables = list( - id_var = "id" - ) - ) - - n_row <- list( - general = 33905L, - variables = 712L, - ordinal = 72L, - pharma = 16270399L, - observations = 776921131L - ) - - zip_files <- list( - general = "reference_data.tar.gz", - variables = "reference_data.tar.gz", - ordinal = "reference_data.tar.gz", - pharma = "raw_stage/pharma_records_csv.tar.gz", - observations = "raw_stage/observation_tables_csv.tar.gz" - ) - - part <- list( - observations = list(variableid = c( - 110L, 120L, 200L, 210L, 211L, 300L, 620L, - 2010L, 2610L, 3110L, 4000L, 5685L, 15001565L, 30005075L) - ), - pharma = list(pharmaid = 431L) - ) - - info <- lapply(info, function(x) { - Map(c, Map(list, name = sub(" ", "_", tolower(names(x))), - col = names(x)), x) - }) - - info <- Map(list, table_name = names(info), cols = info, - num_rows = n_row[names(info)], - zip_file = zip_files[names(info)]) - - time_vars <- lapply(info, function(x) { - nme <- vapply(x[["cols"]], `[[`, character(1L), "name") - typ <- vapply(x[["cols"]], `[[`, character(1L), "spec") - nme[typ == "col_datetime"] - }) - - names(time_vars) <- vapply(info, `[[`, character(1L), "table_name") - - as_tbl_spec(files, defaults, time_vars, info, part) -} - -aumc_tbl_cfg <- function() { - - info <- list( - admissions = list( - patientid = list(spec = "col_integer"), - admissionid = list(spec = "col_integer"), - admissioncount = list(spec = "col_integer"), - location = list(spec = "col_character"), - urgency = list(spec = "col_logical"), - origin = list(spec = "col_character"), - admittedat = list(spec = "col_double"), - admissionyeargroup = list(spec = "col_character"), - dischargedat = list(spec = "col_double"), - lengthofstay = list(spec = "col_integer"), - destination = list(spec = "col_character"), - gender = list(spec = "col_character"), - agegroup = list(spec = "col_character"), - dateofdeath = list(spec = "col_double"), - weightgroup = list(spec = "col_character"), - weightsource = list(spec = "col_character"), - specialty = list(spec = "col_character") - ), - drugitems = list( - admissionid = list(spec = "col_integer"), - orderid = list(spec = "col_integer"), - ordercategoryid = list(spec = "col_integer"), - ordercategory = list(spec = "col_character"), - itemid = list(spec = "col_integer"), - item = list(spec = "col_character"), - isadditive = list(spec = "col_logical"), - isconditional = list(spec = "col_logical"), - rate = list(spec = "col_double"), - rateunit = list(spec = "col_character"), - rateunitid = list(spec = "col_integer"), - ratetimeunitid = list(spec = "col_integer"), - doserateperkg = list(spec = "col_logical"), - dose = list(spec = "col_double"), - doseunit = list(spec = "col_character"), - doserateunit = list(spec = "col_character"), - doseunitid = list(spec = "col_integer"), - doserateunitid = list(spec = "col_integer"), - administered = list(spec = "col_double"), - administeredunit = list(spec = "col_character"), - administeredunitid = list(spec = "col_integer"), - action = list(spec = "col_character"), - start = list(spec = "col_double"), - stop = list(spec = "col_double"), - duration = list(spec = "col_integer"), - solutionitemid = list(spec = "col_integer"), - solutionitem = list(spec = "col_character"), - solutionadministered = list(spec = "col_double"), - solutionadministeredunit = list(spec = "col_character"), - fluidin = list(spec = "col_double"), - iscontinuous = list(spec = "col_logical") - ), - freetextitems = list( - admissionid = list(spec = "col_integer"), - itemid = list(spec = "col_integer"), - item = list(spec = "col_character"), - value = list(spec = "col_character"), - comment = list(spec = "col_character"), - measuredat = list(spec = "col_double"), - registeredat = list(spec = "col_double"), - registeredby = list(spec = "col_character"), - updatedat = list(spec = "col_double"), - updatedby = list(spec = "col_character"), - islabresult = list(spec = "col_logical") - ), - listitems = list( - admissionid = list(spec = "col_integer"), - itemid = list(spec = "col_integer"), - item = list(spec = "col_character"), - valueid = list(spec = "col_integer"), - value = list(spec = "col_character"), - measuredat = list(spec = "col_double"), - registeredat = list(spec = "col_double"), - registeredby = list(spec = "col_character"), - updatedat = list(spec = "col_double"), - updatedby = list(spec = "col_character"), - islabresult = list(spec = "col_logical") - ), - numericitems = list( - admissionid = list(spec = "col_integer"), - itemid = list(spec = "col_integer"), - item = list(spec = "col_character"), - tag = list(spec = "col_character"), - value = list(spec = "col_double"), - unitid = list(spec = "col_integer"), - unit = list(spec = "col_character"), - comment = list(spec = "col_character"), - measuredat = list(spec = "col_double"), - registeredat = list(spec = "col_double"), - registeredby = list(spec = "col_character"), - updatedat = list(spec = "col_double"), - updatedby = list(spec = "col_character"), - islabresult = list(spec = "col_logical"), - fluidout = list(spec = "col_double") - ), - procedureorderitems = list( - admissionid = list(spec = "col_integer"), - orderid = list(spec = "col_integer"), - ordercategoryid = list(spec = "col_integer"), - ordercategoryname = list(spec = "col_character"), - itemid = list(spec = "col_integer"), - item = list(spec = "col_character"), - registeredat = list(spec = "col_double"), - registeredby = list(spec = "col_character") - ), - processitems = list( - admissionid = list(spec = "col_integer"), - itemid = list(spec = "col_integer"), - item = list(spec = "col_character"), - start = list(spec = "col_double"), - stop = list(spec = "col_double"), - duration = list(spec = "col_integer") - ) - ) - - tables <- names(info) - - cols <- lapply(info, function(tbl) { - Map(function(name, spec) c(list(name = name), spec), names(tbl), tbl) - }) - - defaults <- list( - admissions = list( - index_var = "admittedat", - time_vars = c("admittedat", "dischargedat", "dateofdeath") - ), - drugitems = list( - index_var = "start", - val_var = "dose", - unit_var = "doseunit", - time_vars = c("start", "stop") - ), - freetextitems = list( - index_var = "measuredat", - id_var = "value", - time_vars = c("measuredat", "registeredat", "updatedat") - ), - listitems = list( - index_var = "measuredat", - val_var = "value", - time_vars = c("measuredat", "registeredat", "updatedat") - ), - numericitems = list( - index_var = "measuredat", - val_var = "value", - unit_var = "unit", - time_vars = c("measuredat", "registeredat", "updatedat") - ), - procedureorderitems = list( - index_var = "registeredat", - val_var = "item", - time_vars = "registeredat" - ), - processitems = list( - index_var = "start", - val_var = "item", - time_vars = c("start", "stop") - ) - ) - - n_row <- list( - admissions = 23106L, - drugitems = 4907269L, - freetextitems = 651248L, - listitems = 30744065L, - numericitems = 977625612L, - procedureorderitems = 2188626L, - processitems = 256715L - ) - - part <- list( - listitems = list(col = "itemid", breaks = 12290L), - numericitems = list(col = "itemid", breaks = c( - 6641L, 6642L, 6643L, 6664L, 6666L, 6667L, 6669L, 6672L, 6673L, - 6675L, 6707L, 6709L, 8874L, 12270L, 12275L, 12278L, 12281L, 12286L, - 12303L, 12561L, 12576L, 12804L, 14841L) - ) - ) - - tables <- Map(list, files = setNames(paste0(tables, ".csv"), tables), - defaults = defaults[tables], num_rows = n_row[tables], - cols = cols[tables]) - - tables[names(part)] <- Map(`[[<-`, tables[names(part)], "partitioning", part) - - tables -} - -miiv_tbl_cfg <- function() { - - info <- list( - admissions = list( - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - admittime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - dischtime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - deathtime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - admission_type = list(spec = "col_character"), - admission_location = list(spec = "col_character"), - discharge_location = list(spec = "col_character"), - insurance = list(spec = "col_character"), - language = list(spec = "col_character"), - marital_status = list(spec = "col_character"), - ethnicity = list(spec = "col_character"), - edregtime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - edouttime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - hospital_expire_flag = list(spec = "col_integer") - ), - patients = list( - subject_id = list(spec = "col_integer"), - gender = list(spec = "col_character"), - anchor_age = list(spec = "col_integer"), - anchor_year = list(spec = "col_integer"), - anchor_year_group = list(spec = "col_character"), - dod = list(spec = "col_datetime", format = "%Y-%m-%d") - ), - transfers = list( - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - transfer_id = list(spec = "col_integer"), - eventtype = list(spec = "col_character"), - careunit = list(spec = "col_character"), - intime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - outtime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S") - ), - d_hcpcs = list( - code = list(spec = "col_character"), - category = list(spec = "col_integer"), - long_description = list(spec = "col_character"), - short_description = list(spec = "col_character") - ), - diagnoses_icd = list( - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - seq_num = list(spec = "col_integer"), - icd_code = list(spec = "col_character"), - icd_version = list(spec = "col_integer") - ), - d_icd_diagnoses = list( - icd_code = list(spec = "col_character"), - icd_version = list(spec = "col_integer"), - long_title = list(spec = "col_character") - ), - d_icd_procedures = list( - icd_code = list(spec = "col_character"), - icd_version = list(spec = "col_integer"), - long_title = list(spec = "col_character") - ), - d_labitems = list( - itemid = list(spec = "col_integer"), - label = list(spec = "col_character"), - fluid = list(spec = "col_character"), - category = list(spec = "col_character"), - loinc_code = list(spec = "col_character") - ), - drgcodes = list( - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - drg_type = list(spec = "col_character"), - drg_code = list(spec = "col_character"), - description = list(spec = "col_character"), - drg_severity = list(spec = "col_integer"), - drg_mortality = list(spec = "col_integer") - ), - emar_detail = list( - subject_id = list(spec = "col_integer"), - emar_id = list(spec = "col_character"), - emar_seq = list(spec = "col_integer"), - parent_field_ordinal = list(spec = "col_double"), - administration_type = list(spec = "col_character"), - pharmacy_id = list(spec = "col_integer"), - barcode_type = list(spec = "col_character"), - reason_for_no_barcode = list(spec = "col_character"), - complete_dose_not_given = list(spec = "col_character"), - dose_due = list(spec = "col_character"), - dose_due_unit = list(spec = "col_character"), - dose_given = list(spec = "col_character"), - dose_given_unit = list(spec = "col_character"), - will_remainder_of_dose_be_given = list(spec = "col_character"), - product_amount_given = list(spec = "col_character"), - product_unit = list(spec = "col_character"), - product_code = list(spec = "col_character"), - product_description = list(spec = "col_character"), - product_description_other = list(spec = "col_character"), - prior_infusion_rate = list(spec = "col_character"), - infusion_rate = list(spec = "col_character"), - infusion_rate_adjustment = list(spec = "col_character"), - infusion_rate_adjustment_amount = list(spec = "col_character"), - infusion_rate_unit = list(spec = "col_character"), - route = list(spec = "col_character"), - infusion_complete = list(spec = "col_character"), - completion_interval = list(spec = "col_character"), - new_iv_bag_hung = list(spec = "col_character"), - continued_infusion_in_other_location = list(spec = "col_character"), - restart_interval = list(spec = "col_character"), - side = list(spec = "col_character"), - site = list(spec = "col_character"), - non_formulary_visual_verification = list(spec = "col_character") - ), - emar = list( - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - emar_id = list(spec = "col_character"), - emar_seq = list(spec = "col_integer"), - poe_id = list(spec = "col_character"), - pharmacy_id = list(spec = "col_integer"), - charttime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - medication = list(spec = "col_character"), - event_txt = list(spec = "col_character"), - scheduletime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - storetime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S") - ), - hcpcsevents = list( - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - chartdate = list(spec = "col_datetime", format = "%Y-%m-%d"), - hcpcs_cd = list(spec = "col_character"), - seq_num = list(spec = "col_integer"), - short_description = list(spec = "col_character") - ), - labevents = list( - labevent_id = list(spec = "col_integer"), - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - specimen_id = list(spec = "col_integer"), - itemid = list(spec = "col_integer"), - charttime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - storetime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - value = list(spec = "col_character"), - valuenum = list(spec = "col_double"), - valueuom = list(spec = "col_character"), - ref_range_lower = list(spec = "col_double"), - ref_range_upper = list(spec = "col_double"), - flag = list(spec = "col_character"), - priority = list(spec = "col_character"), - comments = list(spec = "col_character") - ), - microbiologyevents = list( - microevent_id = list(spec = "col_integer"), - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - micro_specimen_id = list(spec = "col_integer"), - chartdate = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - charttime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - spec_itemid = list(spec = "col_integer"), - spec_type_desc = list(spec = "col_character"), - test_seq = list(spec = "col_integer"), - storedate = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - storetime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - test_itemid = list(spec = "col_integer"), - test_name = list(spec = "col_character"), - org_itemid = list(spec = "col_integer"), - org_name = list(spec = "col_character"), - isolate_num = list(spec = "col_integer"), - quantity = list(spec = "col_character"), - ab_itemid = list(spec = "col_integer"), - ab_name = list(spec = "col_character"), - dilution_text = list(spec = "col_character"), - dilution_comparison = list(spec = "col_character"), - dilution_value = list(spec = "col_double"), - interpretation = list(spec = "col_character"), - comments = list(spec = "col_character") - ), - pharmacy = list( - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - pharmacy_id = list(spec = "col_integer"), - poe_id = list(spec = "col_character"), - starttime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - stoptime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - medication = list(spec = "col_character"), - proc_type = list(spec = "col_character"), - status = list(spec = "col_character"), - entertime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - verifiedtime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - route = list(spec = "col_character"), - frequency = list(spec = "col_character"), - disp_sched = list(spec = "col_character"), - infusion_type = list(spec = "col_character"), - sliding_scale = list(spec = "col_character"), - lockout_interval = list(spec = "col_character"), - basal_rate = list(spec = "col_double"), - one_hr_max = list(spec = "col_character"), - doses_per_24_hrs = list(spec = "col_double"), - duration = list(spec = "col_double"), - duration_interval = list(spec = "col_character"), - expiration_value = list(spec = "col_integer"), - expiration_unit = list(spec = "col_character"), - expirationdate = list(spec = "col_datetime", - format = "%Y-%m-%d %H:%M:%S"), - dispensation = list(spec = "col_character"), - fill_quantity = list(spec = "col_character") - ), - poe_detail = list( - poe_id = list(spec = "col_character"), - poe_seq = list(spec = "col_integer"), - subject_id = list(spec = "col_integer"), - field_name = list(spec = "col_character"), - field_value = list(spec = "col_character") - ), - poe = list( - poe_id = list(spec = "col_character"), - poe_seq = list(spec = "col_integer"), - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - ordertime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - order_type = list(spec = "col_character"), - order_subtype = list(spec = "col_character"), - transaction_type = list(spec = "col_character"), - discontinue_of_poe_id = list(spec = "col_character"), - discontinued_by_poe_id = list(spec = "col_character"), - order_status = list(spec = "col_character") - ), - prescriptions = list( - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - pharmacy_id = list(spec = "col_integer"), - starttime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - stoptime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - drug_type = list(spec = "col_character"), - drug = list(spec = "col_character"), - gsn = list(spec = "col_character"), - ndc = list(spec = "col_character"), - prod_strength = list(spec = "col_character"), - form_rx = list(spec = "col_character"), - dose_val_rx = list(spec = "col_character"), - dose_unit_rx = list(spec = "col_character"), - form_val_disp = list(spec = "col_character"), - form_unit_disp = list(spec = "col_character"), - doses_per_24_hrs = list(spec = "col_double"), - route = list(spec = "col_character") - ), - procedures_icd = list( - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - seq_num = list(spec = "col_integer"), - chartdate = list(spec = "col_datetime", format = "%Y-%m-%d"), - icd_code = list(spec = "col_character"), - icd_version = list(spec = "col_integer") - ), - services = list( - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - transfertime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - prev_service = list(spec = "col_character"), - curr_service = list(spec = "col_character") - ), - chartevents = list( - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - stay_id = list(spec = "col_integer"), - charttime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - storetime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - itemid = list(spec = "col_integer"), - value = list(spec = "col_character"), - valuenum = list(spec = "col_double"), - valueuom = list(spec = "col_character"), - warning = list(spec = "col_integer") - ), - datetimeevents = list( - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - stay_id = list(spec = "col_integer"), - charttime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - storetime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - itemid = list(spec = "col_integer"), - value = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - valueuom = list(spec = "col_character"), - warning = list(spec = "col_integer") - ), - d_items = list( - itemid = list(spec = "col_integer"), - label = list(spec = "col_character"), - abbreviation = list(spec = "col_character"), - linksto = list(spec = "col_character"), - category = list(spec = "col_character"), - unitname = list(spec = "col_character"), - param_type = list(spec = "col_character"), - lownormalvalue = list(spec = "col_double"), - highnormalvalue = list(spec = "col_double") - ), - icustays = list( - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - stay_id = list(spec = "col_integer"), - first_careunit = list(spec = "col_character"), - last_careunit = list(spec = "col_character"), - intime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - outtime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - los = list(spec = "col_double") - ), - inputevents = list( - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - stay_id = list(spec = "col_integer"), - starttime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - endtime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - storetime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - itemid = list(spec = "col_integer"), - amount = list(spec = "col_double"), - amountuom = list(spec = "col_character"), - rate = list(spec = "col_double"), - rateuom = list(spec = "col_character"), - orderid = list(spec = "col_integer"), - linkorderid = list(spec = "col_integer"), - ordercategoryname = list(spec = "col_character"), - secondaryordercategoryname = list(spec = "col_character"), - ordercomponenttypedescription = list(spec = "col_character"), - ordercategorydescription = list(spec = "col_character"), - patientweight = list(spec = "col_double"), - totalamount = list(spec = "col_double"), - totalamountuom = list(spec = "col_character"), - isopenbag = list(spec = "col_integer"), - continueinnextdept = list(spec = "col_integer"), - cancelreason = list(spec = "col_integer"), - statusdescription = list(spec = "col_character"), - originalamount = list(spec = "col_double"), - originalrate = list(spec = "col_double") - ), - outputevents = list( - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - stay_id = list(spec = "col_integer"), - charttime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - storetime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - itemid = list(spec = "col_integer"), - value = list(spec = "col_double"), - valueuom = list(spec = "col_character") - ), - procedureevents = list( - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - stay_id = list(spec = "col_integer"), - starttime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - endtime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - storetime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - itemid = list(spec = "col_integer"), - value = list(spec = "col_double"), - valueuom = list(spec = "col_character"), - location = list(spec = "col_character"), - locationcategory = list(spec = "col_character"), - orderid = list(spec = "col_integer"), - linkorderid = list(spec = "col_integer"), - ordercategoryname = list(spec = "col_character"), - secondaryordercategoryname = list(spec = "col_character"), - ordercategorydescription = list(spec = "col_character"), - patientweight = list(spec = "col_double"), - totalamount = list(spec = "col_double"), - totalamountuom = list(spec = "col_character"), - isopenbag = list(spec = "col_integer"), - continueinnextdept = list(spec = "col_integer"), - cancelreason = list(spec = "col_integer"), - statusdescription = list(spec = "col_character"), - comments_date = list(spec = "col_datetime", - format = "%Y-%m-%d %H:%M:%S"), - originalamount = list(spec = "col_double"), - originalrate = list(spec = "col_double") - ), - omr = list( - subject_id = list(spec = "col_integer"), - chartdate = list(spec = "col_datetime", format = "%Y-%m-%d"), - seq_num = list(spec = "col_integer"), - result_name = list(spec = "col_character"), - result_value = list(spec = "col_character") - ), - caregiver = list( - caregiver_id = list(spec = "col_integer") - ), - provider = list( - provider_id = list(spec = "col_character") - ), - ingredientevents = list( - subject_id = list(spec = "col_integer"), - hadm_id = list(spec = "col_integer"), - stay_id = list(spec = "col_integer"), - starttime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - endtime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - storetime = list(spec = "col_datetime", format = "%Y-%m-%d %H:%M:%S"), - itemid = list(spec = "col_integer"), - amount = list(spec = "col_double"), - amountuom = list(spec = "col_character"), - rate = list(spec = "col_double"), - rateuom = list(spec = "col_character"), - orderid = list(spec = "col_integer"), - linkorderid = list(spec = "col_integer"), - statusdescription = list(spec = "col_character"), - originalamount = list(spec = "col_double"), - originalrate = list(spec = "col_double") - ) - ) - - tables <- names(info) - - cols <- lapply(info, function(tbl) { - Map(function(name, spec) c(list(name = name), spec), names(tbl), tbl) - }) - - defaults <- list( - admissions = list( - val_var = "admission_type" - ), - d_hcpcs = list( - id_var = "code", - val_var = "short_description" - ), - d_icd_diagnoses = list( - id_var = "icd_code", - val_var = "long_title" - ), - d_icd_procedures = list( - id_var = "icd_code", - val_var = "long_title" - ), - d_labitems = list( - id_var = "itemid", - val_var = "label" - ), - diagnoses_icd = list( - val_var = "icd_code" - ), - drgcodes = list( - val_var = "drg_code" - ), - emar_detail = list( - id_var = "emar_id" - ), - emar = list( - index_var = "charttime" - ), - hcpcsevents = list( - index_var = "chartdate" - ), - labevents = list( - index_var = "charttime", - val_var = "valuenum", - unit_var = "valueuom" - ), - microbiologyevents = list( - index_var = "chartdate", - val_var = "isolate_num" - ), - pharmacy = list( - id_var = "pharmacy_id", - index_var = "starttime", - val_var = "duration", - unit_var = "duration_interval" - ), - poe_detail = list( - id_var = "poe_id" - ), - poe = list( - index_var = "ordertime" - ), - prescriptions = list( - index_var = "starttime", - val_var = "dose_val_rx", - unit_var = "dose_unit_rx" - ), - procedures_icd = list( - index_var = "chartdate", - val_var = "icd_code" - ), - services = list( - index_var = "transfertime", - val_var = "curr_service" - ), - chartevents = list( - index_var = "charttime", - val_var = "valuenum", - unit_var = "valueuom" - ), - d_items = list( - id_var = "itemid", - val_var = "label" - ), - datetimeevents = list( - index_var = "charttime", - val_var = "itemid" - ), - icustays = list( - index_var = "intime", - val_var = "last_careunit" - ), - inputevents = list( - index_var = "starttime", - val_var = "rate", - unit_var = "rateuom" - ), - outputevents = list( - index_var = "charttime", - val_var = "value", - unit_var = "valueuom" - ), - procedureevents = list( - index_var = "starttime", - val_var = "value", - unit_var = "valueuom" - ), - omr = list( - index_var = "chartdate", - val_var = "result_value" - ), - caregiver = list(), - provider = list(), - ingredientevents = list( - index_var = "starttime", - val_var = "rate", - unit_var = "rateuom" - ) - ) - - defaults <- Map(function(cl, df) { - nme <- vapply(cl, `[[`, character(1L), "name") - typ <- vapply(cl, `[[`, character(1L), "spec") - tim <- nme[typ == "col_datetime"] - if (length(tim)) c(df, list(time_vars = tim)) else df - }, cols[tables], defaults[tables]) - - n_row <- c( - admissions = 431231L, - patients = 299712L, - transfers = 1890972L, - d_hcpcs = 89200L, - d_icd_diagnoses = 109775L, - d_icd_procedures = 85257L, - d_labitems = 1622L, - diagnoses_icd = 4756326L, - drgcodes = 604377L, - emar_detail = 54744789L, - emar = 26850359L, - hcpcsevents = 150771L, - labevents = 118171367L, - microbiologyevents = 3228713L, - pharmacy = 13584514L, - poe_detail = 3879418L, - poe = 39366291L, - prescriptions = 15416708L, - procedures_icd = 669186L, - services = 468029L, - chartevents = 313645063L, - d_items = 4014L, - datetimeevents = 7112999L, - icustays = 73181L, - inputevents = 8978893L, - outputevents = 4234967L, - procedureevents = 696092L, - omr = 6439169L, - caregiver = 15468L, - provider = 40508L, - ingredientevents = 11627821L - ) - - files <- c( - admissions = "hosp/admissions.csv.gz", - patients = "hosp/patients.csv.gz", - transfers = "hosp/transfers.csv.gz", - d_hcpcs = "hosp/d_hcpcs.csv.gz", - d_icd_diagnoses = "hosp/d_icd_diagnoses.csv.gz", - d_icd_procedures = "hosp/d_icd_procedures.csv.gz", - d_labitems = "hosp/d_labitems.csv.gz", - diagnoses_icd = "hosp/diagnoses_icd.csv.gz", - drgcodes = "hosp/drgcodes.csv.gz", - emar_detail = "hosp/emar_detail.csv.gz", - emar = "hosp/emar.csv.gz", - hcpcsevents = "hosp/hcpcsevents.csv.gz", - labevents = "hosp/labevents.csv.gz", - microbiologyevents = "hosp/microbiologyevents.csv.gz", - pharmacy = "hosp/pharmacy.csv.gz", - poe_detail = "hosp/poe_detail.csv.gz", - poe = "hosp/poe.csv.gz", - prescriptions = "hosp/prescriptions.csv.gz", - procedures_icd = "hosp/procedures_icd.csv.gz", - services = "hosp/services.csv.gz", - chartevents = "icu/chartevents.csv.gz", - d_items = "icu/d_items.csv.gz", - datetimeevents = "icu/datetimeevents.csv.gz", - icustays = "icu/icustays.csv.gz", - inputevents = "icu/inputevents.csv.gz", - outputevents = "icu/outputevents.csv.gz", - procedureevents = "icu/procedureevents.csv.gz", - omr = "hosp/omr.csv.gz", - caregiver = "hosp/caregiver.csv.gz", - provider = "hosp/provider.csv.gz", - ingredientevents = "icu/ingredientevents.csv.gz" - ) - - part <- list( - labevents = list( - col = "itemid", - breaks = c( - 50868L, 50902L, 50943L, 50983L, 51146L, 51248L, 51256L, 51279L, - 51491L - ) - ), - chartevents = list( - col = "itemid", - breaks = c( - 220048L, 220059L, 220181L, 220228L, 220615L, 223782L, 223835L, - 223905L, 223962L, 223990L, 224015L, 224055L, 224082L, 224093L, - 224328L, 224650L, 224701L, 224850L, 225072L, 226104L, 227240L, - 227467L, 227950L, 227960L, 228004L, 228397L, 228594L, 228924L, - 229124L - ) - ), - poe = list( - col = "subject_id", - breaks = c(12017899L, 13999829L, 15979442L, 17994364L) - ) - ) - - tables <- Map(list, files = files[tables], - defaults = defaults[tables], num_rows = n_row[tables], - cols = cols[tables]) - - tables[names(part)] <- Map(`[[<-`, tables[names(part)], "partitioning", part) - - tables -} - -sic_tbl_cfg <- function() { - - info <- list( - cases = list( - caseid = list(name = "CaseID", spec = "col_integer"), - patientid = list(name = "PatientID", spec = "col_integer"), - admissionyear = list(name = "AdmissionYear", spec = "col_integer"), - timeofstay = list(name = "TimeOfStay", spec = "col_integer"), - icuoffset = list(name = "ICUOffset", spec = "col_integer"), - saps3 = list(name = "saps3", spec = "col_double"), - hospitaldischargetype = list(name = "HospitalDischargeType", - spec = "col_integer"), - dischargestate = list(name = "DischargeState", - spec = "col_integer"), - dischargeunit = list(name = "DischargeUnit", - spec = "col_integer"), - offsetofdeath = list(name = "OffsetOfDeath", - spec = "col_integer"), - estimatedsurvivalobservationtime = list(name = "EstimatedSurvivalObservationTime", - spec = "col_integer"), - sex = list(name = "Sex", spec = "col_integer"), - weightonadmission = list(name = "WeightOnAdmission", spec = "col_double"), - heightonadmission = list(name = "HeightOnAdmission", spec = "col_double"), - ageonadmission = list(name = "AgeOnAdmission", spec = "col_integer"), - hospitalunit = list(name = "HospitalUnit", spec = "col_integer"), - referringunit = list(name = "ReferringUnit", spec = "col_integer"), - icd10main = list(name = "ICD10Main", spec = "col_character"), - icd10maintext = list(name = "ICD10MainText", spec = "col_character"), - diagnosist2 = list(name = "DiagnosisT2", spec = "col_character"), - surgicalsite = list(name = "SurgicalSite", spec = "col_integer"), - hoursofcrrt = list(name = "HoursOfCRRT", spec = "col_integer"), - admissionformhassepsis = list(name = "AdmissionFormHasSepsis", spec = "col_integer"), - orbisdataavailable = list(name = "OrbisDataAvailable", spec = "col_character"), - heartsurgeryadditionaldata = list(name = "HeartSurgeryAdditionalData", - spec = "col_integer"), - heartsurgerycrossclamptime = list(name = "HeartSurgeryCrossClampTime", - spec = "col_integer"), - heartsurgerybeginoffset = list(name = "HeartSurgeryBeginOffset", - spec = "col_integer"), - heartsurgeryendoffset = list(name = "HeartSurgeryEndOffset", - spec = "col_integer"), - offsetafterfirstadmission = list(name = "OffsetAfterFirstAdmission", - spec = "col_integer") - ), - d_references = list( - referenceglobalid = list(name = "ReferenceGlobalID", - spec = "col_integer"), - referencevalue = list(name = "ReferenceValue", - spec = "col_character"), - referencename = list(name = "ReferenceName", - spec = "col_character"), - referencedescription = list(name = "ReferenceDescription", spec = "col_character"), - referenceunit = list(name = "ReferenceUnit", spec = "col_character"), - referenceorder = list(name = "ReferenceOrder", spec = "col_integer"), - referencetype = list(name = "ReferenceType", spec = "col_integer"), - data = list(name = "Data", spec = "col_character") - ), - data_float_h = list( - id = list(name = "id", spec = "col_integer"), - caseid = list(name = "CaseID", - spec = "col_integer"), - dataid = list(name = "DataID", - spec = "col_integer"), - offset = list(name = "Offset", - spec = "col_integer"), - val = list(name = "Val", spec = "col_double"), - cnt = list(name = "cnt", spec = "col_integer"), - rawdata = list(name = "rawdata", spec = "col_double") - ), - data_ref = list( - id = list(name = "id", spec = "col_integer"), - caseid = list(name = "CaseID", spec = "col_integer"), - refid = list(name = "RefID", spec = "col_integer"), - customfieldid = list(name = "CustomFieldID", spec = "col_integer") - ), - laboratory = list( - id = list(name = "id", spec = "col_integer"), - caseid = list(name = "CaseID", spec = "col_integer"), - laboratoryid = list(name = "LaboratoryID", spec = "col_integer"), - offset = list(name = "Offset", spec = "col_integer"), - laboratoryvalue = list(name = "LaboratoryValue", spec = "col_double"), - laboratorytype = list(name = "LaboratoryType", spec = "col_integer") - ), - medication = list( - id = list(name = "id", spec = "col_integer"), - caseid = list(name = "CaseID", - spec = "col_integer"), - patientid = list(name = "PatientID", - spec = "col_integer"), - drugid = list(name = "DrugID", - spec = "col_integer"), - offset = list(name = "Offset", - spec = "col_integer"), - offsetdrugend = list(name = "OffsetDrugEnd", - spec = "col_integer"), - issingledose = list(name = "IsSingleDose", - spec = "col_logical"), - amount = list(name = "Amount", - spec = "col_double"), - amountperminute = list(name = "AmountPerMinute", - spec = "col_double"), - givenstate = list(name = "GivenState", - spec = "col_integer") - ), - data_range = list( - id = list(name = "id", - spec = "col_integer"), - caseid = list(name = "CaseID", - spec = "col_integer"), - dataid = list(name = "DataID", - spec = "col_integer"), - offset = list(name = "Offset", - spec = "col_integer"), - offsetend = list(name = "OffsetEnd", - spec = "col_integer"), - data = list(name = "Data", - spec = "col_character") - ), - unitlog = list( - id = list(name = "id", - spec = "col_integer"), - caseid = list(name = "CaseID", - spec = "col_integer"), - patientid = list(name = "PatientID", - spec = "col_integer"), - logstate = list(name = "LogState", - spec = "col_integer"), - offset = list(name = "Offset", - spec = "col_integer"), - hospitalunit = list(name = "HospitalUnit", - spec = "col_integer") - ) - ) - - tables <- names(info) - cols <- info - - defaults <- list( - cases = list( - index_var = "ICUOffset" - ), - d_references = list(), - data_float_h = list( - index_var = "Offset", - val_var = "Val" - ), - data_ref = list( - index_var = "OffsetAfterFirstAdmission" - ), - laboratory = list( - index_var = "Offset", - val_var = "LaboratoryValue" - ), - medication = list( - index_var = "Offset", - val_var = "Amount" - ), - data_range = list( - index_var = "Offset" - ), - unitlog = list( - index_var = "Offset" - ) - ) - - defaults <- Map(function(cl, df) { - nme <- vapply(cl, `[[`, character(1L), "name") - typ <- vapply(cl, `[[`, character(1L), "spec") - tim <- nme[grep("offset", names(nme), ignore.case = TRUE)] - if (length(tim)) c(df, list(time_vars = tim)) else df - }, cols[tables], defaults[tables]) - - n_row <- c( - cases = 27386L, - d_references = 1608L, - data_float_h = 36785241L, - data_range = 183339L, - data_ref = 354157L, - laboratory = 17572279L, - medication = 5141346L, - unitlog = 139968L - ) - - files <- c( - cases = "cases.csv.gz", - d_references = "d_references.csv.gz", - data_float_h = "data_float_h.csv.gz", - data_range = "data_range.csv.gz", - data_ref = "data_ref.csv.gz", - laboratory = "laboratory.csv.gz", - medication = "medication.csv.gz", - unitlog = "unitlog.csv.gz" - ) - - part <- list( - data_float_h = list( - col = "dataid", - breaks = c( - 1L, 2L, 3L, 4L, 7L, 28L, 29L, 702L, 703L, 705L, 708L, 709L, 710L, 715L, - 717L, 719L, 724L, 725L, 731L, 773L, 2018L, 2274L, 2278L, 2280L, 2283L, - 2290L, 3056L, 3059L, 3071L - ) - ) - ) - - tables <- Map(list, files = files[tables], - defaults = defaults[tables], num_rows = n_row[tables], - cols = cols[tables]) - - tables[names(part)] <- Map(`[[<-`, tables[names(part)], "partitioning", part) - - tables -} - -pkg_dir <- rprojroot::find_root(rprojroot::is_r_package) -cfg_dir <- file.path(pkg_dir, "inst", "extdata", "config") - -eicu_id_cfg <- list( - hadm = list(id = "patienthealthsystemstayid", position = 1L, - start = "hospitaladmitoffset", - end = "hospitaldischargeoffset", table = "patient"), - icustay = list(id = "patientunitstayid", position = 2L, - start = "unitadmitoffset", end = "unitdischargeoffset", - table = "patient") -) - -mimic_id_cfg <- list( - patient = list(id = "subject_id", position = 1L, start = "dob", - end = "dod", table = "patients"), - hadm = list(id = "hadm_id", position = 2L, start = "admittime", - end = "dischtime", table = "admissions"), - icustay = list(id = "icustay_id", position = 3L, start = "intime", - end = "outtime", table = "icustays") -) - -eicu <- get_table_info( - "https://mit-lcp.github.io/eicu-schema-spy/eicu.eicu_crd.xml" -) - -mimic <- get_table_info( - "https://mit-lcp.github.io/mimic-schema-spy/mimic.mimiciii.xml" -) - -eicu_demo_tbls <- eicu_tbl_cfg(eicu, is_demo = TRUE) -mimic_demo_tbls <- mimic_tbl_cfg(mimic, is_demo = TRUE) - -cfg <- list( - list( - name = "eicu", - url = "https://physionet.org/files/eicu-crd/2.0", - id_cfg = eicu_id_cfg, - tables = eicu_tbl_cfg(eicu, is_demo = FALSE) - ), - list( - name = "eicu_demo", - class_prefix = c("eicu_demo", "eicu"), - url = "https://physionet.org/files/eicu-crd-demo/2.0.1", - id_cfg = eicu_id_cfg, - tables = eicu_demo_tbls - ), - list( - name = "mimic", - url = "https://physionet.org/files/mimiciii/1.4", - id_cfg = mimic_id_cfg, - tables = mimic_tbl_cfg(mimic, is_demo = FALSE) - ), - list( - name = "mimic_demo", - class_prefix = c("mimic_demo", "mimic"), - url = "https://physionet.org/files/mimiciii-demo/1.4", - id_cfg = mimic_id_cfg, - tables = mimic_demo_tbls - ), - list( - name = "miiv", - url = "https://physionet.org/files/mimiciv/2.2", - id_cfg = list( - patient = list(id = "subject_id", position = 1L, start = "anchor_year", - end = "dod", table = "patients"), - hadm = list(id = "hadm_id", position = 2L, start = "admittime", - end = "dischtime", table = "admissions"), - icustay = list(id = "stay_id", position = 3L, start = "intime", - end = "outtime", table = "icustays") - ), - tables = miiv_tbl_cfg() - ), - list( - name = "hirid", - url = "https://physionet.org/files/hirid/1.1.1", - id_cfg = list( - icustay = list(id = "patientid", position = 1L, start = "admissiontime", - table = "general") - ), - tables = hirid_tbl_cfg() - ), - list( - name = "aumc", - id_cfg = list( - patient = list(id = "patientid", position = 1L, - start = "firstadmittedat", end = "dateofdeath", - table = "admissions"), - icustay = list(id = "admissionid", position = 2L, start = "admittedat", - end = "dischargedat", table = "admissions") - ), - unit_mapping = list( - list(symbol = "uur", def = "1 hour"), - list(symbol = "dag", def = "1 day") - ), - tables = aumc_tbl_cfg() - ), - list( - name = "sic", - url = "https://physionet.org/files/sicdb/1.0.6", - id_cfg = list( - patient = list(id = "PatientID", position = 1L, - start = "ICUOffset", end = "OffsetOfDeath", - table = "cases"), - icustay = list(id = "CaseID", position = 2L, start = "ICUOffset", - end = "TimeOfStay", - table = "cases") - ), - tables = sic_tbl_cfg() - ) -) - -ricu::set_config(cfg, "data-sources", cfg_dir) - -cfg <- list( - list( - name = "eicu_test", - class_prefix = c("eicu_test", "eicu_demo", "eicu"), - id_cfg = eicu_id_cfg, - tables = lapply(eicu_demo_tbls, as_minimal_tbl_spec) - ), - list( - name = "mimic_test", - class_prefix = c("mimic_test", "mimic_demo", "mimic"), - id_cfg = mimic_id_cfg, - tables = lapply(mimic_demo_tbls, as_minimal_tbl_spec) - ) -) - -ricu::set_config(cfg, "data-sources", file.path(pkg_dir, "inst", "testdata")) - -devtools::install(pkg_dir)