1

I'm trying to use the label API to search for a specific OTC drug. Lets take CVS's 10mg Loratadine for example. The NDC number is 59779-612-75.

Based on the API docs I think the right query should be:

https://api.fda.gov/drug/label.json?search=openfda.product_ndc:59779-612-75&limit=100

That returns several hundred results, none of which have a openfda.product_ndc field that matches. Most are substrings or similar strings. The correct product is in there, but the product_ndc doesn't match. The package_ndc field (which isn't documented) does.

None of the variations on NDC substring seem to work either, all return several hundred results: https://api.fda.gov/drug/label.json?search=openfda.product_ndc:59779-612&limit=100 https://api.fda.gov/drug/label.json?search=openfda.package_ndc:59779-612-75&limit=100 https://api.fda.gov/drug/label.json?search=openfda.package_ndc:59779-612&limit=100

A lookup on the following site returns exactly one correct match: http://www.accessdata.fda.gov/scripts/cder/ndc/dsp_searchresult.cfm

Am I missing something or is the API behaving a bit strangely?

1

I think if you use quotes around the product_ndc field it should give you the results you are looking for.

https://api.fda.gov/drug/label.json?search=openfda.product_ndc:"59779-612"&limit=100

Link for reference:

https://open.fda.gov/api/reference/#exact-matches

  • Yeah, that does work. Just strange that it treats the pieces of the NDC code as partial string matches rather than using the entire NDC code. If I search for "hotdog" I don't get results for "hot" or "h". Is it the hyphen triggering that behavior? – emen Jun 23 '15 at 13:00
  • That I don't know, and that is a good point. I think it may have been setup like that more for when people search for names of drugs, almost like a fuzzy search. It could also be elastic search behavior and not a programmatic decision. – mikedklein Jun 23 '15 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.