Enterprise-Grade AI Healthcare Assistant with Retrieval-Augmented Generation
Founded by: Arvind Sisodiya
π Documentation β’ π Quick Start β’ ποΈ Architecture β’ β¨ Features β’ π£οΈ Roadmap
AI Healthcare Platform is a production-ready, enterprise-grade healthcare AI system that combines:
- π€ Intelligent RAG β Retrieval-Augmented Generation with semantic search, hybrid reranking, and clinical citations
- βοΈ Medical Intelligence β Symptom extraction, triage risk scoring, specialist recommendations
- π Enterprise Security β Prompt injection guards, rate limiting, input validation
- π Observability β Structured logging, request tracing, latency tracking
- π Multilingual β Automatic language detection for English, Hindi, Spanish, French
Medical Disclaimer: This system provides educational information only and is not a substitute for professional medical advice, diagnosis, or treatment.
# Clone and install
git clone https://github.com/arvindsis11/Ai-Healthcare-Chatbot.git
cd Ai-Healthcare-Chatbot
# Configure environment
cp .env.example .env
# Edit .env and add your OPENAI_API_KEY (required for LLM responses)
# Start backend
./setup.sh
./run_backend.sh # Terminal 1: http://localhost:8000
# Start frontend (new terminal)
./run_frontend.sh # Terminal 2: http://localhost:3000docker compose up --buildAll services available at:
- π Frontend: http://localhost:3000
- π API: http://localhost:8000
- π API Docs: http://localhost:8000/docs
- π Admin Dashboard: http://localhost:3000/admin
- Symptom Analysis β Automatic symptom extraction with keyword + ML-assisted detection
- Risk Triage β Real-time risk scoring (low π’ | medium π‘ | high π΄)
- Source Citations β Every response includes clinical sources and evidence excerpts
- Conversation History β Anonymous session persistence and easy restoration
- Prompt Injection Guard β Blocks jailbreak and unsafe input patterns
- Rate Limiting β Per-IP request throttling (configurable)
- Input Validation β Pydantic-powered request validation
- Medical Disclaimers β Automatic safety notices on all responses
- Smart Caching β Redis + in-memory TTL cache for frequent queries
- Hybrid Retrieval β Vector similarity + lexical reranking for best results
- Document Chunking β 120-word windows with 50% overlap for precise context
- Session Abstraction β Ready for PostgreSQL with current in-memory fallback
- Structured Logging β JSON logs with request IDs and latency tracking
- Admin Dashboard β Analytics, symptom trends, user activity
- Multilingual Support β Language detection with translation scaffolding
- API-First Design β Clean REST endpoints for health, chat, analysis, sessions
- Docker Ready β Full containerization with nginx reverse proxy
graph TB
User["π€ User"] -->|Chat Input| FE["π Next.js Frontend"]
FE -->|HTTP/REST| API["β‘ FastAPI API"]
API -->|Validate| Guard["π Prompt Guard"]
API -->|Detect| Lang["π Language Detection"]
API -->|Extract| Symp["βοΈ Symptom Extraction"]
API -->|Assess| Triage["π Triage Service"]
API -->|Check| Cache["β‘ Redis Cache"]
API -->|Retrieve| RAG["π RAG Pipeline"]
RAG -->|Search| VDB["π ChromaDB"]
RAG -->|Rerank| Hybrid["π Hybrid Retrieval"]
RAG -->|Generate| LLM["π€ OpenAI LLM"]
API -->|Persist| Session["πΎ Session Store"]
API -->|Response| FE
FE -->|Display| User
Layered Architecture:
- API Layer β Routing, validation, orchestration
- Service Layer β Chat, RAG, medical intelligence, caching
- Repository Layer β Vector DB, session persistence
- AI Layer β Prompt guards, translation, medical analysis
- Middleware β Request IDs, latency tracking, security headers
| Feature | Details |
|---|---|
| RAG Pipeline | Semantic search + lexical reranking + chunk-based citations |
| Triage System | Rule-based risk detection (low/medium/high with severity scores) |
| Specialist Routing | Automatic doctor type recommendations based on symptoms |
| Session Management | Anonymous chat history with optional PostgreSQL backing |
| Caching | Redis-first architecture with intelligent fallback |
| Logging | Structured JSON logs with request IDs and latency metrics |
| Rate Limiting | Per-IP throttling with configurable request windows |
| Multilingual | Language detection + translation scaffolding |
- Safe conversational healthcare guidance
- RAG with clinical citations
- Triage risk assessment
- Enterprise infrastructure
- Multi-tenant API management
- OAuth2/JWT authentication
- Usage analytics & billing
- Doctor network integration
- Appointment scheduling
- Longitudinal patient context
- Knowledge graph retrieval
- Evidence-based care pathways
- Clinician audit trails
| Document | Purpose |
|---|---|
| PROJECT_STATE.md | Readiness assessment, tech debt, component overview |
| ARCHITECTURE.md | Layered design, request flow, observability |
| SETUP.md | Development & Docker deployment guides |
| API.md | REST endpoints with request/response examples |
| RAG_PIPELINE.md | Retrieval strategy, safety measures |
| SECURITY.md | Security controls & recommendations |
| DEPLOYMENT.md | Production deployment & CI/CD |
| PRODUCT_ROADMAP.md | 4-phase product evolution |
| KNOWLEDGE_GRAPH.md | Future knowledge graph design |
| ENTERPRISE_UPGRADE_SUMMARY.md | Complete upgrade details |
| EXECUTION_CHECKLIST.md | All 18 implementation steps |
# Frontend
cd frontend
npm run lint # ESLint checks
npm run build # Production build
npm run test # Jest unit tests
# Backend (requires dependencies)
pip install -r backend/requirements.txt
pytest tests/
# Full stack
docker compose up --build- β Frontend Build: Passing
- β Frontend Lint: Passing
- β Frontend Tests: Passing
- β Backend Compile: Passing
- β Docker Compose: Valid
GET /api/v1/health # Health check with features
POST /api/v1/chat # Main chat endpoint
POST /api/v1/analyze-symptoms # Focused symptom analysis
GET /api/v1/sessions/{id} # Chat history retrieval
curl -X POST http://localhost:8000/api/v1/chat \
-H "Content-Type: application/json" \
-d '{
"message": "I have fever and headache",
"symptoms": ["fever", "headache"]
}'{
"response": "Based on your symptoms...",
"conversation_id": "abc-123",
"symptom_analysis": {
"symptoms": ["fever", "headache"],
"severity_score": 5,
"risk_level": "medium",
"possible_conditions": ["General symptom cluster..."],
"urgency_recommendation": "See doctor within 24-72 hours"
},
"recommended_specialist": "General Physician",
"citations": [
{
"id": "fever.yml#chunk-1",
"source": "fever.yml",
"excerpt": "Fever is a common symptom..."
}
],
"sources": ["fever.yml"]
}π¦ Ai-Healthcare-Chatbot
βββ π§ backend/
β βββ app/
β β βββ api/ # FastAPI routes
β β βββ services/ # Business logic
β β βββ repositories/ # Data access
β β βββ rag/ # RAG pipeline
β β βββ ai/ # Prompt guards, translation
β β βββ middleware/ # Security, tracing
β β βββ models/ # Pydantic schemas
β β βββ core/ # Settings, logging, DI
β βββ Dockerfile
β βββ requirements.txt
βββ π¨ frontend/
β βββ src/
β β βββ app/ # Routes
β β βββ features/
β β β βββ chat/ # Chat workspace
β β β βββ analytics/ # Admin dashboard
β β βββ components/ # Shared UI
β β βββ services/ # API clients
β β βββ styles/ # Tailwind CSS
β βββ Dockerfile
β βββ package.json
βββ π³ docker-compose.yml # Full stack orchestration
βββ π docs/ # Enterprise documentation
βββ β
tests/ # Test suites
βββ π README.md # This file
Readiness Score: 72/100
| Category | Score | Details |
|---|---|---|
| Architecture | 82/100 | Modular layered design β |
| Safety | 74/100 | Prompt guards, disclaimers β |
| Observability | 70/100 | Structured logging & tracing β |
| Scalability | 75/100 | Caching, abstraction layers β |
| Testing | 58/100 | Core tests passing, expandable |
| Operations | 73/100 | Docker & CI/CD ready β |
- β Prompt Injection Protection β Pattern-based guard against adversarial input
- β Rate Limiting β Per-IP request throttling
- β Input Validation β Pydantic schemas on all endpoints
- β Security Headers β X-Frame-Options, X-Content-Type-Options, Referrer-Policy
- β CORS Configuration β Configurable allow-list
- β Medical Disclaimers β Automatic safety notices
- π JWT Authentication β Coming in Phase 2
We welcome contributions! Please read our Contributing Guide and Code of Conduct before getting started.
To contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push branch (
git push origin feature/amazing-feature) - Open Pull Request
Looking for something to work on? Check the open issues or the full list of proposed improvements in GITHUB_ISSUES.md.
This project is licensed under the MIT License β see LICENSE file for details.
Arvind Sisodiya β Healthcare AI Architect & Full-Stack Engineer
Passionate about building enterprise-grade AI systems that make healthcare accessible and safe.
docker compose up --buildQuestions? Check the π documentation or open an issue!
Built with β€οΈ for healthcare professionals and patients worldwide