How sahinurrahman-debug/docsherlock works
DocSherlock is an evidence-grounded document investigation app. Analysts upload mixed-format files, which the backend extracts, chunks, indexes, and later searches to answer questions with verified citations, confidence and conflict handling. The UI also exposes workspace-wide case findings, timelines, dispute boards, red-team checks, evidence-pack exports, and Trust Lab. The graph preserves these documented capabilities; some service-to-service links rely on README descriptions or the SOURCE INDEX, since much of the implementation was not excerpted.
Main entry points: main.py FastAPI application · ingestion.py Ingestion pipeline · App.tsx Web app · conflicts.py Conflict routes
Components 34
Analyst interface
- Web app
frontend/src/App.tsx - Workspace state
frontend/src/context/workspace.tsx - API client
frontend/src/lib/api.ts - Dashboard
frontend/src/pages/Dashboard.tsx - Documents view
frontend/src/pages/Documents.tsx - Investigation views
frontend/src/pages/Investigation.tsx - Trust Lab view
frontend/src/pages/TrustLab.tsx - Case board
frontend/src/components/BoardView.tsx - Timeline view
frontend/src/components/TimelineView.tsx
API and workspace
- FastAPI application
backend/app/main.py - Document routes
backend/app/api/documents.py - Question routes
backend/app/api/questions.py - Conflict routes
backend/app/api/conflicts.py - Investigation routes
backend/app/api/investigations.py - Trust Lab routes
backend/app/api/trustlab.py
Ingestion and indexing
- Ingestion pipeline
backend/app/services/ingestion.py - Format extraction
backend/app/services/extractor.py - Passage chunking
backend/app/services/chunker.py - Claim extraction
backend/app/services/claims.py - Embeddings
backend/app/services/embeddings.py
Evidence investigation
- Hybrid retrieval
backend/app/services/retriever.py - Answer generation
backend/app/services/qa.py - LLM service
backend/app/services/llm.py - Citation verification
backend/app/services/citations.py - Conflict detection
backend/app/services/conflict_detector.py - Document comparison
backend/app/services/comparison.py - Time travel
backend/app/services/timeline.py - Board assembly
backend/app/services/board.py - Case file findings
backend/app/services/casefile.py - Answer red-team
backend/app/services/redteam.py - Evidence PDF
backend/app/services/evidencepack.py
Persistence and models
- Vector index
backend/app/services/vectorstore.py - SQL database
backend/app/core/database.py
Other components
- Analyst
Connections 42
- Analyst → Web app: uses
- Web app → Workspace state: provides state
frontend/src/App.tsx - Web app → Dashboard: routes to
frontend/src/App.tsx - Web app → Documents view: routes to
frontend/src/App.tsx - Web app → Investigation views: routes to
frontend/src/App.tsx - Web app → Trust Lab view: routes to
frontend/src/App.tsx - Workspace state → API client: calls
frontend/src/context/workspace.tsx - Dashboard → Workspace state: uses
frontend/src/pages/Dashboard.tsx - Documents view → API client: uploads via
frontend/src/pages/Documents.tsx - Investigation views → Case board: renders
frontend/src/pages/Investigation.tsx - Investigation views → Timeline view: renders
frontend/src/pages/Investigation.tsx - Case board → API client: loads data
frontend/src/components/BoardView.tsx - Timeline view → API client: loads data
frontend/src/components/TimelineView.tsx - API client → FastAPI application: HTTP requests
frontend/src/lib/api.ts - FastAPI application → Document routes: mounts
backend/app/main.py - FastAPI application → Question routes: mounts
backend/app/main.py - FastAPI application → Conflict routes: mounts
backend/app/main.py - FastAPI application → Investigation routes: mounts
backend/app/main.py - FastAPI application → Trust Lab routes: mounts
backend/app/main.py - Document routes → Ingestion pipeline: starts ingestion
backend/app/api/documents.py - Ingestion pipeline → Format extraction: extracts files
backend/app/services/ingestion.py - Ingestion pipeline → Passage chunking: chunks pages
backend/app/services/ingestion.py - Ingestion pipeline → Claim extraction: extracts claims
backend/app/services/ingestion.py - Ingestion pipeline → Embeddings: embeds passages
backend/app/services/ingestion.py - Ingestion pipeline → Vector index: indexes passages
backend/app/services/ingestion.py - Ingestion pipeline → SQL database: stores records
backend/app/services/ingestion.py - Question routes → Answer generation: answers with
backend/app/api/questions.py - Answer generation → Hybrid retrieval: retrieves evidence
- Hybrid retrieval → Embeddings: embeds query
backend/app/services/retriever.py - Hybrid retrieval → Vector index: searches index
backend/app/services/retriever.py - Answer generation → LLM service: generates answer
- Answer generation → Citation verification: verifies quotes
- Answer generation → Conflict detection: checks disputes
- Conflict routes → Document comparison: compares sources
backend/app/api/conflicts.py - Conflict routes → Time travel: requests timeline
backend/app/api/conflicts.py - Conflict routes → Board assembly: assembles board
backend/app/api/conflicts.py - Conflict routes → SQL database: reads workspace
backend/app/api/conflicts.py - Document routes → Case file findings: reports findings
- Question routes → Answer red-team: tests answers
backend/app/api/questions.py - Question routes → Evidence PDF: exports evidence
backend/app/api/questions.py - Trust Lab routes → Answer red-team: runs attacks
- FastAPI application → Embeddings: warms models
backend/app/main.py