Skip to content

Commit c2b6328

Browse files
authored
Merge pull request #1 from MIT-LCP/main
downstream pr
2 parents 47d1408 + 2aa9e5b commit c2b6328

File tree

194 files changed

+6131
-1630
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+6131
-1630
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Download MIMIC-IV Demo"
2+
description: "Downloads MIMIC-IV demo data from GCP"
3+
inputs:
4+
gcp-project-id:
5+
required: true
6+
description: "The Google Cloud Project ID used for billing usage"
7+
gcp-sa-key:
8+
required: true
9+
description: "The service account key used to authenticate with GCP"
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Authenticate with GCP
14+
uses: 'google-github-actions/auth@v0'
15+
with:
16+
project_id: ${{ inputs.gcp-project-id }}
17+
credentials_json: ${{ inputs.gcp-sa-key }}
18+
19+
- name: Set up Cloud SDK
20+
uses: 'google-github-actions/setup-gcloud@v0'
21+
22+
- name: Download demo data from GCP
23+
run: |
24+
echo "Downloading MIMIC-IV demo from GCP."
25+
gsutil -q -u $PROJECT_ID -m cp -r gs://mimic-iv-archive/v2.0/demo ./
26+
env:
27+
PROJECT_ID: ${{ inputs.gcp-project-id }}
28+
shell: bash

.github/workflows/main.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ jobs:
99
create-tables:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- name: Check out repository code
13+
uses: actions/checkout@v3
1314

14-
- name: Set up Cloud SDK
15-
uses: google-github-actions/setup-gcloud@master
15+
- id: 'auth'
16+
uses: 'google-github-actions/auth@v0'
1617
with:
17-
project_id: ${{ secrets.GCP_PROJECT_ID }}
18-
service_account_key: ${{ secrets.GCP_SA_KEY }}
19-
export_default_credentials: true
18+
project_id: ${{ secrets.GCP_PROJECT_ID }}
19+
credentials_json: ${{ secrets.GCP_SA_KEY }}
20+
21+
- name: 'Set up Cloud SDK'
22+
uses: 'google-github-actions/setup-gcloud@v0'
2023

2124
- name: Run make_concepts
2225
run: |

