Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏥 Medical RAG Assistant - Complete Project

Production-grade Medical AI Assistant with advanced RAG pipeline and dark professional UI.


📁 Project Structure

Deep-Learning-Project/
│
├── 🚀 PRODUCTION BACKEND (New)
│   ├── app/                      # Flask application
│   │   ├── __init__.py           # Application factory
│   │   ├── routes.py             # API endpoints
│   │   ├── models/               # Pydantic models
│   │   └── services/             # Business logic
│   │       ├── rag_engine.py     # 7-Step RAG Pipeline
│   │       ├── safety.py         # Safety guardrails
│   │       └── session_manager.py # Session management
│   ├── run.py                    # Production entry point
│   └── requirements.txt          # Dependencies
│
├── 🎨 FRONTEND
│   ├── templates/
│   │   └── index.html            # Dark professional UI
│   └── static/
│       ├── style.css             # Styling
│       └── script.js             # Frontend logic
│
├── 📊 DATA & MODELS
│   ├── data/
│   │   └── drug_interactions_first_5000.csv
│   └── notebooks/
│       └── FineTuned_model.ipynb
│
├── 📚 DOCUMENTATION
│   └── docs/
│       ├── ADVANCED_ARCHITECTURE.md  # Technical details
│       ├── ARCHITECTURE.md           # SOLID principles
│       ├── FRONTEND_GUIDE.md         # UI guide
│       └── PROJECT_SUMMARY.md        # Overview
│
└── 📦 ARCHIVE
    ├── archive/
    │   └── old_backend/          # Previous implementation
    └── Medical-RAG-Assistant.pdf

🚀 Quick Start

1. Fix Pydantic (Apple Silicon Mac)

# Uninstall and reinstall with correct architecture
pip3 uninstall -y pydantic pydantic-core
pip3 install --no-cache-dir --force-reinstall pydantic numpy

2. Install Dependencies

pip3 install -r requirements.txt

Note: Web search uses the ddgs package (DuckDuckGo Search). It's included in requirements.txt and will be installed automatically. No API key is required!

3. Run Server

python3 run.py

Server starts on: http://localhost:5002


Features

Backend (Production-Grade)

  • 7-Step RAG Pipeline with real algorithms
  • Cosine Similarity search (NumPy)
  • Evidence Gap Detection (confidence scoring)
  • Web Search Integration (DuckDuckGo with fallback)
  • Safety Guardrails (decorator pattern)
  • Session Management (multi-turn conversations)
  • Pydantic Validation (type-safe API)

Frontend (Dark Professional)

  • ✅ Modern dark theme
  • ✅ Centered empty state with logo
  • ✅ Smooth animations
  • ✅ Source badges (Database/Web/System)
  • ✅ "Powered by Stitch" branding

📡 API Endpoints

Method Endpoint Description
GET / Frontend UI
GET /health Health check
POST /session/create Create session
POST /chat Send query (main)
GET /session/history Get history
POST /session/reset Clear history
DELETE /session/delete Delete session
GET /stats System stats

🧪 Testing

# Test health endpoint
curl http://localhost:5002/health

# Create session
curl -X POST http://localhost:5002/session/create

# Send query
curl -X POST http://localhost:5002/chat \
  -H "Content-Type: application/json" \
  -d '{"query": "What is aspirin?"}'

📚 Documentation

  • Architecture: See docs/ADVANCED_ARCHITECTURE.md
  • SOLID Principles: See docs/ARCHITECTURE.md
  • Frontend: See docs/FRONTEND_GUIDE.md

🎓 University Project

This project includes:

  • ✅ Fine-tuned SLM (Stitch03/drug_interaction_model)
  • ✅ RAG pipeline implementation
  • ✅ SOLID architecture
  • ✅ Professional UI/UX
  • ✅ Safety guardrails
  • ✅ Comprehensive documentation

🔧 Troubleshooting

Pydantic Architecture Error

If you see: mach-o file, but is an incompatible architecture

Solution:

pip3 uninstall -y pydantic pydantic-core
pip3 install --no-cache-dir --force-reinstall pydantic

Port Already in Use

# Kill process on port 5002
lsof -ti:5002 | xargs kill -9

🚀 Technology Stack

  • Backend: Flask, NumPy, Pydantic
  • Frontend: Vanilla JS, Tailwind CSS (CDN)
  • Architecture: Factory Pattern, Blueprints, Decorators
  • AI/ML: RAG Pipeline, Cosine Similarity, Safety Guardrails

Built with ⚡ by Stitch

Status: ✅ Production Ready

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages