Skip to main content

FDA Drug Database

Project description


PLEASE NOTE: this library is not actively maintained and receives only minimal updates necessary. Most of it is no longer in active use at Ro.


travis pypi codecov requiresio

A Django wrapper for National Drug Code (NDC) database. fdadb stores each row under one name MedicationName object instead of having multiple drugs with the same name next to each other, for example: In the NDC database there are around 21 Viagras (with different strengths) so in such case we save the MedicationName: Viagra and under this name we store all the 21 instances. This allows for better user experience when searching through the list of drugs.

Setting Up

  • pip install fdadb

  • Add fdadb to your INSTALLED_APPS

  • ./ migrate fdadb

  • ./ fetch_ndc_database - might take 15-30 minutes (the command will fetch all items from FDA database and save it in your project)


All APIs are searchable with ?q=term query param.


Returns list of MedicationName objects (pass ?q=termtosearch to filter the results), this API supports ElasticSearch for fast querying. Pagination does not work yet when ElasticSearch is enabled (in most cases this does not cause any issues, as this API is generally used for drug autocomplete). You can change the autocomplete limit by setting FDADB_AUTOCOMPLETE_LIMIT in your Django configuration (default: 10).

The ElasticSearch uses ngram for the query parameter.


Returns list of medication strengths


Returns list of Medication NDCs


To enable support of ElasticSearch in autocomplete, set:

  • ELASTICSEARCH_URL in project configuration

  • Run ./ fdadb_es_index after fetching the NDC database (use --drop_indexes in case you want to cleanup the medications index) commands

  • ./ fdadb_es_index - indexes the products into ElasticSearch

  • ./ fetch_ndc_database - fetches products data from NDS DB and saves in the database


  • Django 1.11, 2.1, 2.2

  • Python 3.4-3.6

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fdadb-0.2.0.tar.gz (13.4 kB view hashes)

Uploaded source

Built Distribution

fdadb-0.2.0-py2.py3-none-any.whl (12.7 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page