# pedroh288/wallet_control architecture

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

- Interactive diagram: https://gitdiagram.com/pedroh288/wallet_control
- Repository: https://github.com/pedroh288/wallet_control

## Overview

Wallet Control is a terminal-based personal-finance tracker: the user selects an action, records an expense or income, reviews unexported records, or exports them to an Excel workbook. The main menu initializes SQLite and dispatches those actions. Record modules collect and validate fields through shared utilities before saving; pending-list and export flows read from SQLite. Export writes separate income and expense sheets, then updates and clears database records. The README also describes SQLite persistence and spreadsheet export. Relationships are limited to calls shown in excerpts or menu behavior explicitly documented in the README.

Main entry points: [`main.py`](https://github.com/pedroh288/wallet_control/blob/master/main.py) (Main menu), [`database/banco.py`](https://github.com/pedroh288/wallet_control/blob/master/database/banco.py) (SQLite operations), [`services/excel.py`](https://github.com/pedroh288/wallet_control/blob/master/services/excel.py) (Excel export), [`services/despesa.py`](https://github.com/pedroh288/wallet_control/blob/master/services/despesa.py) (Record expense)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["User workflows"]
  node_menu["Main menu<br/>[main.py]"]
  node_expense["Record expense<br/>[despesa.py]"]
  node_income["Record income<br/>[entrada.py]"]
  node_pending["List pending<br/>[utils.py]"]
end

subgraph group_shared["Shared interaction"]
  node_input_helpers["Input helpers<br/>[utils.py]"]
  node_colors["Terminal colors<br/>[colors.py]"]
end

subgraph group_persistence["Persistence"]
  node_database["SQLite operations<br/>[banco.py]"]
  node_sqlite[("SQLite database")]
end

subgraph group_export["Spreadsheet export"]
  node_excel_export["Excel export<br/>[excel.py]"]
  node_workbook["Excel workbook"]
end

node_user(("User"))

node_user -->|"selects action"| node_menu
node_menu -->|"initializes tables"| node_database
node_menu -->|"dispatches"| node_expense
node_menu -->|"dispatches"| node_income
node_menu -->|"dispatches"| node_pending
node_menu -->|"dispatches"| node_excel_export
node_menu -->|"uses colors"| node_colors
node_expense -->|"requests fields"| node_input_helpers
node_income -->|"requests fields"| node_input_helpers
node_expense -->|"saves expense"| node_database
node_income -->|"saves income"| node_database
node_input_helpers -->|"reads pending"| node_database
node_pending -->|"reads pending"| node_database
node_excel_export -->|"reads pending"| node_database
node_excel_export -->|"marks and clears"| node_database
node_database -->|"reads and writes"| node_sqlite
node_excel_export -->|"writes workbook"| node_workbook

click node_menu "https://github.com/pedroh288/wallet_control/blob/master/main.py"
click node_expense "https://github.com/pedroh288/wallet_control/blob/master/services/despesa.py"
click node_income "https://github.com/pedroh288/wallet_control/blob/master/services/entrada.py"
click node_pending "https://github.com/pedroh288/wallet_control/blob/master/services/utils.py"
click node_input_helpers "https://github.com/pedroh288/wallet_control/blob/master/services/utils.py"
click node_colors "https://github.com/pedroh288/wallet_control/blob/master/services/colors.py"
click node_database "https://github.com/pedroh288/wallet_control/blob/master/database/banco.py"
click node_excel_export "https://github.com/pedroh288/wallet_control/blob/master/services/excel.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_menu,node_expense,node_income,node_pending,node_user toneBlue
class node_input_helpers,node_colors toneAmber
class node_database,node_sqlite toneMint
class node_excel_export,node_workbook toneRose
```

## Components

### User workflows

- [Main menu](https://github.com/pedroh288/wallet_control/blob/master/main.py): `main.py`
- [Record expense](https://github.com/pedroh288/wallet_control/blob/master/services/despesa.py): `services/despesa.py`
- [Record income](https://github.com/pedroh288/wallet_control/blob/master/services/entrada.py): `services/entrada.py`
- [List pending](https://github.com/pedroh288/wallet_control/blob/master/services/utils.py): `services/utils.py`

### Shared interaction

- [Input helpers](https://github.com/pedroh288/wallet_control/blob/master/services/utils.py): `services/utils.py`
- [Terminal colors](https://github.com/pedroh288/wallet_control/blob/master/services/colors.py): `services/colors.py`

### Persistence

- [SQLite operations](https://github.com/pedroh288/wallet_control/blob/master/database/banco.py): `database/banco.py`
- **SQLite database**

### Spreadsheet export

- [Excel export](https://github.com/pedroh288/wallet_control/blob/master/services/excel.py): `services/excel.py`
- **Excel workbook**

### Other components

- **User**

## Connections

- User → Main menu: selects action (evidence: `README.md`)
- Main menu → SQLite operations: initializes tables (evidence: `main.py`)
- Main menu → Record expense: dispatches (evidence: `main.py`)
- Main menu → Record income: dispatches (evidence: `main.py`)
- Main menu → List pending: dispatches (evidence: `main.py`)
- Main menu → Excel export: dispatches (evidence: `main.py`)
- Main menu → Terminal colors: uses colors (evidence: `main.py`)
- Record expense → Input helpers: requests fields (evidence: `services/despesa.py`)
- Record income → Input helpers: requests fields (evidence: `services/entrada.py`)
- Record expense → SQLite operations: saves expense (evidence: `services/despesa.py`)
- Record income → SQLite operations: saves income (evidence: `services/entrada.py`)
- Input helpers → SQLite operations: reads pending (evidence: `services/utils.py`)
- List pending → SQLite operations: reads pending (evidence: `services/utils.py`)
- Excel export → SQLite operations: reads pending (evidence: `services/excel.py`)
- Excel export → SQLite operations: marks and clears (evidence: `services/excel.py`)
- SQLite operations → SQLite database: reads and writes (evidence: `database/banco.py`)
- Excel export → Excel workbook: writes workbook (evidence: `services/excel.py`)
