# stredes/inventario_app architecture

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

- Interactive diagram: https://gitdiagram.com/stredes/inventario_app
- Repository: https://github.com/stredes/inventario_app

## Overview

##### Project type and purpose
- This is a desktop inventory management application (“Inventario App”) written in Python.
- It uses Tkinter for the GUI, SQLAlchemy + SQLite for persistence, and follows a modular architecture (GUI, Core, Data, Utils, Reports).

##### File structure
Top-level directories and files:
- config/settings.ini – application configuration.
- docs/ – architecture overview and database schema.
- src/
- main.py – entry point (initializes Tkinter main window).
- gui/ – all Tkinter views and dialogs (ProductsView, SuppliersView, etc.).
- core/ – business-domain managers (inventory_manager, purchase_manager, sales_manager, supplier_product_manager).
- data/ – data‐access layer: database connection (database.py), ORM models (models.py), repository wrapper (repository.py).
- reports/ – reporting logic and print backend.
- utils/ – helpers (image storage, PO/SO generators).
- app_data/media/products – folder for persisted product images.
- tests/ – pytest test cases for core and data layers.
- scripts/seed_fake_data.py – data seeding for development/testing.
- run_app.py / setup.py / requirements.txt – app launcher and dependencies.

##### README for additional insights
- Confirms modular architecture: GUI, Core, Data.
- Entry command: python -m src.main → creates SQLite file in src/data/.
- Highlights primary features (Products, Suppliers, Purchases, Inventory Movements).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layers
    subgraph "Presentation Layer"
        MW["Main Window"]:::gui
        PV["Products View"]:::gui
        SV["Suppliers View"]:::gui
        PurchV["Purchases View"]:::gui
        SalesV["Sales View"]:::gui
        CustV["Customers View"]:::gui
        InvV["Inventory View"]:::gui
        InvFilt["Inventory Filters Dialog"]:::gui
        OrdersV["Orders Admin View"]:::gui
        PrinterDlg["Printer Select Dialog"]:::gui
        ImgBox["Product Image Box"]:::gui
    end

    subgraph "Business Logic Layer"
        IM["Inventory Manager"]:::core
        PM["Purchase Manager"]:::core
        SM["Sales Manager"]:::core
        SPM["Supplier-Product Manager"]:::core
    end

    subgraph "Data Access Layer"
        DBConn["Database Connection"]:::data
        Models["ORM Models"]:::data
        Repo["Repository"]:::data
    end

    subgraph "Persistence"
        Sqlite["SQLite DB"]:::db
        Media["Media Storage"]:::media
    end

    subgraph "Reporting Module"
        Reports["Inventory Reports"]:::report
        PrintBE["Print Backend"]:::report
    end

    subgraph "Utility Modules"
        Helpers["Helpers"]:::utils
        ImgStore["Image Storage Service"]:::utils
        POG["PO Generator"]:::utils
        SOG["SO Generator"]:::utils
    end

    Config["Configuration Service"]:::config

    %% External User
    User(("User")):::external

    %% Relationships
    User -->|interacts| MW

    MW -->|calls| IM
    PV -->|calls| IM
    SV -->|calls| SPM
    PurchV -->|calls| PM
    SalesV -->|calls| SM
    CustV -->|calls| SM
    InvV -->|calls| IM
    InvFilt -->|filters| IM
    OrdersV -->|calls| POG
    OrdersV -->|calls| SOG
    PrinterDlg -->|selects| PrintBE
    ImgBox -->|uses| ImgStore

    IM -->|CRUD| Repo
    PM -->|CRUD| Repo
    SM -->|CRUD| Repo
    SPM -->|CRUD| Repo

    Repo -->|defines| Models
    Models -->|connects| DBConn
    DBConn -->|reads\/writes| Sqlite
    ImgStore -->|stores images| Media

    IM -->|generates| Reports
    PM -->|generates| Reports
    SM -->|generates| Reports
    Reports -->|sends print jobs| PrintBE

    IM -->|uses| Helpers
    PM -->|uses| Helpers
    SM -->|uses| Helpers
    MW -->|uses| Helpers
    MW -->|uses| Config
    DBConn -->|reads config| Config

    %% Click Events
    click Config "https://github.com/stredes/inventario_app/blob/main/config/settings.ini"
    click MW "https://github.com/stredes/inventario_app/blob/main/src/gui/main_window.py"
    click PV "https://github.com/stredes/inventario_app/blob/main/src/gui/products_view.py"
    click SV "https://github.com/stredes/inventario_app/blob/main/src/gui/suppliers_view.py"
    click PurchV "https://github.com/stredes/inventario_app/blob/main/src/gui/purchases_view.py"
    click SalesV "https://github.com/stredes/inventario_app/blob/main/src/gui/sales_view.py"
    click CustV "https://github.com/stredes/inventario_app/blob/main/src/gui/customers_view.py"
    click InvV "https://github.com/stredes/inventario_app/blob/main/src/gui/inventory_view.py"
    click InvFilt "https://github.com/stredes/inventario_app/blob/main/src/gui/inventory_filters_dialog.py"
    click OrdersV "https://github.com/stredes/inventario_app/blob/main/src/gui/orders_admin_view.py"
    click PrinterDlg "https://github.com/stredes/inventario_app/blob/main/src/gui/printer_select_dialog.py"
    click ImgBox "https://github.com/stredes/inventario_app/blob/main/src/gui/widgets/product_image_box.py"
    click IM "https://github.com/stredes/inventario_app/blob/main/src/core/inventory_manager.py"
    click PM "https://github.com/stredes/inventario_app/blob/main/src/core/purchase_manager.py"
    click SM "https://github.com/stredes/inventario_app/blob/main/src/core/sales_manager.py"
    click SPM "https://github.com/stredes/inventario_app/blob/main/src/core/supplier_product_manager.py"
    click DBConn "https://github.com/stredes/inventario_app/blob/main/src/data/database.py"
    click Models "https://github.com/stredes/inventario_app/blob/main/src/data/models.py"
    click Repo "https://github.com/stredes/inventario_app/blob/main/src/data/repository.py"
    click Media "https://github.com/stredes/inventario_app/tree/main/app_data/media/products"
    click Reports "https://github.com/stredes/inventario_app/blob/main/src/reports/inventory_reports.py"
    click PrintBE "https://github.com/stredes/inventario_app/blob/main/src/reports/print_backend.py"
    click Helpers "https://github.com/stredes/inventario_app/blob/main/src/utils/helpers.py"
    click ImgStore "https://github.com/stredes/inventario_app/blob/main/src/utils/image_store.py"
    click POG "https://github.com/stredes/inventario_app/blob/main/src/utils/po_generator.py"
    click SOG "https://github.com/stredes/inventario_app/blob/main/src/utils/so_generator.py"
    click UDScript "https://github.com/stredes/inventario_app/blob/main/scripts/seed_fake_data.py"
    click TestCore "https://github.com/stredes/inventario_app/blob/main/tests/test_core.py"
    click TestData "https://github.com/stredes/inventario_app/blob/main/tests/test_data.py"
    click Setup "https://github.com/stredes/inventario_app/blob/main/setup.py"
    click Req "https://github.com/stredes/inventario_app/blob/main/requirements.txt"
    click DocsArch "https://github.com/stredes/inventario_app/blob/main/docs/architecture.md"
    click DocsSchema "https://github.com/stredes/inventario_app/blob/main/docs/database_schema.md"

    %% Styles
    classDef gui fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef core fill:#d4edda,stroke:#333,stroke-width:1px
    classDef data fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef db fill:#f8d7da,stroke:#333,stroke-width:1px
    classDef media fill:#e2e3e5,stroke:#333,stroke-width:1px
    classDef report fill:#e6ccff,stroke:#333,stroke-width:1px
    classDef utils fill:#f0f0f0,stroke:#333,stroke-width:1px
    classDef config fill:#d1ecf1,stroke:#333,stroke-width:1px
    classDef external fill:#ffffff,stroke:#666,stroke-dasharray: 4 2,stroke-width:1px
```
