Skip to content

Commit c865195

Browse files
fix: move foodture scripts and data to projets/foodture (#14301)
Adding input files for the Foodture representative products (most scanned products in EU countries in specific categories)
1 parent 17babc1 commit c865195

4 files changed

Lines changed: 310940 additions & 5 deletions

File tree

projects/foodture/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ingredients_sum.csv
2+
representative_products.csv
3+
tmp/
4+

scripts/projects/foodture/extract_data_for_representative_products.pl renamed to projects/foodture/extract_data_for_representative_products.pl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
my @ingredient_languages = qw/en fr/;
8888

8989
# caching directory for API responses
90-
my $cache_dir = "foodture/api_cache";
90+
my $cache_dir = "projects/foodture/tmp/api_cache";
9191
mkdir $cache_dir unless -d $cache_dir;
9292

9393
# variables for API fetching
@@ -150,7 +150,7 @@ sub collect_ingredients {
150150
}
151151

152152
# first pass: read ranked products and group by country/category tags
153-
my $ranked_file = "foodture/ranked_products_202602231414.csv";
153+
my $ranked_file = "projects/foodture/ranked_products_202602231414.csv";
154154
open my $RANK, '<:encoding(UTF-8)', $ranked_file or die "Cannot open $ranked_file: $!\n";
155155
<$RANK>; # skip header
156156
my $parser = Text::CSV->new(
@@ -188,12 +188,12 @@ sub collect_ingredients {
188188
close $RANK;
189189

190190
# read target country/category pairs and output rows as we go
191-
my $list_file = "foodture/16.06.2026_Correspondance_FT_OFF_pour_extract.csv";
191+
my $list_file = "projects/foodture/foodture_foodex2_categories_mapping_to_off.csv";
192192
open my $LIST, '<:encoding(UTF-8)', $list_file or die "Cannot open $list_file: $!\n";
193193
<$LIST>; # skip header
194194

195195
# prepare output file
196-
my $out_file = "foodture/representative_products.csv";
196+
my $out_file = "projects/foodture/representative_products.csv";
197197
open my $OUT, '>:encoding(UTF-8)', $out_file or die "Cannot write $out_file: $!\n";
198198
my $csv_out = Text::CSV->new({binary => 1, eol => "\n"})
199199
or die "Cannot create CSV writer: " . Text::CSV->error_diag();
@@ -420,7 +420,7 @@ sub collect_ingredients {
420420
close $OUT;
421421

422422
# Create a second CSV table that lists all ingredients with the sum of their percentages across all products
423-
my $ingredients_file = "foodture/ingredients_sum.csv";
423+
my $ingredients_file = "projects/foodture/ingredients_sum.csv";
424424
open my $ING_OUT, '>:encoding(UTF-8)', $ingredients_file or die "Cannot write $ingredients_file: $!\n";
425425
my @ingredients_header = (
426426
"ingredient_id",

0 commit comments

Comments
 (0)