
Cap observation periods of an already-built database at a data cutoff
Source:R/etl_pcornet.R
cap_observation_period.RdFor databases built before max_date = "auto" was used, whose periods end on the build date. Periods ending after
cutoff are shortened to it; periods starting after it are deleted.
Arguments
- con
Active DuckDB connection.
- cutoff
Data cutoff, a date like
"2026-09-30". Unlikemax_date = "auto"at build time, which caps only open-ended enrollment spans and keeps recorded end dates, this shortens every period ending aftercutoff, recorded ends included;"auto"also picks its cutoff heuristically (latest event before today), while here the cutoff is the one you pass.- dry_run
If
TRUE, only count what would change.- by_end_date
If
TRUEwithdry_run = TRUE, also returnby_end_date, a data frame of the end dates (at most 20, most common first) of the periods that would be shortened, for planning a cap. Empty after a real run.