library(DrugExposureDiagnostics)
library(CDMConnector)
library(dplyr)
library(DT)
First, connect to the database.
<- getEunomiaCdm() cdm
In the DrugExposureDiagnostics package, all the diagnostics are conducted on ingredient level. We will use “acetaminophen” as an example. Here is a brief look at this ingredient.
Property | Value |
Concept Name | acetaminophen |
Domain ID | Drug |
Concept Class ID | Ingredient |
Vocabulary ID | RxNorm |
Concept ID | 1125315 |
Concept code | 161 |
Validity | Valid |
Concept | Standard |
Valid start | 01-Jan-1970 |
Valid end | 31-Dec-2099 |
We can run all available checks at the same time using the ´executeChecks()´ function. This will return a list which contains the results of each check.
executeChecks(cdm,
ingredients = c(1125315),
checks = c("missing", "exposureDuration", "type", "route","sourceConcept", "daysSupply", "verbatimEndDate","dailyDose", "sig", "quantity", "histogram"),
minCellCount = 5,
sample = 1000000,
verbose = FALSE
)
Thecdm
is the database reference of the OMOP CDM using
the CDMConnector
package.
The ingredient
is the concept_id
of
ingredients of interests, by default it is 1125315 for
acetaminophen.
checks
allows to select the checks to be executed, by
default, all the checks will be run.
sample
is the number of samples, by default, 1 million drug
record samples will be used.
The minCellCount
is minimum number of events to report,
numbers lower than this will be obscured.
<-executeChecks(cdm, ingredients = 1125315)
all_checks#> population after earliestStartDate smaller than sample, ignoring date for sampling
We can then check what results available from ´executeChecks()´ by
names(all_checks)
#> [1] "conceptSummary" "missingValuesOverall"
#> [3] "missingValuesByConcept" "drugExposureDurationOverall"
#> [5] "drugExposureDurationByConcept" "drugTypesOverall"
#> [7] "drugTypesByConcept" "drugRoutesOverall"
#> [9] "drugRoutesByConcept" "drugSourceConceptsOverall"
#> [11] "drugSourceConceptsByConcept" "drugDaysSupply"
#> [13] "drugDaysSupplyByConcept" "drugVerbatimEndDate"
#> [15] "drugVerbatimEndDateByConcept" "drugDose"
#> [17] "drugDoseByConcept" "drugSig"
#> [19] "drugSigByConcept" "drugQuantity"
#> [21] "drugQuantityByConcept" "drugIngredientOverview"
#> [23] "drugIngredientPresence" "drugDaysSupplyHistogram"
#> [25] "drugQuantityHistogram" "drugDurationHistogram"
#> [27] "diagnostics_summary"
Let’s take a look at the results. ingredientConcepts
contains information on the concept ids that are used in the database
for a given ingredient. So in the case of acetaminophen, the following
drugs contain the acetaminophen as an ingredient.
datatable(all_checks$ingredientConcepts,
rownames = FALSE
)
After running the checks, we can write the CSV files into a zip file
to disk using the writeResultToDisk()
function.
writeResultToDisk(all_checks,
databaseId = "your_database_id",
outputFolder = "output_folder")