-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
115 lines (88 loc) · 4.14 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# DrugUtilisation <img src="man/figures/logo.png" align="right" height="200"/>
[![CRANstatus](https://www.r-pkg.org/badges/version/DrugUtilisation)](https://CRAN.R-project.org/package=DrugUtilisation)
[![codecov.io](https://codecov.io/github/darwin-eu/DrugUtilisation/coverage.svg?branch=main)](https://app.codecov.io/github/darwin-eu/DrugUtilisation?branch=main)
[![R-CMD-check](https://github.com/darwin-eu/DrugUtilisation/workflows/R-CMD-check/badge.svg)](https://github.com/darwin-eu/DrugUtilisation/actions)
[![Lifecycle:Experimental](https://img.shields.io/badge/Lifecycle-Experimental-339999)](https://lifecycle.r-lib.org/articles/stages.html)
## Package overview
DrugUtilisation contains functions to instantiate and characterise drug cohorts in data mapped to the OMOP Common Data Model. The package supports:
- Creation of drug cohorts
- Identification of indications for those in a drug cohort
- Summarising drug utilisation among a cohort in terms of duration, quantity, and dose
- Description of treatment adherence based on proportion of patients covered
- Detailing treatment restart and switching after an initial treatment discontinuation
## Example usage
First, we need to create a cdm reference for the data we´ll be using. Here we 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](https://darwin-eu.github.io/CDMConnector/articles/a04_DBI_connection_examples.html).
```{r, message=FALSE, warning=FALSE}
library(DrugUtilisation)
library(CDMConnector)
library(omopgenerics)
library(dplyr)
cdm <- mockDrugUtilisation(numberIndividual = 100)
```
### Create a cohort of acetaminophen users
To generate the cohort of acetaminophen users we will use `generateIngredientCohortSet`, concatenating any records with fewer than 7 days between them. We then filter our cohort records to only include the first record per person and require that they have at least 30 days observation in the database prior to their drug start date.
```{r, message=FALSE}
cdm <- generateIngredientCohortSet(
cdm = cdm,
name = "dus_cohort",
ingredient = "acetaminophen",
gapEra = 7
)
cdm$dus_cohort |>
requireIsFirstDrugEntry() |>
requireObservationBeforeDrug(days = 30)
```
### Indications of acetaminophen users
Now we´ve created our cohort we could first summarise the indications of the cohort. These indications will always be cohorts, so we first need to create them. Here we create two indication cohorts, one for headache and the other for influenza.
```{r}
indications <- list(headache = 378253, influenza = 4266367)
cdm <- generateConceptCohortSet(cdm,
conceptSet = indications,
name = "indications_cohort"
)
```
We can summarise the indication results using the `summariseIndication` function:
```{r}
indication_summary <- cdm$dus_cohort |>
summariseIndication(
indicationCohortName = "indications_cohort",
unknownIndicationTable = "condition_occurrence",
indicationWindow = list(c(-30, 0))
)
indication_summary |> glimpse()
```
### Drug use
We can quickly obtain a summary of drug utilisation among our cohort, with various measures calculated for a provided ingredient concept (in this case the concept for acetaminophen).
```{r}
drug_utilisation_summary <- cdm$dus_cohort |>
summariseDrugUtilisation(
ingredientConceptId = 1125315,
gapEra = 7
)
drug_utilisation_summary |> glimpse()
table(drug_utilisation_summary$variable_name)
```
### Combine and share results
Now we can combine our results and suppress any counts less than 5 so that they are ready to be shared.
```{r}
results <- bind(
indication_summary,
drug_utilisation_summary
) |>
suppress(minCellCount = 5)
results |> glimpse()
```
## Further analyses
There are many more drug-related analyses that we could have done with this acetaminophen cohort using the DrugUtilisation package. Please see the package website for more details.