Skip to contents

Collapse Longitudinal Medication Exposures into Continuous Treatment Episodes

Usage

build_treatment_episodes(
  con,
  target_table = "drug_exposure",
  person_id_col = "person_id",
  concept_id_col = "drug_concept_id",
  start_date_col = "drug_exposure_start_date",
  end_date_col = "drug_exposure_end_date",
  max_gap_days = 30L,
  output_table = NULL
)

Arguments

con

Active DuckDB connection (DBI::dbConnect).

target_table

Source table (default "drug_exposure").

person_id_col

Person ID column.

concept_id_col

Concept ID column.

start_date_col

Exposure start date column.

end_date_col

Exposure end date column.

max_gap_days

Maximum allowed gap days between refills (default 30).

output_table

Optional table to write to.

Value

A data.frame of continuous episodes.