Meal Impact Classifier

1. Project Overview

Goal: Classify meals as High, Medium, or Low glucose impact based on keywords. Key Components:

  • Rule-based Classifier: Uses a keyword list to categorize meal impact.
  • API: Flask RESTful endpoint auto-classifies logged meals.
  • Frontend UI: Displays impact using pill-style labels with emojis.
  • Gamified Feedback: Reinforces healthy habits with real-time impact scores.

    2. Classifier Design

    Architecture: Keyword mapping to impact levels:

  • High: "soda", "ice cream", "pizza", "cake"
  • Medium: "toast", "banana", "rice", "pasta"
  • Low: "salad", "chicken", "broccoli", "grilled" Default fallback: Returns Medium when no keywords match. —

    3. Data Logging

    Storage:

  • Meals stored in SQLAlchemy model meal_log with impact field. Persistence:
  • Classification runs automatically when a new meal is logged.
  • No manual tagging required by user.

    4. Data Storage

    Image

    5. API Documentation

    Endpoints: | Endpoint | Method | Description | |—————-|——–|————————————-| | /api/foodlog | POST | Logs a meal and stores impact level | Example Request: const response = await fetch(‘/api/foodlog’, { method: ‘POST’, headers: { ‘Content-Type’: ‘application/json’ }, body: JSON.stringify({ meal: ‘chicken and rice’ }) }); —

    6. Frontend UI

    Image Display:

  • Emoji indicators:
    • :red_circle: High
    • :large_yellow_circle: Medium
    • :large_green_circle: Low
  • Fade-in animation for new entries.
  • Color-coded pills appear beside each logged meal. Accessibility:
  • Fully keyboard navigable
  • Mobile-responsive layout

    6. Success Metrics

    | Metric | Target | |—————————|—————| | Meal logs with valid impact | 100% | | Time to classify | Under 200ms | | User confusion reports | 0 | | Pill visibility rate | 100% | —

    7. User Stories

    1. Daily Tracker User

    As a user managing blood sugar, I want to instantly see the glucose impact of my meals, So that I can adjust my choices in real time.

    2. Parent of Diabetic Teen

    As a parent monitoring a child’s food intake, I want a simple system that labels foods clearly, So I can help them make better decisions.

    3. Health Coach

    As a nutrition coach, I want to review food logs with impact ratings, So that I can give precise advice.