MacBook Air Generate MIMIC IV on FHIR - kind-lab/mimic-fhir GitHub Wiki

The process to generate to demo and full MIMIC-IV-on-FHIR datastores. There are a few initial steps before starting generation:

  • Connect 1 TB SSD: This is needed since the postgres database would overfill the MacBook Air
  • Start up postgres in SSD: pg_ctl start -D "/Volumes/Samsung SSD T7/postgresql"
  • Clone or pull the latest mimic-code repo
  • When connecting to psql you must use port 5434: ie: psql -d mimic -p 5434

Full Generation

The full generation always starts first with the generation of the updated MIMIC-IV and MIMIC-IV-ED databases.

  • Open a terminal and create a new database with psql:
    • Start by entering psql: psql -d postgres -p 5434
    • Then in psql run: CREATE DATABASE mimic. Use the database name mimic for all future psql commands
  • Download data for MIMIC-IV from Physionet.
  • Generate MIMIC-IV in postgres following the buildmimic directions
    • The only change to the buildmimic code for the MacBook is adding the -p 5434 so it builds in the SSD
  • Download data for MIMIC-IV-ED from Physionet.
  • Generate MIMIC-IV-ED in postgres following the ED buildmimic directions
    • Again adding the -p 5434 to any psql commands

Now that the MIMIC-IV and MIMIC-IV-ED databases are created on the SSD, we can proceed on to the MIMIC-IV-on-FHIR generation.

  • Open a terminal and navigate to the sql folder in the mimic-fhir repo
  • Create mimic-fhir in postgres: psql -d mimic -p 5434 -f create.sql
    • Typically this has taken 48-72 hours (mainly due to chartevents and labevents)

The final step is exporting the resources to ndjson format. Run the following command from the terminal:

  • psql -d mimic -p 5434 create_fhir_jsons.sql

Demo Generation

The demo generation always starts first with the generation of the updated MIMIC-IV demo and MIMIC-IV-ED demo databases.

  • Open a terminal and create a new demo database with psql:
    • Start by entering psql: psql -d postgres -p 5434
    • Then in psql run: CREATE DATABASE mimic_demo. Use the database name mimic_demo for all future psql commands
  • Download data for MIMIC-IV Demo from Physionet.
  • Generate MIMIC-IV demo in postgres following the buildmimic directions
    • The only change to the buildmimic code for the MacBook is adding the -p 5434 so it builds in the SSD
    • Reminder to use the mimic_demo database when connecting psql (don't want to overwrite the wrong DB)
  • The MIMIC-IV-ED data does not have an explicit demo, download from GCP until it's ready on Physionet.
    • Generate MIMIC-IV-ED in postgres following the ED buildmimic directions

Now that the MIMIC-IV and MIMIC-IV-ED demo databases are created on the SSD, we can proceed on to the MIMIC-IV-on-FHIR generation.

  • Open a terminal and navigate to the sql folder in the mimic-fhir repo
  • Create mimic-fhir in postgres: psql -d mimic_demo -p 5434 -f create.sql