Learn R Programming

Drug Ontology Parsing Engine (DOPE)

The goal of DOPE is to provide a structured vocabulary and tools to look up details on drugs tracked by the DEA. The data structure is:

Installation

Official Release

You can install the released version of DOPE from CRAN with:

install.packages("DOPE")

Development Release

Run these two lines of code to install DOPE from GitHub (this requires RTools for Windows or Xcode for Mac to be installed on your computer):

if (!requireNamespace("devtools")) install.packages("devtools")
devtools::install_github("CTN-0094/DOPE")

Examples

You can look up details on a drug with the lookup() function. It will check brand, generic and street names.

library(DOPE)
lookup("adderall")
lookup("ketamine")
lookup("auntie")

The lookup funciton supports vectorized lookups:

library(DOPE)
lookup("cheese", "pizza", "with", "a", "soda")
lookup(c("Buprenorphine", "Tramadol", "Bup/Nx"))

If your only care about the class and/or category and/or if you search returns many matches you can use the compress_lookup() function to drop columns and then remove duplicate rows.

lookup("cheese", "pizza", "with", "a", "soda") %>%
  compress_lookup(compressClass = FALSE,
                  compressCategory = TRUE,
                  compressSynonym = TRUE)

DOPE now allows for parsing out drug names from a vector which contains free text with the parse() function. You can use it in conjunction withlookup() and compress_lookup()

data(drug_df)
parse(drug_df$textdrug[1:5]) %>%
  lookup()

Additional Information

For more information or to see detailed vignettes, please visit https://ctn-0094.github.io/DOPE/.

Copy Link

Version

Install

install.packages('DOPE')

Monthly Downloads

190

Version

2.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Raymond Balise

Last Published

June 18th, 2021

Functions in DOPE (2.1.0)

dea_factsheets

Drug ontology information from https://www.dea.gov/factsheets
drug_df

Simulated drug data
dea_street_names

Drug slang from DEA's DIR-020-17 Drug Slang Code Words.pdf
drug_stop_words

A vector with drug-specific stop words in English
parse

Parse a vector of free text containing drug information
noslang_street_names

Drug slang from https://www.noslang.com/drugs/dictionary
iqvia

Data sent from IQVIA
compress_lookup

Collapse Redundant Rows of a Lookup Table
dea_brands

Drug brand info
lookup

Make a table with the class and category for a drug name
dea_controlled

Drug controlled substance synonyms
lookup_syn

Make a table with the class and category for a drug name
lookup_df

A lookup table with drug class, category, and synonyms
noslang_raw

Drug terms from https://www.noslang.com/drugs/dictionary