Creating MIMIC-III in a local Postgres database

In this article, I’m going to describe how to create MIMIC-III in a local Postgres database on Ubuntu.

  1. Download the MIMIC-III Clinical Database. You need to gain access to the dataset.
  2. Create a Docker container. Install Postgres by apt-get install postgresql.
  3. Clone the mimic-code repository into a local directory using git clone https://github.com/MIT-LCP/mimic-code.git.
  4. Go to the mimic-code/buildmimic/postgres directory and use make to run the Makefile, which contains instructions for creating MIMIC in a local Postgres database.
  5. Create a new PostgreSQL user by createuser -P -s -e -d root. Replace root with your local username.

macOS 10.15 (Catalina)

  1. Install Postgres by brew install postgres.
  2. Run Postgres by postgres -D /usr/local/var/postgres.
  3. Create a new PostgreSQL user by createuser -P -s -e -d postgres. Here postgres is the username.
  4. Build MIMIC-III using .csv.gz files in the /path/to/data directory by make create-user mimic-gz datadir="/Volumes/Logitec_2TB_OHI/physionet.org/files/mimiciii/1.4". By default, the database name is mimic, username is postgres, schema is mimiciii.
  5. Connect to the database using psql -U postgres -d mimic.

Now try to count the number of patients in the database.

select count(subject_id) from mimiciii.patients;

References

Comments

Copied title and URL