-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
111 lines (87 loc) · 3.2 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
---
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%"
)
```
# DrugExposureDiagnostics <img src='man/figures/DrugExposureDiagnostics.png' align="right" width="139"/>
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/DrugExposureDiagnostics)](https://CRAN.R-project.org/package=DrugExposureDiagnostics)
[![codecov.io](https://codecov.io/github/darwin-eu/DrugExposureDiagnostics/coverage.svg?branch=main)](https://app.codecov.io/github/darwin-eu/DrugExposureDiagnostics?branch=main)
[![R-CMD-check](https://github.com/darwin-eu/DrugExposureDiagnostics/workflows/R-CMD-check/badge.svg)](https://github.com/darwin-eu/DrugExposureDiagnostics/actions)
[![Lifecycle:stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
<!-- badges: end -->
The goal of DrugExposureDiagnostics is to summarise ingredient specific drug exposure data in the OMOP CDM.
## Installation
You can install the DrugExposureDiagnostics from CRAN like this:
``` r
install.packages("DrugExposureDiagnostics")
```
or install the development version:
``` r
install.packages("remotes")
remotes::install_github("darwin-eu/DrugExposureDiagnostics")
```
## Citation
```{r}
citation("DrugExposureDiagnostics")
```
## Example use
```{r, message=FALSE}
library(DrugExposureDiagnostics)
library(CDMConnector)
library(dplyr)
```
```{r}
cdm <- mockDrugExposure()
```
Let´s look at the ingredient acetaminophen (https://athena.ohdsi.org/search-terms/terms/1125315).
We can run all the checks available in ´DrugExposureDiagnostics´ using the ´executeChecks´ function.
```{r}
all_checks <- executeChecks(
cdm = cdm,
ingredients = 1125315,
checks = c(
"missing", "exposureDuration", "type", "route", "sourceConcept", "daysSupply",
"verbatimEndDate", "dose", "sig", "quantity", "diagnosticsSummary"
)
)
```
The output is a list which contains the following set of tibbles:
```{r}
names(all_checks)
```
The first item contains information on the concept ids that are used in the database for a given ingredient.
```{r}
glimpse(all_checks$conceptSummary)
all_checks$conceptSummary %>%
select("drug_concept_id", "drug")
```
Other tibbles then contain information from the various checks performed.
For example, we can see a summary of missingness for the ingredient-related records in the drug exposure table, both overall and by concept.
```{r}
all_checks$missingValuesOverall
all_checks$missingValuesByConcept
```
Or we can also see a summary of drug exposure duration (drug_exposure_end_date - drug_exposure_end_date + 1), again overall or by concept.
```{r}
all_checks$drugExposureDurationOverall
all_checks$drugExposureDurationByConcept
```
For further information on the checks performed please see the package vignettes.
After running the checks we can write the CSVs to disk using the `writeResultToDisk` function.
```{r}
writeResultToDisk(all_checks,
databaseId = "Synthea",
outputFolder = tempdir()
)
```
```{r, echo=FALSE}
DBI::dbDisconnect(attr(cdm, "dbcon"), shutdown = TRUE)
```