CureX Healthcare RAG Assistant
CureX is an agentic healthcare RAG application for asking evidence-grounded questions over medical documents. It combines document ingestion, local pgvector retrieval, cited responses, safety checks, JWT authentication, user-scoped memory, human review, and an evaluation dashboard.
The assistant is for educational and research workflows only. It is not a substitute for professional medical advice, diagnosis, or treatment.
Core Features
- Healthcare-focused chat assistant with streamed responses
- PDF, TXT, and Markdown document upload and indexing
- Local PostgreSQL + pgvector vector storage
- Gemini-based generation and embeddings
- User login with JWT authentication
- User-scoped chat sessions and memory isolation
- Source citations for retrieved document chunks
- Medical safety guardrails and faithfulness scoring
- Optional visible agent workflow toggle
- Human-in-the-loop answer review: helpful, unsupported, unsafe, needs review
Architecture
Frontend React app
|
v
FastAPI backend
|
+-- Auth and user-scoped sessions
+-- Document upload and ingestion
+-- Chunking and metadata enrichment
+-- pgvector retrieval
+-- Agent routing, safety checks, and response generation
+-- Feedback and evaluation APIsTech Stack
- Backend: FastAPI, LangGraph, LangChain, Pydantic
- Frontend: React, Vite, lucide-react
- Vector DB: PostgreSQL with pgvector
- Models: Gemini generation and Gemini embeddings
- Storage: SQLite for local auth, memory, feedback, safety logs, and query logs
- Evaluation: RAGAS-style metrics and faithfulness checks
- Tooling: uv, pytest, Docker Compose
Setup
Create the Python environment with uv:
python -m uv venv --python 3.11
.\.venv\Scripts\Activate.ps1
python -m uv syncInstall frontend dependencies:
cd frontend
npm install
cd ..Create a local .env from the example:
Copy-Item .env.example .envSet at least:
GOOGLE_API_KEY=your_google_api_key
GEMINI_API_KEY=your_google_api_key
POSTGRES_URL=postgresql://healthcare:healthcare@localhost:5432/healthcare_rag
VECTOR_BACKEND=pgvectorStart local infrastructure:
docker compose up -dRun
Start the backend:
.\.venv\Scripts\python.exe -m uvicorn backend.api.main:app --reloadStart the frontend:
cd frontend
npm run devOpen the Vite URL shown in the terminal, usually:
http://localhost:5173Usage Flow
1. Create an account or sign in. 2. Start a new healthcare conversation. 3. Upload PDF, TXT, or Markdown medical documents. 4. Ask questions about the uploaded content or clinical research topics. 5. Inspect citations and optional agent workflow details. 6. Review answers as helpful, unsupported, unsafe, or needs review. 7. Open the evaluation dashboard to monitor quality signals.
API Highlights
POST /auth/registerPOST /auth/loginGET /auth/mePOST /session/newGET /session/{session_id}/historyPOST /documents/uploadPOST /chatPOST /feedbackGET /feedback/summaryGET /eval/metrics
Testing
Run the backend test suite:
.\.venv\Scripts\python.exe -m pytest tests -qBuild the frontend:
cd frontend
npm run buildMCP Tool Server
Run the local healthcare tool server:
.\.venv\Scripts\healthcare-mcp-server.exeAvailable tools include drug interaction lookup, ICD-10 lookup, BMI calculation, and retrieval search over indexed healthcare chunks.