You are here

RxIMAGE API

Printer-friendly versionPrinter-friendly version

The RxIMAGE API is a freely accessible Application Programming Interface that software developers can use to create apps for text-based search and retrieval from the RxIMAGE database. The RxIMAGE database is the Nation’s only portfolio of curated, freely available, increasingly comprehensive, high-quality digital images of prescription pills and associated data. The general public can use such apps to search for and retrieve images and data from the RxIMAGE database.

Photographs of pills in the RxIMAGE database were taken under laboratory lighting conditions, from a camera directly above the front and the back faces of the pill, at high resolution, and using specialized digital macro-photography techniques. Image segmentation algorithms were then applied to create the JPEG images in the database. The images include NLM watermarks.

The RxIMAGE database contains images of thousands of pills. The images and data are intended for use in health care and research applications, in environments ranging from smart phones to desktops. Examples of pills are capsules and tablets intended for oral use.

API REQUEST OVERVIEW

The RxIMAGE API is a RESTful (representational state transfer) Web API. Results can be returned in either JSON (JavaScript Object Notation) or XML format. API conventions are:

  • Parameter names use the camelCase naming convention.
  • Parameters are presented in escaped format.
  • Logical AND is used to parse multiple parameters and multiple terms within one parameter.

The API request has the form:

http://rximage.nlm.nih.gov/api/{apiName}/{apiVersion}/{resourcePath}?{parameters} where:

  • {apiName}=rximage
  • {apiVersion}=1
  • {resourcePath}=rxnav (image includes an information panel that gives name, dosage, manufacturer, color(s), imprint (text on the pill), shape, and size) or rxbase (no panel)
  • GET parameters for image selection by appearance are color(s), imprint, imprintColor(s), imprintType (debossed, embossed, or printed), score, shape, size, sizeT (T for tolerance), and symbol (presence/absence)
  • GET parameters for image selection by codes and names enable, for example, search for a specific National Drug Code (NDC), Structured Product Labeling (SPL) identifier, brand name, generic name, active ingredient, or inactive ingredient
  • GET parameters for results control can:
    • Request that the output data include lists of active and/or inactive ingredients or include color(s), imprint, imprintColor(s), imprintType, score, shape, size, and symbol
    • Specify image resolution – one is recommended for high-bandwidth and print, several are for mobile devices
    • Request a specific number of images and their associated data or request paged output

For each image found in response to an API request, the API returns the URL of the image, the brand name and dosage, NDC data, and SPL identifier; appearance parameter values are optional.

API developers are encouraged to use the enumeration parameter to retrieve possible values for the color, imprintColor, imprintType, resolution, score, shape, and size parameters.

EASY-TO-USE FORM FOR BUILDING AN API REQUEST

Software developers can fill out a form to select or enter desired API parameter values, see the resultant API request as each value is selected or entered or changed, and then submit the request or view the images returned by the request.

DETAILED RxIMAGE API DOCUMENTATION

Detailed RxIMAGE API documentation provides information about RxIMAGE search, output control, and output parameters, error handling, and examples.

EXAMPLE

The API request for all blue pills that are exactly 17 mm (millimeters) in their longest dimension is:

http://rximage.nlm.nih.gov/api/rximage/1/rxnav?color=blue&size=17&sizeT=0

The returned images are:

 

PILL IMAGE RECOGNITION CHALLENGE

On January 19, 2016, a Federal Register Notice announced a Pill Image Recognition (PIR) Challenge. The Challenge invites individuals and teams to submit algorithms and software for pill image recognition. The submissions are to rank images taken from NLM's RxIMAGE database of high-quality prescription pill images by similarity to consumer-quality images of the same pills. NLM plans to use the submissions in creating a future software system and a future Application Programming Interface (API) that can be used in identifying an unknown prescription pill from a photo taken of that pill by a smart phone. Registration, submission instructions, and other information is at pir.nlm.nih.gov/challenge.

The Challenge was preceded by a Pill Image Recognition pilot. The Pill Image Recognition (PIR) Request For Information (RFI) Pilot and its Instructions for Responding were posted on February 2, 2015.

ATTRIBUTION

Suggested attribution: RxIMAGE is a product of the National Library of Medicine.

CORRESPONDENCE

Please send to RxIMAGE@nlm.nih.gov:

  • Comments, questions, and suggestions about the RxIMAGE API and the RxIMAGE database
  • Requests to receive RxIMAGE e-mail announcements
  • Requests to use an NLM logo in your apps
  • Requests to waive the NLM attribution
  • Requests to be included in a developer information forum

MORE ABOUT THE PILLS AND THE RxIMAGE API PROJECT

The pills photographed for the database have been voluntarily provided by pharmaceutical manufacturers, purchased from licensed pharmaceutical retailers, acquired through wholesale channels, or provided by other Federal agencies.

The RxIMAGE API and database are part of the Computational Photography Project for Pill Identification. C3PI is a research and development project in NLM/LHNCBC's Office of High Performance Computing and Communications (OHPCC).

The Center for Drug Evaluation and Research at the U.S. Food and Drug Administration provided technical advice, funding, and in-kind support for the development of the SPL image guidelines, the establishment of an imaging facility, and some image capture.

OHPCC appreciates the high quality pill photography, RxIMAGE database, and RxIMAGE API work being done under contract by Medicos Consultants, LLC.