Skip to contents

Summarise code use in patient-level data

Usage

summariseConceptCounts(
  cdm,
  conceptId,
  countBy = c("record", "person"),
  concept = TRUE,
  year = FALSE,
  sex = FALSE,
  ageGroup = NULL
)

Arguments

cdm

A cdm object

conceptId

List of concept IDs to summarise.

countBy

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

concept

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

year

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

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.

Value

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

Examples

# \donttest{

cdm <- mockOmopSketch()

cs <- list(sumatriptan = c(35604883, 35604879, 35604880, 35604884))

results <- summariseConceptCounts(cdm, conceptId = cs)
#>  Getting use of codes from sumatriptan

results
#> # A tibble: 10 × 13
#>    result_id cdm_name       group_name    group_level strata_name strata_level
#>        <int> <chr>          <chr>         <chr>       <chr>       <chr>       
#>  1         1 mockOmopSketch codelist_name sumatriptan overall     overall     
#>  2         1 mockOmopSketch codelist_name sumatriptan overall     overall     
#>  3         1 mockOmopSketch codelist_name sumatriptan overall     overall     
#>  4         1 mockOmopSketch codelist_name sumatriptan overall     overall     
#>  5         1 mockOmopSketch codelist_name sumatriptan overall     overall     
#>  6         1 mockOmopSketch codelist_name sumatriptan overall     overall     
#>  7         1 mockOmopSketch codelist_name sumatriptan overall     overall     
#>  8         1 mockOmopSketch codelist_name sumatriptan overall     overall     
#>  9         1 mockOmopSketch codelist_name sumatriptan overall     overall     
#> 10         1 mockOmopSketch codelist_name sumatriptan 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)
# }