Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the 'load_7z.sql' script to enable the loading of 'ed' module dat… #1656

Merged
merged 2 commits into from
Nov 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions mimic-iv-ed/buildmimic/postgres/load_7z.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
-- -------------------------------------------------------------------------------
--
-- Load data into the MIMICIVED schema
--
-- -------------------------------------------------------------------------------

--------------------------------------------------------
-- File created - Tue 08 Jun 2023
--------------------------------------------------------

-- To run from a terminal:
-- psql "dbname=<DBNAME> user=<USER>" -v mimic_data_dir=<PATH TO 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 edstays.....'
\copy edstays from PROGRAM '7z e -so edstays.csv.gz' delimiter ',' csv header NULL ''
\echo 'Table edstays 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.'
Loading