Skip to contents

Reads target_cohort.sql, outcome_cohort.sql and their Circe JSON from the inst/cohorts/ directory of the omop-duck-db repository and returns the data frame that CohortGenerator::generateCohortSet() takes: one row per cohort with cohortId, cohortName, sql and json. The study parameters @followup_days and @min_age are rendered into the SQL here, so only the four parameters CohortGenerator itself fills in (@cdm_database_schema, @target_database_schema, @target_cohort_table, @target_cohort_id) remain.

Usage

cohort_definition_set(
  cohorts_dir = cohort_definitions_dir(),
  target_cohort_id = 1L,
  outcome_cohort_id = 2L,
  followup_days = 30L,
  min_age = 18L,
  followup_evidence = c("observation_period", "observation_period_or_event")
)

Arguments

cohorts_dir

Directory holding target_cohort.sql, outcome_cohort.sql and the *.circe.json files.

target_cohort_id, outcome_cohort_id

Cohort ids to assign (default 1 and 2).

followup_days

Verified follow-up after discharge in days (default 30).

min_age

Minimum age in years at discharge (default 18).

followup_evidence

"observation_period" (default) or "observation_period_or_event": whether a later visit, measurement, condition or drug record also counts as verified follow-up (FR-D7).

Value

A data frame with columns cohortId, cohortName, sql, json.

Details

The SQL is the authoritative definition. The Circe JSON is hand-written, has not been imported into ATLAS and cannot express the discharge-disposition exclusion; CohortGenerator uses the sql column to generate cohorts.

The shipped SQL creates no inclusion-rule statistics tables (#InclusionRules and friends), so call CohortGenerator::generateCohortSet(..., generateStats = FALSE); with the default it fails.