# mattp04/utn-tupad-prog1-2025-tpi architecture

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

- Interactive diagram: https://gitdiagram.com/mattp04/utn-tupad-prog1-2025-tpi
- Repository: https://github.com/mattp04/utn-tupad-prog1-2025-tpi

## Overview

- Input Data: Paises.csv
- Entry Point: main.py
- CSV Reader: funciones/leer_csv.py
- Menu Dispatcher: funciones/menu.py
- Functional Modules:
- buscar_pais.py
- filtrar_paises.py
- ordenar_paises.py & ordenar_lista.py
- obtener_dato.py
- mostrar_paises.py
- mostrar_estadisticas.py
- Output: Console (print results back to user)

a. main.py → leer_csv.py: load the CSV into an in-memory list of country records.
b. main.py → menu.py: present options and read user choice.
c. menu.py → the chosen functional module(s): depending on user selection, call one of the modules.
d. Functional module(s) → (optionally) ordenar_lista.py or obtener_dato.py: helper modules for sorting or extracting a field.
e. Functional module(s) → mostrar_paises.py or mostrar_estadisticas.py: render the results.
f. After display → loop back to menu.py or exit.

##### Patterns
- Modular design: each “funciones/…” file is a single-responsibility module.
- Central dispatcher (menu) that routes to specialized functions.
- Helper modules (ordenar_lista, obtener_dato) shared by multiple features.

##### Putting It All Together
- Main.py next, then menu.py beneath it.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Nodes
    CSV["Paises.csv"]:::data
    Main["main.py"]:::core
    Menu["menu.py"]:::core

    subgraph "funciones/"
        Buscar["buscar_pais.py"]:::feature
        Filtrar["filtrar_paises.py"]:::feature
        OrdenarP["ordenar_paises.py"]:::feature
        ObtenerDato["obtener_dato.py"]:::helper
        OrdenarLista["ordenar_lista.py"]:::helper
        MostrarP["mostrar_paises.py"]:::feature
        MostrarE["mostrar_estadisticas.py"]:::feature
    end

    Console["Console Output"]:::output

    %% Flow
    CSV -->|"raw CSV"| Main
    Main -->|"list of dicts"| LeerCSV
    Main -->|"start menu"| Menu

    subgraph "_hidden_"
        LeerCSV["leer_csv.py"]:::feature
    end

    Menu -->|"user choice"| Buscar
    Menu -->|"user choice"| Filtrar
    Menu -->|"user choice"| OrdenarP
    Menu -->|"user choice"| ObtenerDato
    Menu -->|"user choice"| MostrarP
    Menu -->|"user choice"| MostrarE

    Buscar -->|"country name"| MostrarP
    Filtrar -->|"filter criteria"| OrdenarLista
    Filtrar -->|"filtered list"| MostrarP
    OrdenarP -->|"sort key"| OrdenarLista
    OrdenarP -->|"sorted list"| MostrarP
    ObtenerDato -->|"field name"| MostrarE
    MostrarP -->|"printed list"| Console
    MostrarE -->|"printed stats"| Console

    Console -->|"return to menu"| Menu

    %% Click Events
    click CSV "https://github.com/mattp04/utn-tupad-prog1-2025-tpi/blob/main/Paises.csv"
    click Main "https://github.com/mattp04/utn-tupad-prog1-2025-tpi/blob/main/main.py"
    click LeerCSV "https://github.com/mattp04/utn-tupad-prog1-2025-tpi/blob/main/funciones/leer_csv.py"
    click Menu "https://github.com/mattp04/utn-tupad-prog1-2025-tpi/blob/main/funciones/menu.py"
    click Buscar "https://github.com/mattp04/utn-tupad-prog1-2025-tpi/blob/main/funciones/buscar_pais.py"
    click Filtrar "https://github.com/mattp04/utn-tupad-prog1-2025-tpi/blob/main/funciones/filtrar_paises.py"
    click OrdenarP "https://github.com/mattp04/utn-tupad-prog1-2025-tpi/blob/main/funciones/ordenar_paises.py"
    click OrdenarLista "https://github.com/mattp04/utn-tupad-prog1-2025-tpi/blob/main/funciones/ordenar_lista.py"
    click ObtenerDato "https://github.com/mattp04/utn-tupad-prog1-2025-tpi/blob/main/funciones/obtener_dato.py"
    click MostrarP "https://github.com/mattp04/utn-tupad-prog1-2025-tpi/blob/main/funciones/mostrar_paises.py"
    click MostrarE "https://github.com/mattp04/utn-tupad-prog1-2025-tpi/blob/main/funciones/mostrar_estadisticas.py"

    %% Styles
    classDef data fill:#a2cffe,stroke:#333,stroke-width:1px
    classDef core fill:#a2fba2,stroke:#333,stroke-width:1px
    classDef feature fill:#fdfba2,stroke:#333,stroke-width:1px
    classDef helper fill:#fcae70,stroke:#333,stroke-width:1px
    classDef output fill:#dddddd,stroke:#333,stroke-width:1px
```
