Julia interface to the National Library of Medicine's online pharmaceutical RxNav API
julia> using RxNav
julia> for i in interact("fentanyl", "selegiline")
if i.severity == "high"
println(i.description)
end
end
Narcotic analgesics - monoamine oxidase (MAO) inhibitors
julia> println(RxNav.getSpellingSuggestions("nortriptelene"))
["nortriptyline", "Nortriptylina"]
julia> RxNav.prescribable(true)
true
julia> println(RxNav.getSpellingSuggestions("nortriptelene"))
["nortriptyline"]
julia> interact("1191", "warfarin", "vitamin K")
3-element Vector{NamedTuple}:
(drug1 = "aspirin", drug2 = "vitamin K", severity = "N/A", description = "Acetylsalicylic acid may decrease the excretion rate of Phylloquinone which could result in a higher serum level.")
(drug1 = "aspirin", drug2 = "warfarin", severity = "N/A", description = "Acetylsalicylic acid may increase the anticoagulant activities of Warfarin.")
(drug1 = "vitamin K", drug2 = "warfarin", severity = "N/A", description = "The therapeutic efficacy of Warfarin can be decreased when used in combination with Phylloquinone.")
julia> filter(x -> occursin("Pediatric", x), drugs("riboflavin"))
2-element Vector{String}:
"alpha-tocopherol acetate 1.4 MG/ML / ascorbic acid 16 MG/ML / biotin 0.004 MG/ML / dexpanthenol 1 MG/ML / ergocalciferol 0.002 MG/ML / folic acid 0.028 MG/ML / niacinamide 3.4 MG/ML / pyridoxine hydrochloride 0.2 MG/ML / riboflavin 0.28 MG/ML / thiamine hydrochloride 0.24 MG/ML / vitamin A 0.14 MG/ML / vitamin B12 0.0002 MG/ML / vitamin K1 0.04 MG/ML Injectable Solution [MVI Pediatric]"
"alpha-tocopherol acetate 1.4 UNT/ML / ascorbic acid 16 MG/ML / biotin 0.004 MG/ML / cholecalciferol 80 UNT/ML / dexpanthenol 1 MG/ML / folic acid 0.028 MG/ML / niacinamide 3.4 MG/ML / pyridoxine hydrochloride 0.2 MG/ML / riboflavin 0.28 MG/ML / thiamine hydrochloride 0.24 MG/ML / vitamin A palmitate 460 UNT/ML / vitamin B12 0.0002 MG/ML / vitamin K1 0.04 MG/ML Injectable Solution [Infuvite Pediatric]"
These functions are derived from the API, but are specialized and have been modified for ease of use. For example, the functions may take either a drug name or an RxCUI identifier as argument.
Take a name of a drug as String argument, return its RxCUI as String.
Given a drug name, return a list of all available dosing forms of the drug.
Get a list of interactions for a single drug (or rxcui drug id) or pairwise interactions for more than one drug (or rxcuid).
Given a drug name or rxcui id string, return known drug interations for that drug.
If ONCHigh is true only return the ONCHigh database entries, which returns fewer
entries, tending to list only the more significant interactions. Set ONCHigh
to false to get all known interactions, which can be multiple and sometimes redundant.
Returns a Vector
of NamedTuple
s as in (drug1, drug2, severity, description).
Given a list of drug names or rxcui id strings, return known drug interations for
that combination of drugs. Results are organized pairwise, so if A, B, and C have
mutual interactions this will be reported for example as A with B, A with C, B with C.
Returns a Vector
of NamedTuple
s as in (drug1, drug2, severity, description)
Note: There are two different RxNorm databases. The more complete one, RxNorm, contains
medications including veterinary-use-only medications and medications no longer in use or
which are not available in United States pharmacies. The Julia functions default to this
database. In order to confine search results to generally available human medications,
the RxNorm database also supports the "Prescribable" RxNorm API, which gives results only
within medications currently available for medical prescription in the US. If you want the
"Prescribable" database used for your RxNorm API calls, you should first call the function
prescribable(true)
after which all calls to the RxNorm API will use the somewhat smaller Prescribable database.
To set this back to using the more general database, call prescribable(false)
.
Some of the API functions take optional arguments. For details of the values for such arguments
you should consult the NLM documentation (links are below). If the function takes an optional argument
called extra
, this means that the function's optional argument extra
should be provided as a Dict
or as a Vector
of Pairs
, with the keys to the Dict being the label for the optional term and the
values for that key as either a string or a vector of strings to be assigned to that value in the
final URL request. For example, extra = Dict("sources" => ["ACTIVE", "OBSOLETE"], "toReturn" => 25)
would be translated to "&sources=ACTIVE+OBSOLETE&toReturn=25"
in the REST call request string sent by HTTP.
The list of API functions is extensive. The API function names are not exported from RxNav, so to call,
for example, getSpellingSuggestions("asprin")
you must call this as RxNav.getSpellingSuggestions("asprin")
.
See https://rxnav.nlm.nih.gov/RxClassAPIs.html, as copied below:
Function | REST Resource | Description |
---|---|---|
findClassByName | /class/byName | Drug classes with a specified class name |
findClassesById | /class/byId | Drug classes with a specified class identifier |
findSimilarClassesByClass | /class/similar | Classes with similar clinically-significant RxNorm ingredients |
findSimilarClassesByDrugList | /class/similarByRxcuis | Classes with clinically-significant RxNorm ingredients similar to a specified list |
getAllClasses | /allClasses | All classes (may limit by class type) |
getClassByRxNormDrugId | /class/byRxcui | Classes containing a specified drug RXCUI |
getClassByRxNormDrugName | /class/byDrugName | Classes containing a drug of the specified name |
getClassContexts | /classContext | Paths from the specified class to the root of its class hierarchies |
getClassGraphBySource | /classGraph | Classes along the path from a specified class to the root of a class hierarchy |
getClassMembers | /classMembers | Drug members of a specified class |
getClassTree | /classTree | Subclasses or descendants of the specified class |
getClassTypes | /classTypes | Class types |
getRelas | /relas | Relationships expressed by a source of drug relations |
getSimilarityInformation | /class/similarInfo | Similarity of the clinically-significant membership of two classes |
getSourcesOfDrugClassRelations | /relaSources | Sources of drug-class relations |
getSpellingSuggestions | /spellingsuggestions | Drug or class names similar to a given string |
Get drug classes with a specified class name
Get drug classes with a specified class identifier
Get classes with similar clinically-significant RxNorm ingredients
Get classes with clinically-significant RxNorm ingredients similar to a specified list
Get all classes (may limit by class type with optional argument)
Get classes containing a specified drug RXCUI
Get classes containing a drug of the specified name
Get name and type context for paths from the specified class to the root of its class hierarchies
Get classes along the path from a specified class to the root of a class hierarchy
Get drug members of a specified class
Get subclasses or descendants of the specified class
Get class types
Get relationships expressed by a source of drug relations
Get similarity of the clinically-significant membership of two classes by id and source
Get sources of drug-class relations
Get drug or class names similar to a given string
See https://rxnav.nlm.nih.gov/RxNormAPIs.html, as copied below:
Function | REST Resource | Description |
---|---|---|
filterByProperty | /rxcui/rxcui/filter | Concept RXCUI if the predicate is true |
findRxcuiById | /rxcui?idtype=...&id=... | Concepts associated with a specified identifier |
findRxcuiByString | /rxcui?name=... | Concepts with a specified name |
getAllConceptsByStatus | /allstatus | Concepts having a specified status |
getAllConceptsByTTY | /allconcepts | Concepts having a specified term type |
getAllHistoricalNDCs | /rxcui/rxcui/allhistoricalndcs | National Drug Codes (NDC) ever associated with a concept |
getAllNDCs (Deprecated) | /rxcui/rxcui/allndcs | National Drug Codes (NDC) associated with a concept |
getAllNDCsByStatus | /allNDCstatus | NDCs having a specified NDC status |
getAllProperties | /rxcui/rxcui/allProperties | Concept details |
getAllRelatedInfo | /rxcui/rxcui/allrelated | Concepts related directly or indirectly to a specified concept |
getApproximateMatch | /approximateTerm | Concept and atom IDs approximately matching a query |
getDisplayTerms | /displaynames | Strings to support auto-completion in a user interface |
getDrugs | /drugs | Drugs related to a specified name |
getIdTypes | /idtypes | Identifier types |
getMultiIngredBrand | /brands | Brands containing specified ingredients |
getNDCProperties | /ndcproperties | National Drug Code (NDC) details |
getNDCStatus | /ndcstatus | Status of a National Drug Code (NDC) |
getNDCs | /rxcui/rxcui/ndcs | National Drug Codes (NDC) associated with a concept |
getPropCategories | /propCategories | RxNav property categories |
getPropNames | /propnames | Property names |
getProprietaryInformation | /rxcui/rxcui/proprietary | Strings from sources that require a UMLS license |
getRelaTypes | /relatypes | RxNorm Relationship types |
getRelatedByRelationship | /rxcui/rxcui/related?rela=... | Concepts directly related to a specified concept by a specified relationship |
getRelatedByType | /rxcui/rxcui/related?tty=... | Concepts of specified types that are directly or indirectly related to a specified concept |
getRxConceptProperties | /rxcui/rxcui/properties | Concept name, TTY, and a synonym |
getRxNormName | /rxcui/rxcui | Name of a concept |
getRxNormVersion | /version | RxNorm data set and API versions |
getRxProperty | /rxcui/rxcui/property | A property of a concept |
getRxcuiHistoryStatus | /rxcui/rxcui/historystatus | Status, history, and other attributes of a concept |
getSourceTypes | /sourcetypes | Vocabulary sources |
getSpellingSuggestions | /spellingsuggestions | Strings similar to a specified string |
getTermTypes | /termtypes | Term types |
Returns true if rxcui has the propName property (and fits optional propValues criteria if given)
Get concepts associated with a specified identifier
Get concepts with a specified name Active or Current
Get concepts having a specified status
Get concepts having a specified term type (tty)
Get National Drug Codes (NDC) ever associated with a concept
NDCs having a specified NDC status
Get concept details
Get concepts related directly or indirectly to a specified concept (rxcui)
Get concept and atom IDs approximately matching a query
Get strings to support auto-completion, as used in a user interface
Get drugs related to a specified name
Get identifier types
Get brands containing specified ingredients
Get National Drug Code (NDC) details
Get status of a National Drug Code (NDC)
Get National Drug Codes (NDC) associated with a concept
Get RxNav property categories
Get property names
Get strings from sources that require a UMLS license
Get RxNorm Relationship types
Get concepts directly related to a specified concept by a specified relationship
Get concepts of specified types that are directly or indirectly related to a specified concept
Get concept name, TTY, and a synonym
Get name of a concept
Get RxNorm data set and API versions
Get a property of a concept
Get XML for status, history, and other attributes of a concept.
Note: as the XML content labels vary, this function returns the metadata in XML form.
Get vocabulary sources
Get strings similar to a specified string
Get term types
See https://rxnav.nlm.nih.gov/RxTermsAPIs.html, as copied below:
Function | REST Resource | Description |
---|---|---|
getAllConcepts | /allconcepts | All RxTerms concepts |
getAllRxTermInfo | /rxcui/rxcui/allinfo | RxTerms information for a specified RxNorm concept |
getRxTermDisplayName | /rxcui/rxcui/name | RxTerms display name for a specified RxNorm concept |
getRxTermsVersion | /version | RxTerms version |
Get all RxTerms concepts
Get RxTerms information for a specified RxNorm concept.
Returns the (quite variable) properties data in XML form.
Get RxTerms display name for a specified RxNorm concept
Get RxTerms version
See https://rxnav.nlm.nih.gov/RxTermsAPIs.html, as copied below:
Function | REST Resource | Description |
---|---|---|
findDrugInteractions | /interaction | Interactions of an RxNorm drug |
findInteractionsFromList | /list | Interactions between a list of drugs |
getInteractionSources | /sources | Sources of the interactions |
getVersion | /version | Version of the data set(s) |
Get interactions of an RxNorm drug with other items in the RxNorm database.
Returns a Vector
of NamedTuple
s as in (drug1, drug2, severity, description)
Get pairwise interactions between items in a list of drugs.
Returns a Vector
of NamedTuple
s as in (drug1, drug2, severity, description)
Get sources of the interactions
Get version of the data set(s)
You may install the package from Github in the usual way, or to install the current master copy:
using Pkg
Pkg.add("http://github.com/wherrera10/RxNav.jl")