Skip to content

rashedulalbab253/Medical-Multi-Disease-Risk-Assessment-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯ Medical Multi-Disease Risk Assessment System

An AI-powered, full-stack healthcare web application that predicts the risk of 8 major diseases using Machine Learning and provides intelligent medical document analysis powered by Large Language Models (LLMs).

Python FastAPI Next.js TypeScript TailwindCSS


✨ Key Features

Feature Description
🩺 Multi-Disease Prediction Risk assessment for Diabetes, Stroke, Parkinson's, Thyroid, Depression, Hepatitis, Heart Disease & Kidney Disease
πŸ“„ AI Medical Report Analysis Upload medical PDFs for automatic extraction of diagnoses, medications & risk factors (Powered by Groq & Llama-3)
πŸ€– Intelligent AI Summaries Natural-language health summaries explaining results to patients (Powered by Google Gemini API)
πŸ” Secure Authentication User registration & login with bcrypt-encrypted passwords
⚑ Modern UI/UX Responsive, interactive interface built with Next.js & Tailwind CSS
πŸš€ High-Performance API FastAPI backend with async request handling and Swagger docs

πŸ” Supported Diseases & ML Models

Disease Model Type
Diabetes Scikit-learn
Stroke Scikit-learn
Parkinson's CatBoost
Thyroid CatBoost
Depression Scikit-learn
Hepatitis Scikit-learn
Heart Disease Scikit-learn
Chronic Kidney Disease Scikit-learn

πŸ› οΈ Tech Stack

Layer Technology
Frontend Next.js, React, TypeScript, Tailwind CSS
Backend FastAPI 0.135.1, Uvicorn 0.41.0, Python 3.12
Database SQLite via SQLAlchemy 2.0.48
ML Models Scikit-learn 1.3.2, CatBoost 1.2.10, LightGBM 4.6.0, XGBoost 3.2.0
AI & Cloud Google Gemini API, Groq API (Llama-3.3-70B)

πŸ“¦ Project Structure

Medical-Disease-Risk-Assessment-System/
β”œβ”€β”€ Backend/
β”‚   β”œβ”€β”€ main.py                # FastAPI entry point & API routes
β”‚   β”œβ”€β”€ database.py            # SQLite database configuration
β”‚   β”œβ”€β”€ models.py              # SQLAlchemy ORM models
β”‚   β”œβ”€β”€ schemas.py             # Pydantic input schemas per disease
β”‚   β”œβ”€β”€ predictor.py           # Disease prediction logic
β”‚   β”œβ”€β”€ predict_utils.py       # Model loading utilities
β”‚   β”œβ”€β”€ utils.py               # Password hashing helpers
β”‚   β”œβ”€β”€ auth.py                # Authentication dependency
β”‚   β”œβ”€β”€ models/                # Pre-trained ML model files (.pkl)
β”‚   └── requirements.txt       # Python dependencies
β”œβ”€β”€ Frontend/
β”‚   β”œβ”€β”€ app/                   # Next.js App Router (pages & API routes)
β”‚   β”œβ”€β”€ components/            # Reusable React components
β”‚   β”œβ”€β”€ context/               # Auth context provider
β”‚   └── package.json           # Node.js dependencies
└── README.md

πŸš€ Getting Started

Prerequisites


1️⃣ Clone the Repository

git clone https://github.com/rashedulalbab253/Medical-Multi-Disease-Risk-Assessment-System.git
cd Medical-Multi-Disease-Risk-Assessment-System

2️⃣ Backend Setup

cd Backend

# Create & activate virtual environment
py -3.12 -m venv venv

# Windows (PowerShell):
.\venv\Scripts\Activate.ps1
# Windows (CMD):
.\venv\Scripts\activate.bat
# macOS/Linux:
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

πŸ”‘ Configure Environment Variables

Create a .env file inside Backend/:

DATABASE_URL=sqlite:///./auth_db.db
SECRET_KEY=your_secret_key_here
ACCESS_TOKEN_EXPIRE_MINUTES=60
GEMINI_API_KEY=your_gemini_api_key_here       # https://aistudio.google.com/
GROQ_API_KEY=your_groq_api_key_here           # https://console.groq.com/

▢️ Start the Backend

.\venv\Scripts\python.exe -m uvicorn main:app --reload

Backend running at http://localhost:8000 | Swagger Docs at http://localhost:8000/docs


3️⃣ Frontend Setup

Open a new terminal:

cd Frontend

# Install dependencies
npm install --legacy-peer-deps

# Start the dev server
npm run dev

Create a .env.local file inside Frontend/:

NEXT_PUBLIC_API_URL=http://localhost:8000

Frontend running at http://localhost:3000


βœ… Quick Start Summary

Step Command Location
1 git clone <repo-url> β€”
2 cd Backend && py -3.12 -m venv venv Project root
3 .\venv\Scripts\Activate.ps1 Backend/
4 pip install -r requirements.txt Backend/
5 Create .env with API keys Backend/
6 uvicorn main:app --reload Backend/
7 cd Frontend && npm install --legacy-peer-deps Project root
8 npm run dev Frontend/

🧠 How to Use

  1. Sign Up β€” Create a new account
  2. Log In β€” Authenticate with your email & password
  3. Select a Disease β€” Choose from 8 available risk assessments
  4. Fill the Form β€” Enter health data (age, BMI, blood pressure, etc.)
  5. Get Results β€” Receive instant High Risk / Low Risk prediction with AI-generated insights
  6. PDF Analysis β€” Upload a medical PDF for AI-powered document analysis

βš™οΈ Troubleshooting

Problem Solution
ModuleNotFoundError Activate your venv and run pip install -r requirements.txt
Failed to fetch on frontend Ensure backend is running & NEXT_PUBLIC_API_URL is set
scikit-learn unpickling errors Must use scikit-learn==1.3.2 (model training version)
npm install errors Use npm install --legacy-peer-deps
Database issues SQLite DB is auto-created on first run

🀝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to open a pull request.

πŸ“„ License

This project is intended for educational purposes.


Made with ❀️ by Rashedul Albab

About

An AI-powered Medical Multi-Disease Risk Assessment System built with Next.js and FastAPI. It predicts risks for 8 major diseases using machine learning (XGBoost, LightGBM) and features an LLM-powered engine (Groq/Llama-3) for analyzing medical PDF reports and generating intelligent health summaries.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors