I want to ask how can I use fuzzy search in openfda api?

For example, I am using "panadol" to search something.


But sometime I miss some word in panadol, So I can search the same result like panadol?

For example, I am using "anadol" to search.


In this case, It will return no matches found. So can I use fuzzy search in openfda api?

Any comments will be much appreciated.

2 Answers 2


Sorry, openFDA doesn't currently support searches based on wildcard, fuzziness, regular expression or proximity.

To get matching results, there are no reasonable alternatives except to search by the full accurate word

  • Thank you very much, I will try to improve my another part!
    – Hina
    Oct 24, 2017 at 3:10

As a workaround, you can download a local dictionary of medical and pharmacy terms, and then fuzzy-match your sub-string to the tokens in your local dictionary. You may be able to get tokens from the API itself, for example, and end-point that returns a list of all drug names.

This isn't real fuzzy-matching, because you are finding sub-tokens in tokens, and not changing spellings, e.g. anEdol

python pseudo-code:

import requests
url = 'https://api.fda.gov/drug/label.json?search=brand_name:'

text = 'anadol'

with open('meddict.txt','r') as f:
    d = f.readlines()

# or
# d = ['panadol','aspirin','ibuprofin']    

for item in d:
   if text in item:
       print 'fuzzy match',item,text
       r = requests.get(url+item)
       print r.json

But you can also do a fuzzy-match between your search string and the medical dictionary, and then pass the words with a high-enough match score to the web service.

I'll search a bit for an open medical dictionary, and perhaps it's worth opening a new question.

  • Thank you for your suggestion, I think it is a good solution to implement fuzzy search. Thank you very much.
    – Hina
    Oct 26, 2017 at 10:23

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.