RxNav.jl

Julia interface to the National Library of Medicine's online pharmaceutical RxNav API
Author wherrera10
Popularity
6 Stars
Updated Last
1 Year Ago
Started In
June 2021

Build status Build Status CI

RxNav.jl

Julia interface to the National Library of Medicine's online pharmaceutical RxNav API

Examples


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]"



General Use Functions

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.



rcui(name)

Take a name of a drug as String argument, return its RxCUI as String.

drugs(name)

Given a drug name, return a list of all available dosing forms of the drug.

interact(list::Vector)

interact(s1::String, severeonly::Bool=true)

interact(s1::String, s2::String, args...)

Get a list of interactions for a single drug (or rxcui drug id) or pairwise interactions for more than one drug (or rxcuid).

interaction(id; ONCHigh = true)

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 NamedTuples as in (drug1, drug2, severity, description).

interaction_within_list(idlist::Vector{String})

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 NamedTuples as in (drug1, drug2, severity, description)


API functions

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").




RxClass API


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



findClassByName(classname::String, types::Vector{String} = String[])

Get drug classes with a specified class name

findClassesById(classid::String)

Get drug classes with a specified class identifier

findSimilarClassesByClass(classid::String, relasource::String, extra=[])

Get classes with similar clinically-significant RxNorm ingredients

findSimilarClassesByDrugList(rxcuis::Vector{String}, extra=[])

Get classes with clinically-significant RxNorm ingredients similar to a specified list

getAllClasses(classtypes::Vector{String}=String[])

Get all classes (may limit by class type with optional argument)

getClassByRxNormDrugId(rxcui::String, extras = [])

Get classes containing a specified drug RXCUI

getClassByRxNormDrugName(drugname::String, extras = [])

Get classes containing a drug of the specified name

getClassContexts(classid::String)

Get name and type context for paths from the specified class to the root of its class hierarchies

getClassGraphBySource(classId, source="")

Get classes along the path from a specified class to the root of a class hierarchy

getClassMembers(classid::String, source::String="")

Get drug members of a specified class

getClassTree(classid::String, type="")

Get subclasses or descendants of the specified class

getClassTypes()

Get class types

getRelas()

Get relationships expressed by a source of drug relations

getSimilarityInformation(id1, source1, id2, source2, extras=[])

Get similarity of the clinically-significant membership of two classes by id and source

getSourcesOfDrugClassRelations()

Get sources of drug-class relations

getSpellingSuggestions(term::String, type="")

Get drug or class names similar to a given string


RxNorm API


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



filterByProperty(rxcui::String, propName::String, propValues::Vector{String} = [])

Returns true if rxcui has the propName property (and fits optional propValues criteria if given)

findRxcuiById(idtype::String, id::String, allsrc = 0)

Get concepts associated with a specified identifier

findRxcuiByString(name::String, extras=[])

Get concepts with a specified name Active or Current

getAllConceptsByStatus(status = "ALL")

Get concepts having a specified status

getAllConceptsByTTY(tty::Vector{String})

Get concepts having a specified term type (tty)

getAllHistoricalNDCs()

Get National Drug Codes (NDC) ever associated with a concept

getAllNDCsByStatus(status = "ALL")

NDCs having a specified NDC status

getAllProperties(rxcui, properties = ["ALL"])

Get concept details

getAllRelatedInfo(rxcui::String)

Get concepts related directly or indirectly to a specified concept (rxcui)

getApproximateMatch(term::String, extras = [])

Get concept and atom IDs approximately matching a query

getDisplayTerms()

Get strings to support auto-completion, as used in a user interface

getDrugs(name::String)

Get drugs related to a specified name

getIdTypes()

Get identifier types

getMultiIngredBrand(ingredientids::Vector{String})

Get brands containing specified ingredients

getNDCProperties(value::String)

Get National Drug Code (NDC) details

getNDCStatus(ndc::String, extras = [])

Get status of a National Drug Code (NDC)

getNDCs(rxcui::String)

Get National Drug Codes (NDC) associated with a concept

getPropCategories()

Get RxNav property categories

getPropNames()

Get property names

getProprietaryInformation(rxcui::String, ticket::String, extras = [])

Get strings from sources that require a UMLS license

getRelaTypes()

Get RxNorm Relationship types

getRelatedByRelationship(rxcui::String, relata::Vector{String})

Get concepts directly related to a specified concept by a specified relationship

getRelatedByType(rxcui::String, ttys::Vector{String})

Get concepts of specified types that are directly or indirectly related to a specified concept

getRxConceptProperties(rxcui::String)

Get concept name, TTY, and a synonym

getRxNormName(rxcui::String)

Get name of a concept

getRxNormVersion()

Get RxNorm data set and API versions

getRxProperty(rxcui::String, propname::String)

Get a property of a concept

getRxcuiHistoryStatus(rxcui::String)

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.

getSourceTypes()

Get vocabulary sources

getSpellingSuggestions(phrase::String)

Get strings similar to a specified string

getTermTypes()

Get term types


RxTerms API


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



getAllConcepts()

Get all RxTerms concepts

getAllRxTermInfo(rxcui::String)

Get RxTerms information for a specified RxNorm concept.
Returns the (quite variable) properties data in XML form.

getRxTermDisplayName(rxcui::String)

Get RxTerms display name for a specified RxNorm concept

getRxTermsVersion()

Get RxTerms version


Drug Interaction API


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)



findDrugInteractions(rxcui::String, extras = [])

Get interactions of an RxNorm drug with other items in the RxNorm database. Returns a Vector of NamedTuples as in (drug1, drug2, severity, description)

findInteractionsFromList(rxcuis::Vector{String}, extras = [])

Get pairwise interactions between items in a list of drugs. Returns a Vector of NamedTuples as in (drug1, drug2, severity, description)

getInteractionSources()

Get sources of the interactions

getVersion()

Get version of the data set(s)


Installation


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")