# batatatab/bank-statement-converter architecture

> Architecture diagram of the GitHub repository batatatab/bank-statement-converter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/batatatab/bank-statement-converter
- Repository: https://github.com/batatatab/bank-statement-converter

## Overview

This is a Windows desktop tool for turning password-protected or ordinary bank-statement PDFs into auditable Excel ledgers. The user selects a PDF, supplies a first-transaction-date anchor and optional balance/account details, then starts conversion; the GUI runs the converter, presents reconciliation results, exports a formula-enabled workbook, and records conversion history. The engine handles PDF table extraction, transaction parsing and cleanup, balance reconciliation, and workbook generation. The README documents these capabilities; the excerpts do not show every internal call, so unverified subsystem links are omitted.

Main entry points: [`app_gui.py`](https://github.com/batatatab/bank-statement-converter/blob/main/app_gui.py) (Conversion GUI), [`converter_engine.py`](https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py) (PDF table extraction), [`optimizer.py`](https://github.com/batatatab/bank-statement-converter/blob/main/optimizer.py) (Runtime helpers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Desktop interface"]
  node_gui["Conversion GUI<br/>[app_gui.py]"]
  node_history["Conversion history<br/>[app_gui.py]"]
  node_history_store[("History file<br/>[app_gui.py]")]
end

subgraph group_conversion["Statement conversion"]
  node_engine["Converter entry"]
  node_pdf_extract["PDF table extraction"]
  node_date_parse["Date parsing"]
  node_row_fusion["Transaction reconstruction"]
  node_noise_filter["Statement noise filtering"]
  node_amount_recovery["Amount recovery"]
  node_reconcile["Balance reconciliation"]
  node_account_class["Account classification"]
end

subgraph group_output["Audit and output"]
  node_excel["Excel workbook generation"]
  node_workbook["Auditable workbook"]
  node_result_ui["Reconciliation results<br/>[app_gui.py]"]
end

subgraph group_support["Runtime support"]
  node_optimizer["Runtime helpers<br/>[optimizer.py]"]
end

node_user(("Desktop user"))
node_pdf["PDF statement"]

node_user -->|"selects and configures"| node_gui
node_gui -->|"chooses input"| node_pdf
node_gui -->|"starts conversion"| node_engine
node_engine -->|"parses PDF"| node_pdf_extract
node_pdf_extract -.->|"detects dates"| node_date_parse
node_pdf_extract -.->|"reconstructs rows"| node_row_fusion
node_pdf_extract -.->|"filters statement text"| node_noise_filter
node_row_fusion -.->|"recovers amounts"| node_amount_recovery
node_engine -->|"reconciles balances"| node_reconcile
node_reconcile -->|"classifies account"| node_account_class
node_gui -->|"exports workbook"| node_excel
node_excel -->|"generates formulas"| node_workbook
node_gui -->|"displays verdict"| node_result_ui
node_gui -->|"reads and writes"| node_history_store
node_history_store -->|"populates records"| node_history
node_gui -->|"dispatches UI updates"| node_optimizer

click node_gui "https://github.com/batatatab/bank-statement-converter/blob/main/app_gui.py"
click node_history "https://github.com/batatatab/bank-statement-converter/blob/main/app_gui.py"
click node_engine "https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py"
click node_pdf_extract "https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py"
click node_date_parse "https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py"
click node_row_fusion "https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py"
click node_noise_filter "https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py"
click node_amount_recovery "https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py"
click node_reconcile "https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py"
click node_account_class "https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py"
click node_excel "https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py"
click node_result_ui "https://github.com/batatatab/bank-statement-converter/blob/main/app_gui.py"
click node_optimizer "https://github.com/batatatab/bank-statement-converter/blob/main/optimizer.py"
click node_history_store "https://github.com/batatatab/bank-statement-converter/blob/main/app_gui.py"

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_gui,node_history,node_history_store,node_user toneBlue
class node_engine,node_pdf_extract,node_date_parse,node_row_fusion,node_noise_filter,node_amount_recovery,node_reconcile,node_account_class toneAmber
class node_excel,node_workbook,node_result_ui toneMint
class node_optimizer toneRose
class node_pdf toneIndigo
```

## Components

### Desktop interface

- [Conversion GUI](https://github.com/batatatab/bank-statement-converter/blob/main/app_gui.py): `app_gui.py`
- [Conversion history](https://github.com/batatatab/bank-statement-converter/blob/main/app_gui.py): `app_gui.py`
- [History file](https://github.com/batatatab/bank-statement-converter/blob/main/app_gui.py): `app_gui.py`

### Statement conversion

- [Converter entry](https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py): `converter_engine.py`
- [PDF table extraction](https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py): `converter_engine.py`
- [Date parsing](https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py): `converter_engine.py`
- [Transaction reconstruction](https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py): `converter_engine.py`
- [Statement noise filtering](https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py): `converter_engine.py`
- [Amount recovery](https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py): `converter_engine.py`
- [Balance reconciliation](https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py): `converter_engine.py`
- [Account classification](https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py): `converter_engine.py`

### Audit and output

- [Excel workbook generation](https://github.com/batatatab/bank-statement-converter/blob/main/converter_engine.py): `converter_engine.py`
- **Auditable workbook**
- [Reconciliation results](https://github.com/batatatab/bank-statement-converter/blob/main/app_gui.py): `app_gui.py`

### Runtime support

- [Runtime helpers](https://github.com/batatatab/bank-statement-converter/blob/main/optimizer.py): `optimizer.py`

### Other components

- **Desktop user**
- **PDF statement**

## Connections

- Desktop user → Conversion GUI: selects and configures (evidence: `README.md`)
- Conversion GUI → PDF statement: chooses input (evidence: `README.md`)
- Conversion GUI → Converter entry: starts conversion (evidence: `app_gui.py`)
- Converter entry → PDF table extraction: parses PDF (evidence: `converter_engine.py`)
- PDF table extraction → Date parsing: detects dates (evidence: `converter_engine.py`)
- PDF table extraction → Transaction reconstruction: reconstructs rows (evidence: `converter_engine.py`)
- PDF table extraction → Statement noise filtering: filters statement text (evidence: `converter_engine.py`)
- Transaction reconstruction → Amount recovery: recovers amounts (evidence: `converter_engine.py`)
- Converter entry → Balance reconciliation: reconciles balances (evidence: `converter_engine.py`)
- Balance reconciliation → Account classification: classifies account (evidence: `converter_engine.py`)
- Conversion GUI → Excel workbook generation: exports workbook (evidence: `app_gui.py`)
- Excel workbook generation → Auditable workbook: generates formulas (evidence: `README.md`)
- Conversion GUI → Reconciliation results: displays verdict (evidence: `app_gui.py`)
- Conversion GUI → History file: reads and writes (evidence: `app_gui.py`)
- History file → Conversion history: populates records (evidence: `app_gui.py`)
- Conversion GUI → Runtime helpers: dispatches UI updates (evidence: `app_gui.py`)
