Permalink
Please sign in to comment.
Browse files
reworked make to call a single sql file to create concepts
- Loading branch information...
Showing
with
82 additions
and 345 deletions.
- +9 −41 Makefile
- +13 −14 Makefile.md
- +0 −42 concepts/Makefile
- +0 −10 concepts/clean.sql
- +0 −7 concepts/comorbidity/clean.sql
- +0 −38 concepts/comorbidity/postgres/Makefile
- +0 −37 concepts/demographics/Makefile
- +0 −7 concepts/demographics/clean.sql
- +0 −35 concepts/firstday/Makefile
- +0 −17 concepts/firstday/clean.sql
- +60 −0 concepts/make-concepts.sql
- +0 −39 concepts/sepsis/Makefile
- +0 −6 concepts/sepsis/clean.sql
- +0 −38 concepts/severityscores/Makefile
- +0 −14 concepts/severityscores/clean.sql
27
Makefile.md
| @@ -1,42 +0,0 @@ | |||
| -## ------------------------------------------------------------------ | |||
| -## Title: Build file for etc and etc/firstday | |||
| -## Description: Automated import of SQL scripts for etc and etc/firstday | |||
| -## ------------------------------------------------------------------ | |||
| - | |||
| -## Parameters ## | |||
| -# The top-level Makefile settings take precedence over this | |||
| -DBNAME=mimic | |||
| -DBUSER=mimic | |||
| -SCHEMA=mimiciii | |||
| - | |||
| - | |||
| -## Commands ## | |||
| -# The top-level Makefile settings take precedence over this | |||
| -PSQL=psql "dbname=$(DBNAME) options=--search_path=$(SCHEMA)" --username=$(DBUSER) | |||
| - | |||
| - | |||
| -## Build targets ## | |||
| - | |||
| -help: | |||
| - @echo 'extra: Miscellaneous staging scripts for useful clinical concepts' | |||
| - @echo ' firstday: Miscellaneous scripts for concepts on day 1 of an admission' | |||
| - | |||
| -extra: echo-data firstday rrt ventilation-durations | |||
| - | |||
| -firstday: | |||
| - @$(MAKE) -e -C firstday extra | |||
| - | |||
| -clean: | |||
| - @$(PSQL) -f clean.sql | |||
| - @$(MAKE) -e -C firstday clean | |||
| - | |||
| -.PHONY: extra firstday help clean | |||
| - | |||
| - | |||
| -## Implicit rules ## | |||
| - | |||
| -%: %.sql | |||
| - @echo | |||
| - @echo '--- Building' $< '---' | |||
| - @echo | |||
| - @$(PSQL) -f $< | |||
| @@ -1,10 +0,0 @@ | |||
| --- ------------------------------------------------------------------ | |||
| --- Title: SQL clean script called by "make clean" | |||
| --- Description: Drops all materialized views re: misc clinical concepts | |||
| --- ------------------------------------------------------------------ | |||
| - | |||
| -DROP MATERIALIZED VIEW IF EXISTS ECHODATA CASCADE; | |||
| -DROP MATERIALIZED VIEW IF EXISTS rrt CASCADE; | |||
| --- Tables for ventdurations | |||
| -DROP TABLE IF EXISTS ventsettings CASCADE; | |||
| -DROP TABLE IF EXISTS ventdurations CASCADE; | |||
| @@ -1,7 +0,0 @@ | |||
| --- ------------------------------------------------------------------ | |||
| --- Title: SQL clean script called by "make clean" | |||
| --- Description: Drops all materialized views re: comorbidity scoring | |||
| --- ------------------------------------------------------------------ | |||
| - | |||
| -DROP MATERIALIZED VIEW IF EXISTS ELIXHAUSER_AHRQ CASCADE; | |||
| -DROP MATERIALIZED VIEW IF EXISTS ELIXHAUSER_QUAN CASCADE; | |||
| @@ -1,38 +0,0 @@ | |||
| -## ------------------------------------------------------------------ | |||
| -## Title: Build file for comorbidity | |||
| -## Description: Automated import of SQL scripts for comorbidity | |||
| -## ------------------------------------------------------------------ | |||
| - | |||
| -## Parameters ## | |||
| -# The top-level Makefile settings take precedence over this | |||
| -DBNAME=mimic | |||
| -DBUSER=mimic | |||
| -SCHEMA=mimiciii | |||
| - | |||
| - | |||
| -## Commands ## | |||
| -# The top-level Makefile settings take precedence over this | |||
| -PSQL=psql "dbname=$(DBNAME) options=--search_path=$(SCHEMA)" --username=$(DBUSER) | |||
| - | |||
| - | |||
| -## Build targets ## | |||
| - | |||
| -help: | |||
| - @echo 'extra: Comorbidity scores' | |||
| - @echo 'clean: Drop all comorbidity score materialized views' | |||
| - | |||
| -extra: elixhauser-ahrq-v37-with-drg elixhauser-quan | |||
| - | |||
| -clean: | |||
| - @$(PSQL) -f clean.sql | |||
| - | |||
| -.PHONY: extra clean help | |||
| - | |||
| - | |||
| -## Implicit rules ## | |||
| - | |||
| -%: %.sql | |||
| - @echo | |||
| - @echo '--- Building' $< '---' | |||
| - @echo | |||
| - @$(PSQL) -f $< | |||
| @@ -1,37 +0,0 @@ | |||
| -## ------------------------------------------------------------------ | |||
| -## Title: Build file for demographics | |||
| -## Description: Automated import of SQL scripts for demographics | |||
| -## ------------------------------------------------------------------ | |||
| - | |||
| -## Parameters ## | |||
| -# The top-level Makefile settings take precedence over this | |||
| -DBNAME=mimic | |||
| -DBUSER=mimic | |||
| -SCHEMA=mimiciii | |||
| - | |||
| - | |||
| -## Commands ## | |||
| -# The top-level Makefile settings take precedence over this | |||
| -PSQL=psql "dbname=$(DBNAME) options=--search_path=$(SCHEMA)" --username=$(DBUSER) | |||
| - | |||
| - | |||
| -## Build targets ## | |||
| - | |||
| -help: | |||
| - @echo 'demographics: tables and views related to demographics' | |||
| - | |||
| -extra: HeightWeightQuery icustay_detail | |||
| - | |||
| -clean: | |||
| - @$(PSQL) -f clean.sql | |||
| - | |||
| -.PHONY: help clean extra | |||
| - | |||
| - | |||
| -## Implicit rules ## | |||
| - | |||
| -%: %.sql | |||
| - @echo | |||
| - @echo '--- Building' $< '---' | |||
| - @echo | |||
| - @$(PSQL) -f $< | |||
| @@ -1,7 +0,0 @@ | |||
| --- ------------------------------------------------------------------ | |||
| --- Title: SQL clean script called by "make clean" | |||
| --- Description: Drops all materialized views re: demographics | |||
| --- ------------------------------------------------------------------ | |||
| - | |||
| -DROP MATERIALIZED VIEW IF EXISTS icustay_detail CASCADE; | |||
| -DROP MATERIALIZED VIEW IF EXISTS heightweight CASCADE; | |||
| @@ -1,35 +0,0 @@ | |||
| -## ------------------------------------------------------------------ | |||
| -## Title: Build file for etc/firstday | |||
| -## Description: Automated import of SQL scripts for firstday | |||
| -## ------------------------------------------------------------------ | |||
| - | |||
| -## Parameters ## | |||
| -# The top-level Makefile settings take precedence over this | |||
| -DBNAME=mimic | |||
| -DBUSER=mimic | |||
| -SCHEMA=mimiciii | |||
| - | |||
| - | |||
| -## Commands ## | |||
| -# The top-level Makefile settings take precedence over this | |||
| -PSQL=psql "dbname=$(DBNAME) options=--search_path=$(SCHEMA)" --username=$(DBUSER) | |||
| - | |||
| - | |||
| -## Build targets ## | |||
| - | |||
| -#blood-gas-first-day-arterial: blood-gas-first-day | |||
| -extra: blood-gas-first-day blood-gas-first-day-arterial gcs-first-day height-first-day labs-first-day rrt-first-day urine-output-first-day ventilation-first-day vitals-first-day weight-first-day | |||
| - | |||
| -clean: | |||
| - @$(PSQL) -f clean.sql | |||
| - | |||
| -.PHONY: extra clean | |||
| - | |||
| - | |||
| -## Implicit rules ## | |||
| - | |||
| -%: %.sql | |||
| - @echo | |||
| - @echo '--- Building' $< '---' | |||
| - @echo | |||
| - @$(PSQL) -f $< | |||
| @@ -1,17 +0,0 @@ | |||
| --- ------------------------------------------------------------------ | |||
| --- Title: SQL clean script called by "make clean" | |||
| --- Description: Drops all materialized views re: first day concepts | |||
| --- ------------------------------------------------------------------ | |||
| - | |||
| -DROP MATERIALIZED VIEW IF EXISTS bloodgasfirstdayarterial CASCADE; | |||
| -DROP MATERIALIZED VIEW IF EXISTS bloodgasfirstday CASCADE; | |||
| -DROP MATERIALIZED VIEW IF EXISTS gcsfirstday CASCADE; | |||
| -DROP MATERIALIZED VIEW IF EXISTS heightfirstday CASCADE; | |||
| -DROP MATERIALIZED VIEW IF EXISTS labsfirstday CASCADE; | |||
| -DROP MATERIALIZED VIEW IF EXISTS rrtfirstday CASCADE; | |||
| -DROP MATERIALIZED VIEW IF EXISTS uofirstday CASCADE; | |||
| --- Need to drop table as well for legacy purposes | |||
| -DROP TABLE IF EXISTS ventfirstday CASCADE; | |||
| -DROP MATERIALIZED VIEW IF EXISTS ventfirstday CASCADE; | |||
| -DROP MATERIALIZED VIEW IF EXISTS vitalsfirstday CASCADE; | |||
| -DROP MATERIALIZED VIEW IF EXISTS weightfirstday CASCADE; | |||
| @@ -0,0 +1,60 @@ | |||
| +-- This file makes all materialized views in this subfolder | |||
| +-- Note that this may take a large amount of time and hard drive space | |||
| + | |||
| +\echo 'Beginning to create materialized views for MIMIC database.' | |||
| +BEGIN; | |||
| +\echo 'Top level files..' | |||
| +\i code-status.sql | |||
| +\i echo-data.sql | |||
| +\i ventilation-durations.sql | |||
| + | |||
| +\echo 'Directory 1 of 6: comorbidity' | |||
| +\i elixhauser-ahrq-v37-with-drg.sql | |||
| +\i elixhauser-quan.sql | |||
| +\i elixhauser-score-ahrq.sql | |||
| +\i elixhauser-score-quan.sql | |||
| + | |||
| +\echo 'Directory 2 of 6: demographics' | |||
| +\i HeightWeightQuery.sql | |||
| +\i icustay_detail.sql | |||
| + | |||
| +\echo 'Directory 3 of 6: firstday' | |||
| +-- data which is extracted from a patient's first ICU stay | |||
| +\i firstday/blood-gas-first-day.sql | |||
| +\i firstday/blood-gas-first-day-arterial.sql | |||
| +\i firstday/gcs-first-day.sql | |||
| +\i firstday/height-first-day.sql | |||
| +\i firstday/labs-first-day.sql | |||
| +\i firstday/rrt-first-day.sql | |||
| +\i firstday/urine-output-first-day.sql | |||
| +\i firstday/ventilation-first-day.sql | |||
| +\i firstday/vitals-first-day.sql | |||
| +\i firstday/weight-first-day.sql | |||
| + | |||
| +\echo 'Directory 4 of 6: sepsis' | |||
| +\i sepsis/angus.sql | |||
| + | |||
| +-- vasopressor durations | |||
| +\echo 'Directory 5 of 6: vasopressor-durations' | |||
| +\i vasopressor-durations/adenosine-durations.sql | |||
| +\i vasopressor-durations/dobutamine-durations.sql | |||
| +\i vasopressor-durations/dopamine-durations.sql | |||
| +\i vasopressor-durations/epinephrine-durations.sql | |||
| +\i vasopressor-durations/isuprel-durations.sql | |||
| +\i vasopressor-durations/milrinone-durations.sql | |||
| +\i vasopressor-durations/norepinephrine-durations.sql | |||
| +\i vasopressor-durations/phenylephrine-durations.sql | |||
| +\i vasopressor-durations/vasopressin-durations.sql | |||
| +\i vasopressor-durations/vasopressor-durations.sql | |||
| + | |||
| +-- Severity of illness scores (requires many views from above) | |||
| +\echo 'Directory 6 of 6: severityscores' | |||
| +\i severityscores/oasis.sql | |||
| +\i severityscores/sofa.sql | |||
| +\i severityscores/saps.sql | |||
| +\i severityscores/sapsii.sql | |||
| +\i severityscores/apsiii.sql | |||
| +\i severityscores/lods.sql | |||
| + | |||
| +COMMIT; | |||
| +\echo 'Finished loading materialized views.' | |||
Oops, something went wrong.
0 comments on commit
b7b9d35