The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

DrugUtilisation

CRANstatus codecov.io R-CMD-check Lifecycle:Experimental

WARNING: This package is under development.

#> Warning: The `groupNameCol` argument of `gtTable()` is deprecated as of visOmopResults
#> 0.3.0.
#> ℹ Please use the `groupColumn` argument instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
amount amount_unit numerator numerator_unit denominator denominator_unit formula
- - number microgram number hour time based with denominator: if (denominator>24) {numerator * 24 / denominator} else {numerator}
- - number milligram number hour time based with denominator: if (denominator>24) {numerator * 24 / denominator} else {numerator}
- - number unit number hour time based with denominator: if (denominator>24) {numerator * 24 / denominator} else {numerator}
- - number microgram - hour time based no denominator: 24 * numerator
- - number milligram - hour time based no denominator: 24 * numerator
number international unit - - - - fixed amount formulation: quantity * amount / days exposed
number microgram - - - - fixed amount formulation: quantity * amount / days exposed
number milliequivalent - - - - fixed amount formulation: quantity * amount / days exposed
number milligram - - - - fixed amount formulation: quantity * amount / days exposed
number milliliter - - - - fixed amount formulation: quantity * amount / days exposed
number unit - - - - fixed amount formulation: quantity * amount / days exposed
- - number international unit number milligram concentration formulation: quantity * numerator / days exposed
- - number international unit number milliliter concentration formulation: quantity * numerator / days exposed
- - number milliequivalent number milliliter concentration formulation: quantity * numerator / days exposed
- - number milligram number Actuation concentration formulation: quantity * numerator / days exposed
- - number milligram number liter concentration formulation: quantity * numerator / days exposed
- - number milligram number milligram concentration formulation: quantity * numerator / days exposed
- - number milligram number milliliter concentration formulation: quantity * numerator / days exposed
- - number milligram number square centimeter concentration formulation: quantity * numerator / days exposed
- - number milliliter number milligram concentration formulation: quantity * numerator / days exposed
- - number milliliter number milliliter concentration formulation: quantity * numerator / days exposed
- - number unit number Actuation concentration formulation: quantity * numerator / days exposed
- - number unit number milligram concentration formulation: quantity * numerator / days exposed
- - number unit number milliliter concentration formulation: quantity * numerator / days exposed
- - number unit number square centimeter concentration formulation: quantity * numerator / days exposed
- - number international unit - milligram concentration formulation: quantity * numerator / days exposed
- - number international unit - milliliter concentration formulation: quantity * numerator / days exposed
- - number mega-international unit - milliliter concentration formulation: quantity * numerator / days exposed
- - number milliequivalent - milligram concentration formulation: quantity * numerator / days exposed
- - number milliequivalent - milliliter concentration formulation: quantity * numerator / days exposed
- - number milligram - Actuation concentration formulation: quantity * numerator / days exposed
- - number milligram - liter concentration formulation: quantity * numerator / days exposed
- - number milligram - milligram concentration formulation: quantity * numerator / days exposed
- - number milligram - milliliter concentration formulation: quantity * numerator / days exposed
- - number milligram - square centimeter concentration formulation: quantity * numerator / days exposed
- - number milliliter - milligram concentration formulation: quantity * numerator / days exposed
- - number milliliter - milliliter concentration formulation: quantity * numerator / days exposed
- - number unit - Actuation concentration formulation: quantity * numerator / days exposed
- - number unit - milligram concentration formulation: quantity * numerator / days exposed
- - number unit - milliliter concentration formulation: quantity * numerator / days exposed
- - number unit - square centimeter concentration formulation: quantity * numerator / days exposed

Package overview

DrugUtilisation contains functions to instantiate and characterize the cohorts used in a Drug Utilisation Study in the OMOP common data model. Main functionalities are:

Example

First, we need to create a cdm reference for the data we´ll be using. Here we´ll generate an example with simulated data, but to see how you would set this up for your database please consult the CDMConnector package connection examples.

The package also provides a functionality to generate a mockDrugUtilisation cdm reference:

