Skip to content

suraj187104/Anemia-Risk-Screening

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Anemia Screening Chatbot

A multi-modal anemia risk screening system combining questionnaire-based assessment with optional eye image analysis using deep learning.

Anemia Screening Python Flask License

πŸ“Έ Application Screenshots

Landing Page

Landing Page Modern, professional landing page with medical disclaimers

Chat Interface

Chat Interface Interactive chatbot with progressive questioning

Results Dashboard

Results Dashboard Comprehensive risk assessment with AI-powered analysis

Screening History

Screening History Track all past screenings with detailed statistics

Note: Screenshots will display once images are added to the screenshots/ folder.


🎯 Live Demo

Run locally to see the application in action:

python app.py
# Open http://localhost:5000

Key Features:

  • πŸ’¬ Interactive chat interface with smooth animations
  • πŸ€– ML-powered image analysis (EfficientNet-B0)
  • πŸ“Š Comprehensive risk dashboard
  • πŸ“ˆ Screening history tracking
  • 🎨 Professional medical-grade UI

⚠️ Medical Disclaimer

This tool is for screening purposes only and does NOT provide medical diagnosis.

  • Not a substitute for professional medical advice
  • Not a replacement for laboratory testing
  • Always consult healthcare providers for proper diagnosis

🎯 Features

  • Interactive Chatbot Interface: Natural conversation flow for symptom assessment
  • Rule-Based Screening: Evidence-based risk scoring from clinical indicators
  • Optional Image Analysis: Deep learning analysis of conjunctival images (EfficientNet-B0)
  • Multi-Modal Fusion: Combines questionnaire + image data for improved accuracy
  • Instant Results Dashboard: Clear risk visualization and recommendations
  • Session History: Track screening results over time

πŸ—οΈ Architecture

Frontend (HTML/CSS/JS)
    ↓
Flask Backend (app.py)
    ↓
β”œβ”€β†’ Rule Engine (rules.py) ──→ Risk Score
β”œβ”€β†’ ML Model (ml_model.py) ──→ Image Analysis
└─→ Database (database.py) ──→ Storage
    ↓
Results Dashboard

πŸ“ Project Structure

anemia_chatbot/
β”‚
β”œβ”€β”€ app.py                 # Flask backend
β”œβ”€β”€ rules.py              # Risk calculation logic
β”œβ”€β”€ ml_model.py           # ML model integration
β”œβ”€β”€ database.py           # SQLite database
β”œβ”€β”€ requirements.txt      # Dependencies
β”‚
β”œβ”€β”€ templates/
β”‚   β”œβ”€β”€ index.html       # Landing page
β”‚   β”œβ”€β”€ chat.html        # Chat interface
β”‚   └── dashboard.html   # Results display
β”‚
β”œβ”€β”€ static/
β”‚   β”œβ”€β”€ style.css        # Styling
β”‚   └── chat.js          # Frontend logic
β”‚
└── uploads/             # User images (created automatically)

πŸš€ Quick Start

1. Install Dependencies

cd anemia_chatbot
pip install -r requirements.txt

2. Run the Application

python app.py

3. Open Browser

Navigate to: http://localhost:5000

πŸ“Š Model Integration

The system uses a trained EfficientNet-B0 model from the parent directory:

../models/image2/efficientnet_b0_cv3_models.pt

Model Performance:

  • Accuracy: 66.0%
  • ROC-AUC: 0.712
  • Trained on 468 pediatric conjunctival images

If the model is not found, the system falls back to rule-based screening only.

πŸ”§ Configuration

Database

  • SQLite database: anemia_screening.db (auto-created)
  • Stores: answers, risk levels, scores, image paths

Image Upload

  • Max file size: 16MB
  • Accepted formats: PNG, JPG, JPEG
  • Storage: uploads/ folder

Risk Scoring

Rule-Based Points:

  • Age < 18: +1
  • Female gender: +1
  • Each symptom (fatigue, dizziness, etc.): +1-2
  • ML prediction high (>0.7): +3
  • ML prediction moderate (0.5-0.7): +2
  • ML prediction low-moderate (0.3-0.5): +1

Risk Levels:

  • Low Risk: 0-3 points
  • Moderate Risk: 4-8 points
  • High Risk: 9+ points

🎨 User Flow

  1. Landing Page β†’ User clicks "Start Screening"
  2. Chat Interface β†’ Bot asks 10 questions (7 required, 3 optional)
  3. Image Upload β†’ Optional eye image upload
  4. Processing β†’ Rule-based + ML analysis
  5. Dashboard β†’ Results, recommendations, risk score

πŸ§ͺ Testing

Test Without ML Model

# System works with rules only if model file is missing
python app.py

Test With ML Model

# Ensure model path is correct in ml_model.py
# Default: ../models/image2/efficientnet_b0_cv3_models.pt
python app.py

πŸ“ˆ API Endpoints

GET  /               Landing page
GET  /chat           Chat interface
POST /api/submit_answer    Save answer
POST /api/upload_image     Upload eye image
POST /api/calculate_risk   Get risk assessment
GET  /dashboard      Results page
GET  /api/history    Get screening history

πŸ”’ Privacy & Security

  • No personal identifiers collected
  • Images stored locally with timestamps
  • Session-based data handling
  • No external API calls
  • SQLite database (local storage)

πŸ› οΈ Development

Add New Questions

Edit rules.py β†’ get_questions() function

Modify Risk Logic

Edit rules.py β†’ calculate_risk() function

Update ML Model

Replace model file and update path in ml_model.py

Customize UI

Edit files in templates/ and static/ folders

πŸ“ Citation

If using this system for research:

Pediatric Anemia Detection using Multi-Modal AI
Authors: [Your Name]
Year: 2025
Institution: [Your Institution]

πŸ› Troubleshooting

"Model not found" warning:

  • Check model path in ml_model.py
  • System works without model (rule-based only)

Images not uploading:

  • Check uploads/ folder permissions
  • Verify file size < 16MB

Database errors:

  • Delete anemia_screening.db to reset
  • Database auto-recreates on restart

πŸ“š Requirements

  • Python 3.8+
  • Flask 3.0+
  • PyTorch 2.1+
  • Pillow (PIL)
  • NumPy

πŸŽ“ Educational Use

This project demonstrates:

  • Full-stack web development
  • ML model deployment
  • Medical AI ethics
  • User experience design
  • Multi-modal data fusion

πŸ“§ Support

For questions or issues, please refer to the code comments or create an issue in the repository.


Remember: This is a screening tool, NOT a diagnostic system. Always consult healthcare professionals for medical advice.

About

Anemia occurs when your blood lacks enough healthy red blood cells or hemoglobin. Common symptoms include: Fatigue and weakness Pale skin Shortness of breath Dizziness Cold hands and feet

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors