Educational tool only. This application does not provide medical diagnoses. Always consult a qualified healthcare professional for medical concerns.
Explainable, multi-disease health risk screening — Diabetes, Heart Disease, Tuberculosis, and Lung Cancer — combining tabular ML (Logistic Regression, Random Forest, XGBoost), computer vision (CNN + Grad-CAM for TB X-ray and Lung Cancer CT), OCR-powered AI Report Analysis, a free-text symptom router, and a full-stack architecture with accounts, history, file uploads, PDF export, and admin analytics.
| Feature | Description |
|---|---|
| 🧠 Multi-model Predictions | Logistic Regression, Random Forest, and XGBoost run simultaneously |
| 📊 SHAP Explainability | Every prediction shows which factors drove the score |
| 🖼️ Image-based Screening | Upload TB X-rays or lung CT scans for CNN + Grad-CAM analysis |
| 🔬 AI Report Analysis | Upload a lab report (PDF/image); OCR extracts markers and gives dietary recommendations |
| 💬 Symptom Checker | Free-text symptom input routes to the most likely condition |
| 📜 History & Export | Full prediction history with CSV, JSON, and PDF export |
| 🔒 Privacy First | httpOnly JWT cookies, per-user data isolation, explicit consent required |
| ⚡ Persistent Sessions | Zustand + localStorage — no re-login on page refresh |
- Frontend: React 18 + Vite, Tailwind CSS, Zustand (persistent auth state)
- Backend: FastAPI (Python) — ML inference, auth, history, uploads, OCR analysis, export, admin
- Database: MongoDB Atlas (M0 free tier)
- Tabular ML: scikit-learn, XGBoost, SHAP
- Vision ML: PyTorch (transfer learning), Grad-CAM
- OCR/NLP: Tesseract, pdfplumber, rule-based health marker engine
- Auth: JWT httpOnly cookies — no external auth service
TraceHealth/
├── frontend/ React SPA (Vite + Tailwind + Zustand)
├── backend/ FastAPI REST API (ML, auth, uploads, OCR, export, admin)
├── training/ Offline ML training pipeline
├── models/ Trained model artifacts (git-ignored, generated locally)
├── docs/ PRD, TRD, Backend and Frontend architecture docs
└── .github/ CI workflows (backend + frontend)
- Node.js 20+ (frontend)
- Python 3.11+ (backend and training)
- A MongoDB Atlas connection string (free M0 tier)
- Tesseract OCR installed locally (
apt install tesseract-ocr/brew install tesseract/ Windows installer) - GPU access recommended (not required) for training vision models — a free Colab notebook works
# 1. Clone the repo
git clone https://github.com/SamarthGarge/TraceHealth.git
cd TraceHealth
# 2. Configure environment variables
cp backend/.env.example backend/.env
# Edit backend/.env — fill in MONGO_URI, JWT_SECRET, ADMIN_EMAIL, ADMIN_PASSWORD
# 3. Train models (one-time — see training/ folder)
# OR copy pre-trained models into the models/ directory
# 4. Start all services
VITE_API_BASE_URL=http://localhost:8000 docker compose up --build
# App will be available at http://localhost (nginx on port 80)cd training
pip install -r requirements.txt
# Tabular models
python train_diabetes.py && python train_heart.py
python train_tb.py && python train_cancer.py
# Vision models (see docs/Datasets.md for image dataset download links)
python train_tb_image.py
python train_cancer_image.py
# Symptom classifier
python train_symptom_classifier.pycd backend
cp .env.example .env # fill in MONGO_URI, JWT_SECRET, ADMIN_EMAIL, ADMIN_PASSWORD
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000cd frontend
cp .env.example .env # set VITE_API_BASE_URL=http://localhost:8000
npm install
npm run devAfter starting the backend with ADMIN_EMAIL and ADMIN_PASSWORD set in .env:
curl -X POST http://localhost:8000/api/auth/admin/setupThen sign in at /admin/login using those credentials.
- Create a new Web Service on Render.
- Connect your GitHub repository.
- Set Root Directory to
backend. - Set Runtime to
Docker. - Add all environment variables from
backend/.env.examplein the Render dashboard. - Deploy. Copy the service URL (e.g.,
https://tracehealth-api.onrender.com).
- Import the repository on Vercel.
- Set Root Directory to
frontend. - Add environment variable:
VITE_API_BASE_URL= your Render backend URL. - Deploy.
| Document | Purpose |
|---|---|
docs/PRD.md |
Product requirements |
docs/TRD.md |
Core technical architecture |
docs/Backend.md |
Backend architecture, API, security |
docs/Frontend.md |
Frontend architecture, flows |
docs/Datasets.md |
Dataset sources and licensing |
SECURITY.md |
Security policy and vulnerability reporting |
This project stores user accounts, health-related prediction history, uploaded documents, and diagnostic images. All security measures — httpOnly JWT cookies, bcrypt password hashing, rate limiting, magic-byte file validation, OWASP-aligned headers, and per-user data isolation — are documented in SECURITY.md and docs/Backend.md §4.
See LICENSE. Third-party datasets retain their own licenses — see docs/Datasets.md.