Skip to content

Commit

Permalink
fixed e2e meds transform bug with eicu where the extraction config st…
Browse files Browse the repository at this point in the history
…ill had the infusionDrug table. Added ACES and meds-dev label extraction
  • Loading branch information
Oufattole committed Dec 15, 2024
1 parent 27484c5 commit 91d30ee
Show file tree
Hide file tree
Showing 9 changed files with 551 additions and 1,325 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -361,3 +361,5 @@ $RECYCLE.BIN/
meds_env/*
src/MEDS_DEV/demo/download/*
src/MEDS_DEV/demo/content/*

demo/work_dir
662 changes: 543 additions & 119 deletions demo/aces.ipynb

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions demo/configs/extract_MIMIC.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ stage_configs:
infer_schema_length: 999999999
split_and_shard_subjects:
n_subjects_per_shard: 1000
split_fracs:
train: 0.5
tuning: 0.25
held_out: 0.25
split_fracs:
train: 0.5
tuning: 0.25
held_out: 0.25

stages:
- shard_events
Expand Down
3 changes: 1 addition & 2 deletions demo/extract_meds_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3619,7 +3619,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -3635,7 +3635,6 @@
"import tempfile\n",
"import os\n",
"from pathlib import Path\n",
"temp_dir = tempfile.TemporaryDirectory()\n",
"notebook_dir = os.getcwd()\n",
"\n",
"ROOT_DIR=f\"{notebook_dir}/work_dir/eicu_demo/\"\n",
Expand Down
77 changes: 0 additions & 77 deletions demo/meds_tab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,83 +9,6 @@
"# Using an example MEDS tool, ACES for labeling"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"collapsed": true,
"id": "z3_pG9YAWpKy",
"outputId": "efa4c286-413d-4a91-a53d-fb41769cd4f2"
},
"outputs": [],
"source": [
"#@title Install ACES\n",
"\n",
"\n",
"!pip install es-aces"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "H6fqe217XDhi"
},
"outputs": [],
"source": [
"# From the ACES documentation\n",
"\n",
"task_config = \"\"\"\n",
"description: >-\n",
" This file specifies the base configuration for the prediction of a hospital los being greater than 3days,\n",
" leveraging only the first 48 hours of data after admission, with a 24 hour gap between the input window\n",
" and the target window. Patients who die or are discharged in the gap window are excluded. Note that this\n",
" task is in-**hospital** los, not in-**ICU** los which is a different task.\n",
"\n",
"predicates:\n",
" hospital_admission:\n",
" code: {regex: \"HOSPITAL_ADMISSION//.*\"}\n",
" hospital_discharge:\n",
" code: {regex: \"HOSPITAL_DISCHARGE//.*\"}\n",
" death:\n",
" code: MEDS_DEATH\n",
" discharge_or_death:\n",
" expr: or(hospital_discharge, death)\n",
"\n",
"trigger: hospital_admission\n",
"\n",
"windows:\n",
" input:\n",
" start: NULL\n",
" end: trigger + 48h\n",
" start_inclusive: True\n",
" end_inclusive: True\n",
" index_timestamp: end\n",
" gap:\n",
" start: input.end\n",
" end: start + 24h\n",
" start_inclusive: False\n",
" end_inclusive: True\n",
" has:\n",
" hospital_admission: (None, 0)\n",
" discharge_or_death: (None, 0)\n",
" target:\n",
" start: trigger\n",
" end: start + 3d\n",
" start_inclusive: False\n",
" end_inclusive: True\n",
" label: discharge_or_death\n",
"\"\"\"\n",
"!mkdir /content/tasks/ -p\n",
"TASK_NAME = \"in_hospital_3d_los_after_48h\"\n",
"TASK_CONFIG_FP = f\"/content/tasks/{TASK_NAME}.yaml\"\n",
"with open(TASK_CONFIG_FP, 'w') as f:\n",
" f.write(task_config)"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
dependencies = ["meds==0.3.3", "es-aces==0.5.0"]
dependencies = ["meds>=0.3.3", "es-aces>=0.5.0"]

[tool.setuptools_scm]

Expand Down
Loading

0 comments on commit 91d30ee

Please sign in to comment.