Skip to contents

Summarise record counts of an omop_table using a specific time interval. Only records that fall within the observation period are considered.

Usage

summariseRecordCount(
  cdm,
  omopTableName,
  interval = "overall",
  ageGroup = NULL,
  sex = FALSE,
  dateRange = NULL
)

Arguments

cdm

A cdm_reference object.

omopTableName

A character vector of omop tables from the cdm.

interval

Time interval to stratify by. It can either be "years", "quarters", "months" or "overall".

ageGroup

A list of age groups to stratify results by.

sex

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

dateRange

A list containing the minimum and the maximum dates defining the time range within which the analysis is performed.

Value

A summarised_result object.

Examples

# \donttest{
library(dplyr, warn.conflicts = FALSE)

cdm <- mockOmopSketch()

summarisedResult <- summariseRecordCount(
  cdm = cdm,
  omopTableName = c("condition_occurrence", "drug_exposure"),
  interval = "years",
  ageGroup = list("<=20" = c(0,20), ">20" = c(21, Inf)),
  sex = TRUE
)

summarisedResult |>
  glimpse()
#> Rows: 958
#> Columns: 13
#> $ result_id        <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
#> $ cdm_name         <chr> "mockOmopSketch", "mockOmopSketch", "mockOmopSketch",…
#> $ group_name       <chr> "omop_table", "omop_table", "omop_table", "omop_table…
#> $ group_level      <chr> "condition_occurrence", "condition_occurrence", "cond…
#> $ strata_name      <chr> "overall", "age_group", "age_group", "sex", "sex", "o…
#> $ strata_level     <chr> "overall", "<=20", ">20", "Female", "Male", "overall"…
#> $ variable_name    <chr> "Number records", "Number records", "Number records",…
#> $ variable_level   <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ estimate_name    <chr> "count", "count", "count", "count", "count", "count",…
#> $ estimate_type    <chr> "integer", "integer", "integer", "integer", "integer"…
#> $ estimate_value   <chr> "1900", "896", "1004", "990", "910", "1", "3", "2", "…
#> $ additional_name  <chr> "overall", "overall", "overall", "overall", "overall"…
#> $ additional_level <chr> "overall", "overall", "overall", "overall", "overall"…

PatientProfiles::mockDisconnect(cdm = cdm)
# }