Skip to contents

Summarise the characteristics of the base population of a cdm object.

Usage

summarisePopulationCharacteristics(
  cdm,
  studyPeriod = c(NA, NA),
  sex = FALSE,
  ageGroup = NULL
)

Arguments

cdm

A cdm object.

studyPeriod

Dates to trim the observation period. If NA, start_observation_period and/or end_observation_period are used.

sex

Boolean variable. Whether to stratify the results by sex.

ageGroup

List of age groups to stratify by at index date. Set to NULL if no stratification is needed.

Value

A summarised_result object.

Examples

# \donttest{
library(dplyr)
library(OmopSketch)

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

# Run summarise population characteristics
summarisedPopulation <- summarisePopulationCharacteristics(cdm = cdm,
                                                          studyPeriod = c("2010-01-01",NA),
                                                          sex = TRUE,
                                                          ageGroup = NULL
                                                          )
#> Warning: ! 1 casted column in og_003_1726698563 (cohort_set) as do not match expected
#>   column type:
#>  `cohort_definition_id` from numeric to integer
#> Warning: ! 1 column in og_003_1726698563 do not match expected column type:
#>  `cohort_definition_id` is numeric but expected integer
#> ! cohort columns will be reordered to match the expected order:
#>   cohort_definition_id, subject_id, cohort_start_date, and cohort_end_date.
#>  Building new trimmed cohort
#> Warning: ! 1 column in tmp_003_og_005_1726698563 do not match expected column type:
#>  `cohort_definition_id` is numeric but expected integer
#> Creating initial cohort
#> ! cohort columns will be reordered to match the expected order:
#>   cohort_definition_id, subject_id, cohort_start_date, and cohort_end_date.
#> ! cohort columns will be reordered to match the expected order:
#>   cohort_definition_id, subject_id, cohort_start_date, and cohort_end_date.
#>  Cohort trimmed
#>  adding demographics columns
#>  summarising data
#>  summariseCharacteristics finished!
#> ! The following column type were changed:
#>  variable_name: from integer to character
summarisedPopulation |> print()
#> # A tibble: 122 × 13
#>    result_id cdm_name       group_name  group_level  strata_name strata_level
#>        <int> <chr>          <chr>       <chr>        <chr>       <chr>       
#>  1         1 mockOmopSketch cohort_name demographics overall     overall     
#>  2         1 mockOmopSketch cohort_name demographics sex         Female      
#>  3         1 mockOmopSketch cohort_name demographics sex         Male        
#>  4         1 mockOmopSketch cohort_name demographics overall     overall     
#>  5         1 mockOmopSketch cohort_name demographics sex         Female      
#>  6         1 mockOmopSketch cohort_name demographics sex         Male        
#>  7         1 mockOmopSketch cohort_name demographics overall     overall     
#>  8         1 mockOmopSketch cohort_name demographics overall     overall     
#>  9         1 mockOmopSketch cohort_name demographics overall     overall     
#> 10         1 mockOmopSketch cohort_name demographics overall     overall     
#> # ℹ 112 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>
PatientProfiles::mockDisconnect(cdm = cdm)

# }