MyNixOS website logo
Description

Diagnostics for Lists of Codes Based on Measurements.

Diagnostics of list of codes based on concepts from the domains measurement and observation. This package works for data mapped to the Observational Medical Outcomes Partnership Common Data Model.

MeasurementDiagnostics

CRANstatus R-CMD-check Codecov testcoverage Lifecycle:experimental

The MeasurementDiagnostics package provides tools to assess how measurements are recorded and used in data mapped to the OMOP Common Data Model.

Diagnostics can be run either on the full dataset or restricted to a specific cohort, helping users better understand data completeness, frequency, and value distributions for measurements of interest.

Installation

The package can be installed from CRAN:

install.packages("MeasurementDiagnostics")

Or you can install the development version of the package from GitHub:

# install.packages("devtools")
devtools::install_github("ohdsi/MeasurementDiagnostics")

Example

Suppose you are conducting a study that relies on measurements of respiratory function. Before using these measurements analytically, you may want to understand how frequently they are recorded, how values are stored, and whether they vary across subgroups. MeasurementDiagnostics can be used to explore these aspects.

For this example we’ll use the GiBleed mock data.

library(omock)
library(MeasurementDiagnostics)
library(OmopViewer)
library(omopgenerics)
cdm <- mockCdmFromDataset(datasetName = "GiBleed")
#> ℹ Reading GiBleed tables.
#> ℹ Adding drug_strength table.
#> ℹ Creating local <cdm_reference> object.
cdm
#> 
#> ── # OMOP CDM reference (local) of GiBleed ─────────────────────────────────────
#> • omop tables: care_site, cdm_source, concept, concept_ancestor, concept_class,
#> concept_relationship, concept_synonym, condition_era, condition_occurrence,
#> cost, death, device_exposure, domain, dose_era, drug_era, drug_exposure,
#> drug_strength, fact_relationship, location, measurement, metadata, note,
#> note_nlp, observation, observation_period, payer_plan_period, person,
#> procedure_occurrence, provider, relationship, source_to_concept_map, specimen,
#> visit_detail, visit_occurrence, vocabulary
#> • cohort tables: -
#> • achilles tables: -
#> • other tables: -

Now we have a cdm reference with our data, we will create a codelist with measurement concepts.

respiratory_function_codes <- list("respiratory_function" = c(4052083L, 4133840L, 3011505L))

And now we can run all measurement diagnostic checks, stratifying results by sex.

respiratory_function_measurements <- summariseMeasurementUse(
  cdm = cdm, codes = respiratory_function_codes, bySex = TRUE
)

The results include three main components:

  1. A summary of measurement use, including the number of subjects with measurements, the number of measurements per subject, and the time between measurements.

  2. A summary of measurement values recorded as numeric.

  3. A summary of measurement values recorded using concepts.

Visualise results: Tables

Tabular summaries can be produced using the corresponding table functions. For example, the following tables display summaries of numeric values and concept-based values:

tableMeasurementValueAsConcept(
  respiratory_function_measurements,
  hide = c("cdm_name", "domain_id", "value_as_concept_id")
)
Concept nameConcept IDSource concept nameSource concept IDVariable nameValue as concept nameEstimate name
Sex
overallFemaleMale
respiratory_function
overalloveralloveralloverallmeasurement_recordsNo matching conceptN (%)8,728 (100.00%)4,807 (100.00%)3,921 (100.00%)
FEV1/FVC3011505FEV1/FVC3011505measurement_recordsNo matching conceptN (%)2,320 (100.00%)1,374 (100.00%)946 (100.00%)
Measurement of respiratory function4052083Measurement of respiratory function4052083measurement_recordsNo matching conceptN (%)4,088 (100.00%)2,059 (100.00%)2,029 (100.00%)
Spirometry4133840Spirometry4133840measurement_recordsNo matching conceptN (%)2,320 (100.00%)1,374 (100.00%)946 (100.00%)
respiratory_function_measurements |>
  filterGroup(concept_name == "overall") |>
  tableMeasurementValueAsNumber(
    hide = c(
      "concept_name", "concept_id", "source_concept_name", "source_concept_id", 
      "domain_id", "unit_concept_id"
    )
  )
CDM nameUnit concept nameVariable nameVariable levelEstimate name
Sex
overallFemaleMale
respiratory_function
GiBleedNo matching conceptMeasurement recordsN8,7284,8073,921
Value as numberMedian [Q25 – Q75]
Q05 – Q95
Q01 – Q99
Range
Missing value, N (%)8,728 (100.00%)4,807 (100.00%)3,921 (100.00%)

Visualise results: Plots

Each diagnostic result can also be visualised using plotting functions. For instance, the time between measurements can be displayed using boxplots:

respiratory_function_measurements |>
  plotMeasurementSummary( 
    x = "sex", 
    colour = "sex",
    facet = NULL
  ) 

Visualise results: Shiny App

The package OmopViewer supports MeasurementDiagnostics results and provides a user-friendly way of quickly get a shiny app to visualise these results.

exportStaticApp(result = respiratory_function_measurements, directory = tempdir())
Metadata

Version

0.3.0

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows