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

Add isInTaxonomy boolean flag in ingredient parsing result #9930

Closed
alexfauquette opened this issue Mar 15, 2024 · 4 comments · Fixed by #9968
Closed

Add isInTaxonomy boolean flag in ingredient parsing result #9930

alexfauquette opened this issue Mar 15, 2024 · 4 comments · Fixed by #9968
Labels
Blocking Hunger Games This issue is blocking HungerGames (https://hunger.openfoodfacts.org) our gamified annotation engine 🥗 Ingredients - processing 🎯 P1

Comments

@alexfauquette
Copy link
Member

alexfauquette commented Mar 15, 2024

Problem

The API does not provide a clean way to know if an ingredient is already in the taxonomy or not.

We can guess from the fact that an ingredient get a ciqual_proxy_food_code or vegetarian attribute that it's in the taxonomy, but there is no way to know when an ingredient is not in the taxonomy.

Proposed solution

Adding isInTaxonomy for all ingredients at the same time the server is looking for ciqual_proxy_food_code

Additional context

Would be useful for hunger game ingredients. And I think robotoff also needs it and for now is using a workaround

Code pointers

No idea where it is

Number of products impacted

Time per product

Mockups

Part of

@alexfauquette alexfauquette added Blocking Hunger Games This issue is blocking HungerGames (https://hunger.openfoodfacts.org) our gamified annotation engine 🥗 Ingredients - processing labels Mar 15, 2024
@himanshisrestha
Copy link
Contributor

I'm interested in this issue and would like to resolve this.

@stephanegigandet
Copy link
Contributor

Related code is in lib/ProductOpener/Ingredients.pm
in the parse_ingredients_text_service() function (it's a huge one).

At the end we should add a boolean field "is_in_taxonomy", using the exists_taxonomy_tag function, near this code:

			if (not $skip_ingredient) {

				my %ingredient = (
					id => get_taxonomyid($ingredients_lc, $ingredient_id),
					text => $ingredient
				);

Note that a lot of tests will need to be updated after that, so you will need to run "make update_tests_results", and possibly change manually some tests results in *.t files

@stephanegigandet
Copy link
Contributor

Note that Perl doesn't have Boolean type, so instead we should return 1 for true, and 0 for false.

@himanshisrestha
Copy link
Contributor

I'm understanding the function refered to. Thank you for the references

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocking Hunger Games This issue is blocking HungerGames (https://hunger.openfoodfacts.org) our gamified annotation engine 🥗 Ingredients - processing 🎯 P1
Projects
4 participants