Add treatment summary to a Drug Utilisation cohort

Marti Catala, Mike Du, Yuchen Guo, Kim Lopez-Guell, Edward Burn, Xintong Li

2024-02-10

Introduction

The DrugUtilisation package incorporates a function to summarise the dose table over multiple cohorts: summariseTreatment(). In this vignette, we will explore the functionalities and usages of this function.

Create mock table

library(DrugUtilisation)
library(CodelistGenerator)
library(CDMConnector)
library(dplyr)
library(PatientProfiles)

cdm <- mockDrugUtilisation(numberIndividual = 200)

new_cohort_set <- cohort_set(cdm$cohort1) %>%
  dplyr::arrange(cohort_definition_id) %>%
  dplyr::mutate(cohort_name = c("asthma","bronchitis","pneumonia"))

cdm$cohort1 <- new_generated_cohort_set(cohort_ref     = cdm$cohort1,
                                        cohort_set_ref = new_cohort_set,
                                        overwrite      = TRUE)

new_cohort_set <- cohort_set(cdm$cohort2) %>%
  dplyr::arrange(cohort_definition_id) %>%
  dplyr::mutate(cohort_name = c("albuterol","fluticasone","montelukast"))

cdm$cohort2 <- new_generated_cohort_set(cohort_ref     = cdm$cohort2,
                                        cohort_set_ref = new_cohort_set,
                                        overwrite      = TRUE)

For the following examples, we will use the cohort cohort1 and cohort2 already created in the mock table.

Notice that cohort1 is a cohort with three subcohorts representing three different conditions:

cohort_set(cdm$cohort1)
#> # A tibble: 3 × 2
#>   cohort_definition_id cohort_name
#>                  <int> <chr>      
#> 1                    1 asthma     
#> 2                    2 bronchitis 
#> 3                    3 pneumonia

And cohort2 is a cohort with three different treatments:

cohort_set(cdm$cohort2)
#> # A tibble: 3 × 2
#>   cohort_definition_id cohort_name
#>                  <int> <chr>      
#> 1                    1 albuterol  
#> 2                    2 fluticasone
#> 3                    3 montelukast

Summarise treatment with summariseTreatmentFromCohort() function

summariseTreatmentFromCohort() function creates a standarised tibble summarising the treatment information (already specified in an existing cohort) over multiple cohorts. There are three mandatory arguments:

  1. cohort: cohort from the cdm object.
  2. treatmentCohortName: name of the treatment cohort’s table.
  3. window: list of the windows where to summarise the treatments.

See an example of its usage below, where we use summariseTreatmentFromCohort() to summarise treatments defined in cohort2 in the cohorts defined in cohort1.

summariseTreatmentFromCohort(cohort = cdm$cohort1,
                   treatmentCohortName = c("cohort2"),
                   window = list(c(0,0), c(1,30)))
#> # A tibble: 48 × 15
#>    cdm_name result_type      package_name package_version group_name group_level
#>    <chr>    <chr>            <chr>        <chr>           <chr>      <chr>      
#>  1 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#>  2 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#>  3 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#>  4 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#>  5 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#>  6 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#>  7 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#>  8 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#>  9 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#> 10 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#> # ℹ 38 more rows
#> # ℹ 9 more variables: strata_name <chr>, strata_level <chr>,
#> #   variable_name <chr>, variable_level <chr>, estimate_name <chr>,
#> #   estimate_type <chr>, estimate_value <chr>, additional_name <chr>,
#> #   additional_level <chr>

strata parameter

We can also stratify our cohort and calculate the estimates within each strata group by using the strata parameter.

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

summariseTreatmentFromCohort(cohort = cdm$cohort1,
                   treatmentCohortName = c("cohort2"),
                   window = list(c(0,0)),
                   treatmentCohortId = 1,
                   strata = list("sex" = "sex", "age" = "age_group")
                   )
#> # A tibble: 60 × 15
#>    cdm_name result_type      package_name package_version group_name group_level
#>    <chr>    <chr>            <chr>        <chr>           <chr>      <chr>      
#>  1 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#>  2 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#>  3 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#>  4 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#>  5 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#>  6 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#>  7 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#>  8 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#>  9 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#> 10 DUS MOCK summarised_trea… DrugUtilisa… 0.5.0           cohort_na… asthma     
#> # ℹ 50 more rows
#> # ℹ 9 more variables: strata_name <chr>, strata_level <chr>,
#> #   variable_name <chr>, variable_level <chr>, estimate_name <chr>,
#> #   estimate_type <chr>, estimate_value <chr>, additional_name <chr>,
#> #   additional_level <chr>

Notice that we have also used the treatmentCohortId parameter to specify that we only want to explore albuterol across the cohorts defined in cohort1.

combination parameter

Soon, you will be able to include combinations of different treatments by using the combination argument. Unfortunately, it has not been implemented yet, stay tuned for the next release! 😄

minCellCount parameter

Specify the minimum number of individuals that a strata group must have in order to appear in the table. Default is set to 5.

Summarise treatment with summariseTreatmentFromConceptSet() function

summariseTreatmentFromCohort() can be used when we have already created our treatment cohort. However, if that is not the case, we can use summariseTreatmentFromConceptSet() to avoid creating a new cohort before using this function. The following arguments have to be provided:

  1. cohort: cohort from the cdm object.
  2. treatmentConceptSet: list with the treatments’ concepts sets.
  3. window: list of the windows where to summarise the treatments.

Unfortunately, is not implemented yet. Stay in the loop for the next release!😉