DiaLog helps people with diabetes make safer food choices. It analyzes meals using machine learning and provides clear, personalized guidance before and after you eat.
- Features
- Architecture
- Tech Stack
- Getting Started
- Run (Windows PowerShell)
- Multilingual Support 🇮🇳
- Safety & Nutrition Page
- API Overview
- Troubleshooting
- Smart Meal Analysis (ML) with confidence and explanations
- Truly Personalized Recommendations based on your profile and logs
- Nutritional Facts: calories, carbs, protein, fats, fiber, GI/GL
- Real‑time Search: 1,000+ Indian foods with quick filter
- BMI & Health Insights surfaced in the dashboard
- Risk Assessment Badges: safe / caution / unsafe
- Safety & Nutrition Page to check food safety without logging
- Multilingual UI: popular Indian languages via live translation
- Frontend: React 18, Tailwind CSS, Heroicons
- Backend: FastAPI, Pydantic, Uvicorn, joblib models
- ML: Random Forest/ensemble models + per‑user personalized models
- Data: Food Master Dataset (nutritional facts), User Logs (for personalization)
- Storage/Cloud (optional): Firebase Admin SDK for Firestore logging
See docs for visuals and flows:
- Frontend: React, Tailwind CSS, Heroicons
- Backend: FastAPI, Uvicorn, Pydantic
- ML: scikit‑learn, joblib
- Optional: Firebase Admin for Firestore logging
Prerequisites:
- Python 3.10+ (3.8+ supported)
- Node.js 16+ (18+ recommended)
- Git
Backend setup
# Navigate to backend directory
cd backend
# Create virtual environment (recommended)
python -m venv venv
# Activate virtual environment (Windows PowerShell)
./venv/Scripts/Activate.ps1
# Install Python dependencies
pip install -r requirements.txt
# Optional: Firebase Admin support (for Firestore logging)
npm installFrontend setup
# Navigate to frontend directory
cd ../frontend
# Install Node.js dependencies
npm installOption 1: Start both servers together
# From project root directory
./start_dev.batOption 2: Start servers separately
# Backend terminal
cd backend; uvicorn main:app --reload --host 0.0.0.0 --port 8000
# Frontend terminal (new window)
cd frontend; npm startAccess URLs
- Backend (Production): https://dialog-backend.onrender.com
- Frontend (Production): https://dialog-frontend.onrender.com
- Local Backend API: http://localhost:8000
- Local Frontend Dev: http://localhost:3000 (or 3001 if 3000 is occupied)
- API Docs (Swagger): http://localhost:8000/docs
- workingDirectory:
backend - buildCommand:
pip install --upgrade pip ; pip install --only-binary=:all: -r requirements.prod.txt - startCommand:
uvicorn main:app --host 0.0.0.0 --port $PORT - Health check path:
/health - Env vars:
PYTHON_VERSION=3.11.9, plus any Firebase / Gemini keys.
- Root Directory:
frontend - Build Command:
npm ci && npm run build(ornpm install && npm run buildif no lockfile) - Publish Directory:
build - REACT_APP_API_BASE_URL:
https://dialog-backend.onrender.com - Firebase env keys (if using Firestore features).
Static hosting returns 404 on deep links by default. Added public/404.html which redirects to index.html and a script in src/index.jsx that restores the original path for React Router. If you use Render's rewrite settings, also add: Source /* → Destination /index.html (Rewrite).
After a successful deploy you can freeze versions for reproducibility:
pip freeze > backend/constraints.txtCopy top‑level lines you care about into a pinned requirements.prod.lock.txt later. Keep the relaxed file for quick iteration until stability is confirmed.
- Live translation across the app; choose your language in Profile or via the Navbar’s globe button.
- Popular Indian languages included: Hindi, Bengali, Marathi, Telugu, Tamil, Gujarati, Kannada, Malayalam, Punjabi, Odia, Urdu (plus English).
- Powered by a free translation API for live content; can be upgraded to i18next + resource files or alternate providers (Bhashini, Sarvam AI, LibreTranslate) as needed.
Check if a food is Safe / Caution / Unsafe before you eat it – without logging anything.
- UI: Navbar → “Safety & Nutrition” page
- Flow: type to search → pick a food → click “Check Safety”
- Backend: uses
/food/{name}for nutrition facts and/predictfor ML safety - No side effects: nothing is written to Firestore logs from this page
GET /health– server/model statusGET /foods– list of foodsGET /food/{food_name}– nutrition for a foodPOST /predict– safety prediction for a mealPOST /recommendations– ML meal recommendationsPOST /truly-personalized-recommendations– per‑user model recommendations
See also: docs/api-endpoints.md
- Frontend on “port 3000 in use”: it will auto‑select 3001.
- Backend “Could not import module 'main'”: run from
backendfolder or useuvicorn main:app. - Ensure the backend runs on port
8000to matchfrontend/src/services/api.js.