You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mimic-iv/concepts/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
This folder contains scripts to generate useful abstractions of raw MIMIC-IV data ("concepts").
4
4
The scripts are written using the **BigQuery Standard SQL Dialect**. Concepts are categorized into folders if possible, otherwise they remain in the top-level directory. The [postgres](/mimic-iv/concepts/postgres) subfolder contains automatically generated PostgreSQL versions of these scripts; [see below for how these were generated](#postgresql-concepts). Concepts are categorized into folders if possible, otherwise they remain in the top-level directory.
5
5
6
-
The concepts are organized into individual SQL scripts, with each script generating a table. The BigQuery `mimic_derived` dataset under `physionet-data` contains the concepts pregenerated. Access to this dataset is available to MIMIC-IV approved users: see the [cloud instructions](https://mimic.mit.edu/docs/gettingstarted/cloud/) on how to access MIMIC-IV on BigQuery (which includes the derived concepts).
6
+
The concepts are organized into individual SQL scripts, with each script generating a table. The BigQuery `mimiciv_derived` dataset under `physionet-data` contains the concepts pregenerated. Access to this dataset is available to MIMIC-IV approved users: see the [cloud instructions](https://mimic.mit.edu/docs/gettingstarted/cloud/) on how to access MIMIC-IV on BigQuery (which includes the derived concepts).
7
7
8
8
*[List of the concept folders and their content](#concept-index)
9
9
*[Generating the concept tables on BigQuery](#generating-the-concepts-on-bigquery)
# for two scripts, add a perl replace to cast rounded values as numeric
53
51
if [[ "${tbl}"=="icustay_times" ]] || [[ "${tbl}"=="urine_output" ]];then
54
-
cat "${d}/${tbl}.sql"| sed -r -e "${REGEX_ARRAY}"| sed -r -e "${REGEX_HOUR_INTERVAL}"| sed -r -e "${REGEX_INT}"| sed -r -e "${REGEX_DATETIME_DIFF}"| sed -r -e "${REGEX_DATETIME_TRUNC}"| sed -r -e "${REGEX_SCHEMA}"| sed -r -e "${REGEX_INTERVAL}"| sed -r -e "${REGEX_SECONDS}"| perl -0777 -pe "${PERL_REGEX_ROUND}">>"postgres/${d}/${tbl}.sql"
52
+
cat "${d}/${tbl}.sql"| sed -r -e "${REGEX_ARRAY}"| sed -r -e "${REGEX_HOUR_INTERVAL}"| sed -r -e "${REGEX_INT}"| sed -r -e "${REGEX_DATETIME_DIFF}"| sed -r -e "${REGEX_DATETIME_TRUNC}"| sed -r -e "${REGEX_SCHEMA}"| sed -r -e "${REGEX_INTERVAL}"| sed -r -e "${REGEX_SECONDS}">>"postgres/${d}/${tbl}.sql"
55
53
else
56
54
cat "${d}/${tbl}.sql"| sed -r -e "${REGEX_ARRAY}"| sed -r -e "${REGEX_HOUR_INTERVAL}"| sed -r -e "${REGEX_INT}"| sed -r -e "${REGEX_DATETIME_DIFF}"| sed -r -e "${REGEX_DATETIME_TRUNC}"| sed -r -e "${REGEX_SCHEMA}"| sed -r -e "${REGEX_INTERVAL}"| sed -r -e "${REGEX_SECONDS}">>"postgres/${d}/${tbl}.sql"
57
55
fi
@@ -66,10 +64,19 @@ echo " done!"
66
64
# (2) output to the postgres subfolder
67
65
# (3) add a line to the postgres-make-concepts.sql script to generate this table
68
66
69
-
# order of the folders is important for a few tables here:
70
-
# * scores (sofa et al) depend on labs, icustay_hourly
71
-
# * sepsis depends on score (sofa.sql in particular)
72
-
# * organfailure depends on measurement and firstday
67
+
# we control the order by skipping tables listed in the below var
# create an array to store tables for which the order of generation matters
71
+
# i.e. these tables cannot be generated in alphabetical order, as done in the later loop
72
+
TABLES_TO_SKIP=()
73
+
fordir_and_tablein$DIR_AND_TABLES_TO_SKIP;
74
+
do
75
+
tbl=`echo ${dir_and_table}| cut -d. -f2`
76
+
TABLES_TO_SKIP+=($tbl)
77
+
done
78
+
79
+
echo$TABLES_TO_SKIP
73
80
# the order *only* matters during the conversion step because our loop is
74
81
# inserting table build commands into the postgres-make-concepts.sql file
75
82
fordin demographics measurement comorbidity medication treatment firstday organfailure score sepsis;
@@ -93,19 +100,24 @@ do
93
100
echo -n "${tbl} .."
94
101
echo"-- THIS SCRIPT IS AUTOMATICALLY GENERATED. DO NOT EDIT IT DIRECTLY.">"postgres/${d}/${tbl}.sql"
95
102
echo"DROP TABLE IF EXISTS ${tbl}; CREATE TABLE ${tbl} AS ">>"postgres/${d}/${tbl}.sql"
96
-
cat "${d}/${tbl}.sql"| sed -r -e "${REGEX_ARRAY}"| sed -r -e "${REGEX_HOUR_INTERVAL}"| sed -r -e "${REGEX_INT}"| sed -r -e "${REGEX_DATETIME_DIFF}"| sed -r -e "${REGEX_DATETIME_TRUNC}"| sed -r -e "${REGEX_SCHEMA}"| sed -r -e "${REGEX_INTERVAL}"| perl -0777 -pe "${PERL_REGEX_ROUND}">>"postgres/${d}/${fn}"
103
+
cat "${d}/${tbl}.sql"| sed -r -e "${REGEX_ARRAY}"| sed -r -e "${REGEX_HOUR_INTERVAL}"| sed -r -e "${REGEX_INT}"| sed -r -e "${REGEX_DATETIME_DIFF}"| sed -r -e "${REGEX_DATETIME_TRUNC}"| sed -r -e "${REGEX_SCHEMA}"| sed -r -e "${REGEX_INTERVAL}">>"postgres/${d}/${fn}"
0 commit comments