How darkveteran28/doc_analyzer works
Doc Analyzer is a PDF upload and question-answering product: users submit a document, then ask questions and receive generated answers with page-level sources. Its documented RAG path extracts page text, chunks it, indexes it in both semantic and keyword stores, retrieves according to vector/BM25/hybrid mode, fuses hybrid rankings, and generates an answer. The frontend and FastAPI entry point are represented, but route implementations and their connection to the RAG service were not sampled; those links are therefore omitted. The RAG orchestration and retrieval wiring are supported by sampled source and the README.
Main entry points: rag_pipeline.py RAG orchestration · retrieval.py Mode selection and retrieval · App.jsx Upload and analysis UI · main.py API application
Components 21
Web frontend
- Upload and analysis UI
Frontend/src/App.jsx - File upload
Frontend/src/components/FileUpload.jsx - Analysis page
Frontend/src/pages/AnalysisPage.jsx - API client
Frontend/src/services/api.js
HTTP API
- API application
app/main.py - Document routes
app/routes/documents.py - Chat routes
app/routes/chat.py - Document operations
app/services/document_service.py
RAG pipeline
- PDF extraction
rag/ingestion.py - Page chunking
rag/chunking.py - RAG orchestration
rag/rag_pipeline.py - Mode selection and retrieval
rag/retrieval.py - Rank fusion
rag/fusion.py - Answer generation
rag/generation.py - Page citations
rag/sources.py
Stores and models
- MiniLM embeddings
rag/embeddings.py - Chroma vector store
rag/vector_store.py - BM25 index
rag/bm25.py - Document metadata DB
app/database/database.py
Other components
- Document user
- Ollama LLM
Connections 24
- Document user → File upload: selects PDF
- File upload → Upload and analysis UI: submits file
- Upload and analysis UI → API client: uploads document
- API client → API application: HTTP requests
- API application → Document routes: dispatches
- API application → Chat routes: dispatches
- Document routes → Document operations: document operations
- Document operations → Document metadata DB: reads and writes
- Chat routes → Document metadata DB: database access
- Upload and analysis UI → Analysis page: shows analysis
- Document user → Analysis page: asks questions
- RAG orchestration → PDF extraction: extracts pages
- RAG orchestration → Page chunking: creates chunks
- RAG orchestration → MiniLM embeddings: embeds chunks
- RAG orchestration → Chroma vector store: stores chunks
- RAG orchestration → BM25 index: indexes chunks
- RAG orchestration → Mode selection and retrieval: requests results
- Mode selection and retrieval → MiniLM embeddings: embeds query
- Mode selection and retrieval → Chroma vector store: queries vectors
- Mode selection and retrieval → BM25 index: queries keywords
- Mode selection and retrieval → Rank fusion: fuses rankings
- RAG orchestration → Answer generation: generates answer
- Answer generation → Ollama LLM: sends prompt
- RAG orchestration → Page citations: builds citations