Skip to content

pavanbadempet/AI-Healthcare-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

268 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

AI Healthcare Logo

AI Healthcare System

Bridging Lab Results to Patient Understanding with AI

Live Demo Python Docker License


🎯 About The Project

AI Healthcare System is a next-gen patient portal built for diagnostic centers. We wanted to solve a simple problem: Lab reports are confusing.

Most patients get a PDF full of numbers they don't understand. Our platform fixes this by combining:

  1. Automated Screening: Immediate risk assessment for Diabetes, Heart Disease, and more.
  2. AI Explanation: A "Medical Assistant" chat that explains the report in plain English (powered by Gemini Pro).

It's a full-stack solutionβ€”diagnostic centers get a dashboard to manage patients, and patients get a secure portal to understand their health.


✨ Features

  • For Patients:

    • πŸ“„ Smart Reports: Upload a PDF and get an instant AI summary.
    • πŸ€– Health Assistant: Chat with an AI that knows your medical history.
    • 🩺 Risk Screening: ML models check your vitals (Diabetes, Kidney, Liver, etc.).
  • For Doctors & Clinics:

    • πŸ₯ Patient Dashboard: View all patient records in one place.
    • πŸ“ˆ Trend Analysis: Visualize patient health metrics over time.
    • πŸ” Secure & compliant: Role-based access and data isolation.

πŸ”¬ Supported Screenings

We use trained ML models (XGBoost/RandomForest) to screen for:

  • Diabetes: (Glucose, BMI, Insulin)
  • Heart Disease: (Cholesterol, BP, ECG)
  • Liver & Kidney Health
  • Lung Cancer Risk

πŸ€– Under the Hood

  • RAG Architecture: We use separate vector stores for each user to prevent data leakage.
  • Vision AI: Gemini Pro Vision reads raw PDF reports so you don't have to type data manually.
  • Security: Full JWT authentication and session management.

πŸš€ Quick Start

Option 1: Docker (Recommended)

Spin up the entire stack with one command:

# Clone the repository
git clone https://github.com/pavanbadempet/AI-Healthcare-System.git
cd AI-Healthcare-System

# Configure environment
cp .env.example .env
# Edit .env and add your GOOGLE_API_KEY

# Launch all services
docker-compose up --build
Service URL
App (Frontend) http://localhost:8501
API Docs http://localhost:8000/docs
MLflow UI http://localhost:5000

Option 2: Local Development

Prerequisites: Python 3.10+, pip

# Install dependencies
# Install dependencies (Full Feature Set)
pip install -r requirements-full.txt

# OR for Lite Version (No PySpark/Heavy ML)
# pip install -r requirements.txt

# Start Backend (Terminal 1)
uvicorn backend.main:app --reload --port 8000

# Start Frontend (Terminal 2)
streamlit run frontend/main.py

Option 3: Quick Scripts (Windows)

# Run everything
.\scripts\runners\run_app.bat

# Run E2E tests
.\scripts\runners\run_e2e_tests.ps1

πŸ› οΈ Technology Stack

Layer Technology Purpose
Frontend Streamlit Responsive UI & Data Visualization
Backend FastAPI, Pydantic REST API & Request Validation
ML/AI XGBoost, Scikit-Learn Disease Classification Models
GenAI Gemini Pro, LangChain Chat Assistant & RAG Pipeline
Vector DB FAISS Semantic Search & Memory
Database SQLite User Data & Chat History
DevOps Docker, GitHub Actions Containerization & CI/CD
Hosting Streamlit Cloud, Render Production Deployment

πŸ§ͺ Testing

# Run all tests with coverage
pytest tests/ --cov=backend --cov-report=term-missing

# Run specific test suites
pytest tests/unit/           # Unit tests
pytest tests/integration/    # Integration tests
pytest tests/e2e/            # End-to-end tests (requires running app)

CI/CD Pipeline

GitHub Actions automatically runs on every push:

  • βœ… Unit & Integration Tests
  • βœ… Code Coverage Reporting
  • βœ… Placeholder Model Generation for CI

πŸ“ Project Structure

β”œβ”€β”€ backend/                # FastAPI backend
β”‚   β”œβ”€β”€ main.py             # API entrypoint
β”‚   β”œβ”€β”€ prediction.py       # ML prediction logic
β”‚   β”œβ”€β”€ agent.py            # AI chat agent
β”‚   β”œβ”€β”€ rag.py              # RAG pipeline
β”‚   β”œβ”€β”€ vision_service.py   # Lab report analyzer
β”‚   └── *.pkl               # Trained ML models
β”œβ”€β”€ frontend/               # Streamlit frontend
β”‚   β”œβ”€β”€ main.py             # App entrypoint
β”‚   β”œβ”€β”€ views/              # Page components
β”‚   └── components/         # Reusable UI components
β”œβ”€β”€ mlops/                  # MLOps pipeline
β”‚   β”œβ”€β”€ data_ingestion.py   # Data loading
β”‚   β”œβ”€β”€ data_processing.py  # Feature engineering
β”‚   └── model_training.py   # Training scripts
β”œβ”€β”€ tests/                  # Test suites
β”‚   β”œβ”€β”€ unit/               # Unit tests
β”‚   β”œβ”€β”€ integration/        # API integration tests
β”‚   └── e2e/                # End-to-end tests
β”œβ”€β”€ scripts/                # Utility scripts
β”œβ”€β”€ docker-compose.yml      # Multi-container setup
└── render.yaml             # Render deployment config

🌐 Deployment

Frontend (Streamlit Cloud)

  1. Fork/Push to GitHub
  2. Connect repository to Streamlit Cloud
  3. Set BACKEND_URL environment variable

Backend (Render)

  1. Connect repository to Render
  2. Uses render.yaml for auto-configuration
  3. Set required environment variables:
    • GOOGLE_API_KEY - Gemini API key
    • SECRET_KEY - JWT signing key

🀝 Contributing

Contributions are welcome! Please check CONTRIBUTING.md for guidelines.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

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


About

AI-powered healthcare platform combining Machine Learning for multi-disease prediction (Diabetes, Heart, Liver, Kidney, Lungs) with Generative AI for intelligent medical assistance and lab report analysis.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors