Research/Thesis Project Notice: MultiDx is a research and thesis-driven clinical AI prototype intended for educational and investigational use. It is not a certified medical device and must not be used for real-world diagnosis or treatment decisions. Always consult licensed healthcare professionals.
A comprehensive full-stack web application for predicting multiple medical conditions using machine learning. This system provides early risk assessment for Ovarian Cancer, PCOS (Polycystic Ovary Syndrome), and Hepatitis B, helping healthcare professionals make informed decisions with explainable AI insights.
This application combines a FastAPI backend with a Next.js frontend to deliver an intuitive interface for multiple disease predictions. The system uses trained machine learning models to analyze patient data and provide predictions with confidence scores for three different medical conditions, enhanced with comprehensive explainable AI (XAI) visualizations.
- Multi-Disease Support: Predictions for Ovarian Cancer, PCOS, Hepatitis B, and Brain Tumor
- Brain Tumor Analysis: Image-based analysis of MRI scans using deep learning (PyTorch/PVTv2)
- Ovarian Cancer Analysis: Input 12 critical biomarkers including CA125, HE4, and other clinical indicators
- PCOS Analysis: Input 20 clinical features including hormonal levels, BMI, and follicle measurements
- Hepatitis B Analysis: Input 15 clinical and laboratory features including liver function tests
- Real-time Prediction: Get instant predictions with confidence scores
- Test Case Generation: Built-in test case generators for tabular models
- SHAP (SHapley Additive exPlanations): Feature importance analysis showing how each feature contributes to the prediction
- LIME (Local Interpretable Model-agnostic Explanations): Local explanations for individual predictions
- PDP (Partial Dependence Plots): Visualize the marginal effect of features on predictions
- ICE (Individual Conditional Expectation): Show how predictions change as features vary
- ALE (Accumulated Local Effects): Alternative to PDP for handling correlated features
- Interactive Visualizations: Dynamic charts and graphs for all XAI methods using ECharts
- User-friendly Interface: Clean, responsive design that works on all devices
- Visual Results: Color-coded results with detailed confidence metrics
- Dark Mode Support: Full dark/light theme toggle
- FAQ Section: Comprehensive answers to common questions
- Team Section: Display of research team members
- Modern Navigation: Responsive navbar with dropdown menus
- Model Registry: Centralized model management system supporting multiple ML models
- Data Validation: Pydantic schemas for robust input validation
- API Documentation: Interactive Swagger UI for all endpoints
- Health Checks: Built-in health monitoring endpoints
- CORS Support: Configurable cross-origin resource sharing
- Medical Disclaimer: Built-in disclaimers emphasizing the tool is for research purposes
- FastAPI - Modern, fast web framework for building APIs
- Python 3.10+ - Core programming language
- PyTorch / TIMM - Deep learning for brain tumor image analysis
- scikit-learn - Machine learning models for tabular data
- SHAP / LIME - Explainable AI (XAI) for all models
- Pydantic - Data validation
- Uvicorn - ASGI server
- NumPy/Pandas / PIL - Data and image processing
- Next.js 15 - React framework with App Router
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first CSS framework
- shadcn/ui - High-quality component library
- ECharts - Interactive data visualization
- Lucide Icons - Modern icon library
- React Hook Form - Form state management
.
├── backend/
│ ├── app/
│ │ ├── main.py # FastAPI application entry point
│ │ ├── routes/
│ │ │ └── predict.py # Prediction endpoints for all models
│ │ ├── schemas/
│ │ │ └── input_schema.py # Pydantic models for validation (all models)
│ │ ├── model/
│ │ │ ├── base.py # Base model interface
│ │ │ ├── model.pkl # Trained Ovarian Cancer model
│ │ │ ├── pcos.pkl # Trained PCOS model
│ │ │ ├── Hepatitis_B.pkl # Trained Hepatitis B model
│ │ │ ├── model_PTH.pth # Trained Brain Tumor model (PyTorch)
│ │ │ ├── predictor.py # Model loading and inference
│ │ │ ├── registry.py # Model registry and configuration
│ │ │ ├── loaders/ # Model loaders
│ │ │ │ ├── pytorch_loader.py # PyTorch model loader
│ │ │ │ └── sklearn_loader.py # scikit-learn model loader
│ │ │ └── predictors/ # Model predictors
│ │ │ ├── image_predictor.py # Image-based prediction (Brain Tumor)
│ │ │ └── sklearn_predictor.py # Tabular data prediction
│ │ ├── services/
│ │ │ ├── preprocessing.py # Data preprocessing utilities
│ │ │ ├── image_preprocessing.py # Image preprocessing for Brain Tumor
│ │ │ ├── tta_predictor.py # Test-Time Augmentation predictor
│ │ │ └── xai/ # Explainable AI services
│ │ │ ├── shap_explainer.py # SHAP for tabular data
│ │ │ ├── lime_explainer.py # LIME for tabular data
│ │ │ ├── pdp_explainer.py # PDP for tabular data
│ │ │ ├── ice_explainer.py # ICE for tabular data
│ │ │ ├── ale_explainer.py # ALE for tabular data
│ │ │ ├── image_shap_explainer.py # SHAP for images
│ │ │ ├── image_lime_explainer.py # LIME for images
│ │ │ ├── image_pdp_explainer.py # PDP for images
│ │ │ ├── image_ice_explainer.py # ICE for images
│ │ │ ├── image_ale_explainer.py # ALE for images
│ │ │ └── utils.py # XAI utility functions
│ │ └── utils/
│ │ └── config.py # Configuration constants
│ ├── scripts/ # Utility scripts
│ │ ├── download_model.py # Model download script
│ │ ├── download_model.sh # Model download shell script
│ │ ├── inspect_model.py # Model inspection script
│ │ └── README.md # Scripts documentation
│ ├── docker-compose.yml # Docker Compose configuration
│ ├── Dockerfile # Docker configuration
│ ├── requirements.txt # Python dependencies
│ └── retrain_model.py # Model retraining script
│
├── frontend/
│ ├── src/
│ │ ├── app/
│ │ │ ├── (home)/ # Home route group
│ │ │ │ ├── layout.tsx
│ │ │ │ └── page.tsx
│ │ │ ├── api/ # API routes
│ │ │ │ ├── predict/ # Prediction API routes
│ │ │ │ │ ├── route.ts # Main prediction route
│ │ │ │ │ ├── brain-tumor/ # Brain tumor prediction route
│ │ │ │ │ ├── hepatitis_b/ # Hepatitis B prediction route
│ │ │ │ │ └── pcos/ # PCOS prediction route
│ │ │ │ └── uploadthing/ # UploadThing file upload routes
│ │ │ │ ├── core.ts
│ │ │ │ └── route.ts
│ │ │ ├── brain-tumor/ # Brain Tumor prediction page
│ │ │ │ ├── layout.tsx
│ │ │ │ └── page.tsx
│ │ │ ├── hepatitis/ # Hepatitis B prediction page
│ │ │ │ ├── layout.tsx
│ │ │ │ └── page.tsx
│ │ │ ├── ovarian/ # Ovarian Cancer prediction page
│ │ │ │ ├── layout.tsx
│ │ │ │ └── page.tsx
│ │ │ ├── pcos/ # PCOS prediction page
│ │ │ │ ├── layout.tsx
│ │ │ │ └── page.tsx
│ │ │ ├── features-section-01/ # Features section page
│ │ │ ├── hero-section-01/ # Hero section page
│ │ │ ├── layout.tsx # Root layout
│ │ │ ├── manifest.ts # PWA manifest
│ │ │ ├── providers.tsx # React providers (theme, etc.)
│ │ │ └── favicon.ico
│ │ ├── components/
│ │ │ ├── brain-tumor-components/ # Brain Tumor specific components
│ │ │ │ ├── brain-prediction-result.tsx
│ │ │ │ ├── prediction-form.tsx
│ │ │ │ ├── index.css
│ │ │ │ └── index.ts
│ │ │ ├── hepatitis-components/ # Hepatitis B specific components
│ │ │ │ ├── prediction-form.tsx
│ │ │ │ ├── index.css
│ │ │ │ └── index.ts
│ │ │ ├── pcos-components/ # PCOS specific components
│ │ │ │ ├── prediction-form.tsx
│ │ │ │ ├── index.css
│ │ │ │ └── index.ts
│ │ │ ├── prediction-components/ # Shared prediction UI components
│ │ │ │ ├── prediction-form.tsx
│ │ │ │ ├── prediction-result.tsx
│ │ │ │ ├── prediction-loading.tsx
│ │ │ │ └── index.ts
│ │ │ ├── xai/ # XAI visualization components
│ │ │ │ ├── shap-visualization.tsx
│ │ │ │ ├── lime-visualization.tsx
│ │ │ │ ├── pdp-visualization.tsx
│ │ │ │ ├── ice-visualization.tsx
│ │ │ │ ├── ale-visualization.tsx
│ │ │ │ ├── image-shap-visualization.tsx
│ │ │ │ ├── image-lime-visualization.tsx
│ │ │ │ ├── image-pdp-visualization.tsx
│ │ │ │ ├── image-ice-visualization.tsx
│ │ │ │ ├── image-ale-visualization.tsx
│ │ │ │ ├── xai-container.tsx
│ │ │ │ ├── xai-loading.tsx
│ │ │ │ └── index.ts
│ │ │ ├── layout/ # Layout components
│ │ │ │ ├── navbar.tsx # Navigation bar
│ │ │ │ ├── app-sidebar.tsx # Application sidebar
│ │ │ │ ├── dynamic-breadcrumb.tsx
│ │ │ │ ├── mode-toggle.tsx # Dark/light mode toggle
│ │ │ │ ├── page-header.tsx
│ │ │ │ └── sections/ # Section components
│ │ │ │ ├── benefits.tsx
│ │ │ │ ├── community.tsx
│ │ │ │ ├── contact.tsx
│ │ │ │ ├── faq.tsx
│ │ │ │ ├── footer.tsx
│ │ │ │ ├── model.tsx
│ │ │ │ ├── pricing.tsx
│ │ │ │ ├── services.tsx
│ │ │ │ ├── team.tsx
│ │ │ │ ├── testimonial.tsx
│ │ │ │ └── trusted.tsx
│ │ │ ├── ui/ # shadcn/ui components (29 components)
│ │ │ │ ├── accordion.tsx
│ │ │ │ ├── avatar.tsx
│ │ │ │ ├── badge.tsx
│ │ │ │ ├── breadcrumb.tsx
│ │ │ │ ├── button.tsx
│ │ │ │ ├── calendar.tsx
│ │ │ │ ├── card.tsx
│ │ │ │ ├── carousel.tsx
│ │ │ │ ├── collapsible.tsx
│ │ │ │ ├── dropdown-menu.tsx
│ │ │ │ ├── form.tsx
│ │ │ │ ├── icon.tsx
│ │ │ │ ├── infinite-slider.tsx
│ │ │ │ ├── input.tsx
│ │ │ │ ├── label.tsx
│ │ │ │ ├── marquee.tsx
│ │ │ │ ├── navigation-menu.tsx
│ │ │ │ ├── popover.tsx
│ │ │ │ ├── progressive-blur.tsx
│ │ │ │ ├── radio-group.tsx
│ │ │ │ ├── scroll-area.tsx
│ │ │ │ ├── select.tsx
│ │ │ │ ├── separator.tsx
│ │ │ │ ├── sheet.tsx
│ │ │ │ ├── sidebar.tsx
│ │ │ │ ├── skeleton.tsx
│ │ │ │ ├── tabs.tsx
│ │ │ │ ├── textarea.tsx
│ │ │ │ └── tooltip.tsx
│ │ │ ├── icons/ # Custom icon components
│ │ │ │ ├── discord-icon.tsx
│ │ │ │ ├── github-icon.tsx
│ │ │ │ ├── linkedin-icon.tsx
│ │ │ │ └── x-icon.tsx
│ │ │ ├── shadcn-studio/ # shadcn studio components
│ │ │ │ ├── blocks/
│ │ │ │ └── logo.tsx
│ │ │ ├── features.tsx
│ │ │ ├── hero.tsx
│ │ │ ├── model-features.tsx
│ │ │ └── team.tsx
│ │ ├── lib/ # Utility libraries
│ │ │ ├── test-case-generator.ts # Ovarian test case generator
│ │ │ ├── pcos-test-case-generator.ts # PCOS test case generator
│ │ │ ├── hepatitis-test-case-generator.ts # Hepatitis test case generator
│ │ │ ├── echarts-theme.ts # ECharts theme configuration
│ │ │ ├── uploadthing.ts # UploadThing configuration
│ │ │ └── utils.ts # General utilities
│ │ ├── config/
│ │ │ └── site.ts # Site configuration
│ │ ├── styles/ # Global styles
│ │ │ ├── globals.css
│ │ │ └── custom.css
│ │ └── types/
│ │ └── xai.ts # XAI type definitions
│ ├── public/ # Static assets
│ │ ├── hero.webp
│ │ ├── logo.png
│ │ ├── model-brain.webp
│ │ ├── model-hepa.webp
│ │ ├── model-ova.webp
│ │ ├── model-pcos.webp
│ │ ├── opengraph.webp
│ │ └── team/ # Team member images
│ │ ├── aditto.webp
│ │ ├── asif.webp
│ │ ├── jilani.webp
│ │ ├── joy.webp
│ │ └── shibly.webp
│ ├── biome.json # Biome linter configuration
│ ├── components.json # shadcn/ui components configuration
│ ├── drizzle.config.ts # Drizzle ORM configuration
│ ├── Dockerfile # Frontend Docker configuration
│ ├── LICENSE.md # License file
│ ├── next.config.ts # Next.js configuration
│ ├── next-env.d.ts # Next.js type definitions
│ ├── package.json # Node.js dependencies
│ ├── postcss.config.mjs # PostCSS configuration
│ ├── tsconfig.json # TypeScript configuration
│ └── turbo.json # Turborepo configuration
│
├── docs/
│ ├── DOKPLOY_SETUP.md # Dokploy deployment guide
│ └── HostGuide.md # Comprehensive hosting guide
│
├── nixpacks.toml # Nixpacks configuration
└── README.md # This file
Before you begin, ensure you have the following installed:
- Python 3.10+ (for backend)
- Node.js 18+ (for frontend)
- pnpm or npm (package manager)
Note: For local development use
scikit-learn>=1.6.0. For server deployment usescikit-learn==1.5.1.
- Navigate to the backend directory:
cd backend- Create a virtual environment (recommended):
python -m venv venv-
Activate the virtual environment:
- Windows:
venv\Scripts\activate
- macOS/Linux:
source venv/bin/activate
- Windows:
-
Install dependencies:
pip install -r requirements.txt- Navigate to the frontend directory:
cd frontend- Install dependencies:
pnpm install
# or
npm installFrom the backend directory:
uvicorn app.main:app --reload --port 8000The API will be available at http://localhost:8000
From the frontend directory:
pnpm dev
# or
npm run devThe application will be available at http://localhost:3000
- Frontend: http://localhost:3000
- Ovarian Cancer Prediction: http://localhost:3000/ovarian
- PCOS Prediction: http://localhost:3000/pcos
- Hepatitis B Prediction: http://localhost:3000/hepatitis
- API Documentation: http://localhost:8000/docs (FastAPI Swagger UI)
Submit biomarker data for ovarian cancer prediction. This is an alias for /predict/ovarian.
Request Body:
{
"age": 45.0,
"alb": 4.2,
"alp": 85.0,
"bun": 15.0,
"ca125": 35.0,
"eo_abs": 0.2,
"ggt": 25.0,
"he4": 50.0,
"mch": 28.0,
"mono_abs": 0.5,
"na": 140.0,
"pdw": 12.0
}Response:
{
"prediction": 1,
"confidence": 0.85,
"xai": {
"shap": {...},
"lime": {...},
"pdp_1d": {...},
"ice_1d": {...},
"ale_1d": {...}
}
}prediction: 0 = No Ovarian Cancer, 1 = Possible Ovarian Cancerconfidence: Confidence score between 0 and 1xai: Explainable AI explanations (optional, can be disabled)
Same as /predict - ovarian cancer prediction endpoint.
Submit clinical data for PCOS prediction.
Request Body: (20 features)
{
"Marraige Status (Yrs)": 5.0,
"Cycle(R/I)": 1.0,
"Pulse rate(bpm)": 72.0,
"FSH(mIU/mL)": 6.5,
"Age (yrs)": 28.0,
"Follicle No. (L)": 12.0,
"BMI": 25.5,
"Skin darkening (Y/N)": 1.0,
"II beta-HCG(mIU/mL)": 2.5,
"BP _Diastolic (mmHg)": 80.0,
"hair growth(Y/N)": 1.0,
"Avg. F size (L) (mm)": 8.5,
"Avg. F size (R) (mm)": 8.2,
"Waist:Hip Ratio": 0.85,
"Weight (Kg)": 65.0,
"Weight gain(Y/N)": 1.0,
"LH(mIU/mL)": 12.5,
"Follicle No. (R)": 10.0,
"Hip(inch)": 38.0,
"Waist(inch)": 32.0
}Response:
{
"prediction": 1,
"confidence": 0.78,
"xai": {...}
}Submit clinical and laboratory data for Hepatitis B prediction.
Request Body: (15 features)
{
"Age": 45.0,
"Sex": 1.0,
"Fatigue": 1.0,
"Malaise": 0.0,
"Liver_big": 1.0,
"Spleen_palpable": 0.0,
"Spiders": 0.0,
"Ascites": 0.0,
"Varices": 0.0,
"Bilirubin": 1.2,
"Alk_phosphate": 85.0,
"Sgot": 45.0,
"Albumin": 4.0,
"Protime": 12.0,
"Histology": 1.0
}Submit an MRI image for brain tumor classification and XAI analysis.
Form Data:
file: MRI image file (JPEG/PNG)include_xai: (optional, default: true)
Response:
{
"prediction": "Glioma",
"confidence": 0.94,
"xai": {
"shap": {"heatmap_image": "base64...", ...},
"lime": {"visualization_image": "base64...", ...},
"pdp_1d": {...},
"ice_1d": {...},
"ale_1d": {...}
}
}prediction: Tumor class (Glioma, Meningioma, No Tumor, Pituitary)confidence: Confidence scorexai: Comprehensive image-based XAI visualizations
Query Parameters:
include_xai(optional, default:true): Set tofalseto disable XAI explanations for faster responses
Health check endpoint to verify the API is running and models are loaded.
Response:
{
"status": "ok"
}Get information about a specific model or all models.
Query Parameters:
model(optional): Model key (ovarian,pcos, orhepatitis_b). If omitted, returns info for ovarian model.
Response:
{
"model_key": "ovarian",
"model_path": "/path/to/model.pkl",
"feature_count": 12,
"loaded": true
}Generate a negative (healthy/normal) test case for ovarian cancer model. Useful for testing and form auto-fill.
Response:
{
"age": 35.0,
"alb": 4.5,
...
}Generate a positive (disease-indicating) test case for ovarian cancer model. Useful for testing and form auto-fill.
Response:
{
"age": 55.0,
"ca125": 150.0,
...
}- Navigate to the Ovarian Cancer Prediction page (
/ovarian) - Fill in all 12 biomarker fields:
- Age: Patient age
- ALB: Albumin level
- ALP: Alkaline phosphatase
- BUN: Blood urea nitrogen
- CA125: Cancer antigen 125
- EO#: Absolute eosinophil count
- GGT: Gamma-glutamyl transferase
- HE4: Human epididymis protein 4
- MCH: Mean corpuscular hemoglobin
- MONO#: Absolute monocyte count
- Na: Sodium level
- PDW: Platelet distribution width
- Optionally use Fill Test Case buttons to auto-populate with positive or negative test cases
- Click Submit to get the prediction
- Review the results, which include:
- Prediction status (Possible Ovarian Cancer / No Ovarian Cancer)
- Confidence level with visual indicator
- Risk assessment badge
- XAI Visualizations: Interactive charts showing SHAP, LIME, PDP, ICE, and ALE explanations
- Navigate to the PCOS Prediction page (
/pcos) - Fill in all 20 clinical features including:
- Demographics: Age, Marriage Status, BMI, Weight
- Hormonal levels: FSH, LH, II beta-HCG
- Physical measurements: Waist, Hip, Waist:Hip Ratio
- Clinical indicators: Cycle regularity, Pulse rate, Blood pressure
- Symptoms: Skin darkening, Hair growth, Weight gain
- Ultrasound data: Follicle counts and sizes (left and right)
- Optionally use Fill Test Case buttons to auto-populate with positive or negative test cases
- Click Submit to get the prediction
- Review the results with confidence scores and XAI visualizations
- Navigate to the Hepatitis B Prediction page (
/hepatitis) - Fill in all 15 clinical and laboratory features including:
- Demographics: Age, Sex
- Symptoms: Fatigue, Malaise
- Physical examination: Liver size, Spleen palpability, Spiders, Ascites, Varices
- Laboratory tests: Bilirubin, Alkaline phosphatase, SGOT, Albumin, Prothrombin time
- Histology: Histology indicator
- Optionally use Fill Test Case buttons to auto-populate with positive or negative test cases
- Click Submit to get the prediction
- Review the results with confidence scores and XAI visualizations
The backend uses FastAPI with automatic API documentation. After starting the server, visit http://localhost:8000/docs to explore the interactive API documentation.
The frontend uses Next.js with TypeScript. The prediction components are modularized:
- Shared components:
src/components/prediction-components/- Reusable prediction UI components - PCOS components:
src/components/pcos-components/- PCOS-specific form and UI - Hepatitis components:
src/components/hepatitis-components/- Hepatitis-specific form and UI - XAI components:
src/components/xai/- Explainable AI visualization components
Each prediction type has its own page route and dedicated components for optimal user experience.
To retrain models with new data:
cd backend
python retrain_model.pyThis will generate new model files (model.pkl, pcos.pkl, Hepatitis_B.pkl) in backend/app/model/ based on the retraining script configuration.
The application uses a centralized model registry system (backend/app/model/registry.py) that manages:
- Model file paths
- Feature order for each model
- Model configuration
To add a new model, update the MODEL_REGISTRY dictionary in registry.py and create the corresponding request schema in schemas/input_schema.py.
This project consists of two main components:
- Frontend: Next.js 15 application (deploy to Vercel, Netlify, or Railway)
- Backend: FastAPI application (deploy to Dokploy, Railway, Render, Fly.io, or DigitalOcean)
- Go to vercel.com and sign in
- Click "Add New Project" and import your Git repository
- Configure:
- Root Directory:
frontend - Framework Preset: Next.js (auto-detected)
- Build Command:
pnpm build(ornpm run build)
- Root Directory:
- Add environment variables:
NEXT_PUBLIC_API_URL=https://your-backend-url.com BACKEND_URL=https://your-backend-url.com
- Click "Deploy"
- Go to netlify.com and sign in
- Click "Add new site" → "Import an existing project"
- Configure:
- Base directory:
frontend - Build command:
pnpm build(ornpm run build) - Publish directory:
frontend/.next
- Base directory:
- Add environment variables (same as Vercel)
You MUST select "Dockerfile" as the build method in Dokploy dashboard to use Docker instead of Nixpacks.
Steps:
- Create New Application in Dokploy
- Connect your Git repository
- Set Root Directory:
backend(IMPORTANT: Must be exactlybackend, notbackend/backend) - Select Build Method: Choose "Dockerfile" (NOT "Nixpacks" or "Auto-detect")
- Build Command: Leave empty (Dockerfile handles the build)
- Start Command: Leave empty (Dockerfile CMD handles startup)
- Dockerfile Path: Should auto-detect as
Dockerfile(since Root Directory isbackend)
Environment Variables:
PORT=8000
PYTHON_VERSION=3.10Why Dockerfile is Required:
- Nixpacks has issues with Python virtual environments and start commands
- Dockerfile provides consistent, reliable builds
- Better control over the build process and dependencies
- Supports volume mounting for the model file
- Go to railway.app and sign in
- Click "New Project" → "Deploy from GitHub repo"
- Set Root Directory to
backend - Configure Start Command:
uvicorn app.main:app --host 0.0.0.0 --port $PORT - Add environment variables:
PORT=8000 PYTHON_VERSION=3.11
- Go to render.com and sign in
- Click "New +" → "Web Service"
- Configure:
- Root Directory:
backend - Build Command:
pip install -r requirements.txt - Start Command:
uvicorn app.main:app --host 0.0.0.0 --port $PORT
- Root Directory:
- Add environment variables (same as Railway)
- Install Fly CLI and login:
fly auth login cd backend fly launch - Configure
fly.toml(see HostGuide.md for details) - Deploy:
fly deploy
Since model files (130+ MB) exceed GitHub's 100 MB file limit, they're excluded from the repository. You need to deploy model files separately:
Option 1: Manual Upload (Recommended for Quick Setup)
- After deployment, upload model files via platform's file system access
- Upload to
backend/app/model/directory:model.pkl(Ovarian Cancer)pcos.pkl(PCOS)Hepatitis_B.pkl(Hepatitis B)
Option 2: Cloud Storage Download
- Store models in AWS S3, Google Cloud Storage, etc.
- Download during build process using environment variable
MODEL_URL - See HostGuide.md for detailed implementation
Option 3: Git LFS
- Use Git Large File Storage to track model files
- Install Git LFS and track
app/model/*.pklfiles
See HostGuide.md for comprehensive deployment options and detailed instructions.
Create frontend/.env.production:
# Backend API URL
NEXT_PUBLIC_API_URL=https://your-backend-api.com
BACKEND_URL=https://your-backend-api.com
# App URL (for auth callbacks, etc.)
NEXT_PUBLIC_APP_URL=https://your-frontend-domain.comCreate backend/.env or set in platform dashboard:
# Server Configuration
PORT=8000
HOST=0.0.0.0
# CORS Origins (comma-separated)
ALLOWED_ORIGINS=https://your-frontend-domain.com,https://www.your-frontend-domain.com
# XAI Performance Optimization (Critical for Brain Tumor)
XAI_ENABLED=true # Master switch for XAI
XAI_PARALLEL=false # Set false to prevent CPU spikes (sequential)
XAI_ESSENTIAL_ONLY=false # Set true to compute only SHAP/LIME for speed
# Brain Tumor Specific XAI Tuning
SHAP_IMAGE_PATCH_SIZE=48 # Larger = faster computation
SHAP_IMAGE_STRIDE=24 # Larger = fewer grid points
LIME_IMAGE_NUM_SAMPLES=50 # Lower = faster computationUpdate backend/app/utils/config.py to read from environment:
import os
# Read from environment or use default
ALLOWED_ORIGINS = os.getenv(
"ALLOWED_ORIGINS",
"http://localhost:3000"
).split(",")For production, ensure your frontend domain is included in ALLOWED_ORIGINS.
-
Model not found: Ensure model files exist in
backend/app/model/:model.pkl(Ovarian Cancer)pcos.pkl(PCOS)Hepatitis_B.pkl(Hepatitis B)- Model files are NOT in Git repository (exceed 100 MB limit)
- You must deploy the model files separately (see Model File Deployment section)
-
Port already in use: Use
$PORTenvironment variable (platforms set this automatically) -
Model loading errors: Check that model files are compatible with the installed scikit-learn version
- Local:
scikit-learn>=1.6.0 - Server:
scikit-learn==1.5.1
- Local:
-
CORS errors: Update
ALLOWED_ORIGINSinbackend/app/utils/config.pyto include your frontend domain -
XAI computation timeouts: Adjust
XAI_TIMEOUT_SECONDSenvironment variable or disable XAI withinclude_xai=falsequery parameter
- API connection errors: Verify the backend is running and CORS is properly configured
- Build errors: Clear
.nextdirectory and reinstall dependencies - Environment variables not working: Use
NEXT_PUBLIC_prefix for client-side variables
- Dokploy Nixpacks errors: Select "Dockerfile" as build method in Dokploy dashboard
- Root directory issues: Ensure Root Directory is set to
backend(notbackend/backend) - Model file missing: Upload model files after deployment (see Model File Deployment section)
Provides interpretable risk stratification for ovarian cancer using routinely available biomarkers.
Produces a prediction with confidence and explainability views highlighting clinically relevant markers.
Designed to support early risk assessment and reporting via the web interface for research use.
- Features: 12 biomarkers
- Model File:
model.pkl - Endpoint:
/predictor/predict/ovarian - XAI Support: Full support for all XAI methods
Predicts PCOS risk with high diagnostic performance on benchmark data using an ensemble approach.
Uses explainable AI outputs to connect predictions to clinically meaningful indicators (e.g., follicle count, cycle irregularity, weight gain).
Built to assist research-oriented decision support for earlier PCOS screening and evaluation.
- Features: 20 clinical features
- Model File:
pcos.pkl - Endpoint:
/predict/pcos - XAI Support: Full support for all XAI methods
Estimates Hepatitis B mortality risk with strong predictive performance on benchmark clinical datasets.
Addresses class imbalance and provides transparent, explainable results using SHAP/LIME-style insights.
Intended as a research-grade prognostic support tool for timely clinical attention.
- Features: 15 clinical and laboratory features
- Model File:
Hepatitis_B.pkl - Endpoint:
/predict/hepatitis_b - XAI Support: Full support for all XAI methods
- Type: Deep Learning (Image-based)
- Architecture: PVTv2-B1 with custom classifier
- Model File:
model_PTH.pth - Endpoint:
/predict/brain_tumor - XAI Support: Full image-based support (Patch-based PDP/ICE/ALE/SHAP/LIME)
- Environment Variables: Never commit
.envfiles to Git - CORS: Only allow trusted origins in production
- HTTPS: Always use HTTPS in production
- Input Validation: Backend validates inputs via Pydantic schemas
- Data Privacy: Input data is processed securely and not stored permanently
This project is for educational and research purposes.
Contributions are welcome! Please ensure your code follows the existing style and includes appropriate tests. When adding new models:
- Add the model file to
backend/app/model/ - Create a Pydantic schema in
backend/app/schemas/input_schema.py - Register the model in
backend/app/model/registry.py - Create frontend components and pages following the existing pattern
- Add test case generators if applicable
- Update XAI services if needed
- Dokploy Setup Guide: See
DOKPLOY_SETUP.mdfor detailed Dokploy deployment instructions - Hosting Guide: See
HostGuide.mdfor comprehensive deployment options and troubleshooting
Built with ❤️ for healthcare research