Skip to contents

Under CMS HRRP and traditional binary readmission models, patients who die post-discharge without an acute readmission are often either censored or mislabeled as non-events (survivors), introducing survivor bias into hospital benchmarking.

Usage

prepare_competing_risks_data(
  con,
  cohort_table = "cohort",
  cohort_id = NULL,
  followup_window_days = 30,
  grace_days = 0,
  outcome_visit_concept_ids = c(9201)
)

Arguments

con

Active DuckDB connection.

cohort_table

Source cohort table name containing index stays (default "cohort").

cohort_id

Optional cohort_definition_id to filter cohort_table.

followup_window_days

Observation horizon in days (default 30).

grace_days

Days post-discharge before outcome evaluation begins (default 0).

outcome_visit_concept_ids

Visit concept IDs for readmission (default 9201).

Value

A list with two elements:

  • data: A data.frame with columns subject_id, visit_occurrence_id, cohort_start_date, cohort_end_date, time_days, status, event_type, and composite_event.

  • summary: A list of summary metrics (total patients, counts and crude rates for readmission, competing mortality, censoring, and composite outcomes).

Details

This function formats index stays into a 3-state competing risk survival framework:

  • Status 0: Censored (event-free throughout the entire follow-up window)

  • Status 1: Primary event of interest (acute hospital readmission)

  • Status 2: Competing event (all-cause mortality post-discharge without readmission)