Skip to content

AdamElitzur/ElevateHealth

Repository files navigation

ElevateHealth - AI-Powered Health Analytics Platform

ElevateHealth is a comprehensive health analytics platform that combines food analysis, barcode scanning, and biological age assessment to help users make informed health decisions.

Dashboard Screenshot

πŸš€ Features

🍎 Food Analytics

  • AI-Powered Food Analysis: Uses OpenAI Vision API to analyze food images and extract detailed nutritional information
  • Camera Integration: Real-time camera capture for instant food analysis
  • Barcode Scanning: Scan product barcodes to get nutritional information
  • Sugar Content Tracking: Detailed sugar analysis and tracking
  • Restaurant Integration: Automatic menu data fetching from supported restaurants

🧬 BioAge Analysis

  • Biological Age Assessment: Real-time analysis using advanced algorithms
  • WebSocket Integration: Live data streaming for real-time updates
  • Health Metrics: Comprehensive health scoring and recommendations

πŸ“Š Dashboard & Tracking

  • Sugar Intake Calendar: Visual calendar for tracking daily sugar consumption
  • Progress Tracking: Monitor health improvements over time
  • Challenge System: Gamified health challenges and progress tracking

πŸ”§ Environment Setup

Required Environment Variables

  1. Create Environment Files:

    cp .env_example .env
    cp .env.local_example .env.local
  2. Configure OpenAI API Key:

    • Get an API key from OpenAI Platform
    • Add to .env.local:
      OPENAI_API_KEY=sk-your-api-key-here
  3. Configure Supabase (Optional):

    • Add to .env:
      NEXT_PUBLIC_SUPABASE_URL=your-supabase-url
      NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key

πŸ› οΈ Tech Stack

  • Frontend: Next.js 15, React 19, TypeScript
  • Styling: Tailwind CSS, Radix UI components
  • AI Integration: OpenAI Vision API, GPT-4
  • Barcode Scanning: ZXing library
  • Backend: Next.js API routes, Python WebSocket server
  • Database: Supabase (for user data and analytics)

πŸ“ Project Structure

ElevateHealth/
β”œβ”€β”€ app/                          # Next.js app directory
β”‚   β”œβ”€β”€ api/                      # API routes
β”‚   β”‚   β”œβ”€β”€ analyze-food/         # Food analysis endpoint
β”‚   β”‚   β”œβ”€β”€ analyze-barcode/      # Barcode analysis endpoint
β”‚   β”‚   └── product-lookup/       # Product lookup endpoint
β”‚   β”œβ”€β”€ bioage/                   # BioAge analysis page
β”‚   β”œβ”€β”€ bioage-analysis/          # BioAge results page
β”‚   β”œβ”€β”€ dashboard/                # Main dashboard
β”‚   β”œβ”€β”€ food-analytics/           # Food analysis interface
β”‚   └── onboarding/               # User onboarding
β”œβ”€β”€ bioage/                       # BioAge WebSocket server
β”‚   β”œβ”€β”€ backend/                  # Python backend
β”‚   β”œβ”€β”€ frontend/                 # BioAge frontend
β”‚   └── websocket-server.py       # WebSocket server
β”œβ”€β”€ components/                   # Reusable UI components
β”œβ”€β”€ lib/                          # Utility libraries
β”‚   β”œβ”€β”€ restaurant-data.ts        # Restaurant menu data
β”‚   └── restaurant-scraper.ts     # Restaurant data scraper
β”œβ”€β”€ doc/                          # Documentation
└── public/                       # Static assets

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • Python 3.8+
  • OpenAI API key

Installation

  1. Clone the repository

    git clone <repository-url>
    cd ElevateHealth
  2. Install dependencies

    npm install
  3. Set up environment variables

    cp .env_example .env.local

    Add your OpenAI API key to .env.local:

    OPENAI_API_KEY=sk-your-api-key-here
    
  4. Start the development server

    npm run dev
  5. Start the BioAge WebSocket server (in a separate terminal)

    cd bioage
    python3 websocket-server.py
  6. Open your browser Navigate to http://localhost:3000

πŸ”§ Configuration

OpenAI Setup

  1. Get an API key from OpenAI Platform
  2. Add it to your .env.local file
  3. Restart the development server

BioAge WebSocket Server

The BioAge analysis requires a WebSocket server running on port 8081. The server connects to an external service for biological age calculations.

πŸ“± Usage

Food Analysis

  1. Navigate to the Food Analytics page
  2. Use the camera to capture food or upload an image
  3. The AI will analyze the food and provide nutritional information
  4. View detailed sugar content and health recommendations

Barcode Scanning

  1. Use the barcode scanner to scan product codes
  2. Get instant nutritional information
  3. Track sugar content and other nutrients

BioAge Analysis

  1. Navigate to the BioAge page
  2. The system will connect to the WebSocket server
  3. View real-time biological age analysis
  4. Monitor health metrics and recommendations

πŸ§ͺ API Endpoints

Food Analysis

  • POST /api/analyze-food - Analyze food images using OpenAI Vision API

Barcode Analysis

  • POST /api/analyze-barcode - Analyze product barcodes

Product Lookup

  • POST /api/product-lookup - Look up product information

πŸ”’ Environment Variables

# OpenAI API
OPENAI_API_KEY=sk-your-api-key-here

# Supabase (if using database features)
NEXT_PUBLIC_SUPABASE_URL=your-supabase-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key

πŸš€ Deployment

Vercel (Recommended)

  1. Connect your repository to Vercel
  2. Add environment variables in Vercel dashboard
  3. Deploy automatically on push to main branch

Other Platforms

  1. Build the project: npm run build
  2. Start production server: npm start
  3. Ensure BioAge WebSocket server is running

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

For support and questions:

  • Check the documentation in the doc/ folder
  • Review the API documentation
  • Open an issue on GitHub

🚨 Troubleshooting

Common Issues

OpenAI API Issues:

  • 401 Unauthorized: Check your API key is correct and starts with sk-
  • 429 Rate Limited: You've exceeded your API usage limits
  • Invalid image format: Ensure images are in supported formats (PNG, JPEG, WebP)

BioAge WebSocket Issues:

  • Connection failed: Ensure the WebSocket server is running on port 8081
  • No data received: Check the external service connection

Environment Variables:

  • Variables not loading: Restart the development server after adding new variables
  • File not found: Ensure .env.local file exists and is properly named

Getting Help

  • Check the browser console for detailed error messages
  • Verify all environment variables are set correctly
  • Ensure both Next.js and WebSocket servers are running

πŸ”„ Recent Updates

  • βœ… Enhanced food analysis with OpenAI Vision API
  • βœ… Added barcode scanning functionality
  • βœ… Integrated BioAge WebSocket server
  • βœ… Improved UI/UX with modern design
  • βœ… Added comprehensive error handling
  • βœ… Organized documentation in doc/ folder
  • βœ… Removed temporary and backup directories

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors