How varshith999/hms works
Clinical Graph RAG is a FastAPI healthcare discovery and receptionist service. The main workflow accepts a patient message, extracts basic demographics, embeds the full message, searches Neo4j for disease-linked clinical cases and doctors, then uses an LLM to compose a patient-facing explanation and disclaimer. Separate API routes validate and ingest batches, seed from bundled synthetic records, or reset and reseed the graph. The graph follows documented capabilities and sampled call ownership; request-time symptom extraction currently returns an empty list.
Main entry points: main.py FastAPI Gateway · recommendation.py RAG Orchestrator · database.py Neo4j Graph Service · ingestion.py Ingestion Engine
Components 15
API
- FastAPI Gateway
backend/app/main.py - Request And Response Models
backend/app/models.py - Health Check
backend/app/main.py
Recommendation
- RAG Orchestrator
backend/app/recommendation.py - Entity Extraction
backend/app/recommendation.py - Doctor Scoring
backend/app/recommendation.py
Data Ingestion
- Ingestion Engine
backend/app/ingestion.py - Record Validation
backend/app/ingestion.py - Synthetic Patient Records
backend/synthetic_data/patients.json - Disease Embeddings
backend/app/ingestion.py
AI And Graph
- LLM And Embeddings
backend/app/llm.py - Neo4j Graph Service
backend/app/database.py
Other components
- API Client
- OpenAI Or OpenRouter
- Neo4j AuraDB
Connections 25
- API Client → FastAPI Gateway: sends request
- FastAPI Gateway → Request And Response Models: validates against
- FastAPI Gateway → RAG Orchestrator: dispatches recommendation
- RAG Orchestrator → Entity Extraction: extracts demographics
- RAG Orchestrator → LLM And Embeddings: embeds message
- LLM And Embeddings → OpenAI Or OpenRouter: requests embedding
- RAG Orchestrator → Neo4j Graph Service: queries recommendations
- Neo4j Graph Service → Neo4j AuraDB: searches graph
- RAG Orchestrator → Doctor Scoring: scores matches
- RAG Orchestrator → LLM And Embeddings: requests explanation
- LLM And Embeddings → OpenAI Or OpenRouter: requests completion
- RAG Orchestrator → FastAPI Gateway: returns recommendation
- FastAPI Gateway → API Client: returns response
- FastAPI Gateway → Ingestion Engine: dispatches ingestion
- Ingestion Engine → Record Validation: validates records
- Record Validation → Ingestion Engine: returns normalized records
- Ingestion Engine → Neo4j Graph Service: writes patient records
- Ingestion Engine → Disease Embeddings: generates disease vectors
- Disease Embeddings → LLM And Embeddings: requests embeddings
- Disease Embeddings → Neo4j Graph Service: stores disease vectors
- Ingestion Engine → Synthetic Patient Records: reads seed data
- FastAPI Gateway → Health Check: dispatches health check
- Health Check → Neo4j Graph Service: checks connectivity
- Neo4j Graph Service → Neo4j AuraDB: verifies connection
- FastAPI Gateway → Neo4j Graph Service: initializes schema