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.
all_checks <- 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,
tablePrefix = NULL,
earliestStartDate = "2010-01-01",
verbose = FALSE,
byConcept = TRUE)
#> population after earliestStartDate smaller than sample
#> Joining with `by = join_by(ingredient_concept_id)`
#> Joining with `by = join_by(ingredient_concept_id)`
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
vector of concept IDs of the ingredients
to filter. If a concept ID is positive it will be included, a negative
one will be excluded. If NULL, all concept IDs for an ingredient will be
considered. checks
allows to select the checks to be
executed, by default the missing values, the exposure duration and the
quantity checks will be run. The minCellCount
is minimum
number of events to report, numbers lower than this will be obscured.
sample
is the number of samples, by default, 10.000 drug
record samples will be used.
The tablePrefix
is an optional value for database tables
that will be created during executeChecks.
earliestStartDate
is the earliest data from which drug
records will be included. verbose
is a parameter that
enables the printing of messages to the console. byConcept
is a boolean that determines if only overall results should be returned
or also by drug concept.
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" "drugDaysSupplyHistogram"
#> [23] "drugQuantityHistogram" "drugDurationHistogram"
#> [25] "diagnosticsSummary"
Let’s take a look at the results. conceptSummary
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.