Files
dpu-food-scanner/README.md

119 lines
2.6 KiB
Markdown

# Food Scanner
## Features
- **Automatischer Barcode Scanner** - Scannt 1D & 2D Barcodes (EAN, UPC, QR-Codes)
- **Vegan-Analyse** - Erkennt tierische Zutaten und offizielle Vegan-Labels
- **Gewichtsverlust-Score** - Bewertet Produkte von 0-100 basierend auf:
- Kalorien
- Zucker
- Fett & gesättigte Fettsäuren
- Protein (sättigend!)
- Ballaststoffe (sättigend!)
- Natrium
- **Detaillierte Analyse** - Pro & Contra Listen für jedes Produkt
- **Open Food Facts API** - Zugriff auf riesige Produktdatenbank
## Installation
```bash
# Dependencies installieren
npm install
# Development Server starten
npm run dev
# App öffnen
# http://localhost:4321
```
## Wie es funktioniert
### 1. Barcode Scannen
```typescript
// ZXing scannt automatisch Barcodes
const codeReader = new ZXing.BrowserMultiFormatReader();
await codeReader.decodeFromVideoDevice(deviceId, videoElement, callback);
```
### 2. Produkt abrufen
```typescript
// Axios ruft Open Food Facts API auf
const response = await axios.get(
`https://world.openfoodfacts.org/api/v2/product/${barcode}.json`,
);
```
### 3. Vegan-Analyse
```typescript
function analyzeVegan(product) {
// Prüft Labels
if (labels.includes('en:vegan')) return true;
// Sucht nach tierischen Zutaten
const animalIngredients = ['milch', 'ei', 'honig', ...];
// ... Analyse Logik
}
```
### 4. Gewichtsverlust-Analyse
```typescript
function analyzeWeightLoss(product) {
let score = 100;
// Kalorien (wichtigster Faktor)
if (calories < 50) score += 10;
else if (calories > 400) score -= 40;
// Zucker (kritisch für Gewichtsverlust)
if (sugar > 20) score -= 30;
// Protein & Ballaststoffe (gut - sättigend!)
if (protein > 15) score += 15;
if (fiber > 6) score += 15;
// ... weitere Faktoren
return score; // 0-100
}
```
## 🎯 Bewertungs-System
### Vegan Score
-**Vegan** - Offiziell zertifiziert oder keine tierischen Zutaten
-**Nicht Vegan** - Enthält tierische Produkte
-**Unklar** - Status nicht eindeutig
### Gewichtsverlust Score
- 🌟 **80-100**: Excellent - Perfekt für Diät
-**60-79**: Good - In normalen Mengen okay
- ⚠️ **40-59**: Moderate - Kleine Portionen
-**20-39**: Poor - Besser vermeiden
- 🚫 **0-19**: Avoid - Nicht empfohlen
## Datenschutz
- Keine Daten werden gespeichert
- Alle Anfragen gehen direkt an Open Food Facts API
- Kamera wird nur mit Erlaubnis verwendet
- Keine Tracking oder Analytics
## Contributing
Feature Ideen:
- [/] Allergen-Warnung
- [ ] PWA Support (Offline-Modus)
## Bekannte Probleme
- Manche Produkte sind nicht in der Datenbank
- Barcode-Scanner funktioniert nur mit HTTPS
- Einige Browser unterstützen Kamera nicht