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,
  unit = "year",
  unitInterval = 1,
  ageGroup = NULL,
  sex = FALSE
)

Arguments

cdm

A cdm_reference object.

omopTableName

A character vector of omop tables from the cdm.

unit

Time unit it can either be "year" or "month".

unitInterval

Number of years or months to include within the same interval.

ageGroup

A list of age groups to stratify results by.

sex

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

Value

A summarised_result object.

Examples

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

cdm <- mockOmopSketch()

summarisedResult <- summariseRecordCount(
  cdm = cdm,
  omopTableName = c("condition_occurrence", "drug_exposure"),
  unit = "year",
  unitInterval = 10,
  ageGroup = list("<=20" = c(0,20), ">20" = c(21, Inf)),
  sex = TRUE
)

summarisedResult |>
  glimpse()
#> Rows: 108
#> 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> "age_group &&& sex", "age_group &&& sex", "age_group …
#> $ strata_level     <chr> "<=20 &&& Male", "<=20 &&& Female", "<=20 &&& Female"…
#> $ variable_name    <chr> "incidence_records", "incidence_records", "incidence_…
#> $ variable_level   <chr> "1959-01-01 to 1968-12-31", "1959-01-01 to 1968-12-31…
#> $ estimate_name    <chr> "count", "count", "count", "count", "count", "count",…
#> $ estimate_type    <chr> "integer", "integer", "integer", "integer", "integer"…
#> $ estimate_value   <chr> "20", "43", "61", "50", "27", "23", "130", "57", "10"…
#> $ additional_name  <chr> "time_interval", "time_interval", "time_interval", "t…
#> $ additional_level <chr> "1959-01-01", "1959-01-01", "1969-01-01", "1969-01-01…

PatientProfiles::mockDisconnect(cdm = cdm)
# }