library(DrugUtilisation)
cdm <- mockDrugUtilisation(numberIndividual = 100)

Create a cohort of drug use

To create a cohort we will need a conceptList, this can be read from json files:

conceptList <- readConceptList(here::here("Concepts"), cdm)

Or we can build our own list using other packages (e.g. CodelistGenerator)

library(CodelistGenerator)
conceptList <- getDrugIngredientCodes(cdm, "acetaminophen")
conceptList
#> $acetaminophen
#> [1]  1125315  1125360  2905077 43135274

To generate the cohort of drug use we will use generateDrugUtilisationCohortSet:

cdm <- generateDrugUtilisationCohortSet(
  cdm = cdm,
  name = "dus_cohort",
  conceptSet = conceptList,
  limit = "first",
  priorObservation = 365,
  gapEra = 30,
  priorUseWashout = 0,
  imputeDuration = "none", 
  durationRange = c(0, Inf)
)

Cohort attributes

The generated cohort will have the GeneratedCohortSet as seen in CDMConnector

class(cdm[["dus_cohort"]])
#> [1] "cohort_table"          "GeneratedCohortSet"    "cdm_table"            
#> [4] "tbl_duckdb_connection" "tbl_dbi"               "tbl_sql"              
#> [7] "tbl_lazy"              "tbl"

Cohort set:

library(CDMConnector)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
settings(cdm[["dus_cohort"]]) %>% glimpse()
#> Rows: 1
#> Columns: 11
#> $ cohort_definition_id    <int> 1
#> $ cohort_name             <chr> "acetaminophen"
#> $ duration_range_min      <chr> "0"
#> $ duration_range_max      <chr> "Inf"
#> $ impute_duration         <chr> "none"
#> $ gap_era                 <chr> "30"
#> $ prior_use_washout       <chr> "0"
#> $ prior_observation       <chr> "365"
#> $ cohort_date_range_start <chr> NA
#> $ cohort_date_range_end   <chr> NA
#> $ limit                   <chr> "first"

Cohort count:

cohortCount(cdm[["dus_cohort"]])
#> # A tibble: 1 × 3
#>   cohort_definition_id number_records number_subjects
#>                  <int>          <int>           <int>
#> 1                    1             35              35

Cohort attrition:

attrition(cdm[["dus_cohort"]]) %>% glimpse()
#> Rows: 4
#> Columns: 7
#> $ cohort_definition_id <int> 1, 1, 1, 1
#> $ number_records       <int> 71, 70, 41, 35
#> $ number_subjects      <int> 62, 62, 35, 35
#> $ reason_id            <int> 1, 2, 3, 4
#> $ reason               <chr> "Initial qualifying events", "join exposures sepa…
#> $ excluded_records     <int> 0, 1, 29, 6
#> $ excluded_subjects    <int> 0, 0, 27, 0

Indication

Indications will always be cohorts. An option that the package has is to create concept based cohorts using generateConceptCohortSet.

indications <- list(headache = 378253, influenza = 4266367)
cdm <- generateConceptCohortSet(cdm, indications, "indications_cohort")
cohortCount(cdm[["indications_cohort"]])
#> # A tibble: 2 × 3
#>   cohort_definition_id number_records number_subjects
#>                  <int>          <int>           <int>
#> 1                    1             52              52
#> 2                    2             46              46

Then we can add the indication using the function addIndication. That will add a new column for each indication gap and indication.

x <- cdm[["dus_cohort"]] %>%
  addIndication(
    indicationCohortName = "indications_cohort", indicationGap = c(0, 30, 365), 
    unknownIndicationTable = c("condition_occurrence")
  )
