@@ -17,8 +17,14 @@ echo 'Top level files..'
1717bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .code_status < code_status.sql
1818bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .echo_data < echo_data.sql
1919
20+ echo ' Running queries in 10 directories.'
21+
22+ echo ' Directory 1: demographics'
23+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .heightweight < demographics/heightweight.sql
24+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .icustay_detail < demographics/icustay_detail.sql
25+
2026# Durations (usually of treatments)
21- echo ' Directory 1 of 9 : durations'
27+ echo ' Directory 2 : durations'
2228bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .ventilation_classification < durations/ventilation_classification.sql
2329bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .ventilation_durations < durations/ventilation_durations.sql
2430bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .crrt_durations < durations/crrt_durations.sql
@@ -33,19 +39,41 @@ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET}.phenylephrine_duratio
3339bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .vasopressin_durations < durations/vasopressin_durations.sql
3440bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .vasopressor_durations < durations/vasopressor_durations.sql
3541bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .weight_durations < durations/weight_durations.sql
42+ # dose queries for vasopressors
43+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .dobutamine_dose < durations/dobutamine_dose.sql
44+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .dopamine_dose < durations/dopamine_dose.sql
45+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .epinephrine_dose < durations/epinephrine_dose.sql
46+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .norepinephrine_dose < durations/norepinephrine_dose.sql
47+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .phenylephrine_dose < durations/phenylephrine_dose.sql
48+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .vasopressin_dose < durations/vasopressin_dose.sql
3649
37- echo ' Directory 2 of 9: comorbidity'
50+ # "pivoted" tables which have icustay_id / timestamp as the primary key
51+ echo ' Directory 3: pivoted tables'
52+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .pivoted_vital < pivot/pivoted_vital.sql
53+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .pivoted_uo < pivot/pivoted_uo.sql
54+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .pivoted_rrt < pivot/pivoted_rrt.sql
55+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .pivoted_lab < pivot/pivoted_lab.sql
56+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .pivoted_invasive_lines < pivot/pivoted_invasive_lines.sql
57+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .pivoted_icp < pivot/pivoted_icp.sql
58+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .pivoted_height < pivot/pivoted_height.sql
59+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .pivoted_gcs < pivot/pivoted_gcs.sql
60+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .pivoted_fio2 < pivot/pivoted_fio2.sql
61+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .pivoted_bg < pivot/pivoted_bg.sql
62+ # pivoted_bg_art must be run after pivoted_bg
63+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .pivoted_bg_art < pivot/pivoted_bg_art.sql
64+ # pivoted oasis depends on icustay_hours in demographics
65+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .pivoted_oasis < pivot/pivoted_oasis.sql
66+ # pivoted sofa depends on many above pivoted views, ventilation_durations, and dose queries
67+ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .pivoted_sofa < pivot/pivoted_sofa.sql
68+
69+ echo ' Directory 4: comorbidity'
3870bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .elixhauser_ahrq_v37 < comorbidity/elixhauser_ahrq_v37.sql
3971bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .elixhauser_ahrq_v37_no_drg < comorbidity/elixhauser_ahrq_v37-no_drg.sql
4072bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .elixhauser_quan < comorbidity/elixhauser_quan.sql
4173bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .elixhauser_score_ahrq < comorbidity/elixhauser_score_ahrq.sql
4274bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .elixhauser_score_quan < comorbidity/elixhauser_score_quan.sql
4375
44- echo ' Directory 3 of 9: demographics'
45- bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .heightweight < demographics/heightweight.sql
46- bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .icustay_detail < demographics/icustay_detail.sql
47-
48- echo ' Directory 4 of 9: firstday'
76+ echo ' Directory 5: firstday'
4977# data which is extracted from a patient's first ICU stay
5078bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .blood_gas_first_day < firstday/blood_gas_first_day.sql
5179bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .blood_gas_first_day_arterial < firstday/blood_gas_first_day_arterial.sql
@@ -57,22 +85,22 @@ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET}.ventilation_first_day
5785bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .vitals_first_day < firstday/vitals_first_day.sql
5886bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .weight_first_day < firstday/weight_first_day.sql
5987
60- echo ' Directory 5 of 9 : fluid_balance'
88+ echo ' Directory 6 : fluid_balance'
6189bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .urine_output < fluid_balance/urine_output.sql
6290
63- echo ' Directory 6 of 9 : sepsis'
91+ echo ' Directory 7 : sepsis'
6492bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .angus < sepsis/angus.sql
6593bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .martin < sepsis/martin.sql
6694bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .explicit < sepsis/explicit.sql
6795
6896# diagnosis mapping using CCS
69- echo ' Directory 7 of 9 : diagnosis'
97+ echo ' Directory 8 : diagnosis'
7098# load the ccs_multi_dx.csv.gz file into bq
7199bq load --source_format=CSV ${TARGET_DATASET} .ccs_multi_dx diagnosis/ccs_multi_dx.csv.gz diagnosis/ccs_multi_dx.json
72100bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .ccs_dx < diagnosis/ccs_dx.sql
73101
74102# Organ failure scores
75- echo ' Directory 8 of 9: organfailure'
103+ echo ' Directory 9: organfailure'
76104bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .kdigo_creatinine < organfailure/kdigo_creatinine.sql
77105bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .kdigo_uo < organfailure/kdigo_uo.sql
78106bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .kdigo_stages < organfailure/kdigo_stages.sql
@@ -81,7 +109,7 @@ bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET}.kdigo_stages_48hr < o
81109bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .meld < organfailure/meld.sql
82110
83111# Severity of illness scores (requires many views from above)
84- echo ' Directory 9 of 9 : severityscores'
112+ echo ' Directory 10 : severityscores'
85113bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .oasis < severityscores/oasis.sql
86114bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .sofa < severityscores/sofa.sql
87115bq query ${BQ_FLAGS} --destination_table=${TARGET_DATASET} .saps < severityscores/saps.sql
0 commit comments