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.
#>  The following estimates will be calculated:
#>  duration: mean, sd
#> → Start summary of data, at 2026-05-19 14:11:14.962447
#>  Summary finished, at 2026-05-19 14:11:15.110618
#>  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.
#>  The following estimates will be calculated:
#>  duration: mean, sd
#> → Start summary of data, at 2026-05-19 14:11:19.078509
#>  Summary finished, at 2026-05-19 14:11:19.232177
#>  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 Is required Estimate name
Database name
GiBleed
condition_occurrence
Number records overall N 65,332
Number subjects overall N (%) 2,694 (100.00%)
Subjects not in person table overall N (%) 0 (0.00%)
Records per person overall Mean (SD) 24.25 (7.41)
Duration of records overall Mean (SD) 53.17 (423.43)
In observation No overall N (%) 450 (0.69%)
Yes overall N (%) 64,882 (99.31%)
Domain Condition overall N (%) 65,332 (100.00%)
Standard vocabulary Snomed overall N (%) 65,332 (100.00%)
Source vocabulary Icd10cm overall N (%) 479 (0.73%)
No matching concept overall N (%) 27 (0.04%)
Snomed overall N (%) 64,826 (99.23%)
Standard concept Standard overall N (%) 65,332 (100.00%)
Type concept id Ehr encounter diagnosis overall N (%) 65,332 (100.00%)
Start date before birth date overall N (%) 0 (0.00%)
End date before start date overall N (%) 0 (0.00%)
Column name Condition concept id TRUE N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Condition end date FALSE N missing data (%) 8,652 (13.24%)
Condition end datetime FALSE N missing data (%) 8,652 (13.24%)
Condition occurrence id TRUE N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Condition source concept id FALSE N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Condition source value FALSE N missing data (%) 0 (0.00%)
Condition start date TRUE N missing data (%) 0 (0.00%)
Condition start datetime FALSE N missing data (%) 0 (0.00%)
Condition status concept id FALSE N missing data (%) 0 (0.00%)
N zeros (%) 65,332 (100.00%)
Condition status source value FALSE N missing data (%) 65,332 (100.00%)
Condition type concept id TRUE N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Person id TRUE N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Provider id FALSE N missing data (%) 65,332 (100.00%)
N zeros (%) 0 (0.00%)
Stop reason FALSE N missing data (%) 65,332 (100.00%)
Visit detail id FALSE N missing data (%) 0 (0.00%)
N zeros (%) 65,332 (100.00%)
Visit occurrence id FALSE N missing data (%) 64 (0.10%)
N zeros (%) 0 (0.00%)
drug_exposure
Number records overall N 67,707
Number subjects overall N (%) 2,694 (100.00%)
Subjects not in person table overall N (%) 0 (0.00%)
Records per person overall Mean (SD) 25.13 (5.25)
Duration of records overall Mean (SD) 33.30 (321.51)
In observation No overall N (%) 251 (0.37%)
Yes overall N (%) 67,456 (99.63%)
Domain Drug overall N (%) 67,707 (100.00%)
Standard vocabulary Cvx overall N (%) 25,710 (37.97%)
Rxnorm overall N (%) 41,997 (62.03%)
Source vocabulary Cvx overall N (%) 25,710 (37.97%)
Ndc overall N (%) 2,694 (3.98%)
No matching concept overall N (%) 35 (0.05%)
Rxnorm overall N (%) 39,268 (58.00%)
Standard concept Standard overall N (%) 67,707 (100.00%)
Type concept id Dispensed in outpatient office overall N (%) 25,710 (37.97%)
Prescription written overall N (%) 41,997 (62.03%)
Concept class Branded drug overall N (%) 68 (0.10%)
Branded drug comp overall N (%) 145 (0.21%)
Branded pack overall N (%) 1,640 (2.42%)
Clinical drug overall N (%) 36,218 (53.49%)
Clinical drug comp overall N (%) 137 (0.20%)
Cvx overall N (%) 25,710 (37.97%)
Ingredient overall N (%) 2,764 (4.08%)
Quant branded drug overall N (%) 6 (0.01%)
Quant clinical drug overall N (%) 1,019 (1.51%)
Start date before birth date overall N (%) <5
End date before start date overall N (%) 0 (0.00%)
Column name Days supply FALSE N missing data (%) 0 (0.00%)
Dose unit source value FALSE N missing data (%) 67,707 (100.00%)
Drug concept id TRUE N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Drug exposure end date TRUE N missing data (%) 0 (0.00%)
Drug exposure end datetime FALSE N missing data (%) 0 (0.00%)
Drug exposure id TRUE N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Drug exposure start date TRUE N missing data (%) 0 (0.00%)
Drug exposure start datetime FALSE N missing data (%) 0 (0.00%)
Drug source concept id FALSE N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Drug source value FALSE N missing data (%) 0 (0.00%)
Drug type concept id TRUE N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Lot number FALSE N missing data (%) 0 (0.00%)
Person id TRUE N missing data (%) 0 (0.00%)
N zeros (%) 0 (0.00%)
Provider id FALSE N missing data (%) 0 (0.00%)
N zeros (%) 67,707 (100.00%)
Quantity FALSE N missing data (%) 0 (0.00%)
Refills FALSE N missing data (%) 0 (0.00%)
Route concept id FALSE N missing data (%) 0 (0.00%)
N zeros (%) 67,707 (100.00%)
Route source value FALSE N missing data (%) 67,707 (100.00%)
Sig FALSE N missing data (%) 67,707 (100.00%)
Stop reason FALSE N missing data (%) 67,707 (100.00%)
Verbatim end date FALSE N missing data (%) 5,763 (8.51%)
Visit detail id FALSE N missing data (%) 0 (0.00%)
N zeros (%) 67,707 (100.00%)
Visit occurrence id FALSE N missing data (%) 520 (0.77%)
N zeros (%) 0 (0.00%)
cdmDisconnect(cdm = cdm) # }