How san2003m/telegram-calrorie-bot works
A personal Telegram food and calorie logger. Users scan or search packaged foods, look up Korean food-database entries or restaurant menus, enter recipes or manual nutrition, confirm candidates, choose portions, and save intake; they can then review totals and history in Telegram or a private dashboard. The map includes the documented barcode, AI, recipe, and web branches. README-described flows fill gaps where implementation excerpts were unavailable; unsampled internal calls are not inferred.
Main entry points: telegram.py Bot workflows · web_api.py Dashboard API · health.py Health and web server · mfds_catalog.py Food database
Components 26
Food capture
- Bot workflows
app/telegram.py - Barcode reader
app/barcode.py - Image preparation
app/image_tools.py
Nutrition lookup
- Product lookup
app/catalog.py - Label recognition
app/ai_recognition.py - Food database
app/mfds_catalog.py - Food estimation
app/food_estimate_ai.py - Menu search
app/menu_ai.py - Recipe parsing
app/recipe_ai.py - Recipe calculation
app/recipe.py
Records and storage
- Portion conversion
app/portion.py - Nutrition normalization
app/nutrition.py - Record repository
app/repository.py - Data models
app/models.py - Database engine
app/db.py
User interfaces
- Dashboard API
app/web_api.py - Web authorization
app/web_auth.py - Dashboard view
app/dashboard.py - Health and web server
app/health.py - Application startup
app/main.py
Other components
- Food logger
- Telegram
- OpenAI
- Open Food Facts
- MFDS API
- Dashboard user
Connections 31
- Food logger → Telegram: sends input
README.md - Telegram → Bot workflows: delivers updates
README.md - Bot workflows → Barcode reader: decodes codes
app/telegram.py - Bot workflows → Image preparation: prepares photos
app/telegram.py - Bot workflows → Product lookup: looks up products
app/telegram.py - Product lookup → Open Food Facts: queries fallback
README.md - Bot workflows → Label recognition: requests recognition
app/telegram.py - Label recognition → OpenAI: analyzes images
app/ai_recognition.py - Bot workflows → Food database: searches foods
app/telegram.py - Food database → MFDS API: queries catalog
README.md - Bot workflows → Food estimation: requests estimate
app/telegram.py - Food estimation → OpenAI: estimates ingredients
app/food_estimate_ai.py - Bot workflows → Menu search: searches menus
app/telegram.py - Menu search → OpenAI: searches official data
README.md - Bot workflows → Recipe parsing: parses recipe text
app/telegram.py - Recipe parsing → OpenAI: structures ingredients
app/recipe_ai.py - Bot workflows → Recipe calculation: calculates recipe
app/telegram.py - Recipe calculation → Food database: matches ingredients
README.md - Bot workflows → Portion conversion: converts serving
app/telegram.py - Bot workflows → Nutrition normalization: normalizes nutrients
app/telegram.py - Bot workflows → Record repository: saves intake
app/telegram.py - Record repository → Data models: queries and updates
app/repository.py - Database engine → Data models: creates schema
app/db.py - Dashboard user → Dashboard view: views totals
README.md - Dashboard view → Dashboard API: requests dashboard data
app/dashboard.py - Dashboard API → Record repository: reads and changes records
app/web_api.py - Dashboard API → Web authorization: checks authorization
app/health.py - Application startup → Bot workflows: registers router
app/main.py - Application startup → Health and web server: starts server
app/main.py - Health and web server → Dashboard view: serves dashboard
app/health.py - Health and web server → Dashboard API: routes requests
app/health.py