# jaygreco/maginkcal architecture

> Architecture diagram of the GitHub repository jaygreco/maginkcal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jaygreco/maginkcal
- Repository: https://github.com/jaygreco/maginkcal

## Overview

Key Components to Include:

##### Data Sources Layer
- Google Calendar API (represented by gcal_engine/)
- iCloud Calendar (represented by ical_engine/)

##### Core Processing Layer
- Render_engine component showing:
- HTML template processing
- CSS styling
- Image rendering pipeline (cutycapt + xvfb)
- Configuration management (config.py and config.json)

##### Hardware Interface Layer
- Epd_hidapi component (shown as a submodule)
- Adafruit ThinkInk feather connection
- E-ink display panel

##### System Management Layer
- Systemd service components for scheduling and management

- [Calendar Services] → [Core Processing] → [Hardware Interface] → [Physical Display]

- Calendar data flow from services
- Rendered image data to display
- Configuration information flow

##### Gray: System management components

Key Relationships to Highlight:

##### Render pipeline
- HTML Template → CSS Styling → cutycapt/xvfb → Image Processing → HID Protocol
##### Demonstrate the systemd timer triggering the update cycle

Special Considerations:

##### Configuration feedback loop

- Data flow directions
- Component types
- Update cycle timing
- External dependencies

Level of Detail:

##### Hardware communication protocol

- The modular nature of the calendar sources
- The rendering pipeline's components
- The hardware interface layer
- The system's automated nature through systemd

Remember to include version/dependency information in a notes section, as this is a fork with specific requirements different from the upstream project.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef external fill:#a8d1f0,stroke:#333
    classDef core fill:#90EE90,stroke:#333
    classDef config fill:#FFE4B5,stroke:#333
    classDef hardware fill:#FFB6C1,stroke:#333
    classDef system fill:#D3D3D3,stroke:#333
    classDef render fill:#98FB98,stroke:#333

    %% Data Sources Layer
    subgraph DataSources
        GCal[("Google Calendar")]:::external
        ICal[("iCloud Calendar")]:::external
        GCalEngine["GCal Engine"]:::core
        ICalEngine["iCal Engine"]:::core
    end

    %% Core Processing Layer
    subgraph CoreProcessing
        MainApp["MagInkCal Controller"]:::core
        Config["Configuration Handler"]:::config
        ConfigFile["config.json"]:::config
    end

    %% Render Pipeline
    subgraph RenderPipeline
        Template["HTML Template"]:::render
        CSS["CSS Styling"]:::render
        RenderEngine["Render Engine"]:::render
        CutyCapt["CutyCapt"]:::render
        Xvfb["Xvfb"]:::render
    end

    %% Hardware Interface Layer
    subgraph HardwareInterface
        HIDAPI["EPD HIDAPI"]:::hardware
        Feather["Adafruit ThinkInk"]:::hardware
        Display["E-Ink Display"]:::hardware
    end

    %% System Management Layer
    subgraph SystemManagement
        Service["Systemd Service"]:::system
        Timer["Systemd Timer"]:::system
    end

    %% Relationships
    GCal --> GCalEngine
    ICal --> ICalEngine
    GCalEngine --> MainApp
    ICalEngine --> MainApp
    MainApp --> RenderEngine
    Config --> MainApp
    ConfigFile --> Config
    Template --> RenderEngine
    CSS --> RenderEngine
    RenderEngine --> CutyCapt
    CutyCapt --> HIDAPI
    Xvfb --> CutyCapt
    HIDAPI --> Feather
    Feather --> Display
    Timer --> Service
    Service --> MainApp

    %% Click Events
    click GCalEngine "https://github.com/jaygreco/MagInkCal/blob/main/gcal_engine/gcal.py"
    click ICalEngine "https://github.com/jaygreco/MagInkCal/blob/main/ical_engine/ical.py"
    click MainApp "https://github.com/jaygreco/MagInkCal/blob/main/maginkcal.py"
    click Template "https://github.com/jaygreco/MagInkCal/blob/main/render_engine/calendar_template.html"
    click CSS "https://github.com/jaygreco/MagInkCal/blob/main/render_engine/styles.css"
    click RenderEngine "https://github.com/jaygreco/MagInkCal/blob/main/render_engine/render.py"
    click Config "https://github.com/jaygreco/MagInkCal/blob/main/config.py"
    click ConfigFile "https://github.com/jaygreco/MagInkCal/blob/main/config.json.sample"
    click HIDAPI "https://github.com/jaygreco/MagInkCal/tree/main/epd_hidapi/"
    click Service "https://github.com/jaygreco/MagInkCal/blob/main/systemd/maginkcal.service"
    click Timer "https://github.com/jaygreco/MagInkCal/blob/main/systemd/maginkcal.timer"

    %% Legend
    subgraph Legend
        L1["External Services"]:::external
        L2["Core Components"]:::core
        L3["Configuration"]:::config
        L4["Hardware"]:::hardware
        L5["System"]:::system
        L6["Render Pipeline"]:::render
    end
```
