Extracts rows from a single OMOP clinical data table, optionally
filtered by concept set, time window, temporal specification, and
custom filters. The output format is controlled by the
representation parameter (long, wide, or features).
Usage
ds.omop.plan.events(
plan,
name,
table,
columns = NULL,
concept_set = NULL,
time_window = NULL,
temporal = NULL,
date_handling = NULL,
filters = NULL,
visit_filter = NULL,
concept_col = NULL,
representation = list(format = "long")
)Arguments
- plan
An
omop_planobject.- name
Character; output name used as a key in the plan's outputs list.
- table
Character; source OMOP table name (e.g.
"condition_occurrence","drug_exposure").- columns
Character vector; columns to include from the table. If
NULL, the server selects default columns.- concept_set
Numeric vector or concept set spec; concept IDs used to filter rows via the standard concept ID column of the table.
- time_window
Named list with
start_dateandend_datefor calendar-based filtering.- temporal
An
omop_temporal_specobject or list; temporal filtering relative to a cohort index date. Seeomop.temporal.- date_handling
A list; date handling specification controlling how date columns are transformed. See
omop.date_handling.- filters
Named list; additional custom filter DSL expressions (nested
and/orof leaves, eachlist(var=, op=, value=)). Validated fail-closed server-side: leaves on identifier or blocked columns, and narrow fingerprinting operators, are rejected. Use this to filter byunit_concept_idor a*_type_concept_idfor unit/type scoping.- visit_filter
Named list
list(concept_ids = ...); restrict events to visits of thosevisit_concept_idvalues via thevisit_occurrence_idlink.- concept_col
Character; override the concept column the
concept_setscopes (default: the table's domain concept), e.g."unit_concept_id"to extract one unit for harmonization.- representation
Named list with
format(one of"long","wide","features", or"sparse") and optional format-specific settings. Wide/features/sparse may setgrainto"person"(default) or"episode"; an index-relative window requires episode grain.
Examples
if (FALSE) { # \dontrun{
plan <- ds.omop.plan()
plan <- ds.omop.plan.events(plan,
name = "conditions",
table = "condition_occurrence",
concept_set = c(201826, 443238),
temporal = omop.temporal(index_window = list(start = -365, end = 0)),
date_handling = omop.date_handling(mode = "relative")
)
} # }