Skip to contents

This function is used to summarise the indication table over multiple cohorts.

Usage

summariseIndication(
  cohort,
  cdm = lifecycle::deprecated(),
  strata = list(),
  minCellCount = lifecycle::deprecated()
)

Arguments

cohort

Cohort with indications and strata

cdm

cdm_reference created by CDMConnector

strata

Stratification list

minCellCount

Minimum counts that a group can have. Cohorts with less counts than this value are obscured.

Value

A Tibble with 4 columns: cohort_definition_id, variable, estimate and value. There will be one row for each cohort, variable and cohort combination.

Examples

# \donttest{
library(DrugUtilisation)
library(PatientProfiles)
library(CodelistGenerator)

cdm <- mockDrugUtilisation()
indications <- list("headache" = 378253, "asthma" = 317009)
cdm <- generateConceptCohortSet(cdm, indications, "indication_cohorts")
acetaminophen <- getDrugIngredientCodes(cdm, "acetaminophen")
cdm <- generateDrugUtilisationCohortSet(cdm, "drug_cohort", acetaminophen)
cdm[["drug_cohort"]] <- cdm[["drug_cohort"]] %>%
  addIndication(
    indicationCohortName = "indication_cohorts",
    indicationGap = c(0, 30, 365)
  )

summariseIndication(cdm[["drug_cohort"]])
#>  The following estimates will be computed:
#>  indication_gap_0_headache: count, percentage
#>  indication_gap_0_asthma: count, percentage
#>  indication_gap_0_none: count, percentage
#>  indication_gap_30_asthma: count, percentage
#>  indication_gap_30_headache: count, percentage
#>  indication_gap_30_none: count, percentage
#>  indication_gap_365_asthma: count, percentage
#>  indication_gap_365_headache: count, percentage
#>  indication_gap_365_none: count, percentage
#> → Start summary of data, at 2024-05-14 15:40:21.131949
#>  Summary finished, at 2024-05-14 15:40:21.204023
#> ! The following variables: result_type, package_name, package_version; were added to `settings`
#> # A tibble: 20 × 13
#>    result_id cdm_name group_name  group_level   strata_name strata_level
#>        <int> <chr>    <chr>       <chr>         <chr>       <chr>       
#>  1         1 DUS MOCK cohort_name acetaminophen overall     overall     
#>  2         1 DUS MOCK cohort_name acetaminophen overall     overall     
#>  3         1 DUS MOCK cohort_name acetaminophen overall     overall     
#>  4         1 DUS MOCK cohort_name acetaminophen overall     overall     
#>  5         1 DUS MOCK cohort_name acetaminophen overall     overall     
#>  6         1 DUS MOCK cohort_name acetaminophen overall     overall     
#>  7         1 DUS MOCK cohort_name acetaminophen overall     overall     
#>  8         1 DUS MOCK cohort_name acetaminophen overall     overall     
#>  9         1 DUS MOCK cohort_name acetaminophen overall     overall     
#> 10         1 DUS MOCK cohort_name acetaminophen overall     overall     
#> 11         1 DUS MOCK cohort_name acetaminophen overall     overall     
#> 12         1 DUS MOCK cohort_name acetaminophen overall     overall     
#> 13         1 DUS MOCK cohort_name acetaminophen overall     overall     
#> 14         1 DUS MOCK cohort_name acetaminophen overall     overall     
#> 15         1 DUS MOCK cohort_name acetaminophen overall     overall     
#> 16         1 DUS MOCK cohort_name acetaminophen overall     overall     
#> 17         1 DUS MOCK cohort_name acetaminophen overall     overall     
#> 18         1 DUS MOCK cohort_name acetaminophen overall     overall     
#> 19         1 DUS MOCK cohort_name acetaminophen overall     overall     
#> 20         1 DUS MOCK cohort_name acetaminophen 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>

cdm[["drug_cohort"]] <- cdm[["drug_cohort"]] %>%
  addAge(ageGroup = list("<40" = c(0, 39), ">=40" = c(40, 150))) %>%
  addSex()

summariseIndication(
  cdm[["drug_cohort"]], strata = list(
    "age_group" = "age_group", "age_group and sex" = c("age_group", "sex")
  )
)
#>  The following estimates will be computed:
#>  indication_gap_0_headache: count, percentage
#>  indication_gap_0_asthma: count, percentage
#>  indication_gap_0_none: count, percentage
#>  indication_gap_30_asthma: count, percentage
#>  indication_gap_30_headache: count, percentage
#>  indication_gap_30_none: count, percentage
#>  indication_gap_365_asthma: count, percentage
#>  indication_gap_365_headache: count, percentage
#>  indication_gap_365_none: count, percentage
#> → Start summary of data, at 2024-05-14 15:40:22.463575
#>  Summary finished, at 2024-05-14 15:40:22.662826
#> ! The following variables: result_type, package_name, package_version; were added to `settings`
#> # A tibble: 120 × 13
#>    result_id cdm_name group_name  group_level   strata_name strata_level
#>        <int> <chr>    <chr>       <chr>         <chr>       <chr>       
#>  1         1 DUS MOCK cohort_name acetaminophen overall     overall     
#>  2         1 DUS MOCK cohort_name acetaminophen overall     overall     
#>  3         1 DUS MOCK cohort_name acetaminophen overall     overall     
#>  4         1 DUS MOCK cohort_name acetaminophen overall     overall     
#>  5         1 DUS MOCK cohort_name acetaminophen overall     overall     
#>  6         1 DUS MOCK cohort_name acetaminophen overall     overall     
#>  7         1 DUS MOCK cohort_name acetaminophen overall     overall     
#>  8         1 DUS MOCK cohort_name acetaminophen overall     overall     
#>  9         1 DUS MOCK cohort_name acetaminophen overall     overall     
#> 10         1 DUS MOCK cohort_name acetaminophen overall     overall     
#> # ℹ 110 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>
# }