Maps an active admission to the TriggerData evaluation payload. Shared by the sync jobbable
and the Check Triggers dry-run so both evaluate identically.
"Current" = latest by start date: a patient has one UR LOC and is in one program at a time,
so the newest review / newest ongoing stay wins.
Episode facts come from episode, not the admission: patient_admissions has no
projected_discharge_date column at all, and a stay can carry no level while the episode has
one. A nil clinical level makes matchesCurrentValueFilters reject the trigger outright, so
without that fallback a clinical-LOC-filtered trigger never fires for those patients.
Maps an active admission to the
TriggerDataevaluation payload. Shared by the sync jobbable and the Check Triggers dry-run so both evaluate identically."Current" = latest by start date: a patient has one UR LOC and is in one program at a time, so the newest review / newest ongoing stay wins.
Episode facts come from
episode, not the admission:patient_admissionshas noprojected_discharge_datecolumn at all, and a stay can carry no level while the episode has one. A nil clinical level makesmatchesCurrentValueFiltersreject the trigger outright, so without that fallback a clinical-LOC-filtered trigger never fires for those patients.