Skip to contents

Thin wrapper over define_study_cohort() that fixes the eDERRI diabetes phenotype: adult (>= 18) inpatient stays of at least one day with diabetes evidence and a 365-day wash-in, with no outcome (target_outcome = "none").

Usage

build_ederri_diabetes_cohort(
  con,
  target_table = "cohort",
  cohort_definition_id = 1,
  random_state = 42,
  persist_keys = NULL,
  materialise = "auto",
  schema = NULL,
  followup_days = NULL,
  require_verified_followup = FALSE,
  transfer_discharge_concept_ids = 8717,
  still_in_hospital_status = "SH",
  diabetes_drug_rule = "names",
  diabetes_rxnorm_cuis = NULL,
  exclude_metformin_only_prediabetes_pcos = FALSE
)

Arguments

con

Active DuckDB DBI connection to an OMOP CDM v5.4 database. May be read-only (see materialise).

target_table

Name of the table the cohort is written to when materialised (default "cohort").

cohort_definition_id

Id written to cohort / cohort_definition (default 1).

random_state

Seed of the "random" rule (default 42).

persist_keys

Path of a CSV (subject_id,visit_occurrence_id, sorted by subject) of the selected index stays. When the file exists the listed stays are preferred over resampling, so selection is identical across re-runs and sites sharing the file; patients missing from it are sampled by sampling_rule and the file is rewritten. It is only written when its content changes (byte-identical for identical selections).

materialise

TRUE writes the cohort to the OMOP cohort / cohort_definition tables (created if missing), exactly as the legacy builders do; rows for the same ids are replaced, so re-running is idempotent. It raises an error on a read-only connection. FALSE leaves the database untouched. "auto" (default) writes unless the connection is read-only, in which case it warns and behaves like FALSE (so the same call works on read-only connections).

schema

Optional schema (or catalog.schema) holding the CDM tables; default resolved via the search path.

followup_days

Length F of the follow-up / outcome horizon in days. Required for every outcome except "none" (where NULL also disables follow-up verification) and in-hospital mortality (ignored).

require_verified_followup

Keep a stay only if it has an outcome event or verified follow-up (default TRUE). Not applicable to in-hospital mortality or when followup_days is NULL. The result column followup_verified is reported either way.

transfer_discharge_concept_ids

Transfer-to-acute-care discharge concepts to exclude (default 8717; integer(0) keeps transfers).

still_in_hospital_status

Discharge source values meaning still in hospital (default "SH"; NULL keeps those stays).

diabetes_drug_rule, diabetes_rxnorm_cuis, exclude_metformin_only_prediabetes_pcos

As in define_study_cohort().