Skip to content

Commit

Permalink
Updated configs for abnormal lab prediction tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Jwoo5 committed Oct 29, 2024
1 parent ab993e8 commit c99c94a
Show file tree
Hide file tree
Showing 13 changed files with 386 additions and 295 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
description: >-
This task predicts whether the patient will have elevated _creatinine_ values within the next 24
hours, given the first 24 hours of their admission to the _hospital_. To be included, 1) patients
must have at least one measurement for _creatinine_ within the next 24 hours after their
admission to the hospital, 2) patients must not have shown elevated _creatinine_ values
previously, and 3) their length of stay in the hospital must be at least 48 hours.
predicates:
hospital_admission: ???
hospital_discharge: ???
birth: ???
death: ???
discharge_or_death:
expr: or(death, hospital_discharge)

# Plain predicates
creatinine:
code: ???
abnormally_high_creatinine:
code: ???
value_min: 1.3 # mg/dL
value_min_inclusive: False
value_max: null

trigger: hospital_admission

windows:
input:
start: null
end: trigger + 24h
start_inclusive: True
end_inclusive: True
index_timestamp: end
# do not allow to have shown elevated creatinine values previously
has:
abnormally_high_creatinine: (None, 0)
# do not allow hospital discharge to happen within the input + target window
no_discharge:
start: trigger
end: start + 48h
start_inclusive: False
end_inclusive: True
has:
hospital_admission: (None, 0)
discharge_or_death: (None, 0)
# do not allow to include children (age <= 18) patients
no_children:
start: end - 6570d # 18 years = 365 * 18 days
end: trigger
start_inclusive: True
end_inclusive: True
has:
birth: (None, 0)
target:
start: input.end
end: start + 24h
start_inclusive: False
end_inclusive: True
has:
creatinine: (1, None)
label: abnormally_high_creatinine
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
description: >-
This task predicts whether the patient will have low _sodium_ values (hyponatremia) within the
next 24 hours, given the first 24 hours of their admission to the _hospital_. To be included,
1) patients must have at least one measurement for _sodium_ within the next 24 hours after their
admission to the hospital, 2) patients must not have shown low _sodium_ values previously, and
3) their length of stay in the hospital must be at least 48 hours.
predicates:
hospital_admission: ???
hospital_discharge: ???
birth: ???
death: ???
discharge_or_death:
expr: or(death, hospital_discharge)

# Plain predicates
sodium:
code: ???
abnormally_low_sodium:
code: ???
value_min: null
value_max: 135 # mEq/L
value_max_inclusive: False

trigger: hospital_admission

windows:
input:
start: null
end: trigger + 24h
start_inclusive: True
end_inclusive: True
index_timestamp: end
# do not allow to have shown low sodium values previously
has:
abnormally_low_sodium: (None, 0)
# do not allow hospital discharge to happen within the input + target window
no_discharge:
start: trigger
end: start + 48h
start_inclusive: False
end_inclusive: True
has:
hospital_admission: (None, 0)
discharge_or_death: (None, 0)
# do not allow to include children (age <= 18) patients
no_children:
start: end - 6570d # 18 years = 365 * 18 days
end: trigger
start_inclusive: True
end_inclusive: True
has:
birth: (None, 0)
target:
start: input.end
end: start + 24h
start_inclusive: False
end_inclusive: True
has:
sodium: (1, None)
label: abnormally_low_sodium
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
description: >-
This task predicts whether the patient will have low _bicarbonate_ values (metabolic acidosis)
within the next 24 hours, given the first 24 hours of their admission to the ICU. To be included,
patients must have at least one measurement for _bicarbonate_ within the next 24 hours after
their admission to ICU, and their length of stay in ICU should be at least 24 hours.
within the next 24 hours, given the first 24 hours of their admission to the hospital. To be
included, 1) patients must have at least one measurement for _bicarbonate_ within the next 24
hours after their admission to the hospital, 2) patients must not have shown low _bicarbonate_
values previously, and 3) their length of stay in the hospital must be at least 48 hours.
predicates:
icu_admission: ???
Expand All @@ -18,9 +19,10 @@ predicates:
abnormally_low_bicarbonate:
code: ???
value_min: null
value_max: ???
value_max: 22 # mEq/L
value_max_inclusive: False

trigger: icu_admission
trigger: hospital_admission