glimpse(x)
#> Rows: ??
#> Columns: 16
#> Database: DuckDB v0.10.0 [martics@Windows 10 x64:R 4.2.3/:memory:]
#> $ cohort_definition_id         <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
#> $ subject_id                   <int> 42, 87, 95, 35, 54, 62, 96, 26, 91, 8, 46…
#> $ cohort_start_date            <date> 2002-09-15, 2020-10-02, 2001-06-13, 2005…
#> $ cohort_end_date              <date> 2007-12-19, 2021-01-02, 2010-01-28, 2006…
#> $ indication_gap_0_headache    <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ indication_gap_0_influenza   <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ indication_gap_0_none        <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
#> $ indication_gap_0_unknown     <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ indication_gap_30_headache   <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ indication_gap_30_influenza  <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ indication_gap_30_none       <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
#> $ indication_gap_30_unknown    <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ indication_gap_365_influenza <dbl> 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,…
#> $ indication_gap_365_headache  <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ indication_gap_365_none      <dbl> 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0,…
#> $ indication_gap_365_unknown   <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,…

We can combine the indications in a single column using the indicationToStrata() function. This column can be used as stratification of the results if needed:

x <- x %>% indicationToStrata(keep = TRUE)
glimpse(x)
#> Rows: ??
#> Columns: 19
#> Database: DuckDB v0.10.0 [martics@Windows 10 x64:R 4.2.3/:memory:]
#> $ cohort_definition_id         <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
#> $ subject_id                   <int> 42, 87, 95, 35, 54, 62, 96, 26, 91, 8, 46…
#> $ cohort_start_date            <date> 2002-09-15, 2020-10-02, 2001-06-13, 2005…
#> $ cohort_end_date              <date> 2007-12-19, 2021-01-02, 2010-01-28, 2006…
#> $ indication_gap_0_headache    <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ indication_gap_0_influenza   <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ indication_gap_0_none        <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
#> $ indication_gap_0_unknown     <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ indication_gap_30_headache   <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ indication_gap_30_influenza  <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ indication_gap_30_none       <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
#> $ indication_gap_30_unknown    <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ indication_gap_365_influenza <dbl> 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,…
#> $ indication_gap_365_headache  <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ indication_gap_365_none      <dbl> 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0,…
#> $ indication_gap_365_unknown   <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,…
#> $ indication_gap_0             <chr> "None", "None", "None", "None", "None", "…
#> $ indication_gap_30            <chr> "None", "None", "None", "None", "None", "…
#> $ indication_gap_365           <chr> "None", "None", "None", "None", "None", "…
table(x %>% pull("indication_gap_365"))
#> 
#>  Headache Influenza      None   Unknown 
#>         2         3        27         3

Summarise the indication

We can summarise the indication results using the summariseIndication function:

summariseIndication(x, cdm)
#> ℹ The following estimates will be computed:
#> • indication_gap_0_headache: count, percentage
#> • indication_gap_0_influenza: count, percentage
#> • indication_gap_0_none: count, percentage
#> • indication_gap_0_unknown: count, percentage
#> • indication_gap_30_headache: count, percentage
#> • indication_gap_30_influenza: count, percentage
#> • indication_gap_30_none: count, percentage
#> • indication_gap_30_unknown: count, percentage
#> • indication_gap_365_influenza: count, percentage
#> • indication_gap_365_headache: count, percentage
#> • indication_gap_365_none: count, percentage
#> • indication_gap_365_unknown: count, percentage
#> • indication_gap_0: count, percentage
#> • indication_gap_30: count, percentage
#> • indication_gap_365: count, percentage
#> → Start summary of data, at 2024-05-14 00:54:02
#> 
#> ✔ Summary finished, at 2024-05-14 00:54:02
#> # A tibble: 42 × 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     
#> # ℹ 32 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>
summariseIndication(x, cdm) %>% glimpse()
#> ℹ The following estimates will be computed:
#> • indication_gap_0_headache: count, percentage
#> • indication_gap_0_influenza: count, percentage
#> • indication_gap_0_none: count, percentage
#> • indication_gap_0_unknown: count, percentage
#> • indication_gap_30_headache: count, percentage
#> • indication_gap_30_influenza: count, percentage
#> • indication_gap_30_none: count, percentage
#> • indication_gap_30_unknown: count, percentage
#> • indication_gap_365_influenza: count, percentage
#> • indication_gap_365_headache: count, percentage
#> • indication_gap_365_none: count, percentage
#> • indication_gap_365_unknown: count, percentage
#> • indication_gap_0: count, percentage
#> • indication_gap_30: count, percentage
#> • indication_gap_365: count, percentage
#> → Start summary of data, at 2024-05-14 00:54:02
#> 
#> ✔ Summary finished, at 2024-05-14 00:54:02
#> Rows: 42
#> Columns: 13
#> $ result_id        <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
#> $ cdm_name         <chr> "DUS MOCK", "DUS MOCK", "DUS MOCK", "DUS MOCK", "DUS …
#> $ group_name       <chr> "cohort_name", "cohort_name", "cohort_name", "cohort_…
#> $ group_level      <chr> "acetaminophen", "acetaminophen", "acetaminophen", "a…
#> $ strata_name      <chr> "overall", "overall", "overall", "overall", "overall"…
#> $ strata_level     <chr> "overall", "overall", "overall", "overall", "overall"…
#> $ variable_name    <chr> "number records", "number subjects", "Indication on i…
#> $ variable_level   <chr> NA, NA, "Headache", "Headache", "Influenza", "Influen…
#> $ estimate_name    <chr> "count", "count", "count", "percentage", "count", "pe…
#> $ estimate_type    <chr> "integer", "integer", "integer", "percentage", "integ…
#> $ estimate_value   <chr> "35", "35", "0", "0", "0", "0", "35", "100", "0", "0"…
#> $ additional_name  <chr> "overall", "overall", "overall", "overall", "overall"…
#> $ additional_level <chr> "overall", "overall", "overall", "overall", "overall"…

Add strata

All summarise functions have the option to add strata. Strata will always point to preexisting columns. Here we can see an example where we create a age_group and sex columns using PatientProfiles and then we use it as strata

library(PatientProfiles)
x <- x %>%
  addAge(ageGroup = list(c(0, 19), c(20, 39), c(40, 59), c(60, 79), c(80, 150))) %>%
  addSex()
summariseIndication(x, cdm, strata = list("age_group", "sex", c("age_group", "sex")))
#> ℹ The following estimates will be computed:
#> • indication_gap_0_headache: count, percentage
#> • indication_gap_0_influenza: count, percentage
#> • indication_gap_0_none: count, percentage
#> • indication_gap_0_unknown: count, percentage
#> • indication_gap_30_headache: count, percentage
#> • indication_gap_30_influenza: count, percentage
#> • indication_gap_30_none: count, percentage
#> • indication_gap_30_unknown: count, percentage
#> • indication_gap_365_influenza: count, percentage
#> • indication_gap_365_headache: count, percentage
#> • indication_gap_365_none: count, percentage
#> • indication_gap_365_unknown: count, percentage
#> • indication_gap_0: count, percentage
#> • indication_gap_30: count, percentage
#> • indication_gap_365: count, percentage
#> → Start summary of data, at 2024-05-14 00:54:04
#> 
#> ✔ Summary finished, at 2024-05-14 00:54:04
#> # A tibble: 430 × 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     
#> # ℹ 420 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>
summariseIndication(x, cdm, strata = list("age_group", "sex", c("age_group", "sex"))) %>% glimpse()
#> ℹ The following estimates will be computed:
#> • indication_gap_0_headache: count, percentage
#> • indication_gap_0_influenza: count, percentage
#> • indication_gap_0_none: count, percentage
#> • indication_gap_0_unknown: count, percentage
#> • indication_gap_30_headache: count, percentage
#> • indication_gap_30_influenza: count, percentage
#> • indication_gap_30_none: count, percentage
#> • indication_gap_30_unknown: count, percentage
#> • indication_gap_365_influenza: count, percentage
#> • indication_gap_365_headache: count, percentage
#> • indication_gap_365_none: count, percentage
#> • indication_gap_365_unknown: count, percentage
#> • indication_gap_0: count, percentage
#> • indication_gap_30: count, percentage
#> • indication_gap_365: count, percentage
#> → Start summary of data, at 2024-05-14 00:54:04
#> 
#> ✔ Summary finished, at 2024-05-14 00:54:05
#> Rows: 430
#> Columns: 13
#> $ result_id        <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
#> $ cdm_name         <chr> "DUS MOCK", "DUS MOCK", "DUS MOCK", "DUS MOCK", "DUS …
#> $ group_name       <chr> "cohort_name", "cohort_name", "cohort_name", "cohort_…
#> $ group_level      <chr> "acetaminophen", "acetaminophen", "acetaminophen", "a…
#> $ strata_name      <chr> "overall", "overall", "overall", "overall", "overall"…
#> $ strata_level     <chr> "overall", "overall", "overall", "overall", "overall"…
#> $ variable_name    <chr> "number records", "number subjects", "Indication on i…
#> $ variable_level   <chr> NA, NA, "Headache", "Headache", "Influenza", "Influen…
#> $ estimate_name    <chr> "count", "count", "count", "percentage", "count", "pe…
#> $ estimate_type    <chr> "integer", "integer", "integer", "percentage", "integ…
#> $ estimate_value   <chr> "35", "35", "0", "0", "0", "0", "35", "100", "0", "0"…
#> $ additional_name  <chr> "overall", "overall", "overall", "overall", "overall"…
#> $ additional_level <chr> "overall", "overall", "overall", "overall", "overall"…

