Skip to contents

Diagnostics of a codelist of measurement codes in the database

Usage

summariseMeasurementUse(
  cdm,
  codes,
  byConcept = TRUE,
  byYear = FALSE,
  bySex = FALSE,
  ageGroup = NULL,
  dateRange = as.Date(c(NA, NA)),
  estimates = list(measurement_timings = c("min", "q25", "median", "q75", "max",
    "density"), measurement_value_as_numeric = c("min", "q01", "q05", "q25", "median",
    "q75", "q95", "q99", "max", "count_missing", "percentage_missing", "density"),
    measurement_value_as_concept = c("count", "percentage")),
  checks = c("measurement_timings", "measurement_value_as_numeric",
    "measurement_value_as_concept")
)

Arguments

cdm

A reference to the cdm object.

codes

A codelist of measurement/observation codes for which to perform diagnostics.

byConcept

TRUE or FALSE. If TRUE code use will be summarised by concept.

byYear

TRUE or FALSE. If TRUE code use will be summarised by year.

bySex

TRUE or FALSE. If TRUE code use will be summarised by sex.

ageGroup

If not NULL, a list of ageGroup vectors of length two.

dateRange

Two dates. The first indicating the earliest measurement date and the second indicating the latest possible measurement date.

estimates

A named list indicating, for each measurement diagnostics check, which estimates to retrieve. The names of the list should correspond to the diagnostics checks, and each list element should be a character vector specifying the estimates to compute.

Allowed estimates are those supported by the `summariseResult()` function in the **PatientProfiles** package. If omitted, all available estimates for each check will be returned.

checks

Diagnostics to run. Options are: "measurement_timing", "measurement_value_as_numeric", and "measurement_value_as_concept".

Value

A summarised result

Examples

# \donttest{
library(MeasurementDiagnostics)

cdm <- mockMeasurementDiagnostics()

result <- summariseMeasurementUse(
  cdm = cdm, codes = list("test_codelist" = c(3001467L, 45875977L))
)
#> → Getting measurement records based on 2 concepts.
#> → Subsetting records to the subjects and timing of interest.
#> → Getting time between records per person.
#> → Summarising results - value as number.
#> → Summarising results - value as concept.
#> → Binding all diagnostic results.

CDMConnector::cdmDisconnect(cdm = cdm)
# }