YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Phase 5 β Nutrition Integration
Compliments Reference DB Pipeline
Version: 1.0.0 Date: 2026-07-30 Status: PASS
Purpose
Phase 5 integrates nutrition data from the authoritative source into the Compliments Reference DB. It joins nutrition.parquet with the product pipeline using deterministic matching by external_id.
Inputs
| Dataset | Source | Description |
|---|---|---|
nutrition.parquet |
saraNour/compliments-brand/source_of_truth/ |
Authoritative nutrition data (4,440 Γ 21) |
products.parquet |
saraNour/compliments-brand/source_of_truth/ |
Authoritative product catalog (4,440 Γ 16) |
product_group_mapping.csv |
Phase 3 output | Product β group mapping (4,440 Γ 14) |
product_variant_mapping.parquet |
Phase 4 output | Product β variant mapping (4,440 Γ 11) |
Outputs
All production data tables are Parquet.
product_group_mapping.parquet
- Phase 3 mapping converted to Parquet for downstream consumption
- 4,440 rows Γ 14 columns
nutrition_cleaned.parquet
- Cleaned/validated nutrition source
- Original values preserved
- Quality flags included
- 4,440 rows Γ 23 columns
product_nutrition_mapping.parquet
- Product β nutrition mapping with group_id and variant_id
- 4,440 rows Γ 27 columns
nutrition_per_100g.parquet
- Normalized per-100g nutrition values
- Conversion/provenance metadata
- 4,440 rows Γ 24 columns
phase5_statistics.parquet
- Summary metrics
phase5_validation.parquet
- Validation checks and results
Matching Strategy
Primary key: external_id (exact match)
Confidence: HIGH
Coverage: 100% (4,440/4,440)
No fallback matching was needed. The relationship is 1:1.
Normalization Strategy
Nutrition values are normalized to per-100g only when a reliable serving-size conversion is possible.
| Method | Count | Description |
|---|---|---|
| Direct 100g/mL | 150 | serving_size is 100 g or 100 mL |
| Scaled to 100g/mL | 1,351 | Serving size in g or mL, scaled proportionally |
| Not normalized | 2,939 | Ambiguous serving unit or missing serving_size |
Why Not Normalized?
- Missing serving_size (1,505 records): Non-food products (light bulbs, gloves, etc.)
- Ambiguous serving unit (1,434 records): tbsp, cup, tsp, slices, pieces, etc. β no reliable gram equivalent available
- No fabrication: We do NOT invent serving weight conversions
Suspicious Value Policy
Suspicious values are flagged, not overwritten.
| Field | Threshold | Records Flagged |
|---|---|---|
| calories | > 1000 | 1 |
| fat_g | > 100 | 1 |
| protein_g | > 100 | 1 |
Original values are preserved in nutrition_cleaned.parquet with nutrition_quality_status = 'SUSPICIOUS'.
Quality Status
| Status | Count | Description |
|---|---|---|
| VALID | 2,932 | Normal nutrition values |
| MISSING | 1,505 | All 17 nutrition fields null (non-food products) |
| SUSPICIOUS | 3 | Out-of-range values flagged |
Validation
| Rule | Description | Result |
|---|---|---|
| 1 | All products have nutrition match | PASS |
| 2 | No duplicate external_ids | PASS |
| 3 | No duplicate matches | PASS |
| 4 | Suspicious values preserved | PASS |
| 5 | No fabricated values | PASS |
| 6 | No external data used | PASS |
| 7 | All outputs Parquet | PASS |
| 8 | No LLM used | PASS |
| Overall | PASS |
Traceability
products.parquet (source of truth)
β
nutrition.parquet (source of truth)
β
Phase 5: nutrition_cleaned.parquet
β
Phase 5: product_nutrition_mapping.parquet
β (group_id from Phase 3, variant_id from Phase 4)
Phase 5: nutrition_per_100g.parquet
β
Phase 6: Nutrition Scoring
Limitations
- Per-100g normalization is partial β only possible for ~34% of records (1,501/4,440)
- Serving size parsing is limited β complex formats like "1 cup (250 mL)" are not parsed
- Suspicious values are flagged, not corrected β requires domain expert review
- Non-food products have no nutrition β 1,505 records with all-null nutrition fields
Files
phase5/
βββ README.md
βββ src/
β βββ phase5.py
βββ notebooks/
β βββ phase5.ipynb
β βββ phase5_executed.ipynb
βββ outputs/
β βββ product_group_mapping.parquet
β βββ nutrition_cleaned.parquet
β βββ product_nutrition_mapping.parquet
β βββ nutrition_per_100g.parquet
β βββ phase5_statistics.parquet
β βββ phase5_validation.parquet
βββ validation/
β βββ phase5_validation.json
βββ statistics/
βββ phase5_statistics.json
How to Run
cd /home/sara/gsoc/compliments-reference-db
python -m phase5.src.phase5
LLM Usage
None. All matching is deterministic by external_id.
External Datasets
None. Only authoritative nutrition source used.
Generated by Phase 5 Production Pipeline Date: 2026-07-30