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

feat: Add is_in_taxonomy boolean flag in ingredient parsing result #9968

Merged
merged 10 commits into from
Apr 19, 2024
6 changes: 5 additions & 1 deletion lib/ProductOpener/Ingredients.pm
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ my %may_contain_regexps = (
"Dit product kan sporen van|bevat mogelijk sporen van|Kan sporen bevatten van|Kan sporen van|bevat mogelijk|sporen van|Geproduceerd in ruimtes waar",
nb =>
"kan inneholde spor av|kan forekomme spor av|kan inneholde spor|kan forekomme spor|kan inneholde|kan forekomme",
pl => "może zawierać śladowe ilości|produkt może zawierać|może zawierać|możliwa obecność|może zawierać alergeny|możliwa obecność|w produkcie możliwa obecność|wyprodukowano w zakładzie przetwarzającym",
pl =>
"może zawierać śladowe ilości|produkt może zawierać|może zawierać|możliwa obecność|może zawierać alergeny|możliwa obecność|w produkcie możliwa obecność|wyprodukowano w zakładzie przetwarzającym",
pt => "pode conter vestígios de|pode conter",
ro => "poate con[țţt]ine urme de|poate con[țţt]ine|poate con[țţt]in|produsul poate conţine urme de",
rs => "može sadržati tragove",
Expand Down Expand Up @@ -2807,6 +2808,9 @@ sub parse_ingredients_text_service ($product_ref, $updated_product_fields_ref) {
text => $ingredient
);

my $is_in_taxonomy = exists_taxonomy_tag("ingredients", $ingredient_id) ? 1 : 0;
$ingredient{is_in_taxonomy} = $is_in_taxonomy;

if (defined $percent_or_quantity_value) {
my ($percent, $quantity, $quantity_g)
= get_percent_or_quantity_and_normalized_quantity($percent_or_quantity_value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@
{
"ciqual_food_code" : "13050",
"id" : "en:apple",
"is_in_taxonomy": 1,
"percent_estimate" : 62.5,
"percent_max" : 100,
"percent_min" : 25,
Expand All @@ -593,6 +594,7 @@
{
"ciqual_proxy_food_code" : "19051",
"id" : "en:milk",
"is_in_taxonomy": 1,
"percent_estimate" : 18.75,
"percent_max" : 50,
"percent_min" : 0,
Expand All @@ -603,6 +605,7 @@
{
"ciqual_food_code" : "22000",
"id" : "en:egg",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 33.3333333333333,
"percent_min" : 0,
Expand All @@ -614,6 +617,7 @@
"ciqual_food_code" : "16129",
"from_palm_oil" : "yes",
"id" : "en:palm-oil",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 25,
"percent_min" : 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@
{
"ciqual_food_code" : "13050",
"id" : "en:apple",
"is_in_taxonomy": 1,
"percent_estimate" : 62.5,
"percent_max" : 100,
"percent_min" : 25,
Expand All @@ -593,6 +594,7 @@
{
"ciqual_proxy_food_code" : "19051",
"id" : "en:milk",
"is_in_taxonomy": 1,
"percent_estimate" : 18.75,
"percent_max" : 50,
"percent_min" : 0,
Expand All @@ -603,6 +605,7 @@
{
"ciqual_food_code" : "22000",
"id" : "en:egg",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 33.3333333333333,
"percent_min" : 0,
Expand All @@ -614,6 +617,7 @@
"ciqual_food_code" : "16129",
"from_palm_oil" : "yes",
"id" : "en:palm-oil",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 25,
"percent_min" : 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@
{
"ciqual_food_code" : "13050",
"id" : "en:apple",
"is_in_taxonomy": 1,
"percent_estimate" : 62.5,
"percent_max" : 100,
"percent_min" : 25,
Expand All @@ -593,6 +594,7 @@
{
"ciqual_proxy_food_code" : "19051",
"id" : "en:milk",
"is_in_taxonomy": 1,
"percent_estimate" : 18.75,
"percent_max" : 50,
"percent_min" : 0,
Expand All @@ -603,6 +605,7 @@
{
"ciqual_food_code" : "22000",
"id" : "en:egg",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 33.3333333333333,
"percent_min" : 0,
Expand All @@ -614,6 +617,7 @@
"ciqual_food_code" : "16129",
"from_palm_oil" : "yes",
"id" : "en:palm-oil",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 25,
"percent_min" : 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,7 @@
{
"ciqual_food_code" : "13050",
"id" : "en:apple",
"is_in_taxonomy": 1,
"percent_estimate" : 62.5,
"percent_max" : 100,
"percent_min" : 25,
Expand All @@ -1241,6 +1242,7 @@
{
"ciqual_proxy_food_code" : "19051",
"id" : "en:milk",
"is_in_taxonomy": 1,
"percent_estimate" : 18.75,
"percent_max" : 50,
"percent_min" : 0,
Expand All @@ -1251,6 +1253,7 @@
{
"ciqual_food_code" : "22000",
"id" : "en:egg",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 33.3333333333333,
"percent_min" : 0,
Expand All @@ -1262,6 +1265,7 @@
"ciqual_food_code" : "16129",
"from_palm_oil" : "yes",
"id" : "en:palm-oil",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 25,
"percent_min" : 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@
{
"ciqual_food_code" : "13050",
"id" : "en:apple",
"is_in_taxonomy": 1,
"percent_estimate" : 62.5,
"percent_max" : 100,
"percent_min" : 25,
Expand All @@ -588,6 +589,7 @@
{
"ciqual_proxy_food_code" : "19051",
"id" : "en:milk",
"is_in_taxonomy": 1,
"percent_estimate" : 18.75,
"percent_max" : 50,
"percent_min" : 0,
Expand All @@ -598,6 +600,7 @@
{
"ciqual_food_code" : "22000",
"id" : "en:egg",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 33.3333333333333,
"percent_min" : 0,
Expand All @@ -609,6 +612,7 @@
"ciqual_food_code" : "16129",
"from_palm_oil" : "yes",
"id" : "en:palm-oil",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 25,
"percent_min" : 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@
{
"ciqual_proxy_food_code" : "9410",
"id" : "en:wheat-flour",
"is_in_taxonomy": 1,
"percent_estimate" : 62.5,
"percent_max" : 100,
"percent_min" : 25,
Expand All @@ -532,6 +533,7 @@
{
"ciqual_food_code" : "18066",
"id" : "en:water",
"is_in_taxonomy": 1,
"percent_estimate" : 18.75,
"percent_max" : 50,
"percent_min" : 0,
Expand All @@ -542,6 +544,7 @@
{
"ciqual_food_code" : "11058",
"id" : "en:salt",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 33.3333333333333,
"percent_min" : 0,
Expand All @@ -552,6 +555,7 @@
{
"ciqual_proxy_food_code" : "31016",
"id" : "en:sugar",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 25,
"percent_min" : 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@
{
"ciqual_proxy_food_code" : "28205",
"id" : "en:pork-meat",
"is_in_taxonomy": 1,
"percent_estimate" : 75,
"percent_max" : 100,
"percent_min" : 50,
Expand All @@ -368,6 +369,7 @@
{
"ciqual_food_code" : "11058",
"id" : "en:salt",
"is_in_taxonomy": 1,
"percent_estimate" : 25,
"percent_max" : 50,
"percent_min" : 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@
{
"ciqual_proxy_food_code" : "9410",
"id" : "en:wheat-flour",
"is_in_taxonomy": 1,
"percent_estimate" : 62.5,
"percent_max" : 100,
"percent_min" : 25,
Expand All @@ -532,6 +533,7 @@
{
"ciqual_food_code" : "18066",
"id" : "en:water",
"is_in_taxonomy": 1,
"percent_estimate" : 18.75,
"percent_max" : 50,
"percent_min" : 0,
Expand All @@ -542,6 +544,7 @@
{
"ciqual_food_code" : "11058",
"id" : "en:salt",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 33.3333333333333,
"percent_min" : 0,
Expand All @@ -552,6 +555,7 @@
{
"ciqual_proxy_food_code" : "31016",
"id" : "en:sugar",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 25,
"percent_min" : 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@
{
"ciqual_food_code" : "13050",
"id" : "en:apple",
"is_in_taxonomy": 1,
"percent_estimate" : 62.5,
"percent_max" : 100,
"percent_min" : 25,
Expand All @@ -595,6 +596,7 @@
{
"ciqual_proxy_food_code" : "19051",
"id" : "en:milk",
"is_in_taxonomy": 1,
"percent_estimate" : 18.75,
"percent_max" : 50,
"percent_min" : 0,
Expand All @@ -605,6 +607,7 @@
{
"ciqual_food_code" : "22000",
"id" : "en:egg",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 33.3333333333333,
"percent_min" : 0,
Expand All @@ -616,6 +619,7 @@
"ciqual_food_code" : "16129",
"from_palm_oil" : "yes",
"id" : "en:palm-oil",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 25,
"percent_min" : 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@
{
"ciqual_food_code" : "13050",
"id" : "en:apple",
"is_in_taxonomy": 1,
"percent_estimate" : 62.5,
"percent_max" : 100,
"percent_min" : 25,
Expand All @@ -595,6 +596,7 @@
{
"ciqual_proxy_food_code" : "19051",
"id" : "en:milk",
"is_in_taxonomy": 1,
"percent_estimate" : 18.75,
"percent_max" : 50,
"percent_min" : 0,
Expand All @@ -605,6 +607,7 @@
{
"ciqual_food_code" : "22000",
"id" : "en:egg",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 33.3333333333333,
"percent_min" : 0,
Expand All @@ -616,6 +619,7 @@
"ciqual_food_code" : "16129",
"from_palm_oil" : "yes",
"id" : "en:palm-oil",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 25,
"percent_min" : 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@
{
"ciqual_food_code" : "13050",
"id" : "en:apple",
"is_in_taxonomy": 1,
"percent_estimate" : 62.5,
"percent_max" : 100,
"percent_min" : 25,
Expand All @@ -595,6 +596,7 @@
{
"ciqual_proxy_food_code" : "19051",
"id" : "en:milk",
"is_in_taxonomy": 1,
"percent_estimate" : 18.75,
"percent_max" : 50,
"percent_min" : 0,
Expand All @@ -605,6 +607,7 @@
{
"ciqual_food_code" : "22000",
"id" : "en:egg",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 33.3333333333333,
"percent_min" : 0,
Expand All @@ -616,6 +619,7 @@
"ciqual_food_code" : "16129",
"from_palm_oil" : "yes",
"id" : "en:palm-oil",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 25,
"percent_min" : 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@
{
"ciqual_food_code" : "13050",
"id" : "en:apple",
"is_in_taxonomy": 1,
"percent_estimate" : 62.5,
"percent_max" : 100,
"percent_min" : 25,
Expand All @@ -595,6 +596,7 @@
{
"ciqual_proxy_food_code" : "19051",
"id" : "en:milk",
"is_in_taxonomy": 1,
"percent_estimate" : 18.75,
"percent_max" : 50,
"percent_min" : 0,
Expand All @@ -605,6 +607,7 @@
{
"ciqual_food_code" : "22000",
"id" : "en:egg",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 33.3333333333333,
"percent_min" : 0,
Expand All @@ -616,6 +619,7 @@
"ciqual_food_code" : "16129",
"from_palm_oil" : "yes",
"id" : "en:palm-oil",
"is_in_taxonomy": 1,
"percent_estimate" : 9.375,
"percent_max" : 25,
"percent_min" : 0,
Expand Down
Loading
Loading