Daily dose

We can compute daily dose for a certain ingredient from a subset of drug_exposure or the whole drug exposure (can be very computationally expensive).

cdm[["drug_exposure"]] %>%
 addDailyDose(ingredientConceptId = 1125315) %>%
 glimpse()
#> Rows: ??
#> Columns: 9
#> Database: DuckDB v0.10.0 [martics@Windows 10 x64:R 4.2.3/:memory:]
#> $ drug_exposure_id         <int> 8, 12, 17, 23, 24, 27, 34, 35, 40, 49, 50, 59…
#> $ person_id                <int> 3, 4, 7, 8, 9, 9, 12, 13, 14, 19, 19, 23, 25,…
#> $ drug_concept_id          <dbl> 43135274, 1125360, 1125360, 2905077, 1125360,…
#> $ drug_exposure_start_date <date> 1996-09-13, 2004-12-26, 1969-09-09, 2019-09-…
#> $ drug_exposure_end_date   <date> 2008-07-15, 2006-04-15, 1970-02-14, 2020-12-…
#> $ drug_type_concept_id     <dbl> 38000177, 38000177, 38000177, 38000177, 38000…
#> $ quantity                 <dbl> 50, 100, 80, 10, 25, 35, 10, 90, 45, 80, 40, …
#> $ daily_dose               <dbl> 4.625347, 105.042017, 251.572327, 202.105263,…
#> $ unit                     <chr> "milligram", "milligram", "milligram", "milli…

Coverage

Currently you can evaluate the coverage of daily dose for a conceptList or overall using dailyDoseCoverage. You should restrict to a certain ingredient.

dailyDoseCoverage(cdm = cdm, ingredient = 1125315) 
#> ℹ The following estimates will be computed:
#> • daily_dose: count_missing, percentage_missing, mean, sd, min, q05, q25,
#>   median, q75, q95, max
#> ! Table is collected to memory as not all requested estimates are supported on
#>   the database side
#> → Start summary of data, at 2024-05-14 00:54:06
#> 
#> ✔ Summary finished, at 2024-05-14 00:54:06
#> # A tibble: 84 × 13
#>    result_id cdm_name group_name      group_level   strata_name strata_level
#>        <int> <chr>    <chr>           <chr>         <chr>       <chr>       
#>  1         1 DUS MOCK ingredient_name acetaminophen overall     overall     
#>  2         1 DUS MOCK ingredient_name acetaminophen overall     overall     
#>  3         1 DUS MOCK ingredient_name acetaminophen overall     overall     
#>  4         1 DUS MOCK ingredient_name acetaminophen overall     overall     
#>  5         1 DUS MOCK ingredient_name acetaminophen overall     overall     
#>  6         1 DUS MOCK ingredient_name acetaminophen overall     overall     
#>  7         1 DUS MOCK ingredient_name acetaminophen overall     overall     
#>  8         1 DUS MOCK ingredient_name acetaminophen overall     overall     
#>  9         1 DUS MOCK ingredient_name acetaminophen overall     overall     
#> 10         1 DUS MOCK ingredient_name acetaminophen overall     overall     
#> # ℹ 74 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>

