Skip to contents

The signature of events filled with the build date. The latest period-end date is compared with the median number of periods ending per day over the preceding 30 days that have any. It is flagged when at least min_periods periods end on it and the count is min_ratio times that median (a genuine data cutoff holds about one ordinary day of ends). The share of all periods is deliberately not tested: 33 ends against a typical day of 1 is unmistakable even when it is 0.015% of 200,000 periods. define_study_cohort() and extract_patient_features() call this.

Usage

check_observation_period_ends(
  con,
  warn = TRUE,
  min_ratio = 10,
  min_periods = 5
)

Arguments

con

Active DuckDB connection.

warn

If TRUE, a flagged result also raises a warning naming cap_observation_period().

min_ratio

Times the typical daily count the latest end date must reach.

min_periods

Fewest periods that must end on the latest date.

Value

A list with flagged, and when a table is found end_date, periods, total and typical_daily. Never errors: a database without observation_period returns list(flagged = FALSE).