# bhaskar2303/bankstatementprocessor architecture

> Architecture diagram of the GitHub repository bhaskar2303/bankstatementprocessor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bhaskar2303/bankstatementprocessor
- Repository: https://github.com/bhaskar2303/bankstatementprocessor

## Overview

#### Purpose and Entry Points
This is a Python document-processing/agent pipeline centered on bank-statement inputs, persistent memory, approval artifacts, and telemetry. Primary executable/control entry points are `app.py` and `process_pipeline.py`.

#### Pipeline Orchestration
`process_pipeline.py` likely coordinates the end-to-end workflow: loading a bank statement, applying configured agent/task stages, storing outputs, and producing approval-ready results. `app.py` is the application-facing entry point that likely invokes or exposes this pipeline.

Paths: `process_pipeline.py`, `app.py`, `utils.py`

#### Agent and Task Definition Boundary
Agent behavior and workflow stages are declaratively separated from Python orchestration through YAML configuration. This makes agent roles and task sequencing replaceable without changing the pipeline implementation.

Paths: `config/agents.yaml`, `config/tasks.yaml`, `config/config_registry.py`

#### Input, Approval, and Output Data Boundary
The pipeline consumes bank statement documents from a dedicated source directory. Structured approved output is kept separately, establishing a clear distinction between raw input and reviewed/accepted records.

Paths: `data/bank_statements/bank_statement.pdf`, `data/approved/bank_statement.json`, `data/bank_statements`

#### Memory Subsystem
A dedicated memory package persists cross-run or multi-stage context. The presence of episodic and semantic stores suggests separate handling for event/history-oriented memory versus reusable factual knowledge.

Paths: `memory/store.py`, `data/episodic.json`, `data/semantic.json`

#### Observability and Usage Tracking
Telemetry is isolated from core processing and records tracing and token-consumption information. This is the principal operational boundary for monitoring agent/pipeline execution cost and behavior.

Paths: `telemetry/tracing.py`, `telemetry/data/token_usage_log.csv`, `telemetry/__init__.py`

#### Runtime and External Dependencies
The runtime is Python, with package boundaries represented by `config/__init__.py`, `memory/__init__.py`, and `telemetry/__init__.py`. Dependencies are declared in `requirement.txt`. The agent/task configuration and token telemetry indicate integration with an LLM or agent runtime, though no specific provider or service is identifiable from the repository tree alone.

Paths: `requirement.txt`, `config/__init__.py`, `telemetry/tracing.py`

