MEDS-DEV 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- MEDS_DEV/__init__.py +13 -0
- MEDS_DEV/configs/__init__.py +0 -0
- MEDS_DEV/configs/_build_dataset.yaml +24 -0
- MEDS_DEV/configs/_evaluate_predictions.yaml +22 -0
- MEDS_DEV/configs/_extract_task.yaml +24 -0
- MEDS_DEV/configs/_run_model.yaml +63 -0
- MEDS_DEV/datasets/AUMCdb/README.md +34 -0
- MEDS_DEV/datasets/AUMCdb/predicates.yaml +8 -0
- MEDS_DEV/datasets/MIMIC-IV/README.md +10 -0
- MEDS_DEV/datasets/MIMIC-IV/__init__.py +0 -0
- MEDS_DEV/datasets/MIMIC-IV/commands.yaml +14 -0
- MEDS_DEV/datasets/MIMIC-IV/predicates.yaml +167 -0
- MEDS_DEV/datasets/MIMIC-IV/requirements.txt +1 -0
- MEDS_DEV/datasets/OMOP/README.md +66 -0
- MEDS_DEV/datasets/OMOP/predicates.yaml +52 -0
- MEDS_DEV/datasets/README.md +19 -0
- MEDS_DEV/datasets/UCLA/README.md +33 -0
- MEDS_DEV/datasets/UCLA/predicates.yaml +18 -0
- MEDS_DEV/datasets/__init__.py +22 -0
- MEDS_DEV/datasets/__main__.py +36 -0
- MEDS_DEV/evaluation/README.md +4 -0
- MEDS_DEV/evaluation/__init__.py +5 -0
- MEDS_DEV/evaluation/__main__.py +31 -0
- MEDS_DEV/models/__init__.py +16 -0
- MEDS_DEV/models/__main__.py +203 -0
- MEDS_DEV/models/random_predictor/README.md +5 -0
- MEDS_DEV/models/random_predictor/__init__.py +0 -0
- MEDS_DEV/models/random_predictor/_config.yaml +14 -0
- MEDS_DEV/models/random_predictor/generate_random_predictions.py +81 -0
- MEDS_DEV/models/random_predictor/model.yaml +7 -0
- MEDS_DEV/tasks/README.md +17 -0
- MEDS_DEV/tasks/__init__.py +18 -0
- MEDS_DEV/tasks/__main__.py +55 -0
- MEDS_DEV/tasks/abnormal_lab/README.md +7 -0
- MEDS_DEV/tasks/abnormal_lab/blood_chemistry/elevated_creatinine/first_24h.yaml +64 -0
- MEDS_DEV/tasks/abnormal_lab/blood_chemistry/hyponatremia/first_24h.yaml +64 -0
- MEDS_DEV/tasks/abnormal_lab/blood_chemistry/metabolic_acidosis/first_24h.yaml +64 -0
- MEDS_DEV/tasks/abnormal_lab/cbc/anemia/first_24h.yaml +64 -0
- MEDS_DEV/tasks/abnormal_lab/cbc/leukocytosis/first_24h.yaml +64 -0
- MEDS_DEV/tasks/abnormal_lab/cbc/thrombocytopenia/first_24h.yaml +64 -0
- MEDS_DEV/tasks/abnormal_lab/reduced_echo_derived_LVEF_via_ECG.yaml +45 -0
- MEDS_DEV/tasks/abnormal_lab/vital/hypotension/first_24h.yaml +64 -0
- MEDS_DEV/tasks/disease_progression/README.md +6 -0
- MEDS_DEV/tasks/disease_progression/diabetes/README.md +1 -0
- MEDS_DEV/tasks/disease_progression/diabetes/ckd_post_kidney_labs.yaml +85 -0
- MEDS_DEV/tasks/mortality/README.md +12 -0
- MEDS_DEV/tasks/mortality/in_icu/README.md +7 -0
- MEDS_DEV/tasks/mortality/in_icu/first_24h.yaml +44 -0
- MEDS_DEV/tasks/phenotyping/README.md +5 -0
- MEDS_DEV/tasks/phenotyping/outpatient/MI/1y-5y.yaml +41 -0
- MEDS_DEV/tasks/phenotyping/outpatient/MI/README.md +3 -0
- MEDS_DEV/tasks/phenotyping/outpatient/README.md +2 -0
- MEDS_DEV/tasks/readmission/README.md +20 -0
- MEDS_DEV/tasks/readmission/general_hospital/30d.yaml +51 -0
- MEDS_DEV/tasks/readmission/general_hospital/README.md +4 -0
- MEDS_DEV/utils.py +61 -0
- MEDS_DEV-0.0.1.dist-info/LICENSE +21 -0
- MEDS_DEV-0.0.1.dist-info/METADATA +301 -0
- MEDS_DEV-0.0.1.dist-info/RECORD +62 -0
- MEDS_DEV-0.0.1.dist-info/WHEEL +5 -0
- MEDS_DEV-0.0.1.dist-info/entry_points.txt +5 -0
- MEDS_DEV-0.0.1.dist-info/top_level.txt +1 -0
MEDS_DEV/__init__.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
2
|
+
|
|
3
|
+
from .datasets import DATASETS # noqa: F401
|
|
4
|
+
from .models import MODELS # noqa: F401
|
|
5
|
+
from .tasks import TASKS # noqa: F401
|
|
6
|
+
|
|
7
|
+
__all__ = ["DATASETS", "TASKS", "MODELS"]
|
|
8
|
+
|
|
9
|
+
__package_name__ = "MEDS_DEV"
|
|
10
|
+
try:
|
|
11
|
+
__version__ = version(__package_name__)
|
|
12
|
+
except PackageNotFoundError:
|
|
13
|
+
__version__ = "unknown"
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
defaults:
|
|
2
|
+
- _self_
|
|
3
|
+
|
|
4
|
+
dataset: ???
|
|
5
|
+
output_dir: ???
|
|
6
|
+
demo: False
|
|
7
|
+
temp_dir: null # If null, will be determined automatically to a temporary directory.
|
|
8
|
+
|
|
9
|
+
hydra:
|
|
10
|
+
job:
|
|
11
|
+
name: "meds_dev_build_{dataset}_${now:%Y-%m-%d_%H-%M-%S}"
|
|
12
|
+
run:
|
|
13
|
+
dir: "${output_dir}/.logs"
|
|
14
|
+
help:
|
|
15
|
+
app_name: "MEDS-DEV Dataset Builder Helper"
|
|
16
|
+
|
|
17
|
+
template: |-
|
|
18
|
+
== ${hydra.help.app_name} ==
|
|
19
|
+
${hydra.help.app_name} is a command line tool for building MEDS-DEV compliant datasets.
|
|
20
|
+
|
|
21
|
+
You can specify "dataset" to point to the dataset you want to build, "demo=True" to build the demo
|
|
22
|
+
instead of the full dataset (good for testing), "output_dir" to say where the final, raw MEDS cohort
|
|
23
|
+
should be stored on disk, and "temp_dir" to overwrite the default temporary directory for storing
|
|
24
|
+
intermediated files.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
defaults:
|
|
2
|
+
- _self_
|
|
3
|
+
|
|
4
|
+
predictions_dir: ???
|
|
5
|
+
predictions_path: ${predictions_dir}/**/*.parquet
|
|
6
|
+
output_dir: ???
|
|
7
|
+
|
|
8
|
+
hydra:
|
|
9
|
+
job:
|
|
10
|
+
name: "meds_dev_evaluation_${now:%Y-%m-%d_%H-%M-%S}"
|
|
11
|
+
run:
|
|
12
|
+
dir: "${output_dir}/.logs"
|
|
13
|
+
help:
|
|
14
|
+
app_name: "MEDS-DEV Evaluation Helper"
|
|
15
|
+
|
|
16
|
+
template: |-
|
|
17
|
+
== ${hydra.help.app_name} ==
|
|
18
|
+
${hydra.help.app_name} is a command line tool for evaluating predictions from MEDS-DEV models.
|
|
19
|
+
|
|
20
|
+
Refer to the usage of MEDS-evaluation for more details. You can either specify the predictions path
|
|
21
|
+
directly with `predictions_path` or use the `predictions_dir` to evaluate all predictions in a
|
|
22
|
+
directory, where this can point to the output dir of a model predict step.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
defaults:
|
|
2
|
+
- _self_
|
|
3
|
+
|
|
4
|
+
dataset: ???
|
|
5
|
+
dataset_dir: ???
|
|
6
|
+
task: ???
|
|
7
|
+
output_dir: ???
|
|
8
|
+
|
|
9
|
+
hydra:
|
|
10
|
+
job:
|
|
11
|
+
name: "meds_dev_extract_{task}_for_{dataset}_${now:%Y-%m-%d_%H-%M-%S}"
|
|
12
|
+
run:
|
|
13
|
+
dir: "${output_dir}/.logs"
|
|
14
|
+
help:
|
|
15
|
+
app_name: "MEDS-DEV Task Extractor Helper"
|
|
16
|
+
|
|
17
|
+
template: |-
|
|
18
|
+
== ${hydra.help.app_name} ==
|
|
19
|
+
${hydra.help.app_name} is a command line tool for extracting MEDS-DEV specified tasks from compliant
|
|
20
|
+
datasets.
|
|
21
|
+
|
|
22
|
+
You can specify "dataset" to give the name of the dataset you want to build and "dataset_dir" to point
|
|
23
|
+
to the extracted dataset on disk, "output_dir" to say where the final, labeled task cohort
|
|
24
|
+
should be stored on disk, and "task" to dictate which task should be extracted.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
defaults:
|
|
2
|
+
- _self_
|
|
3
|
+
|
|
4
|
+
dataset_type: supervised
|
|
5
|
+
dataset_dir: ???
|
|
6
|
+
labels_dir: null
|
|
7
|
+
dataset_name: null
|
|
8
|
+
task_name: null
|
|
9
|
+
|
|
10
|
+
temp_dir: ${output_dir}/.temp # This is used because the venv is built here, so persisting it is useful.
|
|
11
|
+
|
|
12
|
+
demo: false
|
|
13
|
+
mode: prediction
|
|
14
|
+
model: ???
|
|
15
|
+
do_overwrite: false
|
|
16
|
+
|
|
17
|
+
split: null # this is only used for training.
|
|
18
|
+
|
|
19
|
+
model_initialization_dir: null
|
|
20
|
+
|
|
21
|
+
output_dir: ???
|
|
22
|
+
|
|
23
|
+
hydra:
|
|
24
|
+
job:
|
|
25
|
+
name: "meds_dev_model_${now:%Y-%m-%d_%H-%M-%S}"
|
|
26
|
+
run:
|
|
27
|
+
dir: "${output_dir}/.logs"
|
|
28
|
+
help:
|
|
29
|
+
app_name: "MEDS-DEV Model Running Helper"
|
|
30
|
+
|
|
31
|
+
template: |-
|
|
32
|
+
== ${hydra.help.app_name} ==
|
|
33
|
+
${hydra.help.app_name} is a command line tool for running MEDS-DEV compliant models.
|
|
34
|
+
|
|
35
|
+
This tool is primarily designed to help model developers ensure that other users can trivially train
|
|
36
|
+
their models over local health datasets and local data owners trivially train and evaluate MEDS-DEV
|
|
37
|
+
models over their data.
|
|
38
|
+
|
|
39
|
+
Models can either be run over either (a) unsupervised data or (b) supervised data, and can be run in any
|
|
40
|
+
of (1) hyperparameter tuning, (2) training, or (3) prediction modes. Various models need not define all
|
|
41
|
+
of the combinations of these modes, and this is by design!
|
|
42
|
+
|
|
43
|
+
The assumed (global) flow is:
|
|
44
|
+
1. unsupervised, train
|
|
45
|
+
2. [optional, for zero-shot] unsupervised, predict
|
|
46
|
+
3. supervised, train
|
|
47
|
+
4. supervised, predict
|
|
48
|
+
|
|
49
|
+
In each of these steps the "model_initialization_dir" parameter is assumed to point to the directory
|
|
50
|
+
specified by the "output_dir" of the prior stage, if such a prior stage is necessary and was run.
|
|
51
|
+
|
|
52
|
+
It is fully acceptable to have no prior stages having been run, and keep model_initialization_dir as
|
|
53
|
+
null. These parameters are merely used as inputs to the customized model run scripts in the model.yaml
|
|
54
|
+
files. The only mandatory stage for participating in MEDS-DEV is supervised, prediction.
|
|
55
|
+
|
|
56
|
+
You can also run in mode=`full` to run all 4 applicable steps in order (with applicability determined by
|
|
57
|
+
what commands are present in the model), with the model_initialization_dir appropriately set in between.
|
|
58
|
+
In this case, `output_dir` should be set to a global "experiment directory" for the series of runs, and
|
|
59
|
+
appropriate sub-dirs will be created and used for the sequence. In this case, if prior stage completion
|
|
60
|
+
is flagged (e.g., if you use the same dir twice), the stage will not be re-run. The directory structure
|
|
61
|
+
used for these will depend on dataset_name and task_name, so those must be set if this mode is used.
|
|
62
|
+
|
|
63
|
+
If do_overwrite is set to true, the output dir will be cleared before anything is run.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# AUMCdb
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
The first freely accessible intensive care database from within the European Union containing de-identified health data related to tens of thousands of European intensive care unit admissions, including demographics, vital signs, laboratory tests and medications.
|
|
6
|
+
|
|
7
|
+
## Access Requirements
|
|
8
|
+
|
|
9
|
+
Taken from [official website](https://amsterdammedicaldatascience.nl/amsterdamumcdb/#requesting-access):
|
|
10
|
+
|
|
11
|
+
- **Access Policy**: Fill out and sign the combined Access and End User License form.
|
|
12
|
+
- **License (for files)**: Specify the license under which the dataset files are distributed.
|
|
13
|
+
- **Data Use Agreement**: Agreement found [here](https://amsterdammedicaldatascience.nl/content/uploads/sites/2/2022/12/arfeula_v1.6.pdf).
|
|
14
|
+
- **Required training**: Valid training courses include the Data or Specimens Only Research (DSOR) course from CITI, the Basic Course for Clinical Investigators (BROK) from NFU or an equivalent course. The DSOR course may be taken free of charge and is also needed to gain access to the MIMIC and eICU intensive care databases from the USA.
|
|
15
|
+
|
|
16
|
+
## Supported Tasks
|
|
17
|
+
|
|
18
|
+
- `tasks/mortality/in_icu/first_24h.yaml`
|
|
19
|
+
|
|
20
|
+
## MEDS-transformation
|
|
21
|
+
|
|
22
|
+
[MEDS_transforms](https://github.com/mmcdermott/MEDS_transforms) now includes the AUMCdb example. Please refer to the [guide](https://github.com/mmcdermott/MEDS_transforms/tree/main/AUMC_Example).
|
|
23
|
+
|
|
24
|
+
## Sources
|
|
25
|
+
|
|
26
|
+
1. [AUMCdb dataset](https://amsterdammedicaldatascience.nl/amsterdamumcdb/)
|
|
27
|
+
2. [AUMCdb Research Paper](https://journals.lww.com/ccmjournal/fulltext/2021/06000/sharing_icu_patient_data_responsibly_under_the.16.aspx)
|
|
28
|
+
3. [AUMCdb Data Use Agreement](https://amsterdammedicaldatascience.nl/content/uploads/sites/2/2022/12/arfeula_v1.6.pdf)
|
|
29
|
+
4. [Data Repository](https://easy.dans.knaw.nl/ui/home)
|
|
30
|
+
5. [Code Repository](https://github.com/AmsterdamUMC/AmsterdamUMCdb)
|
|
31
|
+
|
|
32
|
+
## Disclaimer
|
|
33
|
+
|
|
34
|
+
Please refer to the data owners and the most up-to-date information when using this dataset in your research.
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
build_full: >-
|
|
2
|
+
MEDS_extract-MIMIC_IV
|
|
3
|
+
raw_input_dir="{temp_dir}/raw"
|
|
4
|
+
pre_MEDS_dir="{temp_dir}/pre_MEDS"
|
|
5
|
+
MEDS_cohort_dir="{output_dir}"
|
|
6
|
+
log_dir="{output_dir}/.pipeline_logs"
|
|
7
|
+
|
|
8
|
+
build_demo: >-
|
|
9
|
+
MEDS_extract-MIMIC_IV
|
|
10
|
+
do_demo=True
|
|
11
|
+
raw_input_dir="{temp_dir}/raw"
|
|
12
|
+
pre_MEDS_dir="{temp_dir}/pre_MEDS"
|
|
13
|
+
MEDS_cohort_dir="{output_dir}"
|
|
14
|
+
log_dir="{output_dir}/.pipeline_logs"
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
predicates:
|
|
2
|
+
hospital_admission:
|
|
3
|
+
code: { regex: "^HOSPITAL_ADMISSION//.*" }
|
|
4
|
+
hospital_discharge:
|
|
5
|
+
code: { regex: "^HOSPITAL_DISCHARGE//.*" }
|
|
6
|
+
|
|
7
|
+
ED_registration:
|
|
8
|
+
code: { regex: "^ED_REGISTRATION//.*" }
|
|
9
|
+
ED_discharge:
|
|
10
|
+
code: { regex: "^ED_OUT//.*" }
|
|
11
|
+
|
|
12
|
+
icu_admission:
|
|
13
|
+
code: { regex: "^ICU_ADMISSION//.*" }
|
|
14
|
+
icu_discharge:
|
|
15
|
+
code: { regex: "^ICU_DISCHARGE//.*" }
|
|
16
|
+
|
|
17
|
+
birth:
|
|
18
|
+
code: MEDS_BIRTH
|
|
19
|
+
death:
|
|
20
|
+
code: MEDS_DEATH
|
|
21
|
+
|
|
22
|
+
creatinine_1:
|
|
23
|
+
code: LAB//50912//mg/dL
|
|
24
|
+
creatinine_2:
|
|
25
|
+
code: LAB//52546//mg/dL
|
|
26
|
+
abnormally_high_creatinine_1:
|
|
27
|
+
code: LAB//50912//mg/dL
|
|
28
|
+
value_min: 1.3 # mg/dL
|
|
29
|
+
value_min_inclusive: False
|
|
30
|
+
value_max: null
|
|
31
|
+
abnormally_high_creatinine_2:
|
|
32
|
+
code: LAB//52546//mg/dL
|
|
33
|
+
value_min: 1.3 # mg/dL
|
|
34
|
+
value_min_inclusive: False
|
|
35
|
+
value_max: null
|
|
36
|
+
creatinine:
|
|
37
|
+
expr: or(creatinine_1, creatinine_2)
|
|
38
|
+
abnormally_high_creatinine:
|
|
39
|
+
expr: or(abnormally_high_creatinine_1, abnormally_high_creatinine_2)
|
|
40
|
+
|
|
41
|
+
sodium_1:
|
|
42
|
+
code: LAB//220645//mEq/L
|
|
43
|
+
sodium_2:
|
|
44
|
+
code: LAB//50983//mEq/L
|
|
45
|
+
sodium_3:
|
|
46
|
+
code: LAB//52623//mEq/L
|
|
47
|
+
abnormally_low_sodium_1:
|
|
48
|
+
code: LAB//220645//mEq/L
|
|
49
|
+
value_min: null
|
|
50
|
+
value_max: 135 # mEq/L
|
|
51
|
+
value_max_inclusive: False
|
|
52
|
+
abnormally_low_sodium_2:
|
|
53
|
+
code: LAB//50983//mEq/L
|
|
54
|
+
value_min: null
|
|
55
|
+
value_max: 135 # mEq/L
|
|
56
|
+
value_max_inclusive: False
|
|
57
|
+
abnormally_low_sodium_3:
|
|
58
|
+
code: LAB//52623//mEq/L
|
|
59
|
+
value_min: null
|
|
60
|
+
value_max: 135 # mEq/L
|
|
61
|
+
value_max_inclusive: False
|
|
62
|
+
sodium:
|
|
63
|
+
expr: or(sodium_1, sodium_2, sodium_3)
|
|
64
|
+
abnormally_low_sodium:
|
|
65
|
+
expr: or(abnormally_low_sodium_1, abnormally_low_sodium_2, abnormally_low_sodium_3)
|
|
66
|
+
|
|
67
|
+
bicarbonate_1:
|
|
68
|
+
code: LAB//227443//mEq/L
|
|
69
|
+
bicarbonate_2:
|
|
70
|
+
code: LAB//50882//mEq/L
|
|
71
|
+
abnormally_low_bicarbonate_1:
|
|
72
|
+
code: LAB//227443//mEq/L
|
|
73
|
+
value_min: null
|
|
74
|
+
value_max: 22 # mEq/L
|
|
75
|
+
value_max_inclusive: False
|
|
76
|
+
abnormally_low_bicarbonate_2:
|
|
77
|
+
code: LAB//50882//mEq/L
|
|
78
|
+
value_min: null
|
|
79
|
+
value_max: 22 # mEq/L
|
|
80
|
+
value_max_inclusive: False
|
|
81
|
+
bicarbonate:
|
|
82
|
+
expr: or(bicarbonate_1, bicarbonate_2)
|
|
83
|
+
abnormally_low_bicarbonate:
|
|
84
|
+
expr: or(abnormally_low_bicarbonate_1, abnormally_low_bicarbonate_2)
|
|
85
|
+
|
|
86
|
+
hemoglobin_1:
|
|
87
|
+
code: LAB//220228//g/dl
|
|
88
|
+
hemoglobin_2:
|
|
89
|
+
code: LAB//50811//g/dL
|
|
90
|
+
abnormally_low_hemoglobin_1:
|
|
91
|
+
code: LAB//220228//g/dl
|
|
92
|
+
value_min: null
|
|
93
|
+
value_max: 13 # g/dL
|
|
94
|
+
value_max_inclusive: False
|
|
95
|
+
abnormally_low_hemoglobin_2:
|
|
96
|
+
code: LAB//50811//g/dL
|
|
97
|
+
value_min: null
|
|
98
|
+
value_max: 13 # g/dL
|
|
99
|
+
value_max_inclusive: False
|
|
100
|
+
hemoglobin:
|
|
101
|
+
expr: or(hemoglobin_1, hemoglobin_2)
|
|
102
|
+
abnormally_low_hemoglobin:
|
|
103
|
+
expr: or(abnormally_low_hemoglobin_1, abnormally_low_hemoglobin_2)
|
|
104
|
+
|
|
105
|
+
wbc_1:
|
|
106
|
+
code: LAB//220546//K/uL
|
|
107
|
+
wbc_2:
|
|
108
|
+
code: LAB//51300//K/uL
|
|
109
|
+
abnormally_high_wbc_1:
|
|
110
|
+
code: LAB//220546//K/uL
|
|
111
|
+
value_min: 11 # K/uL
|
|
112
|
+
value_min_inclusive: False
|
|
113
|
+
value_max: null
|
|
114
|
+
abnormally_high_wbc_2:
|
|
115
|
+
code: LAB//51300//K/uL
|
|
116
|
+
value_min: 11 # K/uL
|
|
117
|
+
value_min_inclusive: False
|
|
118
|
+
value_max: null
|
|
119
|
+
wbc:
|
|
120
|
+
expr: or(wbc_1, wbc_2)
|
|
121
|
+
abnormally_high_wbc:
|
|
122
|
+
expr: or(abnormally_high_wbc_1, abnormally_high_wbc_2)
|
|
123
|
+
|
|
124
|
+
platelets_1:
|
|
125
|
+
code: LAB//227457//K/uL
|
|
126
|
+
platelets_2:
|
|
127
|
+
code: LAB//51265//K/uL
|
|
128
|
+
abnormally_low_platelets_1:
|
|
129
|
+
code: LAB//227457//K/uL
|
|
130
|
+
value_min: null
|
|
131
|
+
value_max: 150 # K/uL
|
|
132
|
+
value_max_inclusive: False
|
|
133
|
+
abnormally_low_platelets_2:
|
|
134
|
+
code: LAB//51265//K/uL
|
|
135
|
+
value_min: null
|
|
136
|
+
value_max: 150 # K/uL
|
|
137
|
+
value_max_inclusive: False
|
|
138
|
+
platelets:
|
|
139
|
+
expr: or(platelets_1, platelets_2)
|
|
140
|
+
abnormally_low_platelets:
|
|
141
|
+
expr: or(abnormally_low_platelets_1, abnormally_low_platelets_2)
|
|
142
|
+
|
|
143
|
+
map_1:
|
|
144
|
+
code: LAB//220052//mmHg
|
|
145
|
+
map_2:
|
|
146
|
+
code: LAB//220181//mmHg
|
|
147
|
+
map_3:
|
|
148
|
+
code: LAB//225312//mmHg
|
|
149
|
+
abnormally_low_map_1:
|
|
150
|
+
code: LAB//220052//mmHg
|
|
151
|
+
value_min: null
|
|
152
|
+
value_max: 65 # mmHg
|
|
153
|
+
value_max_inclusive: False
|
|
154
|
+
abnormally_low_map_2:
|
|
155
|
+
code: LAB//220181//mmHg
|
|
156
|
+
value_min: null
|
|
157
|
+
value_max: 65 # mmHg
|
|
158
|
+
value_max_inclusive: False
|
|
159
|
+
abnormally_low_map_3:
|
|
160
|
+
code: LAB//225312//mmHg
|
|
161
|
+
value_min: null
|
|
162
|
+
value_max: 65 # mmHg
|
|
163
|
+
value_max_inclusive: False
|
|
164
|
+
map:
|
|
165
|
+
expr: or(map_1, map_2, map_3)
|
|
166
|
+
abnormally_low_map:
|
|
167
|
+
expr: or(abnormally_low_map_1, abnormally_low_map_2, abnormally_low_map_3)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
MIMIC-IV-MEDS==0.0.2
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# OMOP Dataset Predicates
|
|
2
|
+
|
|
3
|
+
This README provides an overview of predicates defined for the OMOP dataset to represent various healthcare events. Each predicate is defined with specific codes or patterns that are used to identify events, such as admissions, discharges, and other clinical encounters, within the OMOP format.
|
|
4
|
+
|
|
5
|
+
## Predicates Overview
|
|
6
|
+
|
|
7
|
+
### 1. **hospital_admission**
|
|
8
|
+
|
|
9
|
+
- **Codes**:
|
|
10
|
+
- `Visit/IP`: Inpatient visit.
|
|
11
|
+
- `Visit/ERIP`: Emergency room to inpatient visit.
|
|
12
|
+
- `CMS Place of Service/51`: Inpatient Psychiatric Facility.
|
|
13
|
+
- `CMS Place of Service/61`: Comprehensive Inpatient Rehabilitation Facility.
|
|
14
|
+
|
|
15
|
+
### 2. **hospital_discharge**
|
|
16
|
+
|
|
17
|
+
- **Codes**:
|
|
18
|
+
- `CMS Place of Service/12`: Home.
|
|
19
|
+
- `CMS Place of Service/31`: Skilled Nursing Facility.
|
|
20
|
+
- `SNOMED/371827001`: Discharge to another healthcare facility.
|
|
21
|
+
- `PCORNet/Generic-NI`: Noninstitutional (self-care).
|
|
22
|
+
- `SNOMED/397709008`: Hospice care.
|
|
23
|
+
- `Medicare Specialty/A4`: Hospice provider.
|
|
24
|
+
- `CMS Place of Service/21`: Inpatient hospital.
|
|
25
|
+
- `CMS Place of Service/61`: Comprehensive Inpatient Rehabilitation Facility.
|
|
26
|
+
- `CMS Place of Service/51`: Inpatient Psychiatric Facility.
|
|
27
|
+
- `SNOMED/225928004`: Transfer to intermediate care facility.
|
|
28
|
+
- `CMS Place of Service/34`: Hospice.
|
|
29
|
+
- `PCORNet/Generic-OT`: Other.
|
|
30
|
+
- `CMS Place of Service/27`: Ambulatory Surgical Center.
|
|
31
|
+
- `CMS Place of Service/33`: Custodial Care Facility.
|
|
32
|
+
- `CMS Place of Service/09`: Prison/Correctional Facility.
|
|
33
|
+
- `CMS Place of Service/32`: Nursing Facility.
|
|
34
|
+
|
|
35
|
+
### 3. **ED_registration**
|
|
36
|
+
|
|
37
|
+
- **Code**:
|
|
38
|
+
- `Visit/ER`: Emergency room visit.
|
|
39
|
+
|
|
40
|
+
### 4. **ED_discharge**
|
|
41
|
+
|
|
42
|
+
- **Codes**:
|
|
43
|
+
- `CMS Place of Service/12`: Home.
|
|
44
|
+
- `PCORNet/Generic-NI`: Noninstitutional (self-care).
|
|
45
|
+
- `SNOMED/371827001`: Discharge to other healthcare facility.
|
|
46
|
+
- `CMS Place of Service/21`: Inpatient hospital.
|
|
47
|
+
- `NUCC/261Q00000X`: Clinic/Center.
|
|
48
|
+
- `SNOMED/225928004`: Transfer to intermediate care facility.
|
|
49
|
+
- `CMS Place of Service/51`: Inpatient Psychiatric Facility.
|
|
50
|
+
- `CMS Place of Service/23`: Emergency Room - Hospital.
|
|
51
|
+
- `CMS Place of Service/31`: Skilled Nursing Facility.
|
|
52
|
+
- `CMS Place of Service/34`: Hospice.
|
|
53
|
+
- `SNOMED/397709008`: Hospice care.
|
|
54
|
+
- `CMS Place of Service/24`: Ambulatory Surgical Center.
|
|
55
|
+
- `SNOMED/34596002`: Discharge to home under care of a home health service.
|
|
56
|
+
- `PCORNet/Generic-OT`: Other.
|
|
57
|
+
- `CMS Place of Service/09`: Prison/Correctional Facility.
|
|
58
|
+
|
|
59
|
+
### 5. **death**
|
|
60
|
+
|
|
61
|
+
- **Code**:
|
|
62
|
+
- `MEDS_DEATH`: Indicator of patient death.
|
|
63
|
+
|
|
64
|
+
## Usage
|
|
65
|
+
|
|
66
|
+
Each predicate is defined in the YAML file, allowing for flexible querying and filtering of the OMOP dataset. The structure leverages the codes and patterns specified under each predicate to capture relevant patient events.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
predicates:
|
|
2
|
+
hospital_admission:
|
|
3
|
+
code:
|
|
4
|
+
any:
|
|
5
|
+
- "Visit/IP"
|
|
6
|
+
- "Visit/ERIP"
|
|
7
|
+
- "CMS Place of Service/51"
|
|
8
|
+
- "CMS Place of Service/61"
|
|
9
|
+
|
|
10
|
+
hospital_discharge:
|
|
11
|
+
code:
|
|
12
|
+
any:
|
|
13
|
+
- "CMS Place of Service/12"
|
|
14
|
+
- "CMS Place of Service/31"
|
|
15
|
+
- "SNOMED/371827001"
|
|
16
|
+
- "PCORNet/Generic-NI"
|
|
17
|
+
- "SNOMED/397709008"
|
|
18
|
+
- "Medicare Specialty/A4"
|
|
19
|
+
- "CMS Place of Service/21"
|
|
20
|
+
- "CMS Place of Service/61"
|
|
21
|
+
- "CMS Place of Service/51"
|
|
22
|
+
- "SNOMED/225928004"
|
|
23
|
+
- "CMS Place of Service/34"
|
|
24
|
+
- "PCORNet/Generic-OT"
|
|
25
|
+
- "CMS Place of Service/27"
|
|
26
|
+
- "CMS Place of Service/33"
|
|
27
|
+
- "CMS Place of Service/09"
|
|
28
|
+
- "CMS Place of Service/32"
|
|
29
|
+
|
|
30
|
+
ED_registration:
|
|
31
|
+
code: "Visit/ER"
|
|
32
|
+
|
|
33
|
+
ED_discharge:
|
|
34
|
+
code:
|
|
35
|
+
any:
|
|
36
|
+
- "CMS Place of Service/12"
|
|
37
|
+
- "PCORNet/Generic-NI"
|
|
38
|
+
- "SNOMED/371827001"
|
|
39
|
+
- "CMS Place of Service/21"
|
|
40
|
+
- "NUCC/261Q00000X"
|
|
41
|
+
- "SNOMED/225928004"
|
|
42
|
+
- "CMS Place of Service/51"
|
|
43
|
+
- "CMS Place of Service/23"
|
|
44
|
+
- "CMS Place of Service/31"
|
|
45
|
+
- "CMS Place of Service/34"
|
|
46
|
+
- "SNOMED/397709008"
|
|
47
|
+
- "CMS Place of Service/24"
|
|
48
|
+
- "SNOMED/34596002"
|
|
49
|
+
- "PCORNet/Generic-OT"
|
|
50
|
+
- "CMS Place of Service/09"
|
|
51
|
+
death:
|
|
52
|
+
code: MEDS_DEATH
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Datasets
|
|
2
|
+
|
|
3
|
+
This folder contains details for datasets currently included in the MEDS-DEV effort.
|
|
4
|
+
|
|
5
|
+
To contribute a new dataset:
|
|
6
|
+
|
|
7
|
+
1. Fork this repository
|
|
8
|
+
2. Add your dataset predicates file in its respective folder (see `MIMIC-IV/predicates.yaml` for an example of predicate structure)
|
|
9
|
+
3. Test locally to ensure your dataset works correctly. Ideally specify the used packages and versions in the dataset information.
|
|
10
|
+
4. Specify the dataset information (including supported and custom tasks) in the template README.md file in the dataset's folder.
|
|
11
|
+
5. Create a pull request with your changes
|
|
12
|
+
|
|
13
|
+
## Notes
|
|
14
|
+
|
|
15
|
+
If you have a version of a task configuration file that is more specialized to a dataset than can be achieved
|
|
16
|
+
with overwriting the predicates alone, then:
|
|
17
|
+
|
|
18
|
+
1. Make a GitHub issue explaining why the existing file is not used
|
|
19
|
+
2. Add a file here `../tasks/$DATASET_NAME/$TASK_NAME.yaml` with that configuration.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# UCLA DDR MEDS Dataset
|
|
2
|
+
|
|
3
|
+
UCLA Health serves well over half a million patients annually, and as a result, UCLA possesses a vast database of Electronic Health Records (EHR). The stemming Discovery Data Repository (DDR) serves as an invaluable resource for researchers. Within the DDR Medical record concepts and organization, and the UCLA ATLAS Precision Health Biobank which integrates genetic information and de-identified medical records enable precision health research.
|
|
4
|
+
|
|
5
|
+
## Access Requirements
|
|
6
|
+
|
|
7
|
+
In order to gain access you will need to clear and obtain HIPAA compliance. *HIPAA compliance is the practice of following the Health Insurance Portability and Accountability Act (HIPAA) to protect the privacy and security of health information.* The dataset is not publicly available but people within UCLA can help run analysis on your study by sending over **source code** and **model weights** if it is a pre-trained architecture.
|
|
8
|
+
|
|
9
|
+
- **License (for files)**: Specify the license under which the dataset files are distributed. (Pending)
|
|
10
|
+
- **Data Use Agreement**: Specify any data use agreement that must be signed to access the dataset. (Pending)
|
|
11
|
+
|
|
12
|
+
## Supported Tasks
|
|
13
|
+
|
|
14
|
+
Currently the tasks supported by the UCLA-MEDS format are follows:
|
|
15
|
+
|
|
16
|
+
- `tasks/mortality/in_icu/first_24h.yaml`
|
|
17
|
+
|
|
18
|
+
## MEDS-transformation
|
|
19
|
+
|
|
20
|
+
Researchers at UCLA have transformed our DDR database into the medsformat making it quick and easy to run any analyses at our institution.
|
|
21
|
+
|
|
22
|
+
## Sources
|
|
23
|
+
|
|
24
|
+
Summarize the sources of the dataset. If the dataset is a combination of multiple sources, list them here.
|
|
25
|
+
|
|
26
|
+
1. https://link-to-dataset.org
|
|
27
|
+
|
|
28
|
+
## Contact
|
|
29
|
+
|
|
30
|
+
For queries or questions. Feel free to send emails to
|
|
31
|
+
|
|
32
|
+
- Simon A. Lee (simonlee711@g.ucla.edu)
|
|
33
|
+
- Jeffrey N. Chiang (njchiang@g.ucla.edu)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
predicates:
|
|
2
|
+
hospital_admission:
|
|
3
|
+
code: { regex: "^HOSPITAL_ADMISSION//.*" }
|
|
4
|
+
hospital_discharge:
|
|
5
|
+
code: { regex: "^HOSPITAL_DISCHARGE//.*" }
|
|
6
|
+
|
|
7
|
+
ED_registration:
|
|
8
|
+
code: { regex: "^ED_REGISTRATION//.*" }
|
|
9
|
+
ED_discharge:
|
|
10
|
+
code: { regex: "^ED_DISCHARGE//.*" }
|
|
11
|
+
|
|
12
|
+
icu_admission:
|
|
13
|
+
code: { regex: "^ICU_ADMISSION//.*" }
|
|
14
|
+
icu_discharge:
|
|
15
|
+
code: { regex: "^ICU_DISCHARGE//.*" }
|
|
16
|
+
|
|
17
|
+
death:
|
|
18
|
+
code: MORTALITY
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from importlib.resources import files
|
|
2
|
+
|
|
3
|
+
from omegaconf import OmegaConf
|
|
4
|
+
|
|
5
|
+
dataset_files = files("MEDS_DEV.datasets")
|
|
6
|
+
CFG_YAML = files("MEDS_DEV.configs") / "_build_dataset.yaml"
|
|
7
|
+
|
|
8
|
+
DATASETS = {}
|
|
9
|
+
for path in dataset_files.iterdir():
|
|
10
|
+
if not (path.is_dir() and (path / "commands.yaml").exists()):
|
|
11
|
+
continue
|
|
12
|
+
|
|
13
|
+
commands = OmegaConf.load(path / "commands.yaml")
|
|
14
|
+
requirements_path = path / "requirements.txt"
|
|
15
|
+
predicates_path = path / "predicates.yaml"
|
|
16
|
+
DATASETS[path.name] = {
|
|
17
|
+
"commands": commands,
|
|
18
|
+
"predicates": predicates_path if predicates_path.exists() else None,
|
|
19
|
+
"requirements": requirements_path if requirements_path.exists() else None,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
__all__ = ["DATASETS", "CFG_YAML"]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import subprocess
|
|
3
|
+
|
|
4
|
+
logger = logging.getLogger(__name__)
|
|
5
|
+
|
|
6
|
+
import hydra
|
|
7
|
+
from omegaconf import DictConfig
|
|
8
|
+
|
|
9
|
+
from ..utils import temp_env
|
|
10
|
+
from . import CFG_YAML, DATASETS
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@hydra.main(version_base=None, config_path=str(CFG_YAML.parent), config_name=CFG_YAML.stem)
|
|
14
|
+
def main(cfg: DictConfig):
|
|
15
|
+
if cfg.dataset not in DATASETS:
|
|
16
|
+
raise ValueError(f"Dataset {cfg.dataset} not currently configured!")
|
|
17
|
+
|
|
18
|
+
commands = DATASETS[cfg.dataset]["commands"]
|
|
19
|
+
requirements = DATASETS[cfg.dataset]["requirements"]
|
|
20
|
+
|
|
21
|
+
build_cmd = commands["build_demo"] if cfg.demo else commands["build_full"]
|
|
22
|
+
|
|
23
|
+
with temp_env(cfg, requirements) as (build_temp_dir, env):
|
|
24
|
+
build_cmd = build_cmd.format(output_dir=cfg.output_dir, temp_dir=str(build_temp_dir.resolve()))
|
|
25
|
+
|
|
26
|
+
logger.info(f"Running build command: {build_cmd}")
|
|
27
|
+
build_command_out = subprocess.run(
|
|
28
|
+
build_cmd, shell=True, env=env, cwd=build_temp_dir, capture_output=True
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
command_errored = build_command_out.returncode != 0
|
|
32
|
+
if command_errored:
|
|
33
|
+
raise RuntimeError(
|
|
34
|
+
f"Build {cfg.dataset} command {build_cmd} failed with exit code "
|
|
35
|
+
f"{build_command_out.returncode}:\n{build_command_out.stderr.decode()}"
|
|
36
|
+
)
|