Skip to content

Commit

Permalink
feat: Add is_in_taxonomy boolean flag in ingredient parsing result (#…
Browse files Browse the repository at this point in the history
…9968)

* Add is_in_taxonomy boolean flag in ingredient parsing result

* fix isInTaxonomy update test results

* lint added

* expected results updated for ingredients processing unit test

* modified expected results in ingredient nesting unit test

* added is_in_taxonomy to fix api_v2_product_read tests

* updated test results to multiple files

* update test results in search
  • Loading branch information
himanshisrestha committed Apr 19, 2024
1 parent 22280d9 commit bb240bc
Show file tree
Hide file tree
Showing 253 changed files with 1,413 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/ProductOpener/Ingredients.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2813,6 +2813,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

0 comments on commit bb240bc

Please sign in to comment.