How abhinav-ram/bank-statement-agents works
Bank Statement Agents turns uploaded digital or scanned statements into validated, categorized financial data, then answers questions using SQL and hybrid search with transaction citations. The main workflow is upload → parse/OCR → validate and, when needed, human review → store and enrich → index → ask and receive a grounded answer. The README documents capabilities whose detailed implementations were not sampled; those links are cited to the README or left unverified. Graph wiring is supported by the excerpts and SOURCE INDEX, not by inspection of unsampled source.
Main entry points: ingestion.py Ingestion workflow · query.py Question workflow · client.ts API client · App.tsx Web interface
Components 27
Statement ingestion
- FastAPI application
backend/app/main.py - Statement endpoints
backend/app/api/statements.py - Ingestion jobs
backend/app/api/jobs.py - Ingestion workflow
backend/app/graphs/ingestion.py - Statement parser
backend/app/parsing/digital.py - OCR engines
backend/app/ocr/engines.py - Metadata extraction
backend/app/agents/extract.py - Balance validation
backend/app/services/validate.py - Review contract
backend/app/services/review.py
Question answering
- Question workflow
backend/app/graphs/query.py - Question planner and answerer
backend/app/agents/query.py - SQL query tools
backend/app/tools/sql_tools.py - Hybrid retrieval
backend/app/retrieval/hybrid.py
Data and intelligence
- Statement repository
backend/app/db/repo.py - Transaction categories
backend/app/agents/categorize.py - Anomaly detection
backend/app/services/anomaly.py - Statement summaries
backend/app/agents/summarize.py - Search indexing
backend/app/retrieval/chunks.py - LLM client
backend/app/llm/client.py
Web application
- Web interface
frontend/src/App.tsx - API client
frontend/src/api/client.ts - Upload and progress
frontend/src/pages/Upload.tsx - Review screen
frontend/src/pages/Review.tsx - Statement views
frontend/src/pages/Overview.tsx - Ask page
frontend/src/pages/Chat.tsx
Other components
- Statement user
- LLM provider
Connections 34
- Statement user → Web interface: uses
README.md - Web interface → Upload and progress: routes to
frontend/src/App.tsx - Web interface → Statement views: routes to
frontend/src/App.tsx - Web interface → Ask page: routes to
frontend/src/App.tsx - Upload and progress → API client: requests
- Review screen → API client: requests
frontend/src/pages/Review.tsx - Ask page → API client: requests
frontend/src/pages/Chat.tsx - API client → FastAPI application: calls API
- FastAPI application → Statement endpoints: mounts
backend/app/main.py - FastAPI application → Ingestion jobs: mounts
backend/app/main.py - Statement endpoints → Ingestion workflow: starts ingestion
backend/app/api/statements.py - Ingestion jobs → Ingestion workflow: runs jobs
- Ingestion workflow → Statement parser: parses PDF
backend/app/graphs/ingestion.py - Statement parser → OCR engines: uses for scans
backend/app/parsing/digital.py - Ingestion workflow → Metadata extraction: extracts details
backend/app/graphs/ingestion.py - Ingestion workflow → Balance validation: checks balances
backend/app/graphs/ingestion.py - Ingestion workflow → Review contract: builds review
backend/app/graphs/ingestion.py - Review screen → Statement endpoints: submits corrections
- Ingestion workflow → Statement repository: persists statement
backend/app/graphs/ingestion.py - Ingestion workflow → Transaction categories: categorizes
backend/app/graphs/ingestion.py - Ingestion workflow → Anomaly detection: flags anomalies
backend/app/graphs/ingestion.py - Ingestion workflow → Statement summaries: summarizes
backend/app/graphs/ingestion.py - Ingestion workflow → Search indexing: indexes transactions
backend/app/graphs/ingestion.py - Statement user → Question workflow: asks question
README.md - Question workflow → Question planner and answerer: plans and answers
backend/app/graphs/query.py - Question workflow → SQL query tools: runs tools
backend/app/graphs/query.py - Question workflow → Hybrid retrieval: searches evidence
backend/app/graphs/query.py - Question workflow → Statement repository: reads statements
backend/app/graphs/query.py - Question workflow → LLM client: requests completion
backend/app/graphs/query.py - Ingestion workflow → LLM client: requests completion
backend/app/graphs/ingestion.py - LLM client → LLM provider: sends prompts
backend/app/llm/client.py - Question workflow → FastAPI application: serves answer
- Statement views → API client: requests statement data
- Ask page → Statement user: shows cited answer