Main entry points: [`process_pipeline.py`](https://github.com/bhaskar2303/bankstatementprocessor/blob/main/process_pipeline.py) (Processing pipeline), [`config/config_registry.py`](https://github.com/bhaskar2303/bankstatementprocessor/blob/main/config/config_registry.py) (Configuration registry), [`memory/store.py`](https://github.com/bhaskar2303/bankstatementprocessor/blob/main/memory/store.py) (Memory store), [`data/bank_statements`](https://github.com/bhaskar2303/bankstatementprocessor/tree/main/data/bank_statements) (Bank statements)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application"]
  node_app["Application entry<br/>Python entry point<br/>[app.py]"]
  node_pipeline["Processing pipeline<br/>Python orchestrator"]
  node_utils["Pipeline utilities<br/>Python module<br/>[utils.py]"]
  node_dependencies["Dependencies<br/>Python requirements<br/>[requirement.txt]"]
end

subgraph group_workflow["Agent Workflow"]
  node_agent_config["Agent definitions<br/>YAML configuration<br/>[agents.yaml]"]
  node_task_config["Task definitions<br/>YAML configuration<br/>[tasks.yaml]"]
  node_config_registry["Configuration registry<br/>Python module<br/>[config_registry.py]"]
end

subgraph group_data["Documents &amp; Memory"]
  node_statement_input["Bank statements<br/>source documents"]
  node_sample_statement["Statement PDF<br/>PDF input<br/>[bank_statement.pdf]"]
  node_approved_output["Approved record<br/>JSON output"]
  node_memory_store[("Memory store<br/>Python persistence layer<br/>[store.py]")]
  node_episodic_memory[("Episodic memory<br/>JSON store<br/>[episodic.json]")]
  node_semantic_memory[("Semantic memory<br/>JSON store<br/>[semantic.json]")]
end

subgraph group_ops["Observability"]
  node_tracing["Tracing<br/>Python telemetry module<br/>[tracing.py]"]
  node_token_usage[("Token usage log<br/>CSV telemetry store")]
end

node_app -->|"invokes"| node_pipeline
node_pipeline -->|"uses"| node_utils
node_pipeline -->|"loads workflow config"| node_config_registry
node_config_registry -->|"reads"| node_agent_config
node_config_registry -->|"reads"| node_task_config
node_sample_statement -->|"stored in"| node_statement_input
node_statement_input -->|"input documents"| node_pipeline
node_pipeline -->|"produces approval artifact"| node_approved_output
node_pipeline -->|"reads and writes context"| node_memory_store
node_memory_store -->|"persists events"| node_episodic_memory
node_memory_store -->|"persists knowledge"| node_semantic_memory
node_pipeline -->|"emits telemetry"| node_tracing
node_tracing -->|"records usage"| node_token_usage
node_dependencies -.->|"provides runtime packages"| node_pipeline

click node_app "https://github.com/bhaskar2303/bankstatementprocessor/blob/main/app.py"
click node_pipeline "https://github.com/bhaskar2303/bankstatementprocessor/blob/main/process_pipeline.py"
click node_utils "https://github.com/bhaskar2303/bankstatementprocessor/blob/main/utils.py"
click node_agent_config "https://github.com/bhaskar2303/bankstatementprocessor/blob/main/config/agents.yaml"
click node_task_config "https://github.com/bhaskar2303/bankstatementprocessor/blob/main/config/tasks.yaml"
click node_config_registry "https://github.com/bhaskar2303/bankstatementprocessor/blob/main/config/config_registry.py"
click node_statement_input "https://github.com/bhaskar2303/bankstatementprocessor/tree/main/data/bank_statements"
click node_sample_statement "https://github.com/bhaskar2303/bankstatementprocessor/blob/main/data/bank_statements/bank_statement.pdf"
click node_approved_output "https://github.com/bhaskar2303/bankstatementprocessor/blob/main/data/approved/bank_statement.json"
click node_memory_store "https://github.com/bhaskar2303/bankstatementprocessor/blob/main/memory/store.py"
click node_episodic_memory "https://github.com/bhaskar2303/bankstatementprocessor/blob/main/data/episodic.json"
click node_semantic_memory "https://github.com/bhaskar2303/bankstatementprocessor/blob/main/data/semantic.json"
click node_tracing "https://github.com/bhaskar2303/bankstatementprocessor/blob/main/telemetry/tracing.py"
click node_token_usage "https://github.com/bhaskar2303/bankstatementprocessor/blob/main/telemetry/data/token_usage_log.csv"
click node_dependencies "https://github.com/bhaskar2303/bankstatementprocessor/blob/main/requirement.txt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_pipeline,node_utils,node_dependencies toneBlue
class node_agent_config,node_task_config,node_config_registry toneAmber
class node_statement_input,node_sample_statement,node_approved_output,node_memory_store,node_episodic_memory,node_semantic_memory toneMint
class node_tracing,node_token_usage toneRose
```

## Components

### Application

- [Application entry](https://github.com/bhaskar2303/bankstatementprocessor/blob/main/app.py): Python entry point · Application-facing launcher for the processing workflow. · `app.py`
- [Processing pipeline](https://github.com/bhaskar2303/bankstatementprocessor/blob/main/process_pipeline.py): Python orchestrator · Coordinates statement processing, agent stages, persistence, and approval output. · `process_pipeline.py`
- [Pipeline utilities](https://github.com/bhaskar2303/bankstatementprocessor/blob/main/utils.py): Python module · `utils.py`
- [Dependencies](https://github.com/bhaskar2303/bankstatementprocessor/blob/main/requirement.txt): Python requirements · Runtime dependency declaration. · `requirement.txt`

### Agent Workflow

- [Agent definitions](https://github.com/bhaskar2303/bankstatementprocessor/blob/main/config/agents.yaml): YAML configuration · Declarative agent roles and behavior. · `config/agents.yaml`
- [Task definitions](https://github.com/bhaskar2303/bankstatementprocessor/blob/main/config/tasks.yaml): YAML configuration · Declarative workflow stages and sequencing. · `config/tasks.yaml`
- [Configuration registry](https://github.com/bhaskar2303/bankstatementprocessor/blob/main/config/config_registry.py): Python module · Loads or exposes workflow configuration. · `config/config_registry.py`

### Documents & Memory

- [Bank statements](https://github.com/bhaskar2303/bankstatementprocessor/tree/main/data/bank_statements): source documents · Raw bank-statement input directory. · `data/bank_statements`
- [Statement PDF](https://github.com/bhaskar2303/bankstatementprocessor/blob/main/data/bank_statements/bank_statement.pdf): PDF input · `data/bank_statements/bank_statement.pdf`
- [Approved record](https://github.com/bhaskar2303/bankstatementprocessor/blob/main/data/approved/bank_statement.json): JSON output · Reviewed or accepted structured statement output. · `data/approved/bank_statement.json`
- [Memory store](https://github.com/bhaskar2303/bankstatementprocessor/blob/main/memory/store.py): Python persistence layer · Persists context across pipeline stages or runs. · `memory/store.py`
- [Episodic memory](https://github.com/bhaskar2303/bankstatementprocessor/blob/main/data/episodic.json): JSON store · Event and history-oriented memory. · `data/episodic.json`
- [Semantic memory](https://github.com/bhaskar2303/bankstatementprocessor/blob/main/data/semantic.json): JSON store · Reusable factual knowledge memory. · `data/semantic.json`

### Observability

- [Tracing](https://github.com/bhaskar2303/bankstatementprocessor/blob/main/telemetry/tracing.py): Python telemetry module · Captures pipeline and agent execution telemetry. · `telemetry/tracing.py`
- [Token usage log](https://github.com/bhaskar2303/bankstatementprocessor/blob/main/telemetry/data/token_usage_log.csv): CSV telemetry store · Records agent-runtime token consumption. · `telemetry/data/token_usage_log.csv`

## Connections

- Application entry → Processing pipeline: invokes
- Processing pipeline → Pipeline utilities: uses
- Processing pipeline → Configuration registry: loads workflow config
- Configuration registry → Agent definitions: reads
- Configuration registry → Task definitions: reads
- Statement PDF → Bank statements: stored in
- Bank statements → Processing pipeline: input documents
- Processing pipeline → Approved record: produces approval artifact
- Processing pipeline → Memory store: reads and writes context
- Memory store → Episodic memory: persists events
- Memory store → Semantic memory: persists knowledge
- Processing pipeline → Tracing: emits telemetry
- Tracing → Token usage log: records usage
- Dependencies → Processing pipeline: provides runtime packages
