# tomas-dorado/gestor_clientes architecture

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

- Interactive diagram: https://gitdiagram.com/tomas-dorado/gestor_clientes
- Repository: https://github.com/tomas-dorado/gestor_clientes

## Overview

##### Project type and purpose
- This is a Python desktop application (“Gestor de Clientes”) that provides a graphical interface to manage a client list.
- It uses tkinter for the GUI, a custom linked‐list data structure for in‐memory operations, and persists data in a CSV file.

##### File structure
- Top-level:
- ui.py  – tkinter‐based GUI entrypoint
- requirements.txt – dependencies (pytest, tk)
- tests/ – unit tests for database layer
- Datos/clientes.csv – the persistent datastore
- Module “Gestor_Clientes/”:
- run.py – application runner (initializes GUI)
- menu.py – controller logic for menu actions
- database.py – CSV‐based CRUD operations
- Nodo.py – linked‐list node definition
- helpers.py – utility functions on the linked list
- config.py – application configuration (file paths, settings)

##### Extract insights from the README
- Emphasizes four key components: GUI (tkinter), custom data structure (linked list), CSV storage, and client CRUD operations.
- No mention of external services or databases—everything is local.

##### Main components
a. GUI Layer (tkinter)
b. Controller/Business Layer (menu.py, helpers.py)
c. Data Structure Layer (Nodo.py – the linked list)
d. Persistence Layer (database.py writing to Datos/clientes.csv)
e. Configuration (config.py)

##### Relationships & data flows
- The GUI Layer sends user actions (Create, Read, Update, Delete) to the Controller.
- The Controller manipulates the in‐memory linked list via helpers and Nodo.
- For each change, the Persistence Layer serializes/deserializes the linked list to/from clientes.csv.
- Configuration settings (file paths, CSV schema) flow into both Controller and Persistence layers from config.py.
- Tests import database.py and helpers/Nodo to validate correctness.

##### Architectural patterns & principles
- MVC‐like separation:
- View: ui.py + tkinter widgets
- Controller: menu.py + run.py
- Model: linked list (Nodo.py, helpers) + persistence (database.py)
- Single responsibility per module: config, data node, persistence, UI.
- Local file‐based persistence—no remote services.

- Clear component labels (e.g., “tkinter UI”, “Linked List Model”)
- Arrowheads showing direction of calls/data flow

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "UI Layer"
        ui["tkinter UI\ nui.py"]:::ui
        run["App Runner\ nrun.py"]:::ui
    end

    subgraph "Controller Layer"
        menu["Controller\ nmenu.py"]:::controller
        helpers["Logic Helpers\ nhelpers.py"]:::controller
    end

    subgraph "Data Structure Layer"
        nodo["Linked List Model\ nNodo.py"]:::model
    end

    subgraph "Persistence Layer"
        database["Persistence Layer\ ndatabase.py"]:::persistence
        csvfile["CSV Data\ nclientes.csv"]:::persistence
    end

    subgraph "Configuration"
        config["Config\ nconfig.py"]:::config
    end

    subgraph "Testing Harness"
        tests_dir["Tests\ ntests/"]:::tests
        test_db["Test DB\ ntest_database.py"]:::tests
        test_csv_lib["Test CSV Fixture\ nclientes_test.csv"]:::tests
    end

    run --> ui
    ui --> menu
    menu --> helpers
    helpers --> nodo
    nodo --> database
    database --> nodo
    database --> csvfile
    ui --> database

    config --> menu
    config --> database

    tests_dir -.-> database
    tests_dir -.-> nodo

    click ui "https://github.com/tomas-dorado/gestor_clientes/blob/main/ui.py"
    click run "https://github.com/tomas-dorado/gestor_clientes/blob/main/Gestor_Clientes/run.py"
    click menu "https://github.com/tomas-dorado/gestor_clientes/blob/main/Gestor_Clientes/menu.py"
    click helpers "https://github.com/tomas-dorado/gestor_clientes/blob/main/Gestor_Clientes/helpers.py"
    click nodo "https://github.com/tomas-dorado/gestor_clientes/blob/main/Gestor_Clientes/Nodo.py"
    click database "https://github.com/tomas-dorado/gestor_clientes/blob/main/Gestor_Clientes/database.py"
    click csvfile "https://github.com/tomas-dorado/gestor_clientes/blob/main/Datos/clientes.csv"
    click config "https://github.com/tomas-dorado/gestor_clientes/blob/main/Gestor_Clientes/config.py"
    click tests_dir "https://github.com/tomas-dorado/gestor_clientes/tree/main/tests/"
    click test_db "https://github.com/tomas-dorado/gestor_clientes/blob/main/tests/test_database.py"
    click test_csv_lib "https://github.com/tomas-dorado/gestor_clientes/blob/main/tests/clientes_test.csv"

    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef controller fill:#90EE90,stroke:#000,stroke-width:1px
    classDef model fill:#FFFFE0,stroke:#000,stroke-width:1px
    classDef persistence fill:#FFA500,stroke:#000,stroke-width:1px
    classDef config fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef tests fill:#FFC0CB,stroke:#000,stroke-width:1px
```
