Access drug name and class using RxCUI from the National Library of Medicine RxNorm RESTful API.
rxnorm is an R package providing a basic interface to query the
National Library of Medicine RxNorm RESTful API using RxCUI. The goal is
to provide a simple way to translate RxCUI into drug categories with
incremental levels of generality: specific drug names → brand names →
drug classes.
You can install rxnorm from GitHub with:
devtools::install_github("nt-williams/rxnorm")library(rxnorm)Query the API for the RxNorm name:
get_rx(1011485)
#> [1] "cetirizine hydrochloride 10 MG Disintegrating Oral Tablet [Zyrtec]"Query the API for the brand name:
get_bn(1011485)
#> [1] "ZYRTEC"Query the API for the strength of active ingredients:
get_rxcui_strength(861819)
#> activeIngredientName numeratorValue numeratorUnit denominatorValue
#> 1 sitagliptin phosphate 50 MG 1
#> 2 metformin hydrochloride 500 MG 1
#> denominatorUnit
#> 1 EACH
#> 2 EACHQuery the API for the WHO ATC drug class:
get_atc(1011485)
#> [1] "R06AE"We can further parse ATC codes to varying levels of specificy:
get_atc(1011485, "first")
#> [1] "respiratory system"
get_atc(1011485, "second")
#> [1] "antihistamines for systemic use"
get_atc(1011485, "third")
#> [1] "antihistamines for systemic use"
get_atc(1011485, "fourth")
#> [1] "piperazine derivatives"