yikuan8/MIMIC-IV-Postgres(新しいタブで開きます)
主要言語: PLpgSQL
Installing MIMIC-IV in a local Postgres database
- star 数
- 49
- watcher 数
- 5
- fork 数
- 12
- issue 数
- 2
- 最終更新
- 2021/06/29
主要言語: PLpgSQL
Installing MIMIC-IV in a local Postgres database
Jun 28th, 2021: The repo updates to MIMIC-IV V4.0. As there is a major update of MIMIC-IV from version 0.4 to 1.0, I modify some codes to accomodate these changes.
Jun 2nd, 2021: MIMIC-IV-ED is released. Shout out to the authors. If you don't need the ED data, just skip the steps numbered with "ED". If you have already installed MIMIC-IV using this repo, you only need to run 1.ED, 4.ED, 5.ED.
In light of there is no offcial guide of deploying MIMIC-IV to Postgres server, this repo will help you navigate this process. We made necessary modification based on the offcial guide of MIMIC-III to adapt to MIMIC-IV.
Complete the PhysioNet Credentialing and download MIMIC-IV data. Decompress all .csv.gz file using "gzip -d *.gz". You will have such directory structure:
BASE_DIR
│
└───core
│ │ admissions.csv
│ │ patients.csv
│ │ transfers.csv
└───hosp
│ │ d_hcpcs.csv
│ │ ...
└───icu
│ │ d_items.csv
│ │ ...
Complete the PhysioNet Credentialing and download [MIMIC-IV-ED data][MIMIC-IV_ED]. Decompress all .csv.gz file using "gzip -d *.gz". Move those decompressed file to the same base directory. You will have such directory structure:
BASE_DIR
│
└───core
│ │ admissions.csv
│ │ patients.csv
│ │ transfers.csv
└───hosp
│ │ d_hcpcs.csv
│ │ ...
└───icu
│ │ d_items.csv
│ │ ...
└───ed
│ │ edstays.csv
│ │ ...
Please refer here for postgresql download and installation
In my case, I create a user named mimicuser, a new database named mimic4 containing a new schema named mimiciv holding all data by:
createuser -P -s -e -d mimicuser #creat user psql -U mimicuser #launch psql CREATE DATABASE mimic4 OWNER mimicuser; #create new database \c mimic4; #enter the new database CREATE SCHEMA mimiciv; #create new schema \q #quit psql
psql 'dbname=mimic4 user=mimicuser options=--search_path=mimiciv' -f create_tables.sqlpsql 'dbname=mimic4 user=mimicuser options=--search_path=mimiciv' -f create_ed_tables.sqlChange /YOUR/BASE/DIR/ to your BASE_DIR in the line 3,11,27 and run:
psql 'dbname=mimic4 user=mimicuser options=--search_path=mimiciv' -f load_data.sqlChange /YOUR/BASE/DIR/ to your BASE_DIR in the line 3 and run:
psql 'dbname=mimic4 user=mimicuser options=--search_path=mimiciv' -f load_eddata.sql