Skip to contents

Create a visual table from a summariseClinicalRecord() output

Usage

tableClinicalRecords(
  result,
  header = "cdm_name",
  hide = omopgenerics::settingsColumns(result),
  groupColumn = c("omop_table", omopgenerics::strataColumns(result)),
  type = NULL,
  style = NULL
)

Arguments

result

A summarised_result object (output of summariseClinicalRecords()).

header

A vector specifying the elements to include in the header. The order of elements matters, with the first being the topmost header.

hide

Columns to drop from the output table.

groupColumn

Columns to use as group labels, to see options use visOmopResults::tableColumns(result).

type

Character string specifying the desired output table format. See visOmopResults::tableType() for supported table types. If type = NULL, global options (set via visOmopResults::setGlobalTableOptions()) will be used if available; otherwise, a default 'gt' table is created.

style

Defines the visual formatting of the table. This argument can be provided in one of the following ways:

  1. Pre-defined style: Use the name of a built-in style (e.g., "darwin"). See visOmopResults::tableStyle() for available options.

  2. YAML file path: Provide the path to an existing .yml file defining a new style.

  3. List of custome R code: Supply a block of custom R code or a named list describing styles for each table section. This code must be specific to the selected table type.

If style = NULL, the function will use global options (seevisOmopResults::setGlobalTableOptions()) or a _brand.yml file (if found); otherwise, the default style is applied.

Value

A formatted table visualisation.

Examples

# \donttest{
library(OmopSketch)
library(omock)

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

summarisedResult <- summariseClinicalRecords(
  cdm = cdm,
  omopTableName = c("condition_occurrence", "drug_exposure"),
  recordsPerPerson = c("mean", "sd"),
  inObservation = TRUE,
  standardConcept = TRUE,
  sourceVocabulary = TRUE,
  domainId = TRUE,
  typeConcept = TRUE
)
#> Warning: The `inObservation` argument of `summariseClinicalRecords()` is deprecated as
#> of OmopSketch 1.0.0.
#>  Please use the `quality` argument instead.
#> Warning: The `standardConcept` argument of `summariseClinicalRecords()` is deprecated as
#> of OmopSketch 1.0.0.
#>  Please use the `conceptSummary` argument instead.
#> Warning: The `sourceVocabulary` argument of `summariseClinicalRecords()` is deprecated
#> as of OmopSketch 1.0.0.
#>  Please use the `conceptSummary` argument instead.
#> Warning: The `domainId` argument of `summariseClinicalRecords()` is deprecated as of
#> OmopSketch 1.0.0.
#>  Please use the `conceptSummary` argument instead.
#> Warning: The `typeConcept` argument of `summariseClinicalRecords()` is deprecated as of
#> OmopSketch 1.0.0.
#>  Please use the `conceptSummary` argument instead.
#>  Adding variables of interest to condition_occurrence.
#>  Summarising records per person in condition_occurrence.
#>  Summarising subjects not in person table in condition_occurrence.
#>  Summarising records in observation in condition_occurrence.
#>  Summarising records with start before birth date in condition_occurrence.
#>  Summarising records with end date before start date in condition_occurrence.
#>  Summarising domains in condition_occurrence.
#>  Summarising standard concepts in condition_occurrence.
#>  Summarising source vocabularies in condition_occurrence.
#>  Summarising concept types in condition_occurrence.
#>  Summarising missing data in condition_occurrence.
#>  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.

summarisedResult |>
  suppress(minCellCount = 5) |>
  tableClinicalRecords()
