
Build enrolment spans from the PCORnet ENROLLMENT file
Source:R/etl_pcornet.R
load_enrollment_spans.RdCreates the temporary table _enrollment_spans(person_id, start_date, end_date). Spans are clipped to
[min_date, max_date] (default: today), dropped when empty, and merged when they overlap or touch, so each row is
one continuous enrolment. Persons are matched on person_source_value.
Usage
load_enrollment_spans(
con,
source_dir,
site_id = NULL,
disambiguate_patids = FALSE,
min_date = "1900-01-02",
max_date = NULL,
open_end = NULL
)Arguments
- con
Active DuckDB connection (mapping macros loaded,
personpopulated).- source_dir
Directory of PCORnet source files.
- site_id, disambiguate_patids
As in
etl_pcornet().- min_date, max_date
Clip bounds; see
build_observation_period().- open_end
Optional date given to spans with no end date instead of
max_date;etl_pcornet()passes the data cutoff here underdata_cutoff = "auto", so an ongoing enrolment is not extended to the build date while recorded end dates are kept.