APIs

RxNorm API

getApproximateMatch

Information returned
Concept and atom IDs approximately matching a query
Service domain
https://rxnav.nlm.nih.gov
HTTP request
GET  /REST/approximateTerm.xml?term=value&maxEntries=value&option=value

Description

Searches for strings in the data set that most closely match the term pararmeter.

This function is useful for strings where an exact or normalized string match (findRxcuiByString) does not find the desired results. For example, consider the following queries:

Search TermNote
ACCUPRIL 20 MG TAB TABLET(contains extra word)
HYDROCHLOROT 50 MG TABLET(unknown abbreviation)
Rantidine 15 ML Syrup Oral(misspelled word)

Results can optionally be limited to Active concepts with the option parameter.

Results include the RxAUI, RxCUI, and, where permissible, the name of the closest atoms.

Each atom's name is returned if its source vocabulary has no restrictions (RXNSAB SRL=0) or the request demonstrates a current UMLS license. Otherwise, the name element is omitted.

To demonstrate a current UMLS license, include a UMLS UTS API key in the HTTP "Authorization" header: "Authorization: Bearer put-your-key-here" (substituting the API key). Consult your tool documentation for instructions for providing an HTTP request header, such as Authorization. For information about how to obtain a UMLS UTS API key, please visit the National Library of Medicine’s UMLS Terminology Services.

Results are returned in order by the quality of the lexical match, best results first (rank=1). The maxEntries parameter gives some control over the number of results, but more or fewer may be returned to avoid splitting a rank.

For more information about the approximate-matching algorithm, see Approximate Matching in the RxNorm API.

Scope

Selectable (see parameters):

  • Active: concepts in the current RxNorm data set that have an atom with SAB=RXNORM and SUPPRESS=N

  • Current: concepts in the current RxNorm data set that have an atom with SUPPRESS=N

Parameters

ParameterLocationUseDescriptionDefault
formatPathOptional

Notation for results

One of:
.xml
Get results in XML
.json
Get results in JSON
.xml
termQueryRequiredString, of which to find approximate matches
maxEntriesQueryOptionalCoarse control of number of results

(Range: 1 to 100.)

20
optionQueryOptionalScope of search
One of:
0
Find atoms in Current concepts
1
Find atoms in Active concepts
0

All query parameters are case-insensitive.

Note that HTTP requires that query parameters be "URL encoded". For full information on URL encoding, please refer to IETF RFC 3986, "Uniform Resource Identifier".

Follow instructions specific to your tools for specifying a request header.

Output structure

Results are available as either XML or JSON.

  • The XML result has the root element rxnormdata. It is described in the XML Schema for the RxNorm API; the relevant element structure is summarized below. Elements that would be empty might be left out.

  • The JSON result is an object {...}, analogous to the content of the XML rxnormdata. Fields that might occur multiple times in the XML are expressed as an array. Fields that would be empty might be null or left out. Numbers are expressed as strings.

Both XML and JSON results follow the same outline:

rxnormdata
Root element in XML, or anonymous object in JSON
approximateGroup
inputTerm
(Always empty)
candidate (array)
rxcui
RxNorm identifier
rxaui
RxNorm RXAUI (string identifier) that matches
score
Match score (higher is better, among a given set of results)
rank
1 for all best matches, 2 for all second-best matches, etc.
name
RxNorm concept name
source
Source vocabulary

Example: Terms like "zocor 10 mg"

XML: https://rxnav.nlm.nih.gov/REST/approximateTerm?term=zocor%2010%20mg&maxEntries=4

JSON: https://rxnav.nlm.nih.gov/REST/approximateTerm.json?term=zocor%2010%20mg&maxEntries=4

An XML result is shown below.

<rxnormdata>
    <approximateGroup>
        ...
        <candidate>
            <rxcui>563653</rxcui>
            <rxaui>12297106</rxaui>
            <score>12.743185997009277</score>
            <rank>1</rank>
            <name>simvastatin 10 MG [Zocor]</name>
            <source>RXNORM</source>
        </candidate>
        <candidate>
            <rxcui>104490</rxcui>
            <rxaui>12661942</rxaui>
            <score>12.743185997009277</score>
            <rank>1</rank>
            <source>GS</source>
        </candidate>
        <candidate>
            <rxcui>104490</rxcui>
            <rxaui>2651386</rxaui>
            <score>12.743185997009277</score>
            <rank>1</rank>
            <source>GS</source>
        </candidate>
    </approximateGroup>
</rxnormdata>