Summary of condition_occurrence, drug_exposure tables
Variable name Variable level Estimate name
Database name
GiBleed
condition_occurrence
Number records N 65,332
Number subjects N (%) 2,694 (100.00%)
Subjects not in person table N (%) 0 (0.00%)
Records per person Mean (SD) 24.25 (7.41)
In observation No N (%) 450 (0.69%)
Yes N (%) 64,882 (99.31%)
Domain Condition N (%) 65,332 (100.00%)
Source vocabulary Icd10cm N (%) 479 (0.73%)
No matching concept N (%) 27 (0.04%)
Snomed N (%) 64,826 (99.23%)
Standard concept Standard N (%) 65,332 (100.00%)
Type concept id Ehr encounter diagnosis N (%) 65,332 (100.00%)
Start date before birth date N (%) 0 (0.00%)
End date before start date N (%) 0 (0.00%)
Column name Condition concept id N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Condition end date N missing data (%) 8,652 (13.24%)
Condition end datetime N missing data (%) 8,652 (13.24%)
Condition occurrence id N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Condition source concept id N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Condition source value N missing data (%) 0 (0.00%)
Condition start date N missing data (%) 0 (0.00%)
Condition start datetime N missing data (%) 0 (0.00%)
Condition status concept id N missing data (%) 0 (0.00%)
N zeros (%) 65,332 (100.00%)
Condition status source value N missing data (%) 65,332 (100.00%)
Condition type concept id N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Person id N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Provider id N missing data (%) 65,332 (100.00%)
N zeros (%) 0 (0.00%)
Stop reason N missing data (%) 65,332 (100.00%)
Visit detail id N missing data (%) 0 (0.00%)
N zeros (%) 65,332 (100.00%)
Visit occurrence id N missing data (%) 64 (0.10%)
N zeros (%) 0 (0.00%)
drug_exposure
Number records N 67,713
Number subjects N (%) 2,694 (100.00%)
Subjects not in person table N (%) 0 (0.00%)
Records per person Mean (SD) 25.13 (5.25)
In observation No N (%) 251 (0.37%)
Yes N (%) 67,462 (99.63%)
Domain Drug N (%) 67,713 (100.00%)
Source vocabulary Cvx N (%) 25,713 (37.97%)
Ndc N (%) 2,694 (3.98%)
No matching concept N (%) 35 (0.05%)
Rxnorm N (%) 39,271 (58.00%)
Standard concept Standard N (%) 67,713 (100.00%)
Type concept id Dispensed in outpatient office N (%) 25,713 (37.97%)
Prescription written N (%) 42,000 (62.03%)
Concept class Branded drug N (%) 68 (0.10%)
Branded drug comp N (%) 145 (0.21%)
Branded pack N (%) 1,640 (2.42%)
Clinical drug N (%) 36,221 (53.49%)
Clinical drug comp N (%) 137 (0.20%)
Cvx N (%) 25,713 (37.97%)
Ingredient N (%) 2,764 (4.08%)
Quant branded drug N (%) 6 (0.01%)
Quant clinical drug N (%) 1,019 (1.50%)
Start date before birth date N (%) <5
End date before start date N (%) 0 (0.00%)
Column name Days supply N missing data (%) 0 (0.00%)
Dose unit source value N missing data (%) 67,707 (100.00%)
Drug concept id N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Drug exposure end date N missing data (%) 0 (0.00%)
Drug exposure end datetime N missing data (%) 0 (0.00%)
Drug exposure id N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Drug exposure start date N missing data (%) 0 (0.00%)
Drug exposure start datetime N missing data (%) 0 (0.00%)
Drug source concept id N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Drug source value N missing data (%) 0 (0.00%)
Drug type concept id N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Lot number N missing data (%) 0 (0.00%)
Person id N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Provider id N missing data (%) 0 (0.00%)
N zeros (%) 67,707 (100.00%)
Quantity N missing data (%) 0 (0.00%)
Refills N missing data (%) 0 (0.00%)
Route concept id N missing data (%) 0 (0.00%)
N zeros (%) 67,707 (100.00%)
Route source value N missing data (%) 67,707 (100.00%)
Sig N missing data (%) 67,707 (100.00%)
Stop reason N missing data (%) 67,707 (100.00%)
Verbatim end date N missing data (%) 5,763 (8.51%)
Visit detail id N missing data (%) 0 (0.00%)
N zeros (%) 67,707 (100.00%)
Visit occurrence id N missing data (%) 520 (0.77%)
N zeros (%) 0 (0.00%)
cdmDisconnect(cdm = cdm) # }