Skip to contents

Builds, for every distinct (subject_id, cohort_start_date), the reference script's raw utilization inputs from visit_occurrence (only visits strictly before the admission date inside lookback_days; days_since_* are NA when there is no prior visit), the first admission-day heart rate / SBP / DBP / BUN / creatinine, optionally joins extra_features (labs, elix_*, med_*), and applies engineer_clinical_features(). Mirror of omop_etl.velocity.extract_velocity_features.

Usage

extract_velocity_features(
  con,
  cohort_table = "cohort",
  lookback_days = 365,
  readmit_gap_days = 30,
  ip_concepts = c(9201L, 262L),
  ed_concepts = 9203L,
  os_concepts = 581385L,
  concepts = NULL,
  extra_features = NULL,
  cohort_id = NULL,
  engineer = TRUE
)

Arguments

con

DuckDB DBI connection with visit_occurrence, measurement and the cohort table.

cohort_table

Table or view with subject_id and cohort_start_date (optionally cohort_end_date, cohort_definition_id).

lookback_days, readmit_gap_days

Window lengths in days (>= 1).

ip_concepts, ed_concepts, os_concepts

Visit concept ids counted as inpatient / emergency / observation (outpatient 9202 is not counted by default). The defaults count concept 262 (emergency-to-inpatient) as inpatient only, as the legacy study did.

concepts

Overrides for VELOCITY_CONCEPTS.

extra_features

Optional data.frame joined on subject_id + cohort_start_date.

cohort_id

Optional cohort_definition_id filter.

engineer

If FALSE, return only the raw inputs.

Value

A data.frame.