First, connect to the database.
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),
subsetToConceptId = NULL,
checks = c("missing", "exposureDuration", "type", "route", "sourceConcept", "daysSupply", "verbatimEndDate",
"dose", "sig", "quantity", "histogram", "diagnosticsSummary"),
minCellCount = 5,
sample = 10000,
verbose = FALSE,
byConcept = TRUE
)Thecdm is the database reference of the OMOP CDM using
the CDMConnector package.
The ingredients is a list of ingredients of interests, by
default it is 1125315 for acetaminophen. The
subsetToConceptId is a vector of drug concept ID’s to
subset down to. checks allows to select the checks to be
executed, by default the missing values, the exposure duration and the
quantity checks will be run.
sample is the number of samples, by default, 10.000 drug
record samples will be used.
The minCellCount is minimum number of events to report,
numbers lower than this will be obscured.
all_checks<-executeChecks(cdm, ingredients = 1125315)
#> population after earliestStartDate smaller than sampleWe can then check what results available from ´executeChecks()´ by
names(all_checks)
#> [1] "conceptSummary" "missingValuesOverall"
#> [3] "missingValuesByConcept" "drugExposureDurationOverall"
#> [5] "drugExposureDurationByConcept" "drugQuantity"
#> [7] "drugQuantityByConcept"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.
After running the checks, we can write the CSV files into a zip file
to disk using the writeResultToDisk() function.