How gauravkantgoel/pv-rag-comparison works
PV RAG Comparison is a web application for comparing vector-based retrieval with PageIndex reasoning on pharmacovigilance reports. A user can load the built-in PBRER or upload a PDF; the backend prepares document state, then runs both retrieval approaches concurrently for each query and returns their answers and retrieval details to the comparison UI. The README documents the UI and HTTP workflow; the source excerpts show backend ownership and runtime calls. The frontend implementation and some default-document loading details were not sampled, so their internal behavior is not expanded here.
Main entry points: document_manager.py Document manager · app.py FastAPI API · vector_rag.py Vector retrieval and answer · pageindex_rag.py Tree reasoning and answer
Components 12
User experience
- Comparison UI
frontend/index.html
Backend orchestration
- FastAPI API
backend/app.py - Runtime settings
backend/config.py - Document manager
backend/document_manager.py - Uploaded PDF
- PBRER source
data/pbrer_document.py
Vector RAG
- Vector retrieval and answer
backend/vector_rag.py
PageIndex RAG
- PageIndex tree
data/pageindex_tree.json - Tree reasoning and answer
backend/pageindex_rag.py
Other components
- User
- Anthropic API
- Embedding model
Connections 19
- User → Comparison UI: asks questions
README.md - Comparison UI → FastAPI API: sends HTTP requests
README.md - FastAPI API → Document manager: loads documents
backend/app.py - Uploaded PDF → FastAPI API: uploads PDF
backend/app.py - Document manager → PBRER source: loads demo pages
backend/document_manager.py - Document manager → PageIndex tree: loads prebuilt index
backend/document_manager.py - Document manager → Anthropic API: generates tree index
backend/document_manager.py - Document manager → Embedding model: embeds document chunks
backend/document_manager.py - FastAPI API → Vector retrieval and answer: dispatches query
backend/app.py - FastAPI API → Tree reasoning and answer: dispatches query
backend/app.py - Vector retrieval and answer → Document manager: reads chunks and embeddings
backend/vector_rag.py - Vector retrieval and answer → Embedding model: embeds query
backend/vector_rag.py - Vector retrieval and answer → Anthropic API: generates answer
backend/vector_rag.py - Tree reasoning and answer → Document manager: reads tree and pages
backend/pageindex_rag.py - Tree reasoning and answer → Anthropic API: reasons and answers
backend/pageindex_rag.py - FastAPI API → Comparison UI: returns comparison
README.md - Document manager → Runtime settings: reads settings
backend/document_manager.py - Vector retrieval and answer → Runtime settings: reads settings
backend/vector_rag.py - Tree reasoning and answer → Runtime settings: reads settings
backend/pageindex_rag.py