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/convert_bigquery_to_postgres.sh
+9-4Lines changed: 9 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,13 @@ do
47
47
echo -n "${d}.${tbl} .."
48
48
echo"-- THIS SCRIPT IS AUTOMATICALLY GENERATED. DO NOT EDIT IT DIRECTLY.">"postgres/${d}/${tbl}.sql"
49
49
echo"DROP TABLE IF EXISTS ${tbl}; CREATE TABLE ${tbl} AS ">>"postgres/${d}/${tbl}.sql"
50
-
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_SCHEMA}"| sed -r -e "${REGEX_INTERVAL}"| sed -r -e "${REGEX_SECONDS}"| perl -0777 -pe "${PERL_REGEX_ROUND}">>"postgres/${d}/${tbl}.sql"
50
+
51
+
# for two scripts, add a perl replace to cast rounded values as numeric
52
+
if [[ "${tbl}"=="icustay_times" ]] || [[ "${tbl}"=="urine_output" ]];then
53
+
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_SCHEMA}"| sed -r -e "${REGEX_INTERVAL}"| sed -r -e "${REGEX_SECONDS}"| perl -0777 -pe "${PERL_REGEX_ROUND}">>"postgres/${d}/${tbl}.sql"
54
+
else
55
+
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_SCHEMA}"| sed -r -e "${REGEX_INTERVAL}"| sed -r -e "${REGEX_SECONDS}">>"postgres/${d}/${tbl}.sql"
56
+
fi
51
57
52
58
# write out a call to this script in the make concepts file
0 commit comments