USDA / USDA-APIs

Do you have feedback, ideas, or questions for USDA APIs? Use this repository's Issue Tracker to join the discussion.
www.usda.gov/developer
107 stars 16 forks source link

Suggestions regarding sorting order and categorization #76

Open ellasaro opened 4 years ago

ellasaro commented 4 years ago

Experimenting with the Food Data Central I've encountered two big differences that can impact the way my system uses the API today. I'm not just making these suggestions for my own convenience but because they are pretty common features that the legacy API has.

1 - Sorting the result by "relevance". According to the documentation the possible sorting options are: lowercaseDescription.keyword, dataType.keyword, publishedDate, fdcId. Could I be possibly missing something? Is "lowercaseDescription.keyword" the same as "relevance"?

2 - Narrow a food search using Food Groups, ie: what it used to be, for instance, "Baked Products". That provides an extra tool for filtering foods with similar names to the one we are searching but are in other food groups which are not of our interest and make our search result "crowded", ie: if I'm searching for a "Banana" in "Fruits and Fruit Juices" it saves me the trouble of ignoring a "Banana Cream Pie" from my results which would be in the category "Baked Products".

Thank you!

littlebunch commented 4 years ago

@ellasaro. Regarding sort, I believe the default order is relevance. There's a "score" element that gives the Lucene score for each food item returned by a search. The other options are actual index names, e.g. lowercaseDescription.keyword. I've suggested that these be changed to something more meaningful for users, e.g. "description", "datatype", etc.

I think the problem with food groups is that there is no common nomenclature across datasets. For example, SR Legacy food groups don't cross reference FNDDS food groups. Ditto Branded Foods. I believe there have been efforts to address the issues but not sure what progress if any has been made.