.github/workflows/mysql.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: mysql demo db build
2+
on:
3+
pull_request_review:
4+
types: [submitted]
5+
6+
jobs:
7+
mimic-iv-mysql:
8+
# only run if PR is approved
9+
if: github.event.review.state == 'approved'
10+
runs-on: ubuntu-22.04
11+
12+
steps:
13+
- name: Check out repository code
14+
uses: actions/checkout@v3
15+
16+
- name: Download demo data
17+
uses: ./.github/actions/download-demo
18+
with:
19+
gcp-project-id: ${{ secrets.GCP_PROJECT_ID }}
20+
gcp-sa-key: ${{ secrets.GCP_SA_KEY }}
21+
22+
- name: Extract demo data to local folder
23+
run: |
24+
mv demo/hosp/*.csv.gz ./
25+
mv demo/icu/*.csv.gz ./
26+
mv demo/ed/*.csv.gz ./
27+
gzip -d *.csv.gz
28+
29+
- name: Start MySQL service
30+
run: |
31+
sudo /etc/init.d/mysql start
32+
mysql -u root -proot -e "SET GLOBAL local_infile=1;"
33+
mysql -u root -proot -e "SET GLOBAL sql_notes=0;"
34+
mysql -u root -proot -e "create database mimic"
35+
36+
- name: Load icu/hosp demo data
37+
run: |
38+
echo "Loading data into mysql."
39+
mysql -u root -proot --local-infile=1 mimic < mimic-iv/buildmimic/mysql/load.sql
40+
mysql -u root -proot mimic < mimic-iv/buildmimic/mysql/validate_demo.sql > results
41+
42+
# if we find "FAILED", then we did not pass the build
43+
if grep -F -q "FAILED" results; then
44+
echo "Failed the following row counts:"
45+
head -n 1 results
46+
grep "FAILED" results
47+
exit 1
48+
else
49+
echo "Built and loaded demo data successfully."
50+
cat results
51+
fi
52+
53+
- name: Load ed demo data
54+
run: |
55+
echo "Loading data into mysql."
56+
mysql -u root -proot --local-infile=1 mimic < mimic-iv-ed/buildmimic/mysql/load.sql
57+
mysql -u root -proot mimic < mimic-iv-ed/buildmimic/mysql/validate_demo.sql > results
58+
59+
# if we find "FAILED", then we did not pass the build
60+
if grep -F -q "FAILED" results; then
61+
echo "Failed the following row counts:"
62+
head -n 1 results
63+
grep "FAILED" results
64+
exit 1
65+
else
66+
echo "Built and loaded demo data successfully."
67+
cat results
68+
fi

.github/workflows/psql.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: psql demo db build
2+
on:
3+
pull_request_review:
4+
types: [submitted]
5+
6+
jobs:
7+
mimic-iv-psql:
8+
# only run if PR is approved
9+
if: github.event.review.state == 'approved'
10+
runs-on: ubuntu-latest
11+
container: node:latest
12+
13+
services:
14+
# Label used to access the service container
15+
postgres:
16+
# Docker Hub image
17+
image: postgres
18+
env:
19+
POSTGRES_PASSWORD: postgres
20+
# Set health checks to wait until postgres has started
21+
options: >-
22+
--health-cmd pg_isready
23+
--health-interval 10s
24+
--health-timeout 5s
25+
--health-retries 5
26+
27+
steps:
28+
- name: Check out repository code
29+
uses: actions/checkout@v3
30+
31+
- name: Download demo data
32+
uses: ./.github/actions/download-demo
33+
with:
34+
gcp-project-id: ${{ secrets.GCP_PROJECT_ID }}
35+
gcp-sa-key: ${{ secrets.GCP_SA_KEY }}
36+
37+
- name: Install postgresql-client
38+
run: |
39+
apt-get update
40+
apt-get install --yes --no-install-recommends postgresql-client
41+
42+
- name: Load icu/hosp data into PostgreSQL
43+
run: |
44+
echo "Loading data into psql."
45+
psql -q -h $POSTGRES_HOST -U postgres -f ${BUILDCODE_PATH}/create.sql
46+
psql -q -h $POSTGRES_HOST -U postgres -v mimic_data_dir=demo -f ${BUILDCODE_PATH}/load_gz.sql
47+
echo "Validating build."
48+
psql -h $POSTGRES_HOST -U postgres -f ${BUILDCODE_PATH}/validate_demo.sql > results
49+
50+
# if we find "FAILED", then we did not pass the build
51+
if grep -F -q "FAILED" results; then
52+
echo "Failed the following row counts:"
53+
head -n 1 results
54+
grep "FAILED" results
55+
exit 1
56+
else
57+
echo "Built and loaded demo data successfully."
58+
cat results
59+
fi
60+
61+
env:
62+
POSTGRES_HOST: postgres
63+
PGPASSWORD: postgres
64+
BUILDCODE_PATH: mimic-iv/buildmimic/postgres
65+
66+
- name: Build mimic-iv concepts
67+
run: |
68+
psql -h $POSTGRES_HOST -U postgres -f postgres-functions.sql
69+
psql -h $POSTGRES_HOST -U postgres -f postgres-make-concepts.sql
70+
working-directory: ./mimic-iv/concepts_postgres
71+
env:
72+
POSTGRES_HOST: postgres
73+
PGPASSWORD: postgres
74+
75+
- name: Load ed data into PostgreSQL
76+
run: |
77+
echo "Loading data into psql."
78+
psql -q -h $POSTGRES_HOST -U postgres -f ${BUILDCODE_PATH}/create.sql
79+
psql -q -h $POSTGRES_HOST -U postgres -v mimic_data_dir=demo/ed -f ${BUILDCODE_PATH}/load_gz.sql
80+
echo "Validating build."
81+
psql -h $POSTGRES_HOST -U postgres -f ${BUILDCODE_PATH}/validate_demo.sql > results
82+
83+
# if we find "FAILED", then we did not pass the build
84+
if grep -F -q "FAILED" results; then
85+
echo "Failed the following row counts:"
86+
head -n 1 results
87+
grep "FAILED" results
88+
exit 1
89+
else
90+
echo "Built and loaded demo data successfully."
91+
cat results
92+
fi
93+
94+
env:
95+
# The hostname used to communicate with the PostgreSQL service container
96+
POSTGRES_HOST: postgres
97+
PGPASSWORD: postgres
98+
# The default PostgreSQL port
99+
POSTGRES_PORT: 5432
100+
BUILDCODE_PATH: mimic-iv-ed/buildmimic/postgres

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# MIMIC Code Repository [![Build Status](https://travis-ci.org/MIT-LCP/mimic-code.svg?branch=main)](https://travis-ci.org/MIT-LCP/mimic-code) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.821872.svg)](https://doi.org/10.5281/zenodo.821872)
1+
# MIMIC Code Repository [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.6818823.svg)](https://doi.org/10.5281/zenodo.6818823)
22

33
The MIMIC Code Repository is intended to be a central hub for sharing, refining, and reusing code used for analysis of the [MIMIC critical care database](https://mimic.mit.edu). To find out more about MIMIC, please see: https://mimic.mit.edu. Source code for the website is in the [mimic-website GitHub repository](https://github.com/MIT-LCP/mimic-website/).
44

@@ -48,7 +48,7 @@ To start this deployment, click the Launch Stack button. On the first screen, t
4848
If you use code or concepts available in this repository, we would be grateful if you would:
4949

5050
- cite the dataset(s) you use as described in the PhysioNet project page: [MIMIC-III](https://physionet.org/content/mimiciii/), [MIMIC-IV](https://physionet.org/content/mimiciv/), [MIMIC-IV-ED](https://physionet.org/content/mimic-iv-ed/) , and/or [MIMIC-CXR](https://physionet.org/content/mimic-cxr/)
51-
- include a DOI for the code rather than a direct link to the GitHub repo, i.e. https://doi.org/10.5281/zenodo.821872
51+
- cite the Zenodo repository directly as it contains a static copy of the code. Be sure to select the release of MIMIC Code you used from the menu on the right side of the page on Zenodo: https://zenodo.org/record/6818823
5252
- cite the MIMIC code repository paper: [The MIMIC Code Repository: enabling reproducibility in critical care research](https://doi.org/10.1093/jamia/ocx084)
5353

5454
```bibtex
@@ -66,7 +66,7 @@ If you use code or concepts available in this repository, we would be grateful i
6666

6767
## Contributing
6868

69-
Our team has worked hard to create and share the MIMIC dataset. We encourage you to share the code that you use for data processing and analysis. Sharing code helps to make studies reproducible and promotes collaborative research. To contribute, please:
69+
Our team has worked hard to create and share the MIMIC datasets. We encourage you to share the code that you use for data processing and analysis. Sharing code helps to make studies reproducible and promotes collaborative research. To contribute, please:
7070

7171
* Fork the repository using the following link: https://github.com/MIT-LCP/mimic-code/fork. For a background on GitHub forks, see: https://help.github.com/articles/fork-a-repo/
7272
* Commit your changes to the forked repository.

mimic-iii/tests/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
numpy==1.18.1
1+
numpy==1.22.0
22
pandas==1.0.3
33
psycopg2==2.8.4
44
python-dateutil==2.8.1
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[
2+
{
3+
"name": "subject_id",
4+
"type": "INT64",
5+
"mode": "REQUIRED"
6+
},
7+
{
8+
"name": "stay_id",
9+
"type": "INT64",
10+
"mode": "REQUIRED"
11+
},
12+
{
13+
"name": "seq_num",
14+
"type": "INT64",
15+
"mode": "REQUIRED"
16+
},
17+
{
18+
"name": "icd_code",
19+
"type": "STRING",
20+
"mode": "REQUIRED"
21+
},
22+
{
23+
"name": "icd_title",
24+
"type": "STRING",
25+
"mode": "REQUIRED"
26+
}
27+
]
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[
2+
{
3+
"name": "subject_id",
4+
"type": "INT64",
5+
"mode": "REQUIRED"
6+
},
7+
{
8+
"name": "hadm_id",
9+
"type": "INT64",
10+
"mode": "NULLABLE"
11+
},
12+
{
13+
"name": "stay_id",
14+
"type": "INT64",
15+
"mode": "REQUIRED"
16+
},
17+
{
18+
"name": "intime",
19+
"type": "DATETIME",
20+
"mode": "REQUIRED"
21+
},
22+
{
23+
"name": "outtime",
24+
"type": "DATETIME",
25+
"mode": "REQUIRED"
26+
},
27+
{
28+
"name": "gender",
29+
"type": "STRING",
30+
"mode": "REQUIRED"
31+
},
32+
{
33+
"name": "race",
34+
"type": "STRING",
35+
"mode": "NULLABLE"
36+
},
37+
{
38+
"name": "arrival_transport",
39+
"type": "STRING",
40+
"mode": "REQUIRED"
41+
},
42+
{
43+
"name": "disposition",
44+
"type": "STRING",
45+
"mode": "NULLABLE"
46+
}
47+
]
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[
2+
{
3+
"name": "subject_id",
4+
"type": "INT64",
5+
"mode": "REQUIRED"
6+
},
7+
{
8+
"name": "stay_id",
9+
"type": "INT64",
10+
"mode": "REQUIRED"
11+
},
12+
{
13+
"name": "charttime",
14+
"type": "DATETIME",
15+
"mode": "NULLABLE"
16+
},
17+
{
18+
"name": "name",
19+
"type": "STRING",
20+
"mode": "NULLABLE"
21+
},
22+
{
23+
"name": "gsn",
24+
"type": "STRING",
25+
"mode": "NULLABLE"
26+
},
27+
{
28+
"name": "ndc",
29+
"type": "STRING",
30+
"mode": "NULLABLE"
31+
},
32+
{
33+
"name": "etc_rn",
34+
"type": "INT64",
35+
"mode": "NULLABLE"
36+
},
37+
{
38+
"name": "etccode",
39+
"type": "STRING",
40+
"mode": "NULLABLE"
41+
},
42+
{
43+
"name": "etcdescription",
44+
"type": "STRING",
45+
"mode": "NULLABLE"
46+
}
47+
]

0 commit comments

Comments
 (0)