3

The counts by date range do not seem to add up. For example, the following two queries

https://api.fda.gov/drug/event.json?search=patient.drug.openfda.brand_name:"ambien"+AND+serious:1+AND+patient.patientsex:1+AND+[2013-01-01+TO+2014-01-01]&count=patient.reaction.reactionmeddrapt.exact&limit=10

and

https://api.fda.gov/drug/event.json?search=patient.drug.openfda.brand_name:"ambien"+AND+serious:1+AND+patient.patientsex:1+AND+[2012-01-01+TO+2013-01-01]&count=patient.reaction.reactionmeddrapt.exact&limit=10

return 46 and 137 for FATIGUE, respectively. However, a query that combines those two date ranges into one, namely

https://api.fda.gov/drug/event.json?search=patient.drug.openfda.brand_name:"ambien"+AND+serious:1+AND+patient.patientsex:1+AND+[2012-01-01+TO+2014-01-01]&count=patient.reaction.reactionmeddrapt.exact&limit=10

returns 139 for FATIGUE, instead of 183.

Is this a real issue or a syntax error in the query?

Note that a query avoiding the first day of 2014 (to avoid overlap) does not work at all (I get back "No matches found!")

https://api.fda.gov/drug/event.json?search=patient.drug.openfda.brand_name:"ambien"+AND+serious:1+AND+patient.patientsex:1+AND+[2013-01-01+TO+2013-12-31]&count=patient.reaction.reactionmeddrapt.exact&limit=10

This seems to be an outright issue with how dates are handled.

Ron

  • One issue seems to be that you are not specifying receivedate for your data query. For example, try the following instead of your fourth (and last) URL example: https://api.fda.gov/drug/event.json?search=patient.drug.openfda.brand_name:%22ambien%22+AND+serious:1+AND+patient.patientsex:1+AND+receivedate:[2013-01-01+TO+2013-12-31]&count=patient.reaction.reactionmeddrapt.exact&limit=10 – Mark Silverberg Jun 9 '14 at 19:02
4

Mark is correct - you need to specify the date field that you want to search on. receivedate tends to work best.

  • It appears receivedate only accepts a single date, as in api.fda.gov/drug/… When I submit Mark's suggestion I get { "error": { "code": "BAD_REQUEST", "message": "" } } – medidatian Jun 10 '14 at 4:07
  • It looks like Mark's suggestion doesn't work if you copy and paste due to encoding errors. Additionally, you need to wrap your date ranges in brackets. I used api.fda.gov/drug/… and got results as expected. – Sean Herron Jun 10 '14 at 4:50
  • It was a cut and paste issue. The hyphens were non-ascii ([2013-01-01+TO+20%E2%80%8C%E2%80%8B13-12-31]). This solved the issue and the results I am getting are now accurate. Thanks! – medidatian Jun 10 '14 at 14:43
  • Actually, on second thought, those are the UTF-8 sequences for "ZERO WIDTH NON-JOINER" (E2 80 8C) and "ZERO WIDTH SPACE" (E2 80 8B). They are invisible in the URL string but the service does not tolerate them. – medidatian Jun 10 '14 at 14:56

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.