Skip to contents

Summarise an omop table from a cdm object. You will obtain information related to the number of records, number of subjects, whether the records are in observation, number of present domains and number of present concepts.

Usage

summariseClinicalRecords(
  cdm,
  omopTableName,
  recordsPerPerson = c("mean", "sd", "median", "q25", "q75", "min", "max"),
  inObservation = TRUE,
  standardConcept = TRUE,
  sourceVocabulary = FALSE,
  domainId = TRUE,
  typeConcept = TRUE,
  sex = FALSE,
  ageGroup = NULL
)

Arguments

cdm

A cdm object.

omopTableName

A character vector of the names of the tables to summarise in the cdm object.

recordsPerPerson

Generates summary statistics for the number of records per person. Set to NULL if no summary statistics are required.

inObservation

Boolean variable. Whether to include the percentage of records in observation.

standardConcept

Boolean variable. Whether to summarise standard concept information.

sourceVocabulary

Boolean variable. Whether to summarise source vocabulary information.

domainId

Boolean variable. Whether to summarise domain id of standard concept id information.

typeConcept

Boolean variable. Whether to summarise type concept id field information.

sex

Boolean variable. Whether to stratify by sex (TRUE) or not (FALSE).

ageGroup

A list of age groups to stratify results by.

Value

A summarised_result object.

Examples

# \donttest{
library(dplyr)
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union
library(CDMConnector)
library(DBI)
library(duckdb)
library(OmopSketch)

# Connect to a mock database
cdm <- mockOmopSketch()

# Run summarise clinical tables
summarisedResult <- summariseClinicalRecords(cdm = cdm,
                                            omopTableName = "condition_occurrence",
                                            recordsPerPerson = c("mean", "sd"),
                                            inObservation = TRUE,
                                            standardConcept = TRUE,
                                            sourceVocabulary = TRUE,
                                            domainId = TRUE,
                                            typeConcept = TRUE)
#>  Summarising table counts
#>  The following estimates will be computed:
#> → Start summary of data, at 2024-09-18 22:29:08.546882
#>  Summary finished, at 2024-09-18 22:29:08.675421
#>  Summarising records per person
#>  The following estimates will be computed:
#>  records_per_person: mean, sd
#> → Start summary of data, at 2024-09-18 22:29:09.42305
#>  Summary finished, at 2024-09-18 22:29:09.615818
#>  Summarising in_observation, standard, domain_id, source, and type information
summarisedResult |> print()
#> # A tibble: 15 × 13
#>    result_id cdm_name       group_name group_level      strata_name strata_level
#>        <int> <chr>          <chr>      <chr>            <chr>       <chr>       
#>  1         1 mockOmopSketch omop_table condition_occur… overall     overall     
#>  2         1 mockOmopSketch omop_table condition_occur… overall     overall     
#>  3         1 mockOmopSketch omop_table condition_occur… overall     overall     
#>  4         1 mockOmopSketch omop_table condition_occur… overall     overall     
#>  5         1 mockOmopSketch omop_table condition_occur… overall     overall     
#>  6         1 mockOmopSketch omop_table condition_occur… overall     overall     
#>  7         1 mockOmopSketch omop_table condition_occur… overall     overall     
#>  8         1 mockOmopSketch omop_table condition_occur… overall     overall     
#>  9         1 mockOmopSketch omop_table condition_occur… overall     overall     
#> 10         1 mockOmopSketch omop_table condition_occur… overall     overall     
#> 11         1 mockOmopSketch omop_table condition_occur… overall     overall     
#> 12         1 mockOmopSketch omop_table condition_occur… overall     overall     
#> 13         1 mockOmopSketch omop_table condition_occur… overall     overall     
#> 14         1 mockOmopSketch omop_table condition_occur… overall     overall     
#> 15         1 mockOmopSketch omop_table condition_occur… overall     overall     
#> # ℹ 7 more variables: variable_name <chr>, variable_level <chr>,
#> #   estimate_name <chr>, estimate_type <chr>, estimate_value <chr>,
#> #   additional_name <chr>, additional_level <chr>
PatientProfiles::mockDisconnect(cdm = cdm)
# }