Skip to contents

The period is the span from a person's first to last plausible event, not a real enrolment window. Events dated before min_date (SAS/Excel zero dates such as 1840-12-31 and 1899-12-30, 1900-01-01 placeholders) or after max_date are ignored; a person with no plausible event gets no observation period (FR-C10).

Usage

build_observation_period(
  con,
  min_date = "1900-01-02",
  max_date = "auto",
  use_enrollment = FALSE,
  enrollment_type_concept_id = 0L
)

Arguments

con

Active DuckDB connection

min_date

Earliest plausible event date (default "1900-01-02").

max_date

Latest plausible event date; default "auto" is the latest event dated before today, so events filled with the build date do not set period ends. Pass the source's data cutoff as an ISO date, or NULL for today (the extraction date).

use_enrollment

Logical. If TRUE (needs _enrollment_spans from load_enrollment_spans()), write each person's real enrolment spans with period_type_concept_id = enrollment_type_concept_id and keep the event-span rule only for people with no enrolment record.

enrollment_type_concept_id

period_type_concept_id for enrolment-derived periods (default 0: set your site's concept).