# francocontigo/dundie-rewards architecture

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

- Interactive diagram: https://gitdiagram.com/francocontigo/dundie-rewards
- Repository: https://github.com/francocontigo/dundie-rewards

## Overview

##### Main Components

A. Core System Components:
- CLI Interface (Entry Point)
- Core Business Logic
- Database Layer
- User Management
- Email System
- Logging System

B. Data Storage:
- JSON Database (assets/database.json)
- Employee Data Source (CSV/JSON input)

**[User Input Layer]**

- ▼
**[CLI Layer (dundie/cli.py)]**

- ▼
**[Core Layer (dundie/core.py)]**

- ┬────────────┐
- ▼            ▼            ▼
**[Database]   [User Utils]  [Email System]**

##### Component Details

A. Input/Output Layer:
- CSV/JSON file input
- CLI commands interface
- Logging output

B. Business Logic Layer:
- Core reward management (dundie/core.py)
- User management (dundie/utils/user.py)
- Point transaction handling

C. Data Persistence Layer:
- Database operations (dundie/utils/db.py)
- Data models (dundie/models.py)

##### Key Interactions to Highlight

- CSV/JSON input → User Management
- CLI Commands → Core Logic
- Core Logic ↔ Database
- Core Logic → Email Notifications

**┌─────────────────────────────────────────────┐**
- Dundie Rewards             │
- ┘

- ▼
**┌─────────────────────────────────────────────┐**
- Input Sources                 │
- ┌─────────────┐          ┌─────────────┐  │
- CSV File  │          │  CLI Input  │  │
- ┘          └─────────────┘  │
- ┘

- ▼
**┌─────────────────────────────────────────────┐**
- Business Logic                  │
- ┌─────────────┐    ┌───────────────────┐  │
- Core.py    │◄──►│    Models.py      │  │
- ┘    └───────────────────┘  │
- ┘

- ▼
**┌─────────────────────────────────────────────┐**
- Services Layer                  │
- ┌─────────────┐    ┌───────────────────┐  │
- Database   │    │   Email System    │  │
- ┘    └───────────────────┘  │
- ┘

##### Additional Notes

- Version information and date
- Test coverage boundaries
- Configuration flow

Remember to include:
- Component names
- Data flow directions
- File references
- Integration points
- Configuration sources
- Testing boundaries

This will provide a comprehensive view of the Dundie Rewards system while maintaining the flexibility to add future planned features like UI, web interface, and API endpoints.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        CSV["Employee Data (CSV)"]:::input
        CLI["CLI Interface"]:::input
    end

    subgraph Core
        CORE["Core Business Logic"]:::core
        MODELS["Data Models"]:::core
    end

    subgraph Services
        DB["Database Layer"]:::service
        EMAIL["Email System"]:::service
        LOG["Logging System"]:::service
        USER["User Management"]:::service
    end

    subgraph Storage
        JSON_DB["JSON Database"]:::storage
    end

    subgraph Testing
        UNIT["Unit Tests"]:::test
        INT["Integration Tests"]:::test
        TEST_ASSETS["Test Assets"]:::test
    end

    subgraph Config
        SETTINGS["Settings"]:::config
    end

    %% Relationships
    CSV --> CORE
    CLI --> CORE
    CORE <--> MODELS
    CORE --> DB
    CORE --> EMAIL
    CORE --> LOG
    CORE --> USER
    DB <--> JSON_DB
    UNIT --> CORE
    INT --> CORE
    TEST_ASSETS --> UNIT
    SETTINGS --> CORE

    %% Click Events
    click CLI "https://github.com/francocontigo/dundie-rewards/blob/main/dundie/cli.py"
    click CORE "https://github.com/francocontigo/dundie-rewards/blob/main/dundie/core.py"
    click DB "https://github.com/francocontigo/dundie-rewards/blob/main/dundie/utils/db.py"
    click USER "https://github.com/francocontigo/dundie-rewards/blob/main/dundie/utils/user.py"
    click EMAIL "https://github.com/francocontigo/dundie-rewards/blob/main/dundie/utils/email.py"
    click LOG "https://github.com/francocontigo/dundie-rewards/blob/main/dundie/utils/log.py"
    click JSON_DB "https://github.com/francocontigo/dundie-rewards/blob/main/assets/database.json"
    click CSV "https://github.com/francocontigo/dundie-rewards/blob/main/assets/people.csv"
    click MODELS "https://github.com/francocontigo/dundie-rewards/blob/main/dundie/models.py"
    click SETTINGS "https://github.com/francocontigo/dundie-rewards/blob/main/dundie/settings.py"
    click INT "https://github.com/francocontigo/dundie-rewards/blob/main/integration/test_load.py"
    click UNIT "https://github.com/francocontigo/dundie-rewards/tree/main/tests"
    click TEST_ASSETS "https://github.com/francocontigo/dundie-rewards/blob/main/tests/assets/people.csv"

    %% Styles
    classDef input fill:#2374AB
    classDef core fill:#48A9A6
    classDef service fill:#E4B363
    classDef storage fill:#C1666B
    classDef test fill:#D4B483
    classDef config fill:#4A5859

    %% Legend
    subgraph Legend
        L1["Input Layer"]:::input
        L2["Core Layer"]:::core
        L3["Services Layer"]:::service
        L4["Storage Layer"]:::storage
        L5["Testing Layer"]:::test
        L6["Configuration"]:::config
    end
```
