Skip to contents

PhenotypeR diagnostics on the cdm object.

Diagnostics include: * Summarise a cdm_reference object, creating a snapshot with the metadata of the cdm_reference object. * Summarise the observation period table getting some overall statistics in a summarised_result object. * Summarise the person table including demographics (sex, race, ethnicity, year of birth) and related statistics. * Summarise the OMOP clinical tables where the codes associated with your cohort are found.

Usage

databaseDiagnostics(
  cohort,
  snapshot = TRUE,
  personTableSummary = TRUE,
  observationPeriodsSummary = TRUE,
  clinicalRecordsSummary = TRUE
)

Arguments

cohort

Cohort table in a cdm reference

snapshot

Whether to run `OmopSketch::summariseOmopSnapshot()` (TRUE) or not (FALSE).

personTableSummary

Whether to run `OmopSketch::summarisePerson()` (TRUE) or not (FALSE).

observationPeriodsSummary

Whether to run `OmopSketch::summariseObservationPeriod()` (TRUE) or not (FALSE).

clinicalRecordsSummary

Whether to run `OmopSketch::summariseClinicalRecords()` on those clinical tables where the codes associated with your cohort are found (TRUE) or not (FALSE).

Value

A summarised result

Examples

# \donttest{
library(omock)
library(PhenotypeR)
library(CohortConstructor)

cdm <- mockCdmFromDataset(source = "duckdb")
#>  Loading bundled GiBleed tables from package data.
#>  Adding drug_strength table.
#>  Creating local <cdm_reference> object.
#>  Inserting <cdm_reference> into duckdb.

cdm$new_cohort <- conceptCohort(cdm,
                                conceptSet = list("codes" = c(40213201L, 4336464L)),
                                name = "new_cohort")
#>  Subsetting table drug_exposure using 1 concept with domain: drug.
#>  Subsetting table procedure_occurrence using 1 concept with domain: procedure.
#>  Combining tables.
#>  Creating cohort attributes.
#>  Applying cohort requirements.
#>  Merging overlapping records.
#>  Cohort new_cohort created.

 result <- databaseDiagnostics(cohort = cdm$new_cohort)
#>  The following estimates will be calculated:
#>  date_of_birth: density
#> ! Table is collected to memory as not all requested estimates are supported on
#>   the database side
#> → Start summary of data, at 2026-04-10 19:02:09.969598
#>  Summary finished, at 2026-04-10 19:02:10.03481
#>  retrieving cdm object from cdm_table.
#> Warning: ! There are 2649 individuals not included in the person table.
#>  The following estimates will be calculated:
#>  observation_period_start_date: density
#>  observation_period_end_date: density
#> ! Table is collected to memory as not all requested estimates are supported on
#>   the database side
#> → Start summary of data, at 2026-04-10 19:02:13.275753
#>  Summary finished, at 2026-04-10 19:02:13.341723
#>  Adding variables of interest to drug_exposure.
#>  Summarising records per person in drug_exposure.
#>  Summarising subjects not in person table in drug_exposure.
#>  Summarising records in observation in drug_exposure.
#>  Summarising records with start before birth date in drug_exposure.
#>  Summarising records with end date before start date in drug_exposure.
#>  Summarising domains in drug_exposure.
#>  Summarising standard concepts in drug_exposure.
#>  Summarising source vocabularies in drug_exposure.
#>  Summarising concept types in drug_exposure.
#>  Summarising concept class in drug_exposure.
#>  Summarising missing data in drug_exposure.
#>  Adding variables of interest to procedure_occurrence.
#>  Summarising records per person in procedure_occurrence.
#>  Summarising subjects not in person table in procedure_occurrence.
#>  Summarising records in observation in procedure_occurrence.
#>  Summarising records with start before birth date in procedure_occurrence.
#>  Summarising records with end date before start date in procedure_occurrence.
#>  Summarising domains in procedure_occurrence.
#>  Summarising standard concepts in procedure_occurrence.
#>  Summarising source vocabularies in procedure_occurrence.
#>  Summarising concept types in procedure_occurrence.
#>  Summarising missing data in procedure_occurrence.

 CDMConnector::cdmDisconnect(cdm = cdm)
# }