Skip to content

ApurveKaranwal/PulseAI

Repository files navigation

PulseAI Logo

PulseAI

AI-Powered Health & Fitness Intelligence Platform


Overview

PulseAI is a full-stack, AI-powered health and fitness platform that combines real-time physiological analysis, computer vision-based posture correction, natural language diet tracking, and an LLM-powered health coaching chatbot — all in one cohesive product.

The platform leverages machine learning models at every layer: from MoveNet-based skeletal tracking in the browser, to NLP-driven meal parsing, to a LangGraph-orchestrated conversational agent providing personalized health advice.


Key Features

Health Dashboard

  • Real-time tracking of water intake, walking distance, calories, and sleep patterns
  • Animated ring visualizations with premium dark-mode UI
  • Weekly activity board with 7-day progress rings
  • AI Smart Logger — type natural language updates like "drank 500ml water and walked 3km" to auto-update metrics

AI Predictive Calendar

  • ML-based forecasting engine that projects future health adherence trends
  • High-risk day detection with visual indicators for predicted dropout days
  • Configurable AI aggression slider that adjusts prediction sensitivity
  • Auto-generated text insights analyzing streak momentum and weekend vulnerability

FormAI — Computer Vision Trainer

  • 5 exercises: Bicep Curl, Squat, Push-Up, Shoulder Press, Lunge
  • Real-time pose detection via MoveNet (SINGLEPOSE_THUNDER) / MediaPipe
  • 5-layer accuracy engine: confidence gating → EMA smoothing → stage hold verification → full ROM validation → temporal cooldown
  • Live form scoring (0–100%) with voice coaching via Web Speech API
  • Bilateral angle averaging, elbow drift detection, posture gates per exercise

Diet Intelligence

  • Text-based: Describe meals in plain language → instant macro breakdown (100+ food database with Indian cuisine focus)
  • Photo-based: Upload food images for AI-powered nutritional estimation
  • Cooking method adjustments (fried, grilled, steamed) and portion scaling

Health Analysis Engine

  • 11-module analysis pipeline: BMR/TDEE, sleep, hydration, nutrition, recovery, risk detection, and health scoring
  • Weighted composite Health Score (0–100) from all subsystems
  • Cross-signal risk detection: overtraining, caloric conflict, sleep debt, dehydration
  • Evidence-based insights and actionable recommendations engine

Health Saarth — AI Chatbot

  • LLM-powered health coaching chatbot (OpenAI GPT / Groq)
  • Persistent session memory via LangChain + LangGraph with SQLite checkpointing
  • Context-aware conversation with health-specific prompt engineering

Tech Stack

Layer Technology
Frontend Next.js, Vanilla CSS, TensorFlow.js, Chart.js, Web Speech API
Backend Node.js (primary server), Django (AI microservices), Flask (API gateway)
AI/ML MoveNet, MediaPipe, LangChain, LangGraph, OpenAI/Groq LLMs
Data SQLite, CSV logging, browser localStorage
DevOps Python venv, npm, Uvicorn, Streamlit

Architecture

Client Layer                     API Gateway (Flask/Node.js :5000)
┌────────────────────┐           ┌──────────────────────────────┐
│ Health Dashboard    │──────────▶│ Route orchestration          │
│ FormAI Trainer      │──────────▶│ Static file serving          │
│ Health Saarth UI    │──────────▶│ CSV data logging             │
└────────────────────┘           │ API proxy to microservices   │
                                 └──────┬───────┬───────┬──────┘
                                        │       │       │
                              ┌─────────▼┐ ┌────▼────┐ ┌▼──────────┐
                              │Diet CLI  │ │Diet     │ │Health     │
                              │API :8001 │ │Photo    │ │Saarth     │
                              │(Django)  │ │API :8002│ │API :8010  │
                              │NLP meal  │ │(Django) │ │(Django)   │
                              │parsing   │ │Food CV  │ │LangChain  │
                              └──────────┘ └─────────┘ └───────────┘

Quick Start

Prerequisites

  • Node.js >= 18.x
  • Python >= 3.10
  • pip (Python package manager)

1. Clone & Install

git clone https://github.com/your-org/PulseAI.git
cd PulseAI

# Python dependencies
python -m venv .venv
# Windows: .venv\Scripts\activate
# Linux/Mac: source .venv/bin/activate
pip install flask requests uvicorn fastapi python-dotenv langchain langgraph pydantic
pip install opencv-python mediapipe numpy streamlit

# Node dependencies
npm install

2. Configure Environment

Create health-saarth/.env:

GROQ_API_KEY=your_groq_api_key_here
OPENAI_MODEL=gpt-4o-mini

3. Launch All Services

Windows:

.\health-engine\START_ALL.ps1

Linux/Mac:

chmod +x START_ALL.sh
./START_ALL.sh

Or start individually:

# Terminal 1 — Main Backend
cd health-engine && python server.py

# Terminal 2 — Diet CLI Service
cd diet-model/cli && python -m uvicorn app:app --reload --port 8001

# Terminal 3 — Diet Photo Service
cd diet-model/photo && python -m uvicorn model:app --reload --port 8002

# Terminal 4 — Health Saarth Chatbot
cd health-saarth && python -m app.main

# Terminal 5 — FormAI Streamlit (Optional)
cd cv && streamlit run streamlit_app.py

4. Open in Browser

Page URL
Landing Page http://localhost:5000
Login http://localhost:5000/login
Personalization http://localhost:5000/personalization
Dashboard http://localhost:5000/dashboard
FormAI Trainer http://localhost:5000/trainer
Calories/Form Tab http://localhost:5000/health-engine/simple.html
Health Saarth Chat http://127.0.0.1:8010
Service Health Check http://localhost:5000/api/health

Project Structure

PulseAI/
├── health/                  # Frontend — Dashboard, Login, Personalization
│   ├── dashboard.html       # Main health dashboard
│   ├── dashboard.css        # Dashboard styles (1700+ lines)
│   ├── script.js            # Dashboard logic + AI features
│   ├── login.html           # Authentication
│   ├── personalization.html # Onboarding wizard
│   └── data/                # CSV data storage
│
├── health-engine/           # Backend — Flask API + Health Analysis
│   ├── server.py            # Flask API gateway
│   ├── health-engine.js     # 11-module analysis engine
│   ├── app.js               # Frontend app logic
│   └── charts.js            # Data visualizations
│
├── cv/                      # FormAI — Computer Vision Trainer
│   ├── index.html           # Browser trainer (TF.js + MoveNet)
│   └── streamlit_app.py     # Streamlit trainer (MediaPipe)
│
├── diet-model/              # Diet Intelligence Microservices
│   ├── cli/                 # Text-based meal analysis (NLP)
│   │   └── nutrition_engine.py  # 100+ food database + parser
│   └── photo/               # Image-based food detection
│       └── model.py         # Food detection model
│
├── health-saarth/           # AI Health Chatbot
│   ├── app/                 # FastAPI + LangChain + LangGraph
│   │   ├── main.py          # Server entry point
│   │   ├── graph.py         # Conversation graph
│   │   ├── db.py            # SQLite persistence
│   │   └── prompts.py       # LLM prompt engineering
│   └── frontend/            # Chatbot UI
│
├── DOCUMENTATION.md         # Full technical documentation
├── README.md                # This file
└── START_ALL.sh             # Launch script

API Endpoints

Endpoint Method Description
/api/health GET Service health check across all microservices
/api/analyze-food-text POST NLP-based meal text analysis → macro breakdown
/api/analyze-food-photo POST Image-based food detection → nutritional estimate
/api/signup POST Log signup events to CSV
/api/personalization POST Log personalization data to CSV
/api/dashboard POST Log dashboard interactions to CSV
/api/chat POST Send message to Health Saarth chatbot
/api/sessions GET/POST List or create chatbot sessions

AI/ML Models

Model Framework Usage
MoveNet Thunder TensorFlow.js Real-time pose estimation (17 keypoints, 30+ FPS)
MediaPipe Pose MediaPipe Python Alternative pose backend (33 keypoints) for Streamlit
NLP Meal Parser Custom Regex Engine Natural language food recognition with quantity extraction
LangGraph Agent LangChain + LangGraph Stateful conversation graph with checkpoint persistence
GPT / Groq LLM OpenAI / Groq API Health advice generation with domain-specific prompting
EMA Smoother Custom Algorithm Exponential Moving Average filter for angle stabilization (α=0.3)
Predictive Forecaster Custom Algorithm Momentum-based adherence projection with weekend penalty modeling

FormAI Accuracy Engine

The computer vision trainer implements 5 layers of false-positive prevention:

Layer Mechanism Effect
1. Confidence Gating Keypoint score >= 0.4 required Rejects low-quality detections
2. EMA Smoothing α=0.3 exponential filter Eliminates frame-to-frame jitter
3. Stage Hold 5 consecutive frames required Blocks noise-triggered transitions
4. ROM Validation Min 45°–80° arc per exercise Rejects partial/random movements
5. Temporal Cooldown 900ms between reps Prevents double-counting

Dashboard Shortcuts

From the dashboard sidebar:

  • 🍽 → Opens Calories/Diet tracking
  • 🧍 → Opens FormAI Trainer
  • 🛒 → Smart Diet Ordering (Blinkit)
  • 💬 → Opens Health Saarth Chatbot
  • + → AI Smart Logger (NLP input)
  • → AI Engine Settings

Troubleshooting

Issue Solution
Styles look outdated Hard refresh: Ctrl+Shift+R
Camera not working Check browser permissions → Camera → Allow
Diet service offline Start: cd diet-model/cli && python -m uvicorn app:app --port 8001
Chatbot returns error Ensure GROQ_API_KEY is set in health-saarth/.env
Ports busy Kill previous: netstat -ano | findstr :5000 then taskkill /PID <pid> /F

Documentation

For comprehensive technical documentation including architecture diagrams, API reference, database schemas, algorithm details, and deployment guides, see:

DOCUMENTATION.md


License

Proprietary — All rights reserved.


Built with AI/ML at the core.

About

A full-stack AI health platform integrating real-time computer vision for posture tracking, NLP diet parsing, and an LLM-powered coaching agent. Built on a microservices architecture using MoveNet, LangGraph, and a robust Node.js/Flask API gateway to deliver a unified fitness ecosystem.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors