Production-grade Medical AI Assistant with advanced RAG pipeline and dark professional UI.
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
# Uninstall and reinstall with correct architecture
pip3 uninstall -y pydantic pydantic-core
pip3 install --no-cache-dir --force-reinstall pydantic numpypip3 install -r requirements.txtNote: Web search uses the ddgs package (DuckDuckGo Search). It's included in requirements.txt and will be installed automatically. No API key is required!
python3 run.pyServer starts on: http://localhost:5002
- ✅ 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)
- ✅ Modern dark theme
- ✅ Centered empty state with logo
- ✅ Smooth animations
- ✅ Source badges (Database/Web/System)
- ✅ "Powered by Stitch" branding
| 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 |
# 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?"}'- Architecture: See
docs/ADVANCED_ARCHITECTURE.md - SOLID Principles: See
docs/ARCHITECTURE.md - Frontend: See
docs/FRONTEND_GUIDE.md
This project includes:
- ✅ Fine-tuned SLM (
Stitch03/drug_interaction_model) - ✅ RAG pipeline implementation
- ✅ SOLID architecture
- ✅ Professional UI/UX
- ✅ Safety guardrails
- ✅ Comprehensive documentation
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# Kill process on port 5002
lsof -ti:5002 | xargs kill -9- 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