The dataset viewer is not available for this split.
Error code: StreamingRowsError
Exception: CastError
Message: Couldn't cast
row_count: struct<input: int64, output: int64, pass: bool>
child 0, input: int64
child 1, output: int64
child 2, pass: bool
original_columns_preserved: struct<missing: list<item: null>, pass: bool>
child 0, missing: list<item: null>
child 0, item: null
child 1, pass: bool
new_columns_added: struct<expected: list<item: string>, actual: list<item: string>, missing: list<item: null>, pass: bo (... 3 chars omitted)
child 0, expected: list<item: string>
child 0, item: string
child 1, actual: list<item: string>
child 0, item: string
child 2, missing: list<item: null>
child 0, item: null
child 3, pass: bool
brand_norm: struct<unique_values: list<item: string>, pass: bool>
child 0, unique_values: list<item: string>
child 0, item: string
child 1, pass: bool
product_line: struct<unique_values: list<item: string>, pass: bool>
child 0, unique_values: list<item: string>
child 0, item: string
child 1, pass: bool
fat_level: struct<valid_values: list<item: string>, actual_values: list<item: string>, invalid: list<item: null (... 14 chars omitted)
child 0, valid_values: list<item: string>
child 0, item: string
child 1, actual_values: list<item: string>
child 0, item: string
child 2, invalid: list<item: null>
child 0, item: null
child 3, pass: bool
identity_flags_boolean: struct<pass: bool>
child 0, pass: bool
core_title: struct<empty_count: int64, pass: string>
child 0, empty_count: int64
child 1, pa
...
ass: string>
child 0, empty_count: int64
child 1, pass: string
external_id_uniqueness: struct<duplicate_count: int64, pass: string>
child 0, duplicate_count: int64
child 1, pass: string
overall: struct<result: string>
child 0, result: string
version: string
failures: list<item: null>
child 0, item: null
timestamp: string
result: string
checks: struct<schema: struct<pass: bool, note: string>, external_id_uniqueness: struct<total_rows: int64, n (... 308 chars omitted)
child 0, schema: struct<pass: bool, note: string>
child 0, pass: bool
child 1, note: string
child 1, external_id_uniqueness: struct<total_rows: int64, null_count: int64, unique_count: int64, duplicate_count: int64, pass: stri (... 3 chars omitted)
child 0, total_rows: int64
child 1, null_count: int64
child 2, unique_count: int64
child 3, duplicate_count: int64
child 4, pass: string
child 2, duplicates: struct<full_row_duplicates: int64, external_id_duplicates: int64, upc_duplicates: int64, title_size_ (... 24 chars omitted)
child 0, full_row_duplicates: int64
child 1, external_id_duplicates: int64
child 2, upc_duplicates: int64
child 3, title_size_brand_duplicates: int64
child 3, null_columns: struct<expected_100pct_null: list<item: string>, dropped: list<item: string>>
child 0, expected_100pct_null: list<item: string>
child 0, item: string
child 1, dropped: list<item: string>
child 0, item: string
to
{'version': Value('string'), 'timestamp': Value('string'), 'result': Value('string'), 'failures': List(Value('null')), 'checks': {'schema': {'pass': Value('bool'), 'note': Value('string')}, 'external_id_uniqueness': {'total_rows': Value('int64'), 'null_count': Value('int64'), 'unique_count': Value('int64'), 'duplicate_count': Value('int64'), 'pass': Value('string')}, 'duplicates': {'full_row_duplicates': Value('int64'), 'external_id_duplicates': Value('int64'), 'upc_duplicates': Value('int64'), 'title_size_brand_duplicates': Value('int64')}, 'null_columns': {'expected_100pct_null': List(Value('string')), 'dropped': List(Value('string'))}}}
because column names don't match
Traceback: Traceback (most recent call last):
File "/src/services/worker/src/worker/utils.py", line 149, in get_rows_or_raise
return get_rows(
dataset=dataset,
...<4 lines>...
column_names=column_names,
)
File "/src/libs/libcommon/src/libcommon/utils.py", line 272, in decorator
return func(*args, **kwargs)
File "/src/services/worker/src/worker/utils.py", line 129, in get_rows
rows_plus_one = list(itertools.islice(safe_iter(ds, dataset=dataset), rows_max_number + 1))
File "/src/services/worker/src/worker/utils.py", line 489, in safe_iter
yield from ds.decode(False) if ds.features else ds
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2818, in __iter__
for key, example in ex_iterable:
^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2355, in __iter__
for key, pa_table in self._iter_arrow():
~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2380, in _iter_arrow
for key, pa_table in self.ex_iterable._iter_arrow():
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 536, in _iter_arrow
for key, pa_table in iterator:
^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 419, in _iter_arrow
for key, pa_table in self.generate_tables_fn(**gen_kwags):
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 343, in _generate_tables
self._cast_table(pa_table, json_field_paths=json_field_paths),
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 132, in _cast_table
pa_table = table_cast(pa_table, self.info.features.arrow_schema)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2369, in table_cast
return cast_table_to_schema(table, schema)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2297, in cast_table_to_schema
raise CastError(
...<3 lines>...
)
datasets.table.CastError: Couldn't cast
row_count: struct<input: int64, output: int64, pass: bool>
child 0, input: int64
child 1, output: int64
child 2, pass: bool
original_columns_preserved: struct<missing: list<item: null>, pass: bool>
child 0, missing: list<item: null>
child 0, item: null
child 1, pass: bool
new_columns_added: struct<expected: list<item: string>, actual: list<item: string>, missing: list<item: null>, pass: bo (... 3 chars omitted)
child 0, expected: list<item: string>
child 0, item: string
child 1, actual: list<item: string>
child 0, item: string
child 2, missing: list<item: null>
child 0, item: null
child 3, pass: bool
brand_norm: struct<unique_values: list<item: string>, pass: bool>
child 0, unique_values: list<item: string>
child 0, item: string
child 1, pass: bool
product_line: struct<unique_values: list<item: string>, pass: bool>
child 0, unique_values: list<item: string>
child 0, item: string
child 1, pass: bool
fat_level: struct<valid_values: list<item: string>, actual_values: list<item: string>, invalid: list<item: null (... 14 chars omitted)
child 0, valid_values: list<item: string>
child 0, item: string
child 1, actual_values: list<item: string>
child 0, item: string
child 2, invalid: list<item: null>
child 0, item: null
child 3, pass: bool
identity_flags_boolean: struct<pass: bool>
child 0, pass: bool
core_title: struct<empty_count: int64, pass: string>
child 0, empty_count: int64
child 1, pa
...
ass: string>
child 0, empty_count: int64
child 1, pass: string
external_id_uniqueness: struct<duplicate_count: int64, pass: string>
child 0, duplicate_count: int64
child 1, pass: string
overall: struct<result: string>
child 0, result: string
version: string
failures: list<item: null>
child 0, item: null
timestamp: string
result: string
checks: struct<schema: struct<pass: bool, note: string>, external_id_uniqueness: struct<total_rows: int64, n (... 308 chars omitted)
child 0, schema: struct<pass: bool, note: string>
child 0, pass: bool
child 1, note: string
child 1, external_id_uniqueness: struct<total_rows: int64, null_count: int64, unique_count: int64, duplicate_count: int64, pass: stri (... 3 chars omitted)
child 0, total_rows: int64
child 1, null_count: int64
child 2, unique_count: int64
child 3, duplicate_count: int64
child 4, pass: string
child 2, duplicates: struct<full_row_duplicates: int64, external_id_duplicates: int64, upc_duplicates: int64, title_size_ (... 24 chars omitted)
child 0, full_row_duplicates: int64
child 1, external_id_duplicates: int64
child 2, upc_duplicates: int64
child 3, title_size_brand_duplicates: int64
child 3, null_columns: struct<expected_100pct_null: list<item: string>, dropped: list<item: string>>
child 0, expected_100pct_null: list<item: string>
child 0, item: string
child 1, dropped: list<item: string>
child 0, item: string
to
{'version': Value('string'), 'timestamp': Value('string'), 'result': Value('string'), 'failures': List(Value('null')), 'checks': {'schema': {'pass': Value('bool'), 'note': Value('string')}, 'external_id_uniqueness': {'total_rows': Value('int64'), 'null_count': Value('int64'), 'unique_count': Value('int64'), 'duplicate_count': Value('int64'), 'pass': Value('string')}, 'duplicates': {'full_row_duplicates': Value('int64'), 'external_id_duplicates': Value('int64'), 'upc_duplicates': Value('int64'), 'title_size_brand_duplicates': Value('int64')}, 'null_columns': {'expected_100pct_null': List(Value('string')), 'dropped': List(Value('string'))}}}
because column names don't matchNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
- Quick Start
- Pipeline Overview
- Data Sources
- Phase 1 β Data Quality Foundation
- Phase 2 β Semantic Normalization
- Phase 3 β Product Domain + Taxonomy + Product Grouping
- Phase 4 β Variant Assignment
- Phase 5 β Nutrition Integration
- Phase 6 β Nutri-Score 2023 + Agribalyse Mapping
- Repository Structure
- Tools & Technologies
- Design Principles
- Key Numbers Summary
- License
- Version History
Compliments Reference DB
A clean, reproducible product reference database built from a single authoritative dataset for Sobeys Inc.'s Compliments and Sensations private-label brands.
Pipeline: 6 deterministic phases, no LLM, full traceability.
Authoritative Source: saraNour/compliments-brand
Published DB: saraNour/compliments-reference-db (Public)
Quick Start
from huggingface_hub import hf_hub_download
import pandas as pd
# Load any phase output
path = hf_hub_download("saraNour/compliments-reference-db", "phase6/outputs/phase6_product_scores.parquet", repo_type="dataset")
df = pd.read_parquet(path)
Pipeline Overview
| Phase | Name | Input | Output | Key Metric |
|---|---|---|---|---|
| 1 | Data Quality Foundation | products.parquet (4,440 Γ 16) | phase1_output.parquet (4,440 Γ 14) | 100% null cols dropped |
| 2 | Semantic Normalization | phase1_output (4,440 Γ 14) | phase2_output.parquet (4,440 Γ 34) | 20 new columns |
| 3 | Product Domain + Taxonomy + Grouping | phase2_output (4,440 Γ 34) | reference_product_catalog.csv (3,691 groups) | 19 taxonomy categories |
| 4 | Variant Assignment | phase3 mapping + phase2 | product_variant_mapping.parquet (4,440 Γ 11) | 4,299 variants |
| 5 | Nutrition Integration | nutrition.parquet + phase3 + phase4 | nutrition_per_100g.parquet | 100% match rate |
| 6 | Nutri-Score + Agribalyse | phase5 outputs | phase6_product_scores.parquet (4,440) | 364 scored (8.2%) |
Data Sources
Authoritative Inputs
| File | Rows Γ Cols | Source |
|---|---|---|
products.parquet |
4,440 Γ 16 | saraNour/compliments-brand |
nutrition.parquet |
4,440 Γ 21 | saraNour/compliments-brand |
External References
| Resource | URL | Purpose |
|---|---|---|
| Google Product Category taxonomy | https://www.google.com/basepages/producttype/taxonomy.en-US.txt | GPC mapping |
| Nutri-Score 2023 algorithm | https://www.eurofins.de/food-analysis/other-services/nutri-score/ | Nutri-Score calculation |
| SantΓ© Publique France FAQ v21.Dec.2023 | (via Eurofins) | Algorithm verification |
| Agribalyse v3.2 | CIQUAL database | Environmental category mapping |
Phase 1 β Data Quality Foundation
Goal: Download authoritative data, validate schema, clean, and produce a reproducible foundation.
What It Does
- Downloads
products.parquetfrom HuggingFace - Validates schema (16 expected columns, 4,440 rows)
- Audits raw data (nulls, duplicates, UPC patterns, brands)
- Cleans: whitespace normalization, emptyβnull, brand/title cleaning
- Drops 100% null columns (
size_per_unit,size_total) - Produces clean output + validation + statistics
Cleaning Operations
- String normalization: trim whitespace, collapse repeated spaces, empty strings β null
- Brand cleaning: whitespace trim, ALL CAPS β Title Case (preserve raw)
- UPC validation: format check, null count, duplicate analysis, reused UPC detection
- Title cleaning: whitespace normalization
- Null column handling: documented removal of 100% null columns
Output: phase1_output.parquet (4,440 Γ 14)
| Column | Type | Description |
|---|---|---|
| upc | string | Product UPC (3,271 unique, 774 reused, 1 null) |
| external_id | string | Product-level identifier (4,440 unique) |
| brand | string | Raw brand name |
| brand_clean | string | Cleaned brand name |
| title | string | Raw product title |
| title_clean | string | Cleaned title |
| price | float | Product price |
| price_currency | string | Currency code |
| size | string | Raw size string |
| size_amount | float | Numeric size amount |
| size_unit | string | Size unit (g, mL, etc.) |
| size_qty | int | Quantity |
| size_unit_norm | string | Normalized size unit |
| image_url | string | Product image URL |
| source | string | Data source |
| source_url | string | Source URL |
Validation
- external_id uniqueness: PASS
- No full-row duplicates: PASS
- Schema validation: PASS
Phase 2 β Semantic Normalization
Goal: Normalize brands, extract identity attributes from original titles, parse variants, build core titles and identity hashes.
What It Does
- Normalizes 9 raw brand variants β 2 brands (Compliments, Sensations) + 7 product lines
- Extracts 9 boolean identity flags from ORIGINAL title (before normalization)
- Extracts fat level and fat percentage
- Extracts flavour and formulation keywords
- Parses variant attributes from size strings
- Extracts core titles (strip brand prefix + size)
- Builds deterministic identity hash
Brand Normalization
| Raw Brand | Normalized | Product Line |
|---|---|---|
| Compliments Organic | Compliments | Organic |
| Compliments Balance | Compliments | Balance |
| Compliments Naturally Simple | Compliments | Naturally Simple |
| Compliments Green Care | Compliments | Green |
| Compliments Little Ones | Compliments | Little Ones |
| Sensations | Sensations | Sensations |
| Compliments | Compliments | Core |
Identity Flags Extracted
is_organicβ Organic productsis_gluten_freeβ Gluten-free productsis_naturally_simpleβ Naturally Simple lineis_sugar_freeβ Sugar-free / no sugar added / unsweetenedis_unsaltedβ Unsalted / no saltis_lactose_freeβ Lactose-freeis_peanut_freeβ Peanut-freeis_plant_basedβ Plant-basedis_reduced_sodiumβ Reduced sodium / low sodium
Output: phase2_output.parquet (4,440 Γ 34)
All Phase 1 columns PLUS:
| Column | Type | Description |
|---|---|---|
| brand_norm | string | Normalized brand name |
| product_line | string | Product line (Core, Organic, Balance, etc.) |
| is_organic | bool | Organic flag |
| is_gluten_free | bool | Gluten-free flag |
| is_naturally_simple | bool | Naturally Simple flag |
| is_sugar_free | bool | Sugar-free flag |
| is_unsalted | bool | Unsalted flag |
| is_lactose_free | bool | Lactose-free flag |
| is_peanut_free | bool | Peanut-free flag |
| is_plant_based | bool | Plant-based flag |
| is_reduced_sodium | bool | Reduced sodium flag |
| fat_level | string | regular / reduced_fat / fat_free |
| fat_percentage | float | Numeric fat percentage (if in title) |
| flavour | list | Extracted flavour keywords |
| formulation | list | Extracted formulation keywords |
| variant_attributes | JSON | Parsed size/package attributes |
| core_title | string | Title stripped of brand prefix and size |
| identity_hash | string | Deterministic hash of all identity attributes |
Phase 3 β Product Domain + Taxonomy + Product Grouping
Goal: Classify food/non-food, assign taxonomy, group products by identity, generate reference catalog.
What It Does
- Classifies products as food / non_food / unknown using keyword rules
- Assigns taxonomy category (19 categories) using keyword rules
- Groups products by identity hash + domain + normalized core title
- Detects ambiguous cases (multiple flavours, formulations, etc. in same group)
- Generates reference product catalog (one row per group)
- Generates product group mapping (one row per product)
- Maps internal taxonomy to Google Product Category (GPC)
- Builds separate non-food products table
Food/Non-Food Classification Results
| Domain | Count | % |
|---|---|---|
| food | 2,814 | 63.4% |
| unknown | 1,232 | 27.7% |
| non_food | 394 | 8.9% |
Taxonomy Categories (19)
| Category | Description | GPC Mapping |
|---|---|---|
| DAIRY | Yogurt, milk, cheese, butter | Dairy Products (428) |
| MEAT_SEAFOOD | Chicken, beef, fish, seafood | Meat, Seafood & Eggs (432) |
| BEVERAGES | Juice, coffee, tea, drinks | Beverages (413) |
| BAKERY | Bread, bagel, muffin, cookie | Bakery (1876) |
| FROZEN | Frozen food, ice cream, pizza | Frozen Desserts (5788) |
| PRODUCE | Fruits, vegetables, olives | Fruits & Vegetables (430) |
| CONDIMENTS_SAUCES | Sauce, ketchup, mustard, oil | Condiments & Sauces (427) |
| CONFECTIONERY | Chocolate, candy, gummy | Candy & Chocolate (4748) |
| SNACKS | Chip, cracker, popcorn, nut | Snack Foods (423) |
| PASTA_RICE | Pasta, noodle, rice | Grains, Rice & Cereal (431) |
| BREAKFAST | Cereal, oat, granola | Cereal & Granola (4689) |
| CANNED_GOODS | Canned products | Cooking & Baking Ingredients (2660) |
| GENERAL_GROCERY | Default catch-all | Food Items (422) |
| HOUSEHOLD_CLEANING | Detergent, laundry | Cleaning Supplies |
| HEALTH_REMEDIES | Medication, vitamins | Health Care |
| PERSONAL_CARE | Shampoo, deodorant | Personal Care |
| BABY_CARE | Baby products | Baby & Toddler Food |
| PET_FOOD | Cat/dog food | Pet Food |
| HOUSEHOLD_SUPPLIES | Kitchenware, bulbs | Home DΓ©cor |
Product Grouping
- Group key:
identity_hash | product_domain | normalized_core_title - Group ID: Deterministic UUID5 from group key
- Groups: 3,691 unique groups
- Ambiguous cases: 303 (multiple core titles, flavours, or formulations in same group)
Output Tables
reference_product_catalog.csv (3,691 rows)
| Column | Description |
|---|---|
| group_id | Deterministic UUID5 |
| group_name | Most frequent core_title in group |
| brand | Brand name |
| product_domain | food / non_food / unknown |
| reference_db_taxonomy | Category classification |
| identity_hash | Identity hash from Phase 2 |
| product_count | Number of products in group |
| unique_upcs | Number of unique UPCs |
product_group_mapping.csv (4,440 rows)
| Column | Description |
|---|---|
| upc | Product UPC |
| external_id | External identifier |
| group_id | Group UUID |
| group_name | Group name |
| core_title | Normalized core title |
| original_title | Original product title |
| brand | Brand name |
| size | Product size |
| variant_attributes | Variant attributes JSON |
| identity_hash | Identity hash |
| product_domain | food / non_food / unknown |
| reference_db_taxonomy | Category |
| product_line | Product line |
| is_organic ... is_reduced_sodium | Identity flags |
| fat_level | Fat level |
| fat_percentage | Fat percentage |
| flavour | Flavour keywords |
| formulation | Formulation keywords |
| source | Data source |
| source_url | Source URL |
taxonomy_gpc_mapping.csv (19 rows)
| Column | Description |
|---|---|
| reference_db_taxonomy | Internal taxonomy category |
| gpc_id | Google Product Category ID |
| gpc_name | GPC category name |
| gpc_full_path | Full GPC hierarchy path |
non_food_products.csv (394 rows)
| Column | Description |
|---|---|
| external_id | External identifier |
| upc | Product UPC |
| group_id | Group UUID |
| group_name | Group name |
| core_title | Normalized core title |
| original_title | Original product title |
| brand | Brand name |
| size | Product size |
| reference_db_taxonomy | Category |
| product_line | Product line |
| source | Data source |
| source_url | Source URL |
Phase 4 β Variant Assignment
Goal: Assign variant IDs to products within each group based on size/package attributes.
What It Does
- Loads Phase 3 mapping + Phase 2 variant data
- Builds variant key from size/package attributes
- Generates deterministic variant ID (UUID5 from group_id + variant_key)
- Builds variant table (one row per unique variant)
- Builds product β variant mapping
Variant Key Structure
amt{amount}|unit{unit}|qty{qty}|mult{multiplier}
Examples:
amt500.0|unitgβ 500g productamt1.0|unitkgβ 1kg productamt500.0|unitg|qty2β 2 Γ 500g multipackcount20β 20-count packnosizeβ No size information
Output Tables
product_variant_mapping.parquet (4,440 Γ 11)
| Column | Description |
|---|---|
| external_id | External identifier |
| upc | Product UPC |
| group_id | Group UUID |
| variant_id | Variant UUID |
| core_title | Normalized core title |
| original_title | Original product title |
| brand | Brand name |
| size | Product size |
| variant_key | Variant key string |
| source | Data source |
| source_url | Source URL |
reference_product_variants.parquet (4,299 rows)
| Column | Description |
|---|---|
| variant_id | Variant UUID |
| group_id | Group UUID |
| group_name | Group name |
| brand | Brand name |
| product_line | Product line |
| product_domain | food / non_food / unknown |
| reference_db_taxonomy | Category |
| core_title | Normalized core title |
| variant_key | Variant key string |
| size | Size string |
| size_amount | Numeric size |
| size_unit | Size unit |
| flavour | Flavour keywords |
| formulation | Formulation keywords |
| fat_level | Fat level |
| fat_percentage | Fat percentage |
| product_count | Products in this variant |
| unique_upcs | Unique UPCs in this variant |
Phase 5 β Nutrition Integration
Goal: Match nutrition data to products, normalize per-100g values, validate 1:1 relationship.
What It Does
- Loads nutrition data (4,440 Γ 21) from HuggingFace
- Cleans and validates nutrition (flags MISSING, SUSPICIOUS)
- Normalizes nutrition to per-100g/mL values
- Matches products to nutrition by
external_id(100% deterministic) - Joins with Phase 3 (group_id) and Phase 4 (variant_id)
Normalization Methods
| Method | Count | Description |
|---|---|---|
| direct_100g | 150 | Serving size is 100g/mL |
| scaled_to_100g | 1,351 | Scaled from serving size to 100g/mL |
| not_normalized | 2,939 | Ambiguous unit or missing serving size |
Nutrition Quality Status
| Status | Count | Description |
|---|---|---|
| VALID | 4,076 | All nutrition fields present |
| MISSING | 364 | All nutrition fields null (non-food) |
| SUSPICIOUS | 0 | Values exceed thresholds |
Output Tables
nutrition_per_100g.parquet (4,440 rows)
| Column | Description |
|---|---|
| external_id | External identifier |
| upc | Product UPC |
| serving_size | Raw serving size string |
| serving_amount | Parsed numeric amount |
| serving_unit | Parsed unit (g, mL, etc.) |
| normalization_method | direct_100g / scaled_to_100g / not_normalized |
| normalization_reason | Explanation of normalization |
| calories_per_100g | Calories per 100g |
| carbohydrate_g_per_100g | Carbohydrates per 100g |
| sugars_g_per_100g | Sugars per 100g |
| sodium_mg_per_100g | Sodium per 100g |
| fat_g_per_100g | Fat per 100g |
| saturated_fat_g_per_100g | Saturated fat per 100g |
| protein_g_per_100g | Protein per 100g |
| fibre_g_per_100g | Fibre per 100g |
| ... (17 nutrition fields total) |
product_nutrition_mapping.parquet (4,440 rows)
| Column | Description |
|---|---|
| external_id | External identifier |
| upc | Product UPC |
| group_id | Group UUID |
| variant_id | Variant UUID |
| title | Product title |
| serving_size | Raw serving size |
| calories ... cholesterol_mg | 17 nutrition fields |
| match_method | external_id_exact |
| match_confidence | HIGH |
| nutrition_quality_status | VALID / MISSING / SUSPICIOUS |
| nutrition_quality_flags | Quality flags |
Phase 6 β Nutri-Score 2023 + Agribalyse Mapping
Goal: Calculate Nutri-Score 2023 for eligible food products, map to Agribalyse categories.
Algorithm
Nutri-Score 2023 (updated algorithm)
- Source: Eurofins referencing SantΓ© Publique France FAQ v21.Dec.2023
- URL: https://www.eurofins.de/food-analysis/other-services/nutri-score/
Eligibility Criteria
A product is eligible if ALL of:
product_domain= "food"nutrition_quality_status= "VALID"- ALL 6 required per-100g fields present:
- calories_per_100g
- sugars_g_per_100g
- saturated_fat_g_per_100g
- sodium_mg_per_100g
- fibre_g_per_100g
- protein_g_per_100g
Results
| Metric | Value |
|---|---|
| Total products | 4,440 |
| Eligible | 364 (8.2%) |
| Not eligible | 4,076 (91.8%) |
Nutri-Score Grade Distribution (among eligible)
| Grade | Score Range | Count | % of Eligible |
|---|---|---|---|
| A | β€ 0 | 31 | 8.5% |
| B | 0β2 | 42 | 11.5% |
| C | 2β10 | 135 | 37.1% |
| D | 10β18 | 83 | 22.8% |
| E | > 18 | 73 | 20.1% |
Exclusion Reasons
| Reason | Count |
|---|---|
| NON_FOOD | 394 |
| UNKNOWN_DOMAIN | 1,232 |
| MISSING_NUTRITION | 364 |
| MISSING_REQUIRED_FIELDS | 2,086 |
Agribalyse Category Mapping
| Confidence | Count | Description |
|---|---|---|
| HIGH | 1,908 | DAIRY, MEAT_SEAFOOD, PRODUCE, BEVERAGES, CONFECTIONERY |
| MEDIUM | 885 | BAKERY, BREAKFAST, SNACKS, CONDIMENTS, FROZEN, PASTA_RICE |
| LOW | 1,310 | GENERAL_GROCERY |
| NONE | 337 | Non-food, unknown, health, household, personal care |
FVL (Fruits, Vegetables, Legumes) Estimation
| FVL % | Count | Source |
|---|---|---|
| 90% | ~200 | PRODUCE category estimate |
| 0% | ~4,240 | All other categories |
Output Tables
phase6_product_scores.parquet (4,440 rows)
| Column | Description |
|---|---|
| external_id | External identifier |
| group_id | Group UUID |
| variant_id | Variant UUID |
| upc | Product UPC |
| core_title | Normalized core title |
| product_domain | food / non_food / unknown |
| reference_db_taxonomy | Category |
| nutrition_quality_status | VALID / MISSING / SUSPICIOUS |
| score_eligibility | ELIGIBLE / NOT_ELIGIBLE |
| score_exclusion_reason | Reason for exclusion |
| calories_per_100g | Calories per 100g |
| energy_kj_100g | Energy in kJ per 100g |
| sugars_g_per_100g | Sugars per 100g |
| saturated_fat_g_per_100g | Saturated fat per 100g |
| sodium_mg_per_100g | Sodium per 100g |
| salt_g_100g | Salt per 100g |
| fibre_g_per_100g | Fibre per 100g |
| protein_g_per_100g | Protein per 100g |
| fvl_percent | FVL percentage |
| negative_points | Nutri-Score negative points |
| positive_points | Nutri-Score positive points |
| nutri_score_raw | Raw Nutri-Score (-10 to 40) |
| nutri_score_grade | A / B / C / D / E |
| nutri_score_calculated | boolean |
phase6_agribalyse_mapping.parquet (4,440 rows)
| Column | Description |
|---|---|
| external_id | External identifier |
| group_id | Group UUID |
| reference_db_taxonomy | Category |
| product_domain | food / non_food / unknown |
| agribalyse_category | Agribalyse category name |
| agribalyse_ciqual | CIQUAL code pattern |
| mapping_confidence | HIGH / MEDIUM / LOW / NONE |
phase6_score_exclusions.parquet (4,076 rows)
| Column | Description |
|---|---|
| external_id | External identifier |
| group_id | Group UUID |
| product_domain | food / non_food / unknown |
| reference_db_taxonomy | Category |
| nutrition_quality_status | MISSING / SUSPICIOUS |
| score_exclusion_reason | Detailed exclusion reason |
Repository Structure
compliments-reference-db/
βββ phase1/
β βββ src/phase1.py
β βββ outputs/phase1_output.parquet
β βββ notebooks/phase1.ipynb
β βββ validation/
β βββ statistics/
βββ phase2/
β βββ src/phase2.py
β βββ outputs/phase2_output.parquet
β βββ notebooks/phase2.ipynb
β βββ validation/
β βββ statistics/
βββ phase3/
β βββ src/phase3.py
β βββ outputs/
β β βββ reference_product_catalog.csv
β β βββ product_group_mapping.csv
β β βββ taxonomy_gpc_mapping.csv
β β βββ non_food_products.csv
β β βββ ambiguous_cases.csv
β β βββ unknown_products.csv
β βββ notebooks/phase3.ipynb
β βββ validation/
β βββ statistics/
βββ phase4/
β βββ src/phase4.py
β βββ outputs/
β β βββ product_variant_mapping.parquet
β β βββ reference_product_variants.parquet
β β βββ reference_product_variant_summary.parquet
β βββ notebooks/phase4.ipynb
β βββ validation/
β βββ statistics/
βββ phase5/
β βββ src/phase5.py
β βββ outputs/
β β βββ nutrition_per_100g.parquet
β β βββ nutrition_cleaned.parquet
β β βββ product_nutrition_mapping.parquet
β βββ notebooks/phase5.ipynb
β βββ validation/
β βββ statistics/
βββ phase6/
β βββ src/phase6.py
β βββ outputs/
β β βββ phase6_product_scores.parquet
β β βββ phase6_agribalyse_mapping.parquet
β β βββ phase6_score_exclusions.parquet
β β βββ phase6_review_queue.parquet
β β βββ phase6_summary.parquet
β βββ notebooks/phase6.ipynb
β βββ validation/
βββ code/
β βββ src/ β All 6 scripts consolidated
β βββ notebooks/ β All 6 notebooks with Input/Output/Goal headers
βββ shared/
βββ archive/
Tools & Technologies
| Tool | Purpose |
|---|---|
| Python 3.10+ | Core language |
| pandas | Data manipulation |
| numpy | Numerical operations |
| huggingface_hub | Dataset loading & publishing |
| UUID5 (uuid module) | Deterministic ID generation |
| regex (re module) | Keyword-based classification |
| JSON | Structured metadata |
External Websites Used
| Website | Purpose |
|---|---|
| https://huggingface.co/datasets/saraNour/compliments-brand | Authoritative source data |
| https://huggingface.co/datasets/saraNour/compliments-reference-db | Published reference DB |
| https://www.google.com/basepages/producttype/taxonomy.en-US.txt | Google Product Category taxonomy |
| https://www.eurofins.de/food-analysis/other-services/nutri-score/ | Nutri-Score 2023 algorithm |
Design Principles
- Single authoritative source β Only
products.parquetandnutrition.parquetfrom HuggingFace - No LLM β All 6 phases are 100% deterministic/rule-based
- Full traceability β Every transformation documented, raw values preserved
- Reproducibility β Deterministic UUIDs, deterministic rules, versioned outputs
- Validation at every phase β Schema checks, duplicate checks, regression tests
- Clean separation β Each phase has clear input/output boundary
Key Numbers Summary
| Metric | Value |
|---|---|
| Total products | 4,440 |
| Unique external_ids | 4,440 |
| Unique UPCs | 3,271 |
| Reused UPC values | 774 |
| Product groups | 3,691 |
| Variants | 4,299 |
| Food products | 2,814 |
| Non-food products | 394 |
| Unknown domain | 1,232 |
| Taxonomy categories | 19 |
| Nutrition match rate | 100% |
| Nutri-Score eligible | 364 (8.2%) |
| Nutri-Score A | 31 |
| Nutri-Score B | 42 |
| Nutri-Score C | 135 |
| Nutri-Score D | 83 |
| Nutri-Score E | 73 |
License
Internal research use. Data sourced from Sobeys Inc. Compliments/Sensations product lines.
Version History
| Date | Phase | Version | Change | Impact |
|---|---|---|---|---|
| 2026-08-01 | Phase 2 | 2.0.0 β 2.1.0 | Fixed extract_flavours substring matching bug |
lime: 4,440 β 32, apple: 111 β 98 |
| 2026-08-01 | Phase 3 | 1.2.0 | reference_db_taxonomy rename + GPC mapping | 19 taxonomy categories mapped to GPC |
| 2026-07-31 | Phase 4 | 1.0.0 | Variant assignment | 4,299 variants |
| 2026-07-31 | Phase 5 | 1.0.0 | Nutrition integration | 100% match rate |
| 2026-07-31 | Phase 6 | 1.0.0 | Nutri-Score 2023 + Agribalyse | 364 scored |
Phase 2 v2.1.0 β Flavour Extraction Bug Fix (2026-08-01)
Root cause: The brand name "Compliments" contains the substring "lime" (comp**lime**nts). The extract_flavours function used substring matching (kw in t), causing every product in the database to receive ['lime'] as a flavour. A secondary issue: "apple" matched inside "pineapple".
Fix: Changed from substring matching to word-boundary regex (\bkeyword\b) with plural handling for irregular plurals (berry/berries, peach/peaches, mango/mangos).
Impact on flavour extraction:
| Metric | Before (v2.0.0) | After (v2.1.0) |
|---|---|---|
| Products with flavour | 4,440 (100%) | 868 (19.5%) |
| Products without flavour | 0 | 3,572 (80.5%) |
lime count |
4,440 (all false) | 32 (all genuine) |
apple count |
~111 (13 false) | 98 (0 false) |
| False positives | ~4,440 | 0 |
Downstream impact: All downstream phases (3β6) were re-run with the corrected Phase 2 output. Group count (3,691), variant count (4,299), and all other structural metrics remained unchanged. All validation checks and 12 regression tests pass.
- Downloads last month
- 217