DrugUse

You can add columns related to the drug use using addDrugUse. You always have to provide a reference ingredient.

x <- x %>%
 addDrugUse(
   ingredientConceptId = 1125315,
   dose = TRUE,
   quantity = TRUE,
   duration = TRUE
 )

Summarise the drug use

You can summarise the drug use using summariseDrugUse function

summariseDrugUse(x)
#> ! names of group will be ignored
#> ℹ The following estimates will be computed:
#> • number_exposures: min, q05, q25, median, q75, q95, max, mean, sd,
#>   count_missing, percentage_missing
#> • duration: min, q05, q25, median, q75, q95, max, mean, sd, count_missing,
#>   percentage_missing
#> • cumulative_quantity: min, q05, q25, median, q75, q95, max, mean, sd,
#>   count_missing, percentage_missing
#> • number_eras: min, q05, q25, median, q75, q95, max, mean, sd, count_missing,
#>   percentage_missing
#> • initial_quantity: min, q05, q25, median, q75, q95, max, mean, sd,
#>   count_missing, percentage_missing
#> • impute_daily_dose_percentage: min, q05, q25, median, q75, q95, max, mean, sd,
#>   count_missing, percentage_missing
#> • impute_duration_percentage: min, q05, q25, median, q75, q95, max, mean, sd,
#>   count_missing, percentage_missing
#> • initial_daily_dose_milligram: min, q05, q25, median, q75, q95, max, mean, sd,
#>   count_missing, percentage_missing
#> • cumulative_dose_milligram: min, q05, q25, median, q75, q95, max, mean, sd,
#>   count_missing, percentage_missing
#> ! Table is collected to memory as not all requested estimates are supported on
#>   the database side
#> → Start summary of data, at 2024-05-14 00:54:13
#> 
#> ✔ Summary finished, at 2024-05-14 00:54:13
#> # A tibble: 101 × 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     
#> # ℹ 91 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>

Summarise patient characteristics

You can summarise the patient characteristics with summariseCharacteristics function:

x |>
  summariseCharacteristics(
    ageGroup = list(c(0, 24), c(25, 49), c(50, 74), c(75, 150)),
    tableIntersectCount = list(
      "Visits" = list(
        tableName = "visit_occurrence", window = c(-365, 0)
      )
    ),
    cohortIntersectFlag = list(
      "Indications" = list(
        targetCohortTable  = "indications_cohort", window = c(-365, 0)
      )
    )
  )
#> ℹ adding demographics columns
#> ℹ adding tableIntersectCount 1/1
#> ℹ adding cohortIntersectFlag 1/1
#> ℹ summarising data
#> 
#> ✔ summariseCharacteristics finished!
#> # A tibble: 54 × 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     
#> # ℹ 44 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>

Summarise patients large scale characteristics

You can summarise the patient characteristics with summariseLargeScaleCharacteristics function:

x |>
  summariseLargeScaleCharacteristics(
    window = list(c(-Inf, Inf)), 
    eventInWindow = "condition_occurrence", 
    episodeInWindow = "drug_exposure"
  )
#> ℹ Summarising large scale characteristics
#> - getting characteristics from table condition_occurrence (1 of 2) - getting
#> characteristics from table drug_exposure (2 of 2)
#> # A tibble: 26 × 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         2 DUS MOCK cohort_name acetaminophen overall     overall     
#>  8         2 DUS MOCK cohort_name acetaminophen overall     overall     
#>  9         2 DUS MOCK cohort_name acetaminophen overall     overall     
#> 10         2 DUS MOCK cohort_name acetaminophen overall     overall     
#> # ℹ 16 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>

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.