How ryuo-00/nutriscan works
NutriScan is a local Flask food-label screening prototype. A user uploads a label or chooses the bundled sample; the Flask application coordinates image preparation, OCR, text/section parsing, ingredient and additive matching, allergen checks, unit-aware nutrient screening, scoring, and locally saved results. The UI also exposes scan history, and OCR can retry layout-specific reads. The README documents the end-to-end stages; the source excerpts show selected implementation details, so unsampled subsystem links are limited to documented workflow relationships.
Main entry points: app.py Flask routes · templates Upload and results UI · ocr.py OCR and retries · nutrition.py Nutrient screening
Components 17
Web application
- Upload and results UI
templates - Browser interactions
static/js/app.js - Flask routes
app.py
Image recognition
- Image preparation
preprocess.py - OCR and retries
ocr.py - OCR vocabulary
data/ocr
Label analysis
- Text and sections
parser.py - Ingredient matching
matcher.py - Allergen screening
matcher.py - Nutrient screening
nutrition.py - Explainable score
scoring.py - Rules and paths
config.py
Local data
- Screening knowledge
data/knowledge - Local persistence
storage.py - Scan history
storage.py
Other components
- User
- Tesseract OCR
Connections 24
- User → Upload and results UI: uploads label
README.md - Upload and results UI → Browser interactions: uses interactions
- Upload and results UI → Flask routes: submits scan
README.md - Flask routes → Image preparation: prepares image
app.py - Flask routes → OCR and retries: runs OCR
app.py - Image preparation → OCR and retries: supplies image
ocr.py - OCR and retries → Tesseract OCR: recognizes text
README.md - OCR and retries → OCR vocabulary: uses vocabulary
- Flask routes → Text and sections: parses text
app.py - Flask routes → Ingredient matching: matches ingredients
app.py - Flask routes → Allergen screening: checks allergens
README.md - Flask routes → Nutrient screening: screens nutrients
app.py - Flask routes → Explainable score: calculates score
app.py - Nutrient screening → Text and sections: normalizes text
nutrition.py - Ingredient matching → Screening knowledge: uses records
- Allergen screening → Screening knowledge: uses records
- Nutrient screening → Rules and paths: reads thresholds
nutrition.py - Explainable score → Nutrient screening: checks comparability
scoring.py - Explainable score → Rules and paths: reads weights
scoring.py - Flask routes → Local persistence: loads and saves
app.py - Local persistence → Screening knowledge: loads knowledge
- Local persistence → Scan history: reads and writes
storage.py - Flask routes → Upload and results UI: renders results
- User → Scan history: reopens scans
README.md