# alk3mist/temno architecture

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

- Interactive diagram: https://gitdiagram.com/alk3mist/temno
- Repository: https://github.com/alk3mist/temno

## Overview

##### Project type and purpose
- This is a Python‑based CLI application (“temno”) that consumes the Yasno Outage Scheduling REST API, formats the data, and presents schedules (daily/weekly) or exports calendars (iCalendar).
- It is a single‑executable CLI tool, not a web or GUI app.

##### File structure
- Top‑level:
- src/temno – the CLI application package
- src/yasno_api – the standalone HTTP client + schema definitions for the external API
- doc/adr – architecture decision records
- tests/ – unit + integration tests (with VCR cassettes for HTTP replay)
- Key modules under src/temno:
- __main__.py / cli.py – Typer‑based command definitions
- bootstrap.py – dependency injection (Wireup / DI container)
- model.py, schema mapping (map_yasno.py)
- calendar.py, arange.py – core scheduling logic
- views.py – formatting output / ICS export
- Configuration: pyproject.toml (build & dependencies), .python-version, .vscode, .gitignore

##### README for additional insights
- Shows CLI commands: cities, streets, houses, schedule daily/weekly, ical export.
- Mentions use of uv, pipx, and warns it is a pet project sandbox.

##### Summary of essential architectural elements to capture
- The layered separation (Interface – DI – Domain – I/O)
- Core scheduling logic as an independent module
- Adapter modules for HTTP calls and data mapping
- Export paths: terminal vs. ICS file
- Test harness using VCR for reproducibility

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Temno application layers
    subgraph "Temno App" 
        direction TB
        CLI["CLI Layer\n(src/temno/cli.py,\n__main__.py)"]:::internal
        DI["DI/Bootstrap Layer\n(src/temno/bootstrap.py)"]:::infra
        DomainModel["Domain Model Definitions\n(src/temno/model.py)"]:::internal
        Mapper["Data Mapper\n(src/temno/map_yasno.py)"]:::internal
        Arange["Time Slot Generator\n(src/temno/arange.py)"]:::internal
        CalendarMod["Calendar Combiner\n(src/temno/calendar.py)"]:::internal
        Views["View Renderer\n(src/temno/views.py)"]:::internal
    end

    %% Yasno API client & schema
    subgraph "Yasno API Adapter"
        direction TB
        APIClient["API-Client Service\n(src/yasno_api/client.py)"]:::internal
        APISchema["API Schema Definitions\n(src/yasno_api/schema.py)"]:::internal
    end

    %% Infrastructure
    Cache["HTTP Cache Layer"]:::infra
    FileSys["File System\n(ICS file output)"]:::infra
    Config["Configuration\n(pyproject.toml)"]:::infra
    ExternalAPI["Yasno Scheduling API\n(HTTPS)"]:::external

    %% Tests
    subgraph "Tests"
        direction TB
        subgraph "Temno Tests"
            TestCLI["test_cli.py"]:::test
            TestCalendar["test_calendar.py"]:::test
            TestMap["test_map_yasno.py"]:::test
        end
        subgraph "Yasno API Tests"
            TestClient["test_client.py"]:::test
            VCRCass["VCR Cassettes"]:::test
        end
    end

    %% Data / control flow
    CLI -->|initialize| DI
    CLI -->|invoke command| DI
    DI --> APIClient
    DI --> DomainModel
    DI --> Mapper
    DI --> Arange
    DI --> CalendarMod
    DI --> Views

    APIClient -->|HTTP call| Cache
    Cache -->|forward| ExternalAPI
    APIClient -->|parse| APISchema
    APISchema -->|map| Mapper
    Mapper -->|produce| DomainModel
    DomainModel -->|data| Arange
    Arange -->|slots| CalendarMod
    CalendarMod -->|schedule| Views
    Views -->|write ICS| FileSys

    %% Tests associations
    TestCLI -.-> CLI
    TestCalendar -.-> CalendarMod
    TestMap -.-> Mapper
    TestClient -.-> APIClient
    VCRCass -.-> Cache

    %% Click events
    click CLI "https://github.com/alk3mist/temno/blob/main/src/temno/cli.py"
    click DI "https://github.com/alk3mist/temno/blob/main/src/temno/bootstrap.py"
    click APIClient "https://github.com/alk3mist/temno/blob/main/src/yasno_api/client.py"
    click APISchema "https://github.com/alk3mist/temno/blob/main/src/yasno_api/schema.py"
    click DomainModel "https://github.com/alk3mist/temno/blob/main/src/temno/model.py"
    click Mapper "https://github.com/alk3mist/temno/blob/main/src/temno/map_yasno.py"
    click Arange "https://github.com/alk3mist/temno/blob/main/src/temno/arange.py"
    click CalendarMod "https://github.com/alk3mist/temno/blob/main/src/temno/calendar.py"
    click Views "https://github.com/alk3mist/temno/blob/main/src/temno/views.py"
    click TestCLI "https://github.com/alk3mist/temno/blob/main/tests/temno/test_cli.py"
    click TestCalendar "https://github.com/alk3mist/temno/blob/main/tests/temno/test_calendar.py"
    click TestMap "https://github.com/alk3mist/temno/blob/main/tests/temno/test_map_yasno.py"
    click TestClient "https://github.com/alk3mist/temno/blob/main/tests/yasno_api/test_client.py"
    click VCRCass "https://github.com/alk3mist/temno/tree/main/tests/yasno_api/cassettes/"
    click Config "https://github.com/alk3mist/temno/blob/main/pyproject.toml"

    %% Styling
    classDef internal fill:#d5f5d5,stroke:#28A745,color:#000
    classDef external fill:#aed6f1,stroke:#007bff,color:#000
    classDef infra fill:#f9e79f,stroke:#e67e22,color:#000
    classDef test fill:#dcdcdc,stroke:#888,color:#000
```
