Skip to contents

Registers a cohort definition in cohort_definition and inserts qualifying subject spans into cohort.

Usage

create_cohort(
  con,
  cohort_id,
  cohort_name,
  cohort_description = NULL,
  entry_sql = NULL,
  exit_rule = "fixed_days",
  exit_offset_days = 0
)

Arguments

con

Active DuckDB DBI connection.

cohort_id

Integer unique identifier for this cohort.

cohort_name

Character display name for the cohort.

cohort_description

Optional character description.

entry_sql

SQL string returning candidate events with person_id (or subject_id) and start_date (or cohort_start_date), and optionally end_date.

exit_rule

Character, either "fixed_days" (default) or "from_query".

exit_offset_days

Integer days added to cohort_start_date when exit_rule = "fixed_days".

Value

Integer count of inserted cohort records.