Skip to content

A way to add generic foods (like a fruit or an egg) without personal API key for USDA database #799

Description

@prototyperspective

I think currently the biggest shortcoming of the app is that is doesn't support generic foods. This probably puts most users off before they learned the basics of the still-too-unknown app. Prior issues about this: #222 #86 #154

The current way this has been addressed requires the user to somehow learn that and how it's possible and to create and enter a personal API key for the USDA food database. This is not a solution for the following reasons:

  • Privacy (due to the personal API key)
  • Most people don't know this and aren't able to find out (also not even the FAQ has the info on how)
  • …instead they rather turn to another food tracking app which supports generic foods, notably MyFitnessPal, or stop using the app altogether (example)
  • The effort and time required to set this up
  • When searching it's still hard to find the generic item like "carrot" since it's not shown at the top
  • That this is not an accessible way, 95% of users won't do this even if they knew this is somehow possible and very many of those that would try don't have the skills to do this (many don't even have a computer); it's not user-friendly and greatly reduces the usefulness of the app

Please add a way to add generic foods without a personal API key for the FoodData Central database by the US Departments of Agriculture. These are the potential solutions I have thought of so far (maybe there are more):

  • import their data into a database of yours (the data is licensed CC0)
  • import their data into Open Food Facts
  • use another database that doesn't require a personal API key
  • get in contact with them so that a personal API key is not required
  • import their data into Wikidata or otherwise enter the data into Wikidata and then get the data from there (see my proposal here)
  • identify which of the foods in Open Food Facts could be good generic items for the particular food and then show that (using the unique ID) at the top of the search results
    • usually there already is some generic food somewhere in the results, it's just very hard to find and sometimes what one thinks is the generic food item is actually some drink with that name or something like that
    • it would already be helpful if only the most common generic foods where included like that; for a more extensive approach one would need to have a list of foods for which there should be pinned generic food items; maybe such a list can be created from here or here
    • there usually aren't that notable differences in terms of nutrients between different cultivars of one food so just one or a small number of generic items per food (like 'sour apple' and 'sweet apple' for search "apple") would be enough and probably best; one can adjust the grams/portion so the size of the cultivar doesn't matter much and the app isn't yet suitable to track vitamin consumption anyway; when just entering "egg" obviously the item for chicken eggs should be shown at the top even if there also are generic food items for other eggs like quail eggs so it would need to be categorized as the more common food for that term

Activity

  1. davidhealey commented on Mar 14, 2024

    @davidhealey
    Owner
    • import their data into any a database of yours

    There is too much data and most of it isn't relevant to most people.

    • import their data into Open Food Facts

    OFF only supports products with barcodes, which is why there isn't a lot of generic products in there already.

    use another database that doesn't require a personal API key

    This would be good. If you know of one then please let us know.

    • import their data into Wikidata

    Interesting idea. I'm not familiar with Wikidata, if someone imports the data and tells us how to access it via an API then I don't see an issue with that. For generic food items the data is unlikely to change so it would require minimal maintenance.

    Personally I haven't had any issues just using OFF. If I buy a potato it's usually in a bag of potatoes with nutritional info and a barcode. Same with flour, bread, milk, sugar, eggs, etc. Occasionally I'll buy loose fruit/vegetables, but right next to it in the shop there are some packaged with a barcode, so I can scan those.

  2. prototyperspective commented on Mar 14, 2024

    @prototyperspective
    Author

    There is too much data and most of it isn't relevant to most people.

    One could somehow filter for such generic foods

    OFF only supports products with barcodes

    Thanks for clarifying, I didn't know that! I will probably try to find out if it has ever been proposed to also feature items without barcodes and/or generic foods

    I have request such a large-scale bulk import which may require a few more data properties to be created and will come back to this if somebody does this; I've only added a few items manually and am not familiar with bulk imports which should probably be done by somebody experienced. Data access methods are described here.

    Occasionally I'll buy loose fruit/vegetables

    I only scan it at home but scanning the barcode of loose items in the shop is workaround that I think would be good to mention in the FAQ for example. I think many users already have their generic items for particular foods, the main problem for the adhoc solution to make things a lot easier for most cases would be making these available to others too without requiring workarounds like scanning packages next to loose items in shops. Generic items from online shops even when they have barcodes like various powders such as pea protein are usually not in OFF either. It's easier to simply enter the name of the commons generic food than having to always scan the barcodes even when there is no notable difference between them and often false/missing data for the item.

  3. voronaam commented on Jul 11, 2024

    @voronaam

    I am just starting with the app and this is the issue for me. I think this can be improved in the Search UI by a few tweaks:

    • Prioritize matches by how much of the title matches the food item's name. If user search for "Apple" it makes sense to show the top item "Apple, raw", rather then "Brandname Crispy Apple pie pudding".
    • Allow the user to toggle source filter in the Search UI. If I am adding a raw apple, I know OFF is useless to me and want to only see USDA results.
    • Add "negative" filter to exclude results. Searching for "Apple -crisps -pie -juice" would improve the results a lot.
  4. EmilJunker commented on Jul 11, 2024

    @EmilJunker
    Contributor

    @voronaam These are all very good ideas. The only problem is that I can't think of a good/easy way to implement any of them. It's not as easy as it sounds.

    Regarding the search sources, it might be helpful for you to know that currently the first (up to) 15 search results are always from USDA, and all results after that are from OFF.

  5. voronaam commented on Jul 11, 2024

    @voronaam

    the first (up to) 15 search results are always from USDA

    Thank you, I did not know that! This will help

  6. prototyperspective commented on Jul 14, 2024

    @prototyperspective
    Author

    I think for this app to be competitive to other calorie trackers / appealing to many users this problem needs to be addressed to some extent in some way even if that way is quite suboptimal...what about for now just manually configuring generic items for particular searches that are shown at the top? Nice to see voronaam is engaging with this problem.

    One could mark some generic apple as a reference apple and show it at the top when just "apple" is entered (translations can be gathered from some wordbook if they aren't already known to the app) which is better than requiring users to hassle around with developer API keys which even if they could not even close to 1% of users will ever configure or to require them to scroll around pages of "Brandname Crispy Apple pie pudding" for a term as common and generic as that just to use an item for generic apple that actually is a badly named apple juice item. Scanning things in the store is also not a feasible/useful temporary solution, for example because most people scan at home or enter things into the app at home.

  7. davidhealey commented on Jul 14, 2024

    @davidhealey
    Owner

    I think for this app to be competitive to other calorie trackers

    This is not a goal of Waistline.

  8. prototyperspective commented on Jul 14, 2024

    @prototyperspective
    Author

    You don't want this app to be used and you and other developers' time spent on it to be meaningful? I don't understand but that's not about the things and may be a bit offtopic to discuss this.

  9. davidhealey commented on Jul 14, 2024

    @davidhealey
    Owner

    You don't want this app to be used and you and other developers' time spent on it to be meaningful?

    I made this app for my own use, I didn't expect anyone else to use it, but I'm pleased people are.

  10. prototyperspective commented on Jul 15, 2024

    @prototyperspective
    Author

    This is going offtopic in this issue. That's a lot of time and effort for only something that you made for your personal use. If that was the original motivation and intend, by now it is the most advanced open source food tracking app.

    Moreover, EmilJunker has contributed much as well by now (and some others), there's some level of responsibility when a software is the most advanced open source one (better for people to improve it rather than develop the whole thing yet another time), and most importantly (this is not about responsibility – you don't need to develop this yourself, I'm just pointing out the importance of this issue which other people could look at as well) it's just common sense to make things one has spent a lot of time and effort for to be more useful than for usage by n=1 people. People may not want to share everything they eat with some private company with no options for privacy or collaboratively build a basic personal and societal tool. Thanks for what you built but the number of stars, downloads, and rank in sites like alternativeto should make it clear that this is a really important piece of software at this point.

  11. EmilJunker commented on Jul 15, 2024

    @EmilJunker
    Contributor

    Moreover, EmilJunker has contributed much as well by now

    @prototyperspective Thanks for your concern, but I'm good. Waistline is by far and away the most feature-rich open source nutrition tracker app out there. No other open source app comes even close to the amount of features and flexibility it offers. That is, for people who know how to use it 😉.

    The only other comparable app I'm aware of is OpenNutriTracker, but it still has a very long way to go before reaching parity with Waistline - although it arguably looks a lot prettier 😄. And note that it uses OpenFoodFacts and Food Data Central as its sources too, so it generally suffers from the same problems with generic food items as Waistline.

    Comparing Waistline to commercial food tracking apps is just wrong and misleading. Waistline will never be as user friedly as those apps. But for users who prefer open source, Waistline is the best choice.

    Long story short, I don't consider the time I invested into Waistline a waste. I'm proud of this app. In fact, working on Waistline is how I landed my current job as a hybrid app developer.

  12. hermann-san commented on Apr 12, 2025

    @hermann-san

    another practical workaround for getting generic food into the local list could be to use a browser on a PC/notebook/tablet and open the website of OFF. There I can add the needed products much faster (or at all) and each item has a barcode which I can scan from my notebook display with my phone.
    e.g for kiwi there is this OFF page and it has a code I can scan. This way I can easily add many products (compared to phone only) that I eat often, to my personal list. In the browser version of OFF I can also filter by category (e.g. fruit, vegetable, ....) and that can be at times much easier to find products (without a code) then with a phone only.

    Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions