Skip to contents

Evaluates a SUBSET of Circe, in the ATLAS order: entry events of the Condition, Drug, Procedure, Visit, Measurement, Observation and Device domains (concept sets with descendants and exclusions, ValueAsNumber), the observation window, the primary limit, inclusion rules (windows, occurrence counts, age and gender), DateOffset or default end, era collapse and ExpressionLimit. Constructs that would change who is in the cohort (AdditionalCriteria, includeMapped, nested groups, unevaluated criterion attributes, unknown operators) are an error; CustomEra and censoring criteria only change end dates and warn. For other definitions use CirceR + CohortGenerator.

Usage

compile_circe_to_duckdb(
  circe_json,
  target_cohort_id = 1L,
  cdm_schema = "main",
  stage = NULL
)

Arguments

circe_json

JSON character string, parsed list, or file path.

target_cohort_id

Target cohort definition id (default 1).

cdm_schema

CDM schema name (default "main").

stage

NULL (the cohort), or "_primary_events_raw" (entry events), "_primary_limited" (inside the observation window, after the primary limit) or "_primary_qualified" (after the inclusion rules): returns subject_id, event_start_date of that step. explain_cohort_gaps() uses it.

Value

SQL character string.