Generation of the .csv file for the VentAI algorithm consists of a few steps:
- Setup MIMIC-III Postgres database
- Add derived tables
- Add VentAI views
- Convert final table to .csv
Follow https://mimic.mit.edu/docs/gettingstarted/
Partially copied from here.
First get the MIMIC code from the repository.
git clone https://github.com/MIT-LCP/mimic-code.git
Then navigate to the mimic-code/mimiciii/concepts_postgres
directory, connect to the PSQL database instance, and run the following commands:
\i postgres-functions.sql
\i postgres-make-concepts.sql
If you get an error that ccs_multi_dx.csv.gz
does not exist then copy the file to the directory from which you run the command:
cp diagnosis/ccs_multi_dx.csv.gz .
In the folder ventai-views
you can find all the SQL views that VentAI uses, which were taken from their github. They were modified to work out of the box, and getMainDemographics.sql
was taken from the Supplementary Material of Personalization of Mechanical Ventilation Treatment using Deep Conservative Reinforcement Learning .
Add all the ventai-views by running the SQL file in this repository:
\i add-ventai-views.sql
Connect to the PSQL database and run the next command.
Replace <output_path> with the desired location:
\copy (SELECT * FROM getFinalTable) TO '<output_path>' DELIMITER ';' CSV HEADER
You should end up with a .csv file that contains all the relevant information to start with VentAI.