0

I am trying to build a query tool that takes a scanned barcode (NDC) and looks up the drug information in the openFDA. I have a package for Latanoprost Ophthalmic Solution with a package code of 2420846325, which I think translates to 24208-463-25. Using Postman with my api-key, I submit a GET such as: https://api.fda.gov/drug/ndc.json?api_key=&search=product_ndc:24208-463-25

However, this returns the product "Carvedilol" and not Latanoprost like I would expect.

When I use the Search page (https://www.accessdata.fda.gov/scripts/cder/ndc/index.cfm), selecting the "NDC Code" type from the drop down menu and providing 24208-463-25 for the code, I get the results I was looking for. I do notice that the online query returns a product ndc value of 24208-463 which returns the correct result when I use it in my GET call.

I am hoping you can tell me if the package code is being ignored with the online tool and should I also drop that package code when I make my API calls?

Thank you for your help.

1 Answer 1

1

You can search with the package code using the below query (packaging.package_ndc). Below query return the results including package code.

https://api.fda.gov/drug/ndc.json?search=packaging.package_ndc:24208-463-25

If you want to search only by product ndc code excluding the package code use the below query.

https://api.fda.gov/drug/ndc.json?search=product_ndc:24208-463

Both the queries return the results for the drug latanoprost. You can find more details about the searchable fields for NDC directory here (https://open.fda.gov/apis/drug/ndc/searchable-fields)

2
  • The problem that I am running into is that scanning the barcode gives me the value 2420846325 and so I am looking for an algorithm to determine if that should be 4-4-2, 5-3-2, or 5-4-1 format to submit to the API.
    – sonoerin
    Commented Nov 8, 2019 at 0:57
  • When I scan the packaging I get {"format":"UPC_A","text":"324208463253"}' . I see that I can disregard the first ('3') and last ('3') values, but that still leaves the problem of knowing how to parse 2420846325 into either a product or package NDC value.
    – sonoerin
    Commented Nov 9, 2019 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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