Skip to contents

Generates the checks from the CDM DDL (load_cdm_schema()) so every table and field of the CDM is covered, one batched scan per table, and returns them in the OHDSI DQD JSON shape (Metadata, Overview, CheckResults) with category and context (Kahn framework) added. This is the same catalog as omop_etl.dqd_catalog.run_dqd_catalog in Python.

Usage

run_dqd_catalog(
  con,
  output_json = NULL,
  cdm_version = "5.4",
  tables = NULL,
  threshold_pct = 0,
  value_completeness_threshold_pct = 100,
  zero_concept_threshold_pct = 10,
  death_grace_days = 60L,
  today = Sys.Date(),
  strict_domains = FALSE,
  source_concept_threshold_pct = 100,
  person_completeness_threshold_pct = 100
)

Arguments

con

A DBI connection to an OMOP DuckDB.

output_json

Optional path to write the result as JSON.

cdm_version

CDM version recorded in Metadata.

tables

Optional character vector restricting the CDM tables checked.

threshold_pct

A conformance or plausibility check fails when its violating share exceeds this percentage (default 0).

value_completeness_threshold_pct

measureValueCompleteness fails a field at or above this NULL share (default 100, fully empty).

zero_concept_threshold_pct

standardConceptRecordCompleteness fails above this share of *_concept_id = 0 (default 10).

death_grace_days

Days after death that plausibleBeforeDeath tolerates (default 60).

today

Date used by plausibleFutureDate and the birth-year bound (default today).

strict_domains

If TRUE, measurement and observation fields do not accept each other's domain.

source_concept_threshold_pct

sourceConceptRecordCompleteness fails a *_source_concept_id that is 0 in at least this share (default 100).

person_completeness_threshold_pct

measurePersonCompleteness fails a clinical table with no row for at least this share of persons (default 100).

Value

A list with Metadata, Overview and CheckResults.

Details

Checks: cdmTable, cdmField, isRequired, isPrimaryKey, isForeignKey, visitPersonMatch, measureValueCompleteness, standardConceptRecordCompleteness, sourceConceptRecordCompleteness, fkDomain, fkClass, isStandardValidConcept, measurePersonCompleteness, measureConditionEraCompleteness, measureObservationPeriodOverlap, plausibleValueLow, plausibleValueHigh, plausibleStartBeforeEnd, plausibleAfterBirth, plausibleBeforeDeath and plausibleFutureDate. fkDomain, fkClass and isStandardValidConcept need a populated concept table with domain_id / concept_class_id (and standard_concept / invalid_reason); without them those checks are not generated.

plausibleValueLow / plausibleValueHigh check fixed bounds (birth year, days supply, quantity) and the bundled physiologic limits of measurement.value_as_number; the latter apply only to rows whose unit_concept_id matches a limit, so an ETL that leaves it 0 gets NOT_APPLICABLE (use sanitize_measurements() there). Not run: the per-concept checks of the official list (plausibleGender, plausibleUnitConceptIds, ...); report the subset when you cite the result.