Skip to contents

Summarise concept use in patient-level data. Only concepts recorded during observation period are counted.

Usage

summariseConceptIdCounts(
  cdm,
  omopTableName,
  countBy = "record",
  year = lifecycle::deprecated(),
  interval = "overall",
  sex = FALSE,
  ageGroup = NULL,
  sample = NULL,
  dateRange = NULL
)

Arguments

cdm

A cdm object

omopTableName

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

countBy

Either "record" for record-level counts or "person" for person-level counts

year

deprecated

interval

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

sex

TRUE or FALSE. If TRUE code use will be summarised by sex.

ageGroup

A list of ageGroup vectors of length two. Code use will be thus summarised by age groups.

sample

An integer to sample the tables to only that number of records. If NULL no sample is done.

dateRange

A vector of two dates defining the desired study period. Only the start_date column of the OMOP table is checked to ensure it falls within this range. If dateRange is NULL, no restriction is applied.

Value

A summarised_result object with results overall and, if specified, by strata.

Examples

# \donttest{
library(OmopSketch)
library(CDMConnector)
library(duckdb)
#> Loading required package: DBI

requireEunomia()
#>  `EUNOMIA_DATA_FOLDER` set to: /tmp/RtmpsAnLPD.
#> 
#> Download completed!
con <- dbConnect(duckdb(), eunomiaDir())
#> Creating CDM database /tmp/RtmpsAnLPD/GiBleed_5.3.zip
cdm <- cdmFromCon(con = con, cdmSchema = "main", writeSchema = "main")

summariseConceptIdCounts(cdm, "condition_occurrence")
#> # A tibble: 80 × 13
#>    result_id cdm_name group_name group_level          strata_name strata_level
#>        <int> <chr>    <chr>      <chr>                <chr>       <chr>       
#>  1         1 Synthea  omop_table condition_occurrence overall     overall     
#>  2         1 Synthea  omop_table condition_occurrence overall     overall     
#>  3         1 Synthea  omop_table condition_occurrence overall     overall     
#>  4         1 Synthea  omop_table condition_occurrence overall     overall     
#>  5         1 Synthea  omop_table condition_occurrence overall     overall     
#>  6         1 Synthea  omop_table condition_occurrence overall     overall     
#>  7         1 Synthea  omop_table condition_occurrence overall     overall     
#>  8         1 Synthea  omop_table condition_occurrence overall     overall     
#>  9         1 Synthea  omop_table condition_occurrence overall     overall     
#> 10         1 Synthea  omop_table condition_occurrence overall     overall     
#> # ℹ 70 more rows
#> # ℹ 7 more variables: variable_name <chr>, variable_level <chr>,
#> #   estimate_name <chr>, estimate_type <chr>, estimate_value <chr>,
#> #   additional_name <chr>, additional_level <chr>
# }