windows:
input:
Expand All @@ -29,15 +31,26 @@ windows:
start_inclusive: True
end_inclusive: True
index_timestamp: end
# do not allow icu discharge to happen within the input + target window.
# do not allow to have shown low bicarbonate values previously
has:
abnormally_low_bicarbonate: (None, 0)
# do not allow hospital discharge to happen within the input + target window
no_discharge:
start: trigger
end: start + 48h
start_inclusive: False
end_inclusive: True
has:
icu_admission: (None, 0)
hospital_admission: (None, 0)
discharge_or_death: (None, 0)
# do not allow to include children (age <= 18) patients
no_children:
start: end - 6570d # 18 years = 365 * 18 days
end: trigger
start_inclusive: True
end_inclusive: True
has:
birth: (None, 0)
target:
start: input.end
end: start + 24h
Expand Down
61 changes: 61 additions & 0 deletions src/MEDS_DEV/tasks/criteria/abnormal_lab/cbc/anemia/first_24h.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
description: >-
This task predicts whether the patient will have low _hemoglobin_ values (anemia) within the next
24 hours, given the first 24 hours of their admission to the _hospital_. To be included,
1) patients must have at least one measurement for _hemoglobin_ within the next 24 hours after
their admission to the hospital, 2) patients must not have shown low _hemoglobin_ values
previously, and 3) their length of stay in the hospital must be at least 48 hours.
predicates:
hospital_admission: ???
hospital_discharge: ???
birth: ???
death: ???
discharge_or_death:
expr: or(death, hospital_discharge)

# Plain predicates
hemoglobin:
code: ???
abnormally_low_hemoglobin:
code: ???
value_min: null
value_max: 13 # g/dL
value_max_inclusive: False

trigger: hospital_admission

windows:
input:
start: null
end: trigger + 24h
start_inclusive: True
end_inclusive: True
index_timestamp: end
# do not allow to have shown low hemoglobin values previously
has:
abnormally_low_hemoglobin: (None, 0)
# do not allow hospital discharge to happen within the input + target window
no_discharge:
start: trigger
end: start + 48h
start_inclusive: False
end_inclusive: True
has:
hospital_admission: (None, 0)
discharge_or_death: (None, 0)
# do not allow to include children (age <= 18) patients
no_children:
start: end - 6570d # 18 years = 365 * 18 days
end: trigger
start_inclusive: True
end_inclusive: True
has:
birth: (None, 0)
target:
start: input.end
end: start + 24h
start_inclusive: False
end_inclusive: True
has:
hemoglobin: (1, None)
label: abnormally_low_hemoglobin
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
description: >-
This task predicts whether the patient will have high _WBC_ values (leukocytosis) within the next
24 hours, given the first 24 hours of their admission to the _hospital_. To be included,
1) patients must have at least one measurement for _WBC_ within the next 24 hours after their
admission to the hospital, 2) patients must not have shown high _WBC_ values previously, and
3) their length of stay in the hospital must be at least 48 hours.
predicates:
hospital_admission: ???
hospital_discharge: ???
birth: ???
death: ???
discharge_or_death:
expr: or(death, hospital_discharge)

# Plain predicates
wbc:
code: ???
abnormally_high_wbc:
code: ???
value_min: 11 # K/uL
value_min_inclusive: False
value_max: null

trigger: hospital_admission

windows:
input:
start: null
end: trigger + 24h
start_inclusive: True
end_inclusive: True
index_timestamp: end
# do not allow to have shown high WBC values previously
has:
abnormally_high_wbc: (None, 0)
# do not allow hospital discharge to happen within the input + target window
no_discharge:
start: trigger
end: start + 48h
start_inclusive: False
end_inclusive: True
has:
hospital_admission: (None, 0)
discharge_or_death: (None, 0)
# do not allow to include children (age <= 18) patients
no_children:
start: end - 6570d # 18 years = 365 * 18 days
end: trigger
start_inclusive: True
end_inclusive: True
has:
birth: (None, 0)
target:
start: input.end
end: start + 24h
start_inclusive: False
end_inclusive: True
has:
wbc: (1, None)
label: abnormally_high_wbc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
description: >-
This task predicts whether the patient will have low _platelets_ values (thrombocytopenia) within
the next 24 hours, given the first 24 hours of their admission to the hospital. To be included,
1) patients must have at least one measurement for _platelets_ within the next 24 hours after
their admission to the hospital, 2) patients must not have shown low _platelets_ values
previously, and 3) their length of stay in the hospital must be at least 48 hours.
predicates:
hospital_admission: ???
hospital_discharge: ???
birth: ???
death: ???
discharge_or_death:
expr: or(death, hospital_discharge)

# Plain predicates
platelets:
code: ???
abnormally_low_platelets:
code: ???
value_min: null
value_max: 150 # K/uL
value_max_inclusive: False

trigger: hospital_admission

windows:
input:
start: null
end: trigger + 24h
start_inclusive: True
end_inclusive: True
index_timestamp: end
# do not allow to have shown low platelets values previously
has:
abnormally_low_platelets: (None, 0)
# do not allow hospital discharge to happen within the input + target window
no_discharge:
start: trigger
end: start + 48h
start_inclusive: False
end_inclusive: True
has:
hospital_admission: (None, 0)
discharge_or_death: (None, 0)
# do not allow to include children (age <= 18) patients
no_children:
start: end - 6570d # 18 years = 365 * 18 days
end: trigger
start_inclusive: True
end_inclusive: True
has:
birth: (None, 0)
target:
start: input.end
end: start + 24h
start_inclusive: False
end_inclusive: True
has:
platelets: (1, None)
label: abnormally_low_platelets
Loading

0 comments on commit c99c94a

Please sign in to comment.