# 0xblxck/mspr_epsi architecture

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

- Interactive diagram: https://gitdiagram.com/0xblxck/mspr_epsi
- Repository: https://github.com/0xblxck/mspr_epsi

## Overview

##### Project type and purpose
- Type: Monolithic Python-based system administration toolkit with both CLI (main.py) and GUI (gui.py) front ends.
- Purpose: Automate diagnostics, backups, and obsolescence audits for NordTransit Logistics’ IT infrastructure.

##### File structure
- Top-level entry points: main.py (CLI launcher), gui.py (GUI launcher)
- modules/ folder: three domain modules—diagnostic.py, backup.py, audit.py
- utils/ folder: shared services—logger.py (logging), output.py (JSON/console formatting)
- config/config.json: runtime parameters (credentials, targets, thresholds)
- data/eol_database.json: local reference data for end-of-life checks
- output/ (implied by README): subdirs backups/, reports/, logs/ for persisting results
- requirements.txt: Python dependencies (e.g., paramiko for SSH, PyMySQL, PySimpleGUI?)
- package.json / pnpm-lock.yaml: likely for packaging or bundling GUI assets (if any JS/CSS)

##### README for additional insights
- Three major functional modules (Diagnostic, Backup, Audit) each performing external interactions
- Dual interface: synchronous CLI menu vs. asynchronous GUI
- Outputs: console prints + JSON files + daily log files
- External dependencies: Windows hosts (WMI/PowerShell), Linux hosts (SSH), MySQL database, network scan for OS detection

##### Essential details to capture
- Configuration precedence: environment variables override config.json.
- Utilities are singletons/services shared by all modules.
- Output directory structure: separate folders for logs, reports, and backups.
- Data/eol_database.json as a read-only reference data store used by the Audit module.
- Error‐handling paths (e.g., Logger logs failures, modules return status codes).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer"
        CLI["CLI Runner"]:::front
        GUI["GUI Runner"]:::front
    end

    subgraph "Business Logic"
        Dispatcher["Module Dispatcher"]:::logic
        Diag["Diagnostic Module"]:::logic
        Backup["Backup Module"]:::logic
        Audit["Audit Module"]:::logic
    end

    subgraph "Infrastructure & Utilities"
        Config["Configuration Store"]:::infra
        Req["Python Dependencies List"]:::infra
        Pkg["GUI Packaging Configuration"]:::infra
        Lock["GUI Packaging Lockfile"]:::infra
        Logger["Logger Service"]:::infra
        OutputSvc["Output Service"]:::infra
        RefData["EOL Reference Data"]:::infra
        OutputStores["Output Stores\n(logs/, reports/, backups/)"]:::infra
    end

    subgraph "External Systems"
        Win["Windows Hosts"]:::external
        Lin["Linux Hosts"]:::external
        MySQL["MySQL Database"]:::external
        Net["Network (IP Scan)"]:::external
    end

    CLI -->|"invokes"| Dispatcher
    GUI -->|"invokes"| Dispatcher
    Dispatcher -->|"loads config"| Config
    Config -->|"provides parameters"| Dispatcher

    Dispatcher -->|"dispatches to"| Diag
    Dispatcher -->|"dispatches to"| Backup
    Dispatcher -->|"dispatches to"| Audit

    Diag -->|"logs steps"| Logger
    Diag -->|"formats output"| OutputSvc
    Diag -->|"SSH/WMI calls"| Win
    Diag -->|"SSH calls"| Lin
    Diag -->|"tests connectivity"| MySQL

    Backup -->|"logs steps"| Logger
    Backup -->|"formats output"| OutputSvc
    Backup -->|"SQL queries"| MySQL
    Backup -->|"writes backups"| OutputStores

    Audit -->|"logs steps"| Logger
    Audit -->|"formats output"| OutputSvc
    Audit -->|"reads data"| RefData
    Audit -->|"network scan"| Net
    Audit -->|"writes reports"| OutputStores

    Logger -->|"writes logs"| OutputStores
    OutputSvc -->|"writes JSON"| OutputStores

    click CLI "https://github.com/0xblxck/mspr_epsi/blob/main/main.py"
    click GUI "https://github.com/0xblxck/mspr_epsi/blob/main/gui.py"
    click Diag "https://github.com/0xblxck/mspr_epsi/blob/main/modules/diagnostic.py"
    click Backup "https://github.com/0xblxck/mspr_epsi/blob/main/modules/backup.py"
    click Audit "https://github.com/0xblxck/mspr_epsi/blob/main/modules/audit.py"
    click Logger "https://github.com/0xblxck/mspr_epsi/blob/main/utils/logger.py"
    click OutputSvc "https://github.com/0xblxck/mspr_epsi/blob/main/utils/output.py"
    click Config "https://github.com/0xblxck/mspr_epsi/blob/main/config/config.json"
    click RefData "https://github.com/0xblxck/mspr_epsi/blob/main/data/eol_database.json"
    click Req "https://github.com/0xblxck/mspr_epsi/blob/main/requirements.txt"
    click Pkg "https://github.com/0xblxck/mspr_epsi/blob/main/package.json"
    click Lock "https://github.com/0xblxck/mspr_epsi/blob/main/pnpm-lock.yaml"

    classDef front fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef logic fill:#90EE90,stroke:#333,stroke-width:1px
    classDef infra fill:#FFFACD,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
