Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
monsieurtanuki opened this issue Jun 10, 2022 · 15 comments
Open

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

monsieurtanuki opened this issue Jun 10, 2022 · 15 comments

Comments

@monsieurtanuki
Copy link
Contributor

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
Copy link
Member

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

@M123-dev
Copy link
Member

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

@monsieurtanuki
Copy link
Contributor Author

@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
Copy link
Member

@stephanegigandet
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor Author

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:

  • frustrating experience to see that OFF doesn't understand that "raisins de sultanine" or "basilic de Ligurie" are vegetarian
  • rewarding experience if the end user can easily help by fixing ingredients

@stephanegigandet
Copy link
Contributor

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
Copy link
Contributor

stephanegigandet commented Jun 15, 2022

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

Corresponding bug server side: openfoodfacts/openfoodfacts-server#6904

@stephanegigandet
Copy link
Contributor

@monsieurtanuki I have a PR for the server side here: openfoodfacts/openfoodfacts-server#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 monsieurtanuki self-assigned this Jun 15, 2022
@monsieurtanuki
Copy link
Contributor Author

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

@monsieurtanuki
Copy link
Contributor Author

@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
Copy link
Contributor

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
Copy link
Contributor Author

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.

@teolemon teolemon moved this from To discuss and validate to Todo (ready 2 dev) in 🤳🥫 The Open Food Facts mobile app (Android & iOS) Jun 21, 2022
@monsieurtanuki
Copy link
Contributor Author

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:

  • "type" should be the tag we're looking for (and not "text_type", the current tag in off-dart KnowledgePanelTextElement)
    => fix needed in off-dart
  • for the record, "text_type" was found in carbon_footprint and ecoscore_agribalyse
    => fix needed on the server
  • a list of possible values is
    • "summary"
    • "warning"
    • "default"
    • "note" => it's spelled "notes" in off-dart's KnowledgePanelTextElementType
    • "callout_info" => not there in off-dart's KnowledgePanelTextElementType
  • in off-dart we would maybe be better off, flexibility-wise, with just a String instead of trying to decode the type into an enum. We could use static const String instead.
    => not that clear yet

@teolemon teolemon changed the title Direct link to "fix that ingredient" from KP Direct link to "fix that ingredient" from Knowledge Panel Aug 20, 2022
@monsieurtanuki monsieurtanuki removed their assignment Aug 25, 2022
@teolemon teolemon removed the ✨ enhancement New feature or request label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📋 Todo (ready 2 dev)
Development

No branches or pull requests

4 participants