This commit is contained in:
2025-09-14 13:26:27 +02:00
parent 4e752d09cc
commit e70cd44616
5 changed files with 8074 additions and 44 deletions

View File

@@ -31,3 +31,30 @@ add column nutrition vector(10);
UPDATE produits
SET nutrition = ARRAY[energie, proteines, glucide, sucre, graisse, graisse_saturee, sel, fibres, nutriscore, additifs]::vector;
with selection as (
select op.id, product_name, brands, "energy-kcal_100g", fat_100g, "saturated-fat_100g",
"carbohydrates_100g", "sugars_100g", "proteins_100g", "salt_100g", "fiber_100g",
"nutriscore_score", "additives_n", string_to_array(additives_en, ','),
"potassium_100g", "calcium_100g", "vitamin-a_100g", "vitamin-c_100g",
main_category_en
from openfoodfacts_cleaned op
left join produit p on p.id = op.id
where brands like 'Familia%'
and p.id is null
and "energy-kcal_100g" is not null
and proteins_100g is not null
and fat_100g is not null
and "saturated-fat_100g" is not null
and carbohydrates_100g is not null
and sugars_100g is not null
and salt_100g is not null
and nutriscore_score is not null
)
insert into produit (id, nom, marque,
energie, graisse, graisse_saturee,
glucide, sucre, proteines, sel,
fibres, nutriscore, additifs, additifs_list,
potassium, calcium, vitamin_a, vitamin_c, categorie)
select * from selection;