Code lists for medications

Creating a codelists for acetaminophen

For this vignette we are going to create codelists for identifying a acetaminophen, looking in the drug domain.

Connecting to a database with the OMOP CDM vocabularies

# postgres database connection details
serverDbi <- Sys.getenv("server")
user <- Sys.getenv("user")
password <- Sys.getenv("password")
port <- Sys.getenv("port")
host <- Sys.getenv("host")

db <- DBI::dbConnect(RPostgres::Postgres(),
  dbname = serverDbi,
  port = port,
  host = host,
  user = user,
  password = password
)

# name of vocabulary schema
vocabularyDatabaseSchema <- "vocabulary"

Codelist from “acetaminophen” and its descendants

First we can follow the approach of identifying high-level codes and include all their descendants.

library(dplyr)
library(CodelistGenerator)
library(stringr)
library(DT)
library(kableExtra)
acetaminophen1 <- getCandidateCodes(
  cdm = cdm,
  keywords = "acetaminophen",
  domains = "drug",
  standardConcept = "standard",
  includeDescendants = TRUE
)
acetaminophen1 %>% dplyr::glimpse()
#> Rows: 22,782
#> Columns: 15
#> $ concept_id                  <int> 587290, 587473, 587705, 587929, 588401, 58…
#> $ concept_name                <chr> "Acetaminophen 0.0501 MG/MG / Antipyrine 0…
#> $ domain_id                   <chr> "drug", "drug", "drug", "drug", "drug", "d…
#> $ concept_class_id            <chr> "clinical drug", "branded drug", "branded …
#> $ vocabulary_id               <chr> "rxnorm extension", "rxnorm extension", "r…
#> $ found_from                  <chr> "From initial search", "From initial searc…
#> $ ingredient_concept_id       <int> 1134439, 1134439, 1036059, 1135766, 113576…
#> $ amount_value                <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ amount_unit_concept_id      <int> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ numerator_value             <dbl> 1.25e-02, 1.25e-02, 7.49e-02, 7.42e-03, 6.…
#> $ numerator_unit_concept_id   <int> 8576, 8576, 8576, 8576, 8576, 8576, 8576, …
#> $ denominator_value           <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ denominator_unit_concept_id <int> 8576, 8576, 8576, 8576, 8576, 8576, 8576, …
#> $ box_size                    <int> NA, NA, 100, 10, NA, 100, 5, NA, 5, 10, NA…
#> $ dose_form                   <chr> "Oral Solution", "Oral Solution", "Oral So…

Restrict on dose form

We can also restrict on dose form, in this case requiring dose form to include either “injection” or “intravenous” in it’s name

acetaminophen2 <- getCandidateCodes(
  cdm = cdm_arrow,
  keywords = "acetaminophen",
  domains = "drug",
  doseForm = c("injection", "intravenous"),
  standardConcept = "standard",
  includeDescendants = TRUE,
  verbose = TRUE
)
acetaminophen2 %>% dplyr::glimpse()
#> Rows: 127
#> Columns: 15
#> $ concept_id                  <int> 740261, 19112656, 21029938, 21049585, 2105…
#> $ concept_name                <chr> "50 ML acetaminophen 10 MG/ML Injection", …
#> $ domain_id                   <chr> "drug", "drug", "drug", "drug", "drug", "d…
#> $ concept_class_id            <chr> "quant clinical drug", "quant clinical dru…
#> $ vocabulary_id               <chr> "rxnorm", "rxnorm", "rxnorm extension", "r…
#> $ found_from                  <chr> "From initial search", "From initial searc…
#> $ ingredient_concept_id       <int> 1125315, 1125315, 1125315, 1125315, 112531…
#> $ amount_value                <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ amount_unit_concept_id      <int> NA, NA, NA, NA, NA, NA, NA, NA, 8576, NA, …
#> $ numerator_value             <dbl> 500, 1000, 1000, 1000, 1000, 10, 1000, 100…
#> $ numerator_unit_concept_id   <int> 8576, 8576, 8576, 8576, 8576, 8576, 8576, …
#> $ denominator_value           <dbl> 50, 100, 100, 100, 100, NA, 100, 100, NA, …
#> $ denominator_unit_concept_id <int> 8587, 8587, 8587, 8587, 8587, 8587, 8587, …
#> $ box_size                    <int> NA, NA, 10, 12, 10, 12, NA, 12, NA, 10, 10…
#> $ dose_form                   <chr> "Injection", "Injection", "Injection", "In…

Restrict on concept class

We can also restrict on concept class, in this case only identifying codes with a concept class of “Quant Clinical Drug”

acetaminophen3 <- getCandidateCodes(
  cdm = cdm_arrow,
  keywords = "acetaminophen",
  domains = "drug",
  conceptClassId = c("Quant Clinical Drug"),
  doseForm = c("injection", "intravenous"),
  standardConcept = "standard",
  includeDescendants = TRUE,
  verbose = TRUE
)
acetaminophen3 %>% dplyr::glimpse()
#> Rows: 5
#> Columns: 15
#> $ concept_id                  <int> 740261, 19112656, 36279869, 36778619, 3677…
#> $ concept_name                <chr> "50 ML acetaminophen 10 MG/ML Injection", …
#> $ domain_id                   <chr> "drug", "drug", "drug", "drug", "drug"
#> $ concept_class_id            <chr> "quant clinical drug", "quant clinical dru…
#> $ vocabulary_id               <chr> "rxnorm", "rxnorm", "rxnorm extension", "r…
#> $ found_from                  <chr> "From initial search", "From initial searc…
#> $ ingredient_concept_id       <int> 1125315, 1125315, 1125315, 1125315, 1125315
#> $ amount_value                <dbl> NA, NA, NA, NA, NA
#> $ amount_unit_concept_id      <int> NA, NA, NA, NA, NA
#> $ numerator_value             <dbl> 500, 1000, 100, 1000, 500
#> $ numerator_unit_concept_id   <int> 8576, 8576, 8576, 8576, 8576
#> $ denominator_value           <dbl> 50, 100, 10, 100, 50
#> $ denominator_unit_concept_id <int> 8587, 8587, 8587, 8587, 8587
#> $ box_size                    <int> NA, NA, NA, NA, NA
#> $ dose_form                   <chr> "Injection", "Injection", "Intravenous Sol…