
Prior healthcare utilization per cohort row, strictly before the index admission
Source:R/utilization.R
extract_prior_utilization.RdPrior utilization is the strongest single family of readmission predictors. For every cohort row this counts the
visits that precede the index admission: inpatient (IP), emergency (ED) and outpatient (OS) counts, cumulative
length of stay, days since the last encounter and the number of prior 30-day readmissions. The look-back is
strictly before the admission date, so nothing from the index stay (or anything later) can leak into the
features. Mirror of omop_etl.utilization.extract_prior_utilization in Python.
Usage
extract_prior_utilization(
con,
cohort_table = "cohort",
cohort_id = NULL,
lookback_days = 365,
anchor_date = "admission",
visit_concept_groups = NULL,
readmission_gap_days = 30,
readmission_group = "ip",
format = "df"
)Arguments
- con
DuckDB DBI connection with
visit_occurrenceand the cohort table.- cohort_table
Table or view with
subject_idandcohort_start_date. If it also hasvisit_occurrence_idthat visit is excluded explicitly.- cohort_id
Optional
cohort_definition_idfilter.- lookback_days
Window length in days (non-negative integer).
- anchor_date
Only
"admission"is supported: a window anchored at discharge would count the index stay.- visit_concept_groups
Named list
group -> visit_concept_ids. Defaults to DEFAULT_VISIT_CONCEPT_GROUPS. A visit concept may belong to several groups.- readmission_gap_days
Gap for the prior-readmission count.
- readmission_group
Group used for the prior-readmission count (must be a name of the groups).
- format
"df"or"arrow".
Details
Output columns, one row per distinct (subject_id, cohort_start_date) ordered by both:
prior_<group>_count: visits of that group starting in[admission - lookback_days, admission)prior_<group>_los_days: summedvisit_end_date - visit_start_dateof those visits (missing end = same day)days_since_last_encounter: days from the end of the most recent visit of ANY type that started within the look-back to the admission (NAwhen there is none)prior_readmit_<gap>d_count: priorreadmission_groupvisits in the look-back that began withinreadmission_gap_daysdays after the discharge of an earlier visit of that group (any earlier date)