-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e55cd19
commit 635cb77
Showing
2 changed files
with
174 additions
and
134 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,41 @@ | |
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# R Demo for the 2018 BHI & BSN Data Challenge\n", | ||
"# R demo for the 2018 BHI & BSN Data Challenge\n", | ||
"\n", | ||
"This notebook provides a simple introduction to analysing the MIMIC-III database. It was created as a demonstrator for the [2018 BHI & BSN Data Challenge](https://mimic.physionet.org/events/bhibsn-challenge/), which explores the following question:\n", | ||
"\n", | ||
"> Are patients admitted to the intensive care unit (ICU) on a weekend more likely to die in the hospital than those admitted on a weekday?\n", | ||
"\n", | ||
"We have provided an example slide template for final presentations (`slide-template.pptx`) at: https://github.com/MIT-LCP/bhi-bsn-challenge. There is no obligation to use it!" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Background on MIMIC-III\n", | ||
"\n", | ||
"MIMIC-III (‘Medical Information Mart for Intensive Care’) is a large, single-center database comprising information relating to patients admitted to critical care units at a large tertiary care hospital. \n", | ||
"\n", | ||
"Data includes vital signs, medications, laboratory measurements, observations and notes charted by care providers, fluid balance, procedure codes, diagnostic codes, imaging reports, hospital length of stay, survival data, and more. \n", | ||
"\n", | ||
"For details, see: https://mimic.physionet.org/. The data is downloaded as 26 CSV files, which can then be loaded into a database system. Scripts for loading the data into Postgres are provided in the [MIMIC Code Repository](https://mimic.physionet.org/gettingstarted/dbsetup/). A demo dataset is also available: https://mimic.physionet.org/gettingstarted/demo/\n", | ||
"\n", | ||
"Points to note:\n", | ||
"\n", | ||
"- A patient-level shift has been applied to dates. Day of week is retained. \n", | ||
"- Patients aged >89 years on first admission have been reassigned an age of ~300 years.\n", | ||
"- Patients may have multiple hospital admissions. Each hospital admission may comprise multiple ICU stays (e.g. a patient may visit the ICU, leave for surgery, and then return to the ICU for recovery, all within a single hospital admission).\n", | ||
"\n", | ||
"If you need help getting set up with access to MIMIC-III, please contact `[email protected]`." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Connect to the MIMIC-III database\n", | ||
"\n", | ||
"The toughest part is often getting the database running and the software connecting to it. This is the way I usually do it:\n", | ||
"\n", | ||
|
@@ -108,8 +142,6 @@ | |
"\n", | ||
"###\n", | ||
"\n", | ||
"\n", | ||
"\n", | ||
"query = \"\n", | ||
"WITH first_icu AS (\n", | ||
" SELECT i.subject_id, i.hadm_id, i.icustay_id, i.gender, i.admittime admittime_hospital, \n", | ||
|
@@ -306,7 +338,6 @@ | |
} | ||
], | ||
"source": [ | ||
"\n", | ||
"# Have a look at the dataset:\n", | ||
"head(dat)\n", | ||
"\n", | ||
|
@@ -1031,7 +1062,9 @@ | |
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"In the first model (no interaction), we see that although the effect of weekend is almost halved, it remains statistically significant, after adjusting for admission type (p<0.001).\n", | ||
|
@@ -1199,15 +1232,6 @@ | |
"onWeekend %>% inner_join(onWeekday,by=\"admission_type\") %>% mutate(OR=exp((pred.x-pred.y)))\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
|
@@ -1238,7 +1262,7 @@ | |
"mimetype": "text/x-r-source", | ||
"name": "R", | ||
"pygments_lexer": "r", | ||
"version": "3.3.1" | ||
"version": "3.4.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
|