From dbf6b50ebf381047cca89a26dac13a89cf913bb0 Mon Sep 17 00:00:00 2001 From: codeimport Date: Tue, 10 Oct 2023 23:30:51 +0800 Subject: [PATCH 1/2] Add the 'load_7z.sql' script to enable the loading of 'ed' module data using 7z. --- mimic-iv-ed/buildmimic/postgres/load_7z.sql | 77 +++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 mimic-iv-ed/buildmimic/postgres/load_7z.sql diff --git a/mimic-iv-ed/buildmimic/postgres/load_7z.sql b/mimic-iv-ed/buildmimic/postgres/load_7z.sql new file mode 100644 index 000000000..dee6171b3 --- /dev/null +++ b/mimic-iv-ed/buildmimic/postgres/load_7z.sql @@ -0,0 +1,77 @@ +-- ------------------------------------------------------------------------------- +-- +-- Load data into the MIMICIVED schema +-- +-- ------------------------------------------------------------------------------- + +-------------------------------------------------------- +-- File created - Tue 08 Jun 2023 +-------------------------------------------------------- + +-- To run from a terminal: +-- psql "dbname= user=" -v mimic_data_dir= -f load_7z.sql + +-- Change to the directory containing the data files +\cd :mimic_data_dir + +-- If running scripts individually, you can set the schema where all tables are created as follows: +SET search_path TO mimiciv_ed; +-- Restoring the search path to its default value can be accomplished as follows: +-- SET search_path TO "$user",public; + +/* Set the mimic_data_dir variable to point to directory containing + all .csv files. If using Docker, this should not be changed here. + Rather, when running the docker container, use the -v option + to have Docker mount a host volume to the container path /mimic_data + as explained in the README file +*/ + +-------------------------------------------------------- +-- Load Data for Table diagnosis +-------------------------------------------------------- +\echo '######################' +\echo 'Copying diagnosis.....' +\copy diagnosis FROM PROGRAM '7z e -so diagnosis.csv.gz' DELIMITER ',' CSV HEADER NULL '' +\echo 'Table diagnosis successfully generated.' + +-------------------------------------------------------- +-- Load Data for Table edstays +-------------------------------------------------------- +\echo '###################' +\echo 'Copying edstay.....' +\copy edstays from PROGRAM '7z e -so edstays.csv.gz' delimiter ',' csv header NULL '' +\echo 'Table edstay successfully generated.' + +-------------------------------------------------------- +-- Load Data for Table medrecon +-------------------------------------------------------- +\echo '#####################' +\echo 'Copying medrecon.....' +\copy medrecon from PROGRAM '7z e -so medrecon.csv.gz' delimiter ',' csv header NULL '' +\echo 'Table medrecon successfully generated.' + +-------------------------------------------------------- +-- Load Data for Table pyxis +-------------------------------------------------------- +\echo '##################' +\echo 'Copying pyxis.....' +\copy pyxis from PROGRAM '7z e -so pyxis.csv.gz' delimiter ',' csv header NULL '' +\echo 'Table pyxis successfully generated.' + +-------------------------------------------------------- +-- Load Data for Table triage +-------------------------------------------------------- +\echo '###################' +\echo 'Copying triage.....' +\copy triage from PROGRAM '7z e -so triage.csv.gz' delimiter ',' csv header NULL '' +\echo 'Table triage successfully generated.' + +-------------------------------------------------------- +-- Load Data for Table vitalsign +-------------------------------------------------------- +\echo '######################' +\echo 'Copying vitalsign.....' +\copy vitalsign from PROGRAM '7z e -so vitalsign.csv.gz' delimiter ',' csv header NULL '' +\echo 'Table vitalsign successfully generated.' +\echo 'All tables generated.' +\echo 'THE END.' From 98deadc24ccc48382b5d5bec55d17dd13a5592e0 Mon Sep 17 00:00:00 2001 From: Alistair Johnson Date: Thu, 16 Nov 2023 09:13:53 -0500 Subject: [PATCH 2/2] typo edstay -> edstays --- mimic-iv-ed/buildmimic/postgres/load_7z.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mimic-iv-ed/buildmimic/postgres/load_7z.sql b/mimic-iv-ed/buildmimic/postgres/load_7z.sql index dee6171b3..15d031f93 100644 --- a/mimic-iv-ed/buildmimic/postgres/load_7z.sql +++ b/mimic-iv-ed/buildmimic/postgres/load_7z.sql @@ -38,9 +38,9 @@ SET search_path TO mimiciv_ed; -- Load Data for Table edstays -------------------------------------------------------- \echo '###################' -\echo 'Copying edstay.....' +\echo 'Copying edstays.....' \copy edstays from PROGRAM '7z e -so edstays.csv.gz' delimiter ',' csv header NULL '' -\echo 'Table edstay successfully generated.' +\echo 'Table edstays successfully generated.' -------------------------------------------------------- -- Load Data for Table medrecon