Skip to contents

Runs two target-cohort SQL files on one CDM and compares them (FR-D8). Both cohorts are written to a TEMP table, so a read-only CDM works. outcome_sql (e.g. outcome_cohort.sql) adds a binary outcome: an outcome event starting in (start, start + followup_days]. R port of omop_etl.cohort_sql.compare_cohort_definitions().

Usage

compare_cohort_definitions(
  con,
  target_a,
  target_b,
  outcome_sql = NULL,
  params_a = list(),
  params_b = list(),
  common_params = list(),
  followup_days = 30L,
  cdm_database_schema = "main"
)

Arguments

con

A DuckDB DBI connection to the CDM.

target_a, target_b

Paths to the two target-cohort SQL files.

outcome_sql

Optional path to the outcome-cohort SQL file.

params_a, params_b

Named lists overriding parameters per definition, e.g. list(followup_evidence = "observation_period_or_event").

common_params

Named list of parameters applied to both definitions.

followup_days

Follow-up window in days (default 30).

cdm_database_schema

CDM schema (default "main").

Value

A list with summary (one row per definition: definition, n, events, outcome_rate) and overlap (the cohort_overlap() table).