# mevaktecno-vane/sistema_bancario architecture

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

- Interactive diagram: https://gitdiagram.com/mevaktecno-vane/sistema_bancario
- Repository: https://github.com/mevaktecno-vane/sistema_bancario

## Overview

##### Project Type and Purpose
- This is a Python-based desktop/GUI banking application (not a web app) that models a bank’s core operations (clients, accounts, cards, transactions) with an interactive Flet interface, PDF reporting via FPDF, and comprehensive unit tests.

##### File Structure Analysis
- Top level:
- main.py – application entry point that initializes the Flet GUI and binds UI events to business logic.
- requirements.txt – lists flet, fpdf, pytest.
- src/ – core application code:
– app_banco.py (orchestrator/controllers)
– cliente.py, cuenta.py, cuenta_ahorro.py, tarjeta.py, transaccion.py (domain model classes)
– exportar_datos_a_pdf.py (infrastructure/service for PDF generation)
- tests/ – pytest unit tests for each domain class.
- README.md – describes architecture, POO principles, tools.

##### Key Architectural Insights from README
- Layered design using OOP: abstraction, inheritance, polymorphism, encapsulation.
- Presentation layer built with Flet (main.py + app_banco.py hooking into domain services).
- Domain layer composed of Cliente, Cuenta (+ CuentaAhorro subclass), Tarjeta, Transaccion.
- Infrastructure service layer for PDF export (FPDF).
- No external database—data is held in memory and exported to PDF.

a. Main Components
- Presentation Layer (UI): Flet framework, main.py, app_banco.py
- Domain Layer: Cliente, Cuenta, CuentaAhorro, Tarjeta, Transaccion classes
- Service/Infrastructure Layer: exportar_datos_a_pdf.py + FPDF library
- External Libraries: Flet, FPDF
- Tests: pytest modules (for completeness, shown as a parallel “Validation” component)

b. Relationships and Interactions
- UI triggers controller methods in app_banco.py (e.g., create_client(), perform_deposit()).
- Controller uses domain classes to execute operations; domain classes record Transaccion objects.
- Upon user request, controller calls exportar_datos_a_pdf to produce PDF.
- Tests exercise domain classes directly.

c. Architectural Patterns and Principles
- Layered architecture (Presentation → Domain → Infrastructure)
- OOP principles:
– Inheritance (CuentaAhorro extends Cuenta)
– Polymorphism (overriding interest calculation)
– Encapsulation (private attributes with getters)
- MVC-style separation: Flet UI acts as View, app_banco.py as Controller, domain classes as Model.

d. Technologies and Frameworks
- Flet (UI)
- FPDF (PDF generation)
- pytest (unit testing)
- Python standard library

##### Detailed Element Capture
- Six domain classes plus the export module.
- Main.py as the bootstrap component instantiating the Flet app.
- Dependency on requirements.txt libraries.
- Test suite as a separate validation layer to emphasize quality assurance.
- Optionally, include the git/GitHub workflow in an appendix if version-control integration is part of the desired system context.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        main["main.py\n(bootstrap UI)"]:::presentation
        controller["app_banco.py\n(controller)"]:::presentation
    end

    %% Domain Layer
    subgraph "Domain Layer"
        cliente["Cliente"]:::domain
        cuenta["Cuenta"]:::domain
        cuentaA["CuentaAhorro"]:::domain
        tarjeta["Tarjeta"]:::domain
        transaccion["Transaccion"]:::domain
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        pdfExport["exportar_datos_a_pdf.py\n(PDF Service)"]:::infra
    end

    %% External Libraries
    subgraph "External Libraries"
        fletLib["Flet"]:::external
        fpdfLib["FPDF"]:::external
        pytestLib["pytest"]:::external
    end

    %% Validation Layer
    subgraph "Validation Layer"
        test_cliente["test_cliente.py"]:::tests
        test_cuenta["test_cuenta.py"]:::tests
        test_cuentaA["test_cuenta_ahorro.py"]:::tests
        test_tarjeta["test_tarjeta.py"]:::tests
        test_transaccion["test_transaccion.py"]:::tests
    end

    %% Connections
    main -->|"launch UI"| controller
    main -->|"depends on"| fletLib

    controller -->|"create_client() / perform_deposit()"| cliente
    controller -->|"create_account()"| cuenta
    controller -->|"create_savings_account()"| cuentaA
    controller -->|"issue_card()"| tarjeta
    controller -->|"generate_pdf(Cliente, Cuenta, Transacciones)"| pdfExport

    cuentaA -->|"inherits"| cuenta
    cuenta -->|"composes"| transaccion

    pdfExport -->|"uses"| fpdfLib

    test_cliente -.->|tests| cliente
    test_cuenta -.->|tests| cuenta
    test_cuentaA -.->|tests| cuentaA
    test_tarjeta -.->|tests| tarjeta
    test_transaccion -.->|tests| transaccion

    %% Click Events
    click main "https://github.com/mevaktecno-vane/sistema_bancario/blob/main/main.py"
    click controller "https://github.com/mevaktecno-vane/sistema_bancario/blob/main/src/app_banco.py"
    click cliente "https://github.com/mevaktecno-vane/sistema_bancario/blob/main/src/cliente.py"
    click cuenta "https://github.com/mevaktecno-vane/sistema_bancario/blob/main/src/cuenta.py"
    click cuentaA "https://github.com/mevaktecno-vane/sistema_bancario/blob/main/src/cuenta_ahorro.py"
    click tarjeta "https://github.com/mevaktecno-vane/sistema_bancario/blob/main/src/tarjeta.py"
    click transaccion "https://github.com/mevaktecno-vane/sistema_bancario/blob/main/src/transaccion.py"
    click pdfExport "https://github.com/mevaktecno-vane/sistema_bancario/blob/main/src/exportar_datos_a_pdf.py"
    click test_cliente "https://github.com/mevaktecno-vane/sistema_bancario/blob/main/tests/test_cliente.py"
    click test_cuenta "https://github.com/mevaktecno-vane/sistema_bancario/blob/main/tests/test_cuenta.py"
    click test_cuentaA "https://github.com/mevaktecno-vane/sistema_bancario/blob/main/tests/test_cuenta_ahorro.py"
    click test_tarjeta "https://github.com/mevaktecno-vane/sistema_bancario/blob/main/tests/test_tarjeta.py"
    click test_transaccion "https://github.com/mevaktecno-vane/sistema_bancario/blob/main/tests/test_transaccion.py"

    %% Styles
    classDef presentation fill:#d0e7ff,stroke:#0366d6,color:#0366d6
    classDef domain fill:#d0ffd8,stroke:#28a745,color:#28a745
    classDef infra fill:#ffe8d6,stroke:#d63301,color:#d63301
    classDef external fill:#e0e0e0,stroke:#6a737d,color:#6a737d
    classDef tests fill:#f0f0f0,stroke:#735c0f,color:#735c0f
```
