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

fix: more changes for GS1 import through Bayard #8068

Merged
merged 9 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 6 additions & 21 deletions lib/ProductOpener/GS1.pm
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ my %unknown_entries_in_gs1_maps = ();
# Shellfish could be Molluscs or Crustaceans
# "UN" => "Shellfish",
"UW" => "Wheat",
"X99" => "None",
},

measurementUnitCode => {
Expand Down Expand Up @@ -232,27 +233,6 @@ my %unknown_entries_in_gs1_maps = ();
},

packagingTypeCode => {
"AE" => "Aérosol",
"BA" => "Tonneau",
"BG" => "Sac",
"BK" => "Barquette",
"BO" => "Bouteille",
"BPG" => "Blister",
"BRI" => "Brique",
"BX" => "Boite",
"CNG" => "Canette",
"CR" => "Caisse",
"CT" => "Conteneur",
"CU" => "Pot",
"EN" => "Enveloppe",
"JR" => "Bocal",
"PO" => "Poche",
"PUG" => "Sac de transport",
"TU" => "Tube",
"WRP" => "Film",
},

packagingTypeCode_unused_not_taxonomized_yet => {
"AE" => "en:aerosol",
"BA" => "en:barrel",
"BG" => "en:bag",
Expand Down Expand Up @@ -329,8 +309,13 @@ my %unknown_entries_in_gs1_maps = ();

# https://gs1.se/en/guides/documentation/code-lists/t3783-target-market-country-code/
targetMarketCountryCode => {
"040" => "en:austria",
"056" => "en:belgium",
"250" => "en:france",
"276" => "en:germany",
"380" => "en:italy",
"724" => "en:spain",
"756" => "en:switzerland",
},

timeMeasurementUnitCode => {
Expand Down
4 changes: 4 additions & 0 deletions lib/ProductOpener/ImportConvert.pm
Original file line number Diff line number Diff line change
Expand Up @@ -851,9 +851,13 @@ sub clean_fields ($product_ref) {
foreach my $brand (split(/,/, $product_ref->{brands})) {
$brand =~ s/^\s+//;
$brand =~ s/\s+$//;
# we may get brands with quantifiers like * + ? etc. we need to escape them
$brand =~ s/(\*|\+|\?|\(|\)|\[|\]|\{|\}|\$|\^|\\)/\\$1/g;

# dashes/dots/spaces -> allow matching dashes/dot/spaces
# e.g. "bons.mayennais" matches "bons mayennais"
$brand =~ s/(\s|\.|-|_)/\(\\s|\\.|-|_\)/g;

$product_ref->{$field} =~ s/\s+$brand$//i;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"net_weight" : "0.36 kg",
"nutriscore_grade_producer" : "D",
"org_name" : "ANDROS",
"packaging" : "Bocal",
"packaging" : "en:jar",
"preparation_en" : "Keep away from heat and light. Don't put in the fridge.",
"preparation_fr" : "A conserver à l'abri de la chaleur et de la lumière. Ne pas mettre au réfrigérateur",
"producer_version_id" : "PREMIERE VERSION",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"net_weight" : "0.17 kg",
"org_name" : "AOSTE SNC",
"origin_fr" : "Origine du produit fini « Saucisson sec qualité supérieure 47,1% et Emmental - fromage à pâte pressée cuite 52,9%. » : Belgique # Origine de l’ingrédient primaire « Viande de porc » : France # Origine de l’ingrédient primaire « Lait de vache pasteurisé » : France",
"packaging" : "Sac de transport",
"packaging" : "en:carrying-bag",
"producer_version_id" : "Création",
"product_name_fr" : "JBRI DUO SAUC EMMENTAL 170G",
"proteins_100g_unit" : "g",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"lc" : "fr",
"net_weight" : "0.25 kg",
"nutriscore_grade_producer" : "EXEMPT",
"packaging" : "Boite",
"packaging" : "en:box",
"producer_version_id" : "Création",
"product_name_fr" : "PRESIDENT CAMEMBERT 250g",
"proteins_100g_unit" : "g",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"net_weight" : "0.25 kg",
"nutriscore_grade_producer" : "EXEMPT",
"org_name" : "BRASSERIES KRONENBOURG",
"packaging" : "Bouteille",
"packaging" : "en:bottle",
"product_name_fr" : "GRIMBERGEN - 25CL GRIMBERGEN ROUGE - 5.50 DEGRE ALCOOL",
"proteins_100g_unit" : "g",
"proteins_100g_value" : "0.4",
Expand Down Expand Up @@ -73,7 +73,7 @@
"net_weight" : "1.5 kg",
"nutriscore_grade_producer" : "EXEMPT",
"org_name" : "BRASSERIES KRONENBOURG",
"packaging" : "Bouteille",
"packaging" : "en:bottle",
"product_name_fr" : "GRIMBERGEN - 6X25CL GRIMBERGEN ROUGE - 5.50 DEGRE ALCOOL",
"proteins_100g_unit" : "g",
"proteins_100g_value" : "0.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"nutriscore_grade_producer" : "D",
"org_name" : "BRASSERIES KRONENBOURG",
"origin_fr" : "67210 Obernai France",
"packaging" : "Bouteille",
"packaging" : "en:bottle",
"product_name_fr" : "TOURTEL - 27,5CL TTCITR BIO FR-BIO-01 - 0.00 DEGRE ALCOOL",
"proteins_100g_unit" : "g",
"proteins_100g_value" : "0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"lc" : "fr",
"net_weight" : "0.0690 kg",
"org_name" : "UNILEVER FRANCE GMS",
"packaging" : "Poche",
"packaging" : "en:bag",
"preparation_fr" : " Pour préparer 2 bols généreux1. Faites bouillir 700 ml d'eau. Ramenez à feu doux puis versez le contenu du sachet en remuant avec une cuillère en bois. 2. Laissez mijoter 5 minutes en remuant de temps en temps. Inutile de saler.",
"producer_version_id" : "SERVING_SIZE_CU KN DSO SICHUAN 69G POU FR",
"product_name_fr" : "Knorr Soupe Déshydratée Chinoise Nouilles et Champignons Noirs Sachet 69g 2 Portions",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"lc" : "fr",
"net_weight" : "0.34 kg",
"org_name" : "UNILEVER FRANCE RHD",
"packaging" : "Film",
"packaging" : "en:film",
"preparation_fr" : "Préparation :\nMise en Place s'utilise en mélange à chaud comme à froid, pour des applications multiples.\nMise en place contenant déjà du sel, saler la préparation en dernier lieu si nécessaire.\nPour préparer une sauce au pesto rouge, ajouter de l'huile d'olive et du parmesan.\nSuggestions de recettes :\nConvient parfaitement pour l'assaisonnement de pâtes, sauces tomate, poissons, viandes, marinades, carpaccios, vinaigrettes et sauces pour\nPanini.",
"producer_version_id" : "Knorr ROUGE Pâte aux Aromates 340 GR",
"product_name_fr" : "Knorr Mise en place pesto rouge Pot 340g",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"nutriscore_grade_producer" : "D",
"org_name" : "NESTLE FRANCE (DIV CHOC,CUL,BI,INF)",
"origin_fr" : "Fabriqué en France. Café Origine non-UE. Chicorée Origine UE et Non-UE. Lait origine France. La majorité de notre chicorée vient du Nord de la France.",
"packaging" : "Canette",
"packaging" : "en:can",
"preparation_fr" : "4 cuillères + 200 ml d'eau frémissante.",
"producer_version_id" : "44041392",
"product_name_fr" : "RICORE au Lait, Boîte de 400g",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"monounsaturated-fat_100g_value" : "0",
"net_weight" : "3.2 kg",
"org_name" : "PANZANI SA",
"packaging" : "Conteneur",
"packaging" : "en:container",
"preparation_fr" : "Plongez les pâtes dans de l'eau bouillante salée à votre convenance (1L pour 100g de pâtes) et laissez cuire le temps indiqué sur le devant du paquet.",
"product_name_fr" : "TAGLIATELLE QUALITE PATES FRAICHES",
"proteins_100g_unit" : "g",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"net_weight" : "0.264 kg",
"nutriscore_grade_producer" : "C",
"org_name" : "PEPSICO FRANCE",
"packaging" : "Sac",
"packaging" : "en:bag",
"preparation_fr" : "A consommer sans préparation",
"product_name_fr" : "Lay's saveur sel & vinaigre 240 g + 10% offert",
"proteins_100g_unit" : "g",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"net_weight" : "0.3 kg",
"nutriscore_grade_producer" : "D",
"org_name" : "UNILEVER FRANCE GMS",
"packaging" : "Film",
"packaging" : "en:film",
"preparation_fr" : "Sortez vos glaces du congélateur quelques minutes avant de les déguster, afin de profiter pleinement de leurs saveurs.",
"producer_version_id" : "Magnum DOUBLE RASPEBBRY Bâtonnets de Glace 360 ML",
"product_name_fr" : "Magnum Glace Batonnet Mini Double Framboise 6x60ml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"net_weight" : "0.258 kg",
"nutriscore_grade_producer" : "D",
"org_name" : "UNILEVER FRANCE GMS",
"packaging" : "Film",
"packaging" : "en:film",
"preparation_fr" : "Pour une dégustation encore plus onctueuse de votre crème glacée, sortez-le quelques minutes avant de servir.",
"producer_version_id" : "Magnum RUBY Bâtonnets de Glace 330 ML",
"product_name_fr" : "Magnum Glace Bâtonnet Mini Ruby x6 330ml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"lc" : "fr",
"net_weight" : "0.34 kg",
"org_name" : "UNILEVER FRANCE GMS",
"packaging" : "Film",
"packaging" : "en:film",
"periods_after_opening" : "1 month",
"preparation_fr" : ".",
"producer_version_id" : "MAILLE FIN GOURMET Moutarde 375 ML",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"lc" : "fr",
"net_weight" : "0.095 kg",
"org_name" : "UNILEVER FRANCE GMS",
"packaging" : "Tube",
"packaging" : "en:tube",
"periods_after_opening" : "12 month",
"preparation_fr" : "Brossez-vous les dents en effectuant de petits mouvements de haut en bas – du rose des gencives vers le blanc des dents - et en prenant soin de passer sur toute la surface de chaque dent. Prenez votre temps : il faut compter au moins deux minutes, voire trois, pour un brossage efficace. Terminez votre rituel de soins dentaire par un bain de bouche Signal pour une hygiène optimale.",
"producer_version_id" : "Signal CLAY&CHARCOAL DENTIFRICE 75 ML",
Expand Down