# mgriot/dataentrykpi architecture

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

- Interactive diagram: https://gitdiagram.com/mgriot/dataentrykpi
- Repository: https://github.com/mgriot/dataentrykpi

## Overview

##### Project type and purpose
- This is a desktop/web dashboard application (“dataentryKPI”) for visualizing and analyzing data‐entry KPIs.
- It offers two UI flavors—Streamlit (web) and Tkinter (desktop)—for charting, filtering, performance tracking, and data export of Excel-based sources.

##### File structure
- Top-level: README, requirements.txt.
- src/
- app_streamlit.py – Streamlit UI entrypoint
- app_tkinter.py – Tkinter UI entrypoint
- main.py – Orchestrates the workflow between UI, data loading, processing, and export
- database_manager.py – Reads, parses, and filters Excel data into in-memory structures (e.g., pandas DataFrames)
- export_manager.py – Exports processed data to CSV, Excel, etc.

##### README for additional insights
- Dependencies: pandas, streamlit, openpyxl (implicit).
- Usage: “streamlit run …” for web, place Excel files in a data directory, then filter via UI.
- Customization: add KPIs, modify filters, tweak layout in the Python code.

a. Main components
1. UI Layer
- Streamlit App (app_streamlit.py)
- Tkinter App (app_tkinter.py)
2. Business Logic Layer
- main.py (controller/orchestrator)
3. Data Access Layer
- database_manager.py (Excel reader, filter functions)
4. Export Layer
- export_manager.py (CSV/Excel writer)
5. Data Source
- Raw Excel files
6. External Libraries
- pandas, openpyxl, streamlit, tkinter, etc.

b. Relationships and interactions
1. User → selects UI (Streamlit/Tkinter) → triggers main.py
2. main.py → invokes database_manager to load and filter Excel data
3. Processed data → returned to main.py → passed to UI for rendering charts & tables
4. User export action → main.py → invokes export_manager → writes CSV/Excel
5. Data flow is unidirectional: UI → controller → data layer → controller → UI/export

c. Architectural patterns/design principles
- Modular separation (UI / controller / data access / export) reminiscent of MVC
- Single responsibility for each module
- Pluggable UI backends (Streamlit vs Tkinter) share the same core logic

d. Key technologies/frameworks
- streamlit for web UI
- tkinter for desktop UI
- pandas & openpyxl for Excel I/O and data manipulation
- standard Python modules and packaging (requirements.txt)

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User"]:::ext

    subgraph "UI Layer"
        UI_Streamlit["app_streamlit.py: Web UI"]:::ui
        UI_Tkinter["app_tkinter.py: Desktop UI"]:::ui
    end

    Controller["main.py: Controller"]:::controller

    subgraph "Data Access Layer"
        DataAccess["database_manager.py: Excel Reader/Filter"]:::data
    end

    subgraph "Export Layer"
        Export["export_manager.py: CSV/Excel Writer"]:::data
        FileOut["Exported CSV/Excel"]:::ext
    end

    subgraph "Data Source"
        ExcelFiles["Raw Excel Files"]:::ext
    end

    subgraph "Documentation & Dependencies"
        README["README.md"]:::docs
        Requirements["requirements.txt"]:::docs
    end

    User --> UI_Streamlit
    User --> UI_Tkinter

    UI_Streamlit -->|"invoke"| Controller
    UI_Tkinter -->|"invoke"| Controller

    Controller -->|"load/filter"| DataAccess
    DataAccess -->|"read Excel"| ExcelFiles
    DataAccess -->|"return DataFrame"| Controller

    Controller -->|"render data"| UI_Streamlit
    Controller -->|"render data"| UI_Tkinter

    Controller -->|"export action"| Export
    Export -->|"write files"| FileOut

    click UI_Streamlit "https://github.com/mgriot/dataentrykpi/blob/main/src/app_streamlit.py"
    click UI_Tkinter "https://github.com/mgriot/dataentrykpi/blob/main/src/app_tkinter.py"
    click Controller "https://github.com/mgriot/dataentrykpi/blob/main/src/main.py"
    click DataAccess "https://github.com/mgriot/dataentrykpi/blob/main/src/database_manager.py"
    click Export "https://github.com/mgriot/dataentrykpi/blob/main/src/export_manager.py"
    click README "https://github.com/mgriot/dataentrykpi/blob/main/README.md"
    click Requirements "https://github.com/mgriot/dataentrykpi/blob/main/requirements.txt"

    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef controller fill:#90EE90,stroke:#333,stroke-width:1px
    classDef data fill:#FFA500,stroke:#333,stroke-width:1px
    classDef ext fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef docs fill:#E0E0E0,stroke:#333,stroke-width:1px
```
