Skip to contents

Profiles whether the cohort-defining concepts are present, well-mapped, and richly represented in the CDM. Maps to FDA RWE Relevance (are the data fit for the question?). This is the first module to read the vocabulary schema.

Usage

run_concepts(
  con,
  cdm_schema,
  cohort_table = NULL,
  cohort_id = NULL,
  concept_ids,
  domain = "condition",
  vocab_schema = "vocab",
  prevalence_warn_pct = 10,
  prevalence_fail_pct = 1,
  unmapped_warn_pct = 20
)

Arguments

con

A live DBI connection (see cdm_connect()).

cdm_schema

Schema holding the clinical CDM tables.

cohort_table

Cohort table, schema-qualified. Optional and currently unused; reserved for cohort-restricted prevalence in a later version.

cohort_id

Integer cohort definition id. Optional and reserved, see cohort_table.

concept_ids

Numeric vector of cohort-defining seed concept id(s). Their descendants are expanded via {vocab_schema}.concept_ancestor.

domain

Domain the seed concepts live in; one of the names of the internal domain map ("condition", "drug", "measurement", "procedure"). Default "condition".

vocab_schema

Schema holding the vocabulary tables. Default "vocab".

prevalence_warn_pct, prevalence_fail_pct

Concept-prevalence thresholds (percent of CDM persons with at least one descendant record). Below warn flags WARN, below fail flags FAIL. Defaults 10 and 1.

unmapped_warn_pct

Per-domain unmapped-record threshold (percent mapped to concept_id = 0) above which a WARN is flagged. Default 20.

Value

A named list:

prevalence

data.frame: n_with, n_total, pct

ancestor_coverage

data.frame: total_descendants, present_descendants, pct_present

mapping_by_domain

data.frame: domain, n_records, n_unmapped, pct_mapped

flags

character vector of WARN:/FAIL: messages

Examples

if (requireNamespace("duckdb", quietly = TRUE)) {
  con <- example_cdm()
  # 316139 = "Heart failure" (SNOMED), the seed concept in the demo CDM.
  res <- run_concepts(con, cdm_schema = "main", concept_ids = 316139,
                      domain = "condition", vocab_schema = "main")
  res$prevalence
  res$mapping_by_domain
  cdm_disconnect(con)
}