wger-project / flutter

Flutter fitness/workout app for wger
GNU Affero General Public License v3.0
527 stars 231 forks source link

App should show brand for ingredients #630

Open ysalmon opened 4 weeks ago

ysalmon commented 4 weeks ago

Use case

Some products/ingredients are manufactured and sold under the same name but different brands, and also do not have the same nutritional values. It is therefore difficult to choose between equally named ingredients when searching for one.

Proposal

The list obtained after a search in the nutrition tab should also display the brand, as fetched from eg. OpenFoodFacts. And the details panel too.

Maybe even, the search input could have a separate field for brand ? At least, search should also operate on brands : it is often quicker that way, because not so many brands will sell products with the same name but different nutritional values (at least in a given country).

More generally, inspiration, and maybe even some code, could be taken from the Energize app, which has way less features than wger but imho a better interface for food logging (including responsiveness).

Dieterbe commented 4 weeks ago

re search, i would like to be able to fuzzy search, for example "pudd dan" would include "danone pudding"

re displaying brand, it seems the api currently doesn't include this information, perhaps @rolandgeider can find a way to include it.

ysalmon commented 4 weeks ago

It seems the API has brands : https://pub.dev/documentation/openfoodfacts/latest/openfoodfacts/OpenFoodAPIClient/getProductV3.html

Here is how Energize searches for OFF products : https://codeberg.org/epinez/Energize/src/commit/f96c9183c0f4537dac70673055fb704135c16017/lib/services/food_database_bindings/open_food_facts/open_food_facts_binding.dart#L56

and how they consume the results from OFF : https://codeberg.org/epinez/Energize/src/commit/f96c9183c0f4537dac70673055fb704135c16017/lib/models/food/food.dart#L242

Dieterbe commented 4 weeks ago

FWIW i meant the wger api. it looks like energize may work directly with OFF. in wger, we import from OFF via background jobs into the database, and then expose the database via the wger api (to the wger flutter app, the wger web UI, etc) the job: https://github.com/wger-project/wger/blob/master/wger/nutrition/management/commands/import-off-products.py it uses the code here https://github.com/wger-project/wger/blob/5c7192317a1f05fec64af33caf4224f4a4d49b05/wger/nutrition/off.py#L72 , it looks like we include brand into the database but i don't think we expose it via the wger api.