• Stars
    star
    185
  • Rank 208,271 (Top 5 %)
  • Language
    Jupyter Notebook
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Evaluation of the Sepsis-3 guidelines in MIMIC-III

Sepsis-3 in MIMIC-III DOI

This is the code repository associated with A Comparative Analysis of Sepsis Identification Methods in an Electronic Database

The publication assessed five methods of identifying sepsis in electronic health records, and found that all five had varying cohort sizes and severity of illness as measured by in-hospital mortality rate. The results are best summarized by the following figure:

Frequency of sepsis and mortality rate using various criteria

Above, we can see that, as we change the criteria used to define sepsis, the percentage of patients who satisfy the criteria decreases (blue bars) and the percent mortality of that cohort increases (red bars). For more detail please see the paper.

Acknowledgement

If you find the code useful, we would appreciate acknowledging our work with a citation: either the code directly (using the DOI badge from Zenodo), the paper summarizing the work, or both!

@article{johnson2018comparative,
  title={A Comparative Analysis of Sepsis Identification Methods in an Electronic Database},
  author={Johnson, Alistair EW and Aboab, Jerome and Raffa, Jesse D and Pollard, Tom J and Deliberato, Rodrigo O and Celi, Leo A and Stone, David J},
  journal={Critical care medicine},
  volume={46},
  number={4},
  pages={494--499},
  year={2018},
  publisher={Wolters Kluwer}
}

@misc{alistair_johnson_2018_1256723,
  author       = {Alistair Johnson and Tom Pollard},
  title        = {sepsis3-mimic},
  version      = {1.0.0},
  publisher    = {Zenodo},
  month        = may,
  year         = 2018,
  doi          = {10.5281/zenodo.1256723},
  url          = {https://doi.org/10.5281/zenodo.1256723}
}

Reproducing the results of the above study

Reproducing the study can be done as follows:

  1. Installing necessary Python dependencies
  2. Generate or acquire the CSV files which are used for analysis by...
  • Running the sepsis-3-get-data.ipynb notebook from start to finish
  • ... or downloading the CSV files from the MIMIC-III Derived Data Repository and analyzing those files
  1. Running the analysis in sepsis-3-main.ipynb

The following instructions have been tested on Ubuntu 16.04, but should be relatively straightforward to adapt to other systems.

1. Clone the repository and install necessary Python dependencies

You will need a local copy of the code in this repository. The easiest way to acquire this is to use git to clone the data locally. If using Ubuntu, you can install git easily with:

sudo apt-get install git

Next, clone the repository with the --recursive flag as it relies on a distinct repository (mimic-code):

git clone https://github.com/alistairewj/sepsis3-mimic sepsis3-mimic --recursive

If you already have the repository cloned on your local computer, but you didn't use the --recursive flag, you can clone the submodule easily:

cd sepsis3-mimic
git submodule update --init --recursive

(Optional, recommended): Create a virtual environment for this repository. I like to use virtualenvwrapper as it makes managing virtual environments easier. After installing virtualenvwrapper, run: mkvirtualenv --python=python3 sepsis3-py3

If you are running jupyter notebook in a different environment (e.g. you have a system level install of jupyter currently running, but want to use this virtual environment), then you can add this virtual environment as a kernel specification. From outside your virtual environment, run: python -m ipykernel install --user --name sepsis3-py3 --display-name "sepsis3-py3". You can read more about this here. After installing the kernel specification, you may need to reload any active notebooks in order to see the kernel as an option.

Finally, using a package manager for Python (pip), you can run the following from the root directory of this repository to install all necessary python packages:

pip install -r requirements.txt

2. Acquire CSVs from a database with MIMIC-III

There are two options: (a) regenerate the CSVs from the original MIMIC-III database, or (b) download pre-generated CSVs from PhysioNetWorks. Both will require approval to access MIMIC-III - you can also read more about getting access to MIMIC-III.

(a) Regenerate the CSVs from a PostgreSQL database with MIMIC-III

The sepsis-3-get-data.ipynb notebook runs through the process of exporting the data from the database and writing it to CSV files. This notebook requires:

  1. PostgreSQL version 9.4 or later
  2. The MIMIC-III database installed in PostgreSQL

If you do not have the above, you can follow the instructions on this page to access and install MIMIC-III.

Once you have the database setup, you will need to generate the CSV files. The easiest way is to run through the sepsis-3-get-data.ipynb notebook: this will call the query/make-tables.sql script and generate the necessary tables on the database. Alternatively, you can run this script directly, and the notebook will recognize that the final sepsis3 table already exists. If running directly using psql, you can call:

cd query
psql
set search_path to public,mimiciii;
\i make-tables.sql

Either way, the generation of all the tables can take anywhere from 10 minutes to about an hour, depending on your system. You may see a lot of NOTICE warnings: don't worry about them. The query logic is "check if the table exists, and if it does, drop it". These warnings indicate that the table did not exist (and nor would you expect it to on a fresh install!).

(b) Download the CSVs from the MIMIC-III Derived Data repository

The data files can be downloaded from the MIMIC-III Derived Data Repository. If you have a PhysioNetWorks account which has been approved for access to MIMIC-III, access the sepsis3-mimic derived data repository here, supplying your username and password when prompted. The data file is "sepsis3-data.zip". By default, the code expects the data to be extracted in the data subfolder of this repository.

3. Run analysis

sepsis-3-main.ipynb - this analyzes the data and reports all results found in the paper. It assumes the data is available in the data subfolder of this directory - all notebooks do this, and you can change it if you like by modifying the data_path variable at the top of each script.

(Optional) Supplemental Material

Results presented in the supplemental material can be regenerated using the supplemental-material.ipynb file.

(Optional) Other notebooks

There are a number of other notebooks: venn-diagrams.ipynb unsurprisingly generates many Venn diagrams, criteria-over-time.ipynb and the appendix subfolder contains a number of notebooks/R scripts which contain some interesting analyses but may not work out of the box. Pull requests welcome! :)

More Repositories

1

mimic-iv-aline-study

Replication of the arterial line study in MIMIC-IV
Jupyter Notebook
61
star
2

peak-detector

Multimodal peak detection using ECG, ABP, PPG or SV
MATLAB
54
star
3

mortality-prediction

Real time mortality prediction in the MIMIC-III database
Jupyter Notebook
52
star
4

reproducibility-mimic

Evaluating the reproducibility of mortality prediction studies in the MIMIC-III database
Jupyter Notebook
37
star
5

mechanical-power

Study on mechanical power in MIMIC-III and eICU-CRD
TSQL
31
star
6

tree-prediction-tutorial

Tutorial on prediction with medical data using tree based models
Jupyter Notebook
19
star
7

challenge2012

Python code parsing data from PhysioNet Challenge 2012
Jupyter Notebook
17
star
8

icu-model-transfer

Evaluating methods to improve model transfer for intensive care unit models
Jupyter Notebook
16
star
9

bert-deid

deidentify patient notes using pre-trained BERT
Python
12
star
10

pyroc

Calculate area under the ROC and p-values when comparing predictions
Jupyter Notebook
9
star
11

cvpr-2021-cxr-tutorial

Tutorial introducing chest x-rays and challenges in building deep learning models with them
Jupyter Notebook
7
star
12

model-perf-matlab

Calculate statistics evaluating the performance of binary or continuous predictions output from a model
MATLAB
6
star
13

mimic-analysis-template

A template for conducting an analysis in the MIMIC clinical databases
Jupyter Notebook
5
star
14

auroc-matlab

Code to calculate the AUROC in MATLAB
MATLAB
5
star
15

oasis

Code for calculating the Oxford Acute Severity of Illness Score
Python
4
star
16

process-biases-in-mimic

Evaluating biases in the healthcare process which impact results
Jupyter Notebook
4
star
17

lecture-intro-to-nlp

Jupyter Notebook
4
star
18

icu-care-value

To evaluate the value provided by ICU care across a decade of MIMIC data
Python
3
star
19

pao2-fio2-prediction

Predict the PaO2/FiO2 ratio from non-laboratory derived data
Jupyter Notebook
3
star
20

got-predictions

Making predictions about season 6 of Game of Thrones
Jupyter Notebook
2
star
21

alistairewj.github.io

Personal website built using Hugo and based off the hugo-academic theme
HTML
2
star
22

chexpert-labeler

CheXpert NLP tool to extract observations from radiology reports.
Python
1
star
23

install-sqlite-manager

Quick tutorial on installing SQLite manager
HTML
1
star
24

bert-deid-models

Trained models for use with bert-deid package
1
star
25

aki-progression-prediction

Predict progression of AKI from stage 1 to stage 3 in hospitalized patients
Jupyter Notebook
1
star