openfoodfacts / smooth-app

🤳🥫 The new Open Food Facts mobile application for Android and iOS, crafted with Flutter and Dart
https://world.openfoodfacts.org/open-food-facts-mobile-app?utm_source=off&utf_medium=web&utm_campaign=github-repo
Apache License 2.0
787 stars 271 forks source link

Direct link to "fix that ingredient" from Knowledge Panel #2245

Open monsieurtanuki opened 2 years ago

monsieurtanuki commented 2 years ago

Problem

As a vegetarian, I find it very frustrating to see obvious vegetarian or vegan products not being flagged so just because there's an unknown ingredient or a potentially non-vegetarian ingredient. Happens all the time with soy milk and breakfast cereals. That could even be a deal breaker: "so you think you're smart but you don't even know that soy milk is vegan?"

Proposed solution

Beyond the fact that a "vegan" or "vegetarian" label should maybe override OFF's assessment, I suggest to put a direct link from "unknown ingredient" to a "help us fix that ingredient" website page.

Additional context

barcode 5010477348630 Capture d’écran 2022-06-10 à 09 12 57

M123-dev commented 2 years ago

This is in fact a more common problem, not just for vegan/vegetarian, so we should aim for a more general solution

M123-dev commented 2 years ago

Don't know if some backend changes are needed for this

monsieurtanuki commented 2 years ago

@M123-dev The thing is that even on the website I don't understand what to do with unknown ingredients.

Regarding "forcing" the vegetarian status, I guess it should be done on the server side as it changes the score too. But that was not the main point of my OP.

teolemon commented 2 years ago
stephanegigandet commented 2 years ago

Beyond the fact that a "vegan" or "vegetarian" label should maybe override OFF's assessment,

It actually does, if there is a vegan or vegetarian label, then it is used for the vegan / vegetarian attributes and knowledge panels.

stephanegigandet commented 2 years ago

One thing we could do is to add default labels for some product categories. So if a product is in the breakfast cereals category for instance, we could consider that all unknown ingredients are most probably vegetarian (and in the panels we would still list them).

monsieurtanuki commented 2 years ago

One thing we could do is to add default labels for some product categories. So if a product is in the breakfast cereals category for instance, we could consider that all unknown ingredients are most probably vegetarian (and in the panels we would still list them).

Not sure if it would be fair to make those assumptions - unless you add a value "probably vegetarian". For instance yesterday I had a wonderful dessert ("mousse amande sur lit de praliné"), that actually contained "gélatine de bœuf" - which could arguably be considered as NOT vegetarian.

I really think that making it easy to "fix/add" an ingredient is good:

stephanegigandet commented 2 years ago

I really think that making it easy to "fix/add" an ingredient is good:

Making it easy is actually quite difficult though. But we can at least make it easy to report is to us, with a link to the help us page as you suggest.

stephanegigandet commented 2 years ago

I will add a panel server side to display information on how to help improve the ingredient analysis.

Corresponding bug server side: https://github.com/openfoodfacts/openfoodfacts-server/issues/6904

stephanegigandet commented 2 years ago

@monsieurtanuki I have a PR for the server side here: https://github.com/openfoodfacts/openfoodfacts-server/pull/6905

With screenshots on what it looks like on the app (it's deployed on world.openfoodfacts.dev ).

In order to get the same display on the app, we would need to add support for 2 features:

  1. a new "type": "callout_info", for the text element. This is to display the corresponding HTML on a special background, to make it stand out.

  2. adding some styles for the HTML:

on the web site we have:

.text_info { background-color:#63dfff !important; }

But for Smoothie, we could probably re-use the light mode and dark mode color and background for the "grade C" button.

This is to differentiate visually ingredients that were not recognized.

monsieurtanuki commented 2 years ago

Ok @stephanegigandet, as soon as your PR is merged we can start to code in smoothie in order to use the added data.

monsieurtanuki commented 2 years ago

@stephanegigandet I've just had a look at https://world.openfoodfacts.dev/api/v2/product/5010477348630/ which does not know all ingredients (cf. https://fr.openfoodfacts.dev/produit/5010477348630/muesli-bio-jordans), but I cannot see your callout_info.

stephanegigandet commented 2 years ago

Hi @monsieurtanuki , the callout is in the knowledge panels, they have to be requested specifically: https://world.openfoodfacts.dev/api/v2/product/5010477348630?fields=knowledge_panels

monsieurtanuki commented 2 years ago

Thank you @stephanegigandet!

A little problem: in off-dart we expect an optional field called text_type, not just type:

  /// Type of the text description, Client may choose to display the description
  /// depending upon the type.
  @JsonKey(
      name: 'text_type',
      unknownEnumValue: KnowledgePanelTextElementType.DEFAULT)
  final KnowledgePanelTextElementType? type;

And in "your" json it's type:

{
  "element_type": "text",
  "text_element": {
    "html": "\n                <h3>We need your help!</h3>\n                <p>You can help us recognize more ingredients and better analyze the list of ingredients for this product and others:</p>\n                <ul>\n                    <li>Edit this product page to correct spelling mistakes in the ingredients list, and/or to remove ingredients in other languages and sentences that are not related to the ingredients.</li>\n                    <li>Add new entries, synonyms or translations to our multilingual lists of ingredients, ingredient processing methods, and labels.</li>\n                </ul>\n                <p>If you would like to help, join the #ingredients channel on <a href=\"https://slack.openfoodfacts.org\">our Slack discussion space</a> and/or learn about <a href=\"https://wiki.openfoodfacts.org/Ingredients_Extraction_and_Analysis\">ingredients analysis on our wiki</a>. Thank you!</p>                \n                ",
    "type": "callout_info"
  }
}

Actually we don't use the type field for the moment in Smoothie: the impact there would be limited if we had to rename text_type as type, but maybe it's not the same for the other apps that already use off-dart.

monsieurtanuki commented 2 years ago

Hi @stephanegigandet! There are some discrepancy in the text_element's types, from what I've just seen in https://world.openfoodfacts.dev/api/v2/product/5010477348630?fields=knowledge_panels:

type count
"text_type": "summary" 2
"type": "summary" 10
"type": "warning" 3
"type": "default" 2
"type": "note" 1
"type": "callout_info" 1
no type specified 13
TOTAL 32

It looks like: