Maps high-level concept sets to standard descendants and aggregates across cohort observation windows.
Usage
aggregate_concept_sets(
con,
cohort_table = "cohort",
cohort_id = NULL,
concept_sets = NULL,
domain = "drug",
lookback_days = 365,
window = "lookback",
as_flag = TRUE,
format = "df"
)Arguments
- con
Active DuckDB DBI connection.
- cohort_table
Cohort table or view name (default "cohort").
- cohort_id
Optional integer cohort definition ID filter.
- concept_sets
Named list of integer vectors of ancestor concept IDs. If NULL and domain="drug", defaults to the 8 core chronic medication classes.
- domain
Character string: "drug", "condition", "procedure", or "measurement".
- lookback_days
Integer lookback window in days (default 365).
- window
Window strategy: "lookback", "stay", or "all".
- as_flag
Logical. If TRUE, returns 0/1 binary indicator; if FALSE, returns event counts.
- format
Output format: "df" or "arrow".
