fix: correct BLS 4.0 category mapping for food search results

The CATEGORY_MAP was based on BLS 3.x letter codes which were completely
reshuffled in version 4.0. This caused wrong categories like Schwarztee
showing "Wurstwaren" instead of "Getränke". Remapped all 20 letter codes
to match actual BLS 4.0 Hauptlebensmittelgruppen and regenerated blsDb.
This commit is contained in:
2026-04-08 10:40:23 +02:00
parent 28fac452ed
commit cf62ce00fa
2 changed files with 12 additions and 10 deletions
+10 -8
View File
@@ -94,15 +94,17 @@ const NUTRIENT_MAP: Record<string, { field: string; divisor?: number }> = {
TYR: { field: 'tyrosine' }, TYR: { field: 'tyrosine' },
}; };
// BLS code first letter → category (BLS 4.0 Hauptgruppen) // BLS 4.0 code first letter → category (Hauptlebensmittelgruppen)
const CATEGORY_MAP: Record<string, string> = { const CATEGORY_MAP: Record<string, string> = {
A: 'Getränke', B: 'Getreideprodukte', C: 'Getreide', D: 'Backwaren', B: 'Brot & Backwaren', C: 'Getreide', D: 'Dauerbackwaren & Kekse',
E: 'Gemüse', F: 'Obst', G: 'Hülsenfrüchte', E: 'Teigwaren & Nudeln', F: 'Obst & Früchte', G: 'Gemüse',
H: 'Gewürze und Kräuter', J: 'Fette und Öle', K: 'Milch und Milchprodukte', H: 'Hülsenfrüchte & Sojaprodukte', K: 'Kartoffeln & Stärke',
L: 'Eier', M: 'Fleisch', N: 'Wurstwaren', O: 'Wild', P: 'Geflügel', M: 'Milch & Milchprodukte', N: 'Getränke (alkoholfrei)',
Q: 'Fisch und Meeresfrüchte', R: 'Süßwaren', S: 'Zucker und Honig', P: 'Alkoholische Getränke', Q: 'Fette & Öle',
T: 'Gerichte und Rezepte', U: 'Pilze', V: 'Sonstiges', W: 'Algen', R: 'Gewürze & Würzmittel', S: 'Zucker & Honig',
X: 'Fleischersatz', Y: 'Supplemente', T: 'Fisch & Meeresfrüchte', U: 'Fleisch',
V: 'Wild & Kaninchen', W: 'Wurstwaren',
X: 'Brühen & Fertiggerichte', Y: 'Gerichte & Rezepte',
}; };
async function main() { async function main() {
File diff suppressed because one or more lines are too long