Skip to content

kunalverma2512/IngrediSense

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

29 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯ AI Health Ingredient Copilot

ENCODE 2026 Hackathon @ IIT Guwahati
AI-powered food ingredient analysis and health risk assessment platform

License Python Node React

πŸ“‹ Table of Contents

🎯 Overview

AI Health Ingredient Copilot is an intelligent health analysis platform that helps users make informed decisions about food products by analyzing ingredient labels using advanced AI. The system extracts ingredients from product images, assesses health risks based on user profiles, and provides personalized recommendations.

Key Capabilities

  • πŸ“Έ OCR-based Label Extraction - Extract brand names and ingredient lists from food labels
  • 🧬 Clinical Profile Mapping - Convert health conditions to biochemical triggers
  • πŸ”¬ Evidence-based Analysis - Fetch clinical research and regulatory data for ingredients
  • ⚠️ Risk Assessment - Identify potential health risks based on user profile
  • πŸ’‘ Smart Recommendations - Suggest healthier product alternatives
  • πŸ€– Conversational AI - Friendly expert insights with visual indicators (🟒/🟑/πŸ”΄)

✨ Features

Core Features

  • πŸ” User Authentication - Secure JWT-based authentication system
  • πŸ‘€ Health Profiling - Personalized health condition tracking
  • πŸ“Š Real-time Analysis - Instant AI-powered ingredient assessment
  • 🎯 Risk Scoring - NOVA classification and health risk indicators
  • πŸ“± Responsive Design - Beautiful UI across all devices
  • 🌐 Multi-modal Input - Support for image upload and URL analysis
  • πŸ“ˆ History Tracking - Save and review past analyses

Advanced Features

  • LangGraph Workflow - Sophisticated AI agent pipeline
  • Google Gemini Integration - State-of-the-art AI model
  • Clinical Evidence Search - Real-time medical research lookup
  • Regulatory Database - International food safety regulations
  • Alternative Suggestions - Healthier product recommendations

πŸ— Architecture

graph TB
    A[React Frontend<br/>Port 5173] --> B[Node.js Auth Server<br/>Port 8080]
    A --> C[FastAPI AI Server<br/>Port 8000]
    B --> D[(MongoDB<br/>User Data)]
    C --> E[Google Gemini<br/>AI Model]
    C --> F[Tesseract OCR]
    C --> G[Web Scraper<br/>Clinical Data]
    
    style A fill:#61dafb
    style B fill:#68a063
    style C fill:#009688
    style D fill:#4db33d
    style E fill:#4285f4
Loading

System Components

  1. Frontend (React + Vite)

    • User interface and interaction
    • Authentication flow
    • Health profile management
    • Real-time analysis display
  2. Node Server (Express + MongoDB)

    • User authentication (JWT)
    • Health profile storage
    • Session management
    • User data persistence
  3. FastAPI Server (Python + LangGraph)

    • AI health agent workflow
    • Image OCR processing
    • Ingredient analysis
    • Clinical risk assessment
    • Alternative recommendations

πŸ›  Technology Stack

Frontend

  • Framework: React 19.2.0
  • Build Tool: Vite 7.2.4
  • Styling: TailwindCSS 4.1.18
  • Animations: Framer Motion 12.23.26
  • Routing: React Router DOM 7.11.0
  • HTTP Client: Axios 1.13.2
  • Icons: React Icons 5.5.0

Backend (Node Server)

  • Runtime: Node.js 18+
  • Framework: Express 5.2.1
  • Database: MongoDB + Mongoose 9.1.1
  • Authentication: JWT (jsonwebtoken 9.0.3)
  • Security: Helmet 8.1.0, bcryptjs 3.0.3
  • Logging: Morgan 1.10.1

Backend (FastAPI Server)

  • Framework: FastAPI 0.115.6
  • Server: Uvicorn 0.34.0
  • AI/ML: LangChain 0.3.14, LangGraph 0.2.64
  • LLM: Google Generative AI 0.8.3
  • OCR: Tesseract, OpenCV 4.10.0
  • Image Processing: Pillow 11.0.0
  • Web Scraping: BeautifulSoup4 4.12.3

πŸ“¦ Prerequisites

Required Software

macOS Setup

# Install Homebrew (if not installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Install required software
brew install node python tesseract mongodb-community

API Keys Required

πŸš€ Quick Start

1. Clone the Repository

git clone <repository-url>
cd "ENCODE 2026 HACKATHON IIT GUWAHATI"

2. Setup Frontend

cd frontend
npm install
cp .env.example .env
# Edit .env and configure API URLs
npm run dev

Frontend will run at: http://localhost:5173

3. Setup Node Server

cd NodeServer
npm install
cp .env.example .env
# Edit .env and add MongoDB URI, JWT secrets
npm run dev

Node server will run at: http://localhost:8080

4. Setup FastAPI Server

cd FASTAPISERVER
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
# Edit .env and add Google API key
python run.py

FastAPI server will run at: http://localhost:8000

5. Access the Application

πŸ“ Project Structure

ENCODE 2026 HACKATHON IIT GUWAHATI/
β”œβ”€β”€ frontend/                 # React + Vite frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/          # Route pages
β”‚   β”‚   β”œβ”€β”€ services/       # API integration
β”‚   β”‚   β”œβ”€β”€ context/        # React context (auth)
β”‚   β”‚   └── assets/         # Static assets
β”‚   β”œβ”€β”€ .env.example
β”‚   └── package.json
β”‚
β”œβ”€β”€ NodeServer/              # Express + MongoDB backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ routes/         # API routes
β”‚   β”‚   β”œβ”€β”€ controllers/    # Request handlers
β”‚   β”‚   β”œβ”€β”€ models/         # Mongoose models
β”‚   β”‚   β”œβ”€β”€ middleware/     # Custom middleware
β”‚   β”‚   β”œβ”€β”€ config/         # Configuration
β”‚   β”‚   └── utils/          # Utilities
β”‚   β”œβ”€β”€ .env.example
β”‚   └── package.json
β”‚
β”œβ”€β”€ FASTAPISERVER/           # FastAPI + AI backend
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/routes/     # API endpoints
β”‚   β”‚   β”œβ”€β”€ services/       # Business logic
β”‚   β”‚   β”‚   └── health_agent/ # LangGraph AI agent
β”‚   β”‚   β”œβ”€β”€ models/         # Pydantic models
β”‚   β”‚   β”œβ”€β”€ middleware/     # Middleware
β”‚   β”‚   β”œβ”€β”€ config/         # Settings
β”‚   β”‚   └── utils/          # Utilities
β”‚   β”œβ”€β”€ uploads/            # Temporary files
β”‚   β”œβ”€β”€ logs/               # Application logs
β”‚   β”œβ”€β”€ .env.example
β”‚   └── requirements.txt
β”‚
β”œβ”€β”€ .gitignore
└── README.md               # This file

πŸ’» Development

Frontend Development

cd frontend
npm run dev      # Start dev server with HMR
npm run build    # Build for production
npm run preview  # Preview production build
npm run lint     # Run ESLint

Node Server Development

cd NodeServer
npm run dev      # Start with nodemon (auto-restart)
npm start        # Start production server

FastAPI Server Development

cd FASTAPISERVER
source venv/bin/activate  # Activate virtual environment
python run.py             # Start with auto-reload
uvicorn app.main:app --reload  # Alternative start method

Environment Variables

Each service requires specific environment variables. Copy .env.example to .env in each directory and configure:

  • Frontend: API URLs, feature flags
  • Node Server: MongoDB URI, JWT secrets, CORS origins
  • FastAPI Server: Google API key, server config, OCR settings

🌐 Deployment

Frontend (Vercel/Netlify)

cd frontend
npm run build
# Deploy dist/ folder

Node Server (Railway/Render)

  • Set environment variables in platform dashboard
  • Ensure MongoDB connection string is configured
  • Use start command: npm start

FastAPI Server (Render/Railway)

  • Set environment variables
  • Install Tesseract in build script
  • Use start command: uvicorn app.main:app --host 0.0.0.0 --port $PORT

Build Script for FastAPI (Render):

#!/usr/bin/env bash
apt-get update && apt-get install -y tesseract-ocr
pip install -r requirements.txt

🀝 Contributing

This project was built for the ENCODE 2026 Hackathon at IIT Guwahati.

Development Workflow

  1. Create a feature branch
  2. Make your changes
  3. Test thoroughly
  4. Submit a pull request

Code Style

  • Frontend: ESLint rules defined in eslint.config.js
  • Python: Follow PEP 8 guidelines
  • JavaScript: ES6+ modern syntax

πŸ“„ License

ISC License - See LICENSE file for details

πŸ‘₯ Team

ENCODE 2026 Team
IIT Guwahati


πŸ“š Additional Resources

πŸ› Troubleshooting

Common Issues

MongoDB Connection Failed

  • Ensure MongoDB is running: brew services start mongodb-community
  • Check connection string in .env

Tesseract Not Found

  • Install via Homebrew: brew install tesseract
  • Verify installation: tesseract --version

Port Already in Use

  • Check running processes: lsof -i :PORT
  • Kill process or change port in .env

CORS Errors

  • Verify CORS_ORIGINS in server .env files
  • Ensure frontend URL is whitelisted

Built with ❀️ for ENCODE 2026 Hackathon

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors