๐ Awarded "Best Project" - Sem 6 TEIT
Vitality is an intelligent healthcare system that uses machine learning to analyze blood biomarkers and predict potential metabolic health risks. The platform addresses the lack of personalized, clinical-data-driven healthcare by providing actionable diet and lifestyle recommendations.
It combines a React glassmorphism frontend, a Flask/MongoDB backend, an AI-driven OCR microservice, and a Multi-Output Random Forest Classifier to eliminate manual data entry and generate highly specific, downloadable health protocols.
- Secure Access: Powered by Firebase Authentication (Google Sign-In).
- Data Decoupling: Sensitive medical history and physical parameters are securely persisted in a cloud MongoDB Atlas database, completely decoupled from the authentication layer.
Vitality eliminates tedious manual entry using an asynchronous microservice pipeline:
- n8n Workflows: Acts as the webhook receiver and PDF processor.
- Groq LLM API: Performs strict JSON entity extraction to pull exact biomarkers (Fasting Glucose, HbA1c, Vitamin D, etc.) from messy, unstructured lab reports.
- Instant Sync: The React UI instantly auto-fills sliders based on the AI extraction.
- Metabolic Risk Prediction: Powered by a custom Multi-Output Random Forest Classifier (
model.pkl), the backend analyzes blood anomalies to predict specific metabolic risks. - Multi-Tag Classification: Simultaneously generates distinct, medically-aware Diet tags and Exercise tags tailored to the user's age, gender, and deficiencies.
- Downloadable PDF Reports: Compiles the user's clinical data and predicted lifestyle protocols into a clean, exportable PDF document for personal tracking or doctor visits.
- Live Notifications: Uses Python
smtplibfor real-time email alerts. - GDPR-Style Privacy: A strict one-click "Delete Data" protocol that permanently wipes a user's medical history from the database.
| Domain | Tech Used | Deployment |
|---|---|---|
| Frontend | React.js (Vite), Tailwind CSS, Shadcn UI | Vercel (Custom Domain) |
| Backend & ML | Python, Flask, Scikit-learn, Pandas, smtplib | Hugging Face Spaces (16GB RAM) |
| Database | MongoDB Atlas | MongoDB Cloud |
| Authentication | Firebase Authentication (Google Sign-In) | Firebase |
| AI / Microservice | n8n (Automation), Groq API (Llama 3), Caddy | Azure Linux VM (South Korea) |
- Frontend: React UI hosted on Vercel communicates with the Flask backend via REST APIs and handles live state.
- Auth: Firebase handles secure Google authentication and token management.
- AI Microservice: Self-hosted n8n running via Docker on an Azure VM processes uploaded pathology reports into structured JSON parameters using the Groq API.
- ML Backend: The Flask server hosted on Hugging Face Spaces feeds clinical parameters into the Random Forest model to classify personalized diet/exercise tags.
- Database: MongoDB Atlas securely stores user profiles, clinical parameters, and generated health plans in the cloud.
| Dashboard | AI-OCR Input Wizard |
|---|---|
![]() |
![]() |
| Health Analysis Results | Generated Diet & Workout PDF |
|---|---|
![]() |
![]() |
| History Log | Settings & Privacy |
|---|---|
![]() |
![]() |
| n8n AI Extraction Workflow | Firebase Auth Integration |
|---|---|
![]() |
![]() |
Vitality/
โโโ backend/ # Flask Backend & Machine Learning Services
โ โโโ static/ # Backend static storage (e.g., uploaded user avatars)
โ โโโ app.py # Main Flask server, API endpoints, and email services
โ โโโ classes.txt # ML model labels and classification mapping
โ โโโ model.pkl # Large ML predictive model (ignored from Git)
โ โโโ requirements.txt # Python dependencies (Flask, Pandas, etc.)
โ โโโ test_email.py # Sandbox script for testing SMTP notifications
โ โโโ vitality.db # SQLite user database (ignored from Git)
โ โโโ .env # Backend environment variables / API Keys (ignored)
โ
โโโ frontend/ # React Frontend Application (Vite)
โ โโโ public/ # Public static assets
โ โโโ src/ # Frontend source code
โ โ โโโ assets/ # Image illustrations and SVGs
โ โ โโโ components/ # Reusable UI elements (InputWizard, Sidebar, etc.)
โ โ โโโ components/ui/ # Shadcn/Radix UI base components
โ โ โโโ contexts/ # Global React state (AuthContext, HealthDataContext)
โ โ โโโ hooks/ # Custom React hooks (e.g., use-toast, use-mobile)
โ โ โโโ lib/ # Utility functions
โ โ โโโ pages/ # Full application views (Dashboard, Profile, etc.)
โ โ โโโ App.jsx # Main application routing
โ โ โโโ firebase.js # Firebase Auth client configuration
โ โ โโโ i18n.js # Multi-language internationalization setup
โ โ โโโ index.css # Global styles, Tailwind config, and themes
โ โ โโโ main.jsx # React DOM entry point
โ โ
โ โโโ .env # Frontend environment variables (ignored)
โ โโโ eslint.config.js # Linting configuration
โ โโโ index.html # Main HTML template
โ โโโ package.json # Node.js dependencies and run scripts
โ โโโ vite.config.js # Vite build and server configuration
โ
โโโ .gitignore # Centralized Git ignore rules for the platform
โโโ LICENSE # Open-source license file
โโโ README.md # Project documentation and setup guide
- Node.js (v18 or higher)
- Python (3.9 or higher)
- n8n installed globally (
npm install -g n8n) - Firebase Project (for Auth credentials)
- Groq API Key (for LLM extraction)
-
Clone the Repository
git clone https://github.com/thisisAtharv/Vitality.git cd Vitality -
Frontend Setup
cd frontend npm install -
Backend Setup Note: The
model.pklRandom Forest model must be generated locally or acquired, as it is ignored via Git.cd ../backend pip install -r requirements.txt -
Environment Setup This project uses separate credentials for the frontend and backend.
Frontend Environment Variables (
frontend/.env)VITE_FIREBASE_API_KEY=your_api_key VITE_FIREBASE_AUTH_DOMAIN=your_project_id.firebaseapp.com VITE_FIREBASE_PROJECT_ID=your_project_id VITE_FIREBASE_STORAGE_BUCKET=your_project_id.appspot.com VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id VITE_FIREBASE_APP_ID=your_app_id
Backend Environment Variables (
backend/.env)MAIL_APP_PASSWORD=your_gmail_app_password SECRET_KEY=your_flask_secret_key GROQ_API_KEY=your_groq_api_key
-
Run the Application (Requires 3 Terminals)
Terminal 1: Frontend
cd frontend npm run devTerminal 2: Backend
cd backend python app.pyTerminal 3: AI Microservice (n8n)
npx n8n
Open
http://localhost:5678, import your workflow, add your Groq API key to the HTTP node, and set the workflow to Active.
- Training and deploying a Multi-Output Random Forest Classifier for multi-tag prediction.
- Architecting a decoupled microservice backend with Flask and n8n.
- Integrating Large Language Models (Groq/Llama 3) for structured JSON data extraction.
- Building complex, responsive React Glassmorphism UIs using Shadcn.
- Cloud Database Migration: Successfully migrated from local SQLite to a distributed MongoDB Atlas cluster.
- Production ML Engine: Deployed the heavy Random Forest classifier to a dedicated Hugging Face Space (16GB RAM tier).
- Self-Hosted AI Microservice: Containerized n8n with Docker and deployed it on an Azure Linux VM to bypass API geo-blocks.
- Automated SSL/HTTPS: Implemented Caddy Reverse Proxy for secure, auto-renewing certificates.
- ๐ฆ Cloud Storage: Migrate local avatar/image uploads to Firebase Storage or AWS S3.
- ๐ Advanced Analytics: Add longitudinal charting to track biomarkers over time.
This project is licensed under the MIT License.







