# claudesaul/salesforce-taskmanager architecture

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

- Interactive diagram: https://gitdiagram.com/claudesaul/salesforce-taskmanager
- Repository: https://github.com/claudesaul/salesforce-taskmanager

## Overview

##### Project type and purpose
- This is a Python‐based command‐line Service Technician Management System.
- It manages technicians’ tasks by loading initial data from text files, persisting it into an SQLite database, and offering CLI menus for inventory, customer, and machine management.
- Key features include viewing machines needing repair, distance calculations between customer sites, on-the-fly inventory updates, service history lookups, and order suggestions.

##### File structure
- Top‐level items:
- Inventory_Management.py – main application logic (presentation + business layer)
- Inventory Management Tests.py – unit tests for core functionality
- README.md – project overview and usage instructions
- inventoryList.txt, customerList.txt, machinesList.txt – initial data sources
- No separate “frontend” or “backend” folders; the CLI acts as the presentation layer, and the business logic and persistence are together in a single script.

##### README for additional insights
- Confirms Python + SQLite usage.
- Data files are parsed and loaded into an in-memory or file-based SQLite database on each run.
- No external web front end; pure CLI interactions.
- Distance calculation likely uses an internal algorithm or a geolocation library.

##### Components
a. Data Sources
- Text File Ingestion Module (parses .txt files)
- inventoryList.txt, customerList.txt, machinesList.txt
b. Database Layer
- SQLite Engine (schema: Inventory, Customers, Machines, ServiceHistory tables)
- Data Access Objects (CRUD)
c. Business Logic Layer
- Inventory Management (add/remove/update items)
- Customer Management (list, details, distance calculations)
- Machine Management (status, location, service history)
d. Presentation Layer
- CLI Menu & Input Handler
e. (Optional) External Services
- Geocoding/Distance API or internal algorithm for computing distances

##### Relationships and interactions
- On startup, the File Ingestion Module reads all text files → populates SQLite.
- CLI Menu → invokes Business Logic functions → issues SQL queries via Data Access Objects → returns results.
- Business Logic may call Distance Calculation component → uses either internal math or an external API.
- Inventory modifications in Business Logic → commit back to SQLite → persisted until next run.
- Unit Tests exercise Business Logic and Data Access with mock or test DB instances.

##### Architectural patterns / design principles
- Layered architecture: Presentation (CLI) → Business Logic → Data Access → Persistence (SQLite).
- Single‐responsibility: separate modules for ingestion, logic, DB operations, and tests.
- Data initialization pattern: seed DB from static files on each boot for reproducibility.
- Test harness to validate core modules independently of the live DB.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Data Sources"
        TXT1["inventoryList.txt"]:::filesIO
        TXT2["customerList.txt"]:::filesIO
        TXT3["machinesList.txt"]:::filesIO
    end

    subgraph "Ingestion Module"
        Ingest["Text File Ingestion Module"]:::coreModules
    end

    subgraph "Presentation Layer"
        CLI["CLI Menu & Input Handler"]:::presentation
    end

    subgraph "Business Logic Layer"
        BizInv["Inventory Management"]:::coreModules
        BizCust["Customer Management"]:::coreModules
        BizMach["Machine Management"]:::coreModules
        Distance["Distance Calculation Component"]:::coreModules
    end

    subgraph "Data Access Layer"
        DAO["Data Access Objects"]:::coreModules
    end

    subgraph "Persistence Layer"
        DB["SQLite Database"]:::persistence
    end

    External["External Geolocation API"]:::external

    subgraph "Documentation & Testing"
        Tests["Unit Tests"]:::filesIO
        Readme["README.md"]:::filesIO
    end

    TXT1 -->|"LOAD initial data"| Ingest
    TXT2 -->|"LOAD initial data"| Ingest
    TXT3 -->|"LOAD initial data"| Ingest
    Ingest -->|"INSERT data"| DB

    CLI -->|"commands"| BizInv
    CLI -->|"commands"| BizCust
    CLI -->|"commands"| BizMach

    BizInv -->|"CRUD operations"| DAO
    BizCust -->|"CRUD operations"| DAO
    BizMach -->|"CRUD operations"| DAO

    DAO -->|"SQL queries"| DB

    BizCust -->|"compute distance"| Distance
    Distance -->|"API call"| External

    Tests -->|"validate Business Logic & Data Access"| BizInv
    Tests -->|"validate Business Logic & Data Access"| DAO
    Readme --- Tests

    subgraph "Legend"
        F1["Text Files"]:::filesIO
        M1["Core Modules"]:::coreModules
        P1["SQLite"]:::persistence
        C1["CLI"]:::presentation
        E1["External API"]:::external
    end

    click TXT1 "https://github.com/claudesaul/salesforce-taskmanager/blob/main/inventoryList.txt"
    click TXT2 "https://github.com/claudesaul/salesforce-taskmanager/blob/main/customerList.txt"
    click TXT3 "https://github.com/claudesaul/salesforce-taskmanager/blob/main/machinesList.txt"
    click Ingest "https://github.com/claudesaul/salesforce-taskmanager/blob/main/Inventory_Management.py"
    click CLI "https://github.com/claudesaul/salesforce-taskmanager/blob/main/Inventory_Management.py"
    click BizInv "https://github.com/claudesaul/salesforce-taskmanager/blob/main/Inventory_Management.py"
    click BizCust "https://github.com/claudesaul/salesforce-taskmanager/blob/main/Inventory_Management.py"
    click BizMach "https://github.com/claudesaul/salesforce-taskmanager/blob/main/Inventory_Management.py"
    click Distance "https://github.com/claudesaul/salesforce-taskmanager/blob/main/Inventory_Management.py"
    click DAO "https://github.com/claudesaul/salesforce-taskmanager/blob/main/Inventory_Management.py"
    click Tests "https://github.com/claudesaul/salesforce-taskmanager/blob/main/Inventory Management Tests.py"
    click Readme "https://github.com/claudesaul/salesforce-taskmanager/blob/main/README.md"

    classDef filesIO fill:#ADD8E6,stroke:#333,stroke-width:1px;
    classDef coreModules fill:#90ee90,stroke:#333,stroke-width:1px;
    classDef persistence fill:#FFA500,stroke:#333,stroke-width:1px;
    classDef presentation fill:#D3D3D3,stroke:#333,stroke-width:1px;
    classDef external fill:#ADD8E6,stroke:#333,stroke-width:1px;
```
