I am researching hormonal birth control and finding different results depending on how the order of the drug is listed. Also, if a space is used between Ethinyl Estradiol or not.

Ethinyl Estradiol+Norelgestromin = 83,341 records
EthinylEstradiol+Norelgestromin =15,106 records
EE+Norelgestromin = 14,260 records

Ethinyl Estradiol+Etonogestrel = 90,482 records
EthinylEstradiol+Etonogestrel = 15,972 records
EE+etonogestrel = 15,117 records
EE+eton = 217 records

Other results that were interesting: NuvaRing is the only product that I know of (although I might be wrong) that uses Ethinyl Estradio AND Etonogestrel and it was interesting to see the various results

Etonogestrel+Ethinyl+Estradiol+nuvaring = 90,495 records
Nuvaring = 7,741 records
Nuva = 15 records

It looks like some records are recorded differently, such as Ethinyl Estradiol, or EthinylEstradiol or EE so they all counted separately, so the total count is not correct. Other issues as to how the drug name is entered appear to be affecting the data as well.

  • I'm happy to help you figure this out, but need to see the queries you were running. For example, which fields were you searching in? – Adam Oct 23 '14 at 0:17

Actually, Andrew from OpenGeoCode's answer isn't quite correct; it is a much wider query than expected. I'll explain why.

First, to the OP: This is exactly what is necessary to answer your original question—a pasted link to the queries you used to arrive at your results! Otherwise there's no way to reproduce the queries.


This returns about 83k results. Why so many? Here's what's going on.

The API is going to search for:

  • patient.drug.medicinalproduct.exact:EthinylEstradiol

    All records where medicinalproduct contains exactly "EthinylEstradiol" 0 results

  • +Norelgestromin

    Because Norelgestromin is "loose" in the query—it's not prefixed by a field to search in—the API will search in every field, in every record, for the word Norelgestromin ~14k results.

  • +patient.drug.medicinalproduct.exact:Ethinyl

    Because there's a space between Ethinyl and Estradiol, but these are not grouped with quotation marks to indicate an exact phrase match is desired, the API searches for all records where medicinalproduct contains exactly "Ethinyl" 0 results

  • %20Estradiol

    Again, this is "loose" in the query so the API does a big keyword search across all fields for the word Estradiol, wherever it may be found. ~83k results

  • +Norelgestromin

    Again, this is "loose" in the query so the API does the same broad keyword search it did before. No new records are returned.

  • &count

    This does nothing now. count needs a parameter—a field to count. i.e. count=patient.drug.medicinalproduct.exact will return a list of the top medicinalproduct entries across the matching records; it's a good way to ballpark your query logic and see whether you're casting too wide a net.

Here are different, more specific queries.

  1. This first one is a much more precise intersection of two ingredients, but may not capture all the misspellings or combinations that are possible.


    In this query (about 30 results) we're looking for any records where the medicinalproduct contained BOTH "Ethinyl Estradiol" AND "Norelgestromin" or contained BOTH "EthinylEstradiol" AND "Norelgestromin".

    Here's a more compact version of the same query, using more parentheses to group all the things we want to search for within medicinalproduct:


    Note that the + is just a "space" and to the API, it's an implicit OR. In other words, if you just write a bunch of words with spaces between them, the API is going to try to match the biggest number of records that contains any of those words. You can use quotation marks and the keyword AND to be more specific.

  2. This second one is more like what I think Andrew from OpenGeoCode was going for—a union of records that match ANY of "Ethinyl Estradiol" OR "EthinylEstradiol" OR "Norelgestromin". It returns about 7k records.


    Remember, the parentheses are grouping all the things we want to look for WITHIN medicinalproduct, and the + between them is an implicit OR.

| improve this answer | |

I am able to replicate your results. The problem you are having is that the query is doing a keyword match with the terms you are using. Some of the records list the drup Ethinyl Estradiol with a space and others without a space.

Do not use abbreviations like 'EE'. I found they match unrelated records that had EE in them.

I believe the query below will give you the union of records using Ethinyl Estradiol with and without a space and Norelgestromin, and filter out inexact matches to the drug name. Otherwise, remove the two instances of '.exact'


"total": 83309

| improve this answer | |

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.