# maddenp/iotaa architecture

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

- Interactive diagram: https://gitdiagram.com/maddenp/iotaa
- Repository: https://github.com/maddenp/iotaa

## Overview

Key Components to Include in the System Design:

##### Core Workflow Engine Components
- Task Decorators (@task, @tasks, @external)
- Asset Management System
- Workflow Execution Engine
- State Management
- CLI Interface

##### Main Architectural Patterns
- Decorator Pattern (for task definitions)
- Generator Pattern (for workflow control flow)
- Observer Pattern (for asset state monitoring)

##### High-Level Components
- [CLI Interface] → [Workflow Engine Core] → [Task Execution System]
- ↓
- [Asset Manager]

##### Detail the Core Components

a. Task Management Layer:
- [@task Decorator] → [Task Definition]
- [@tasks Decorator] → [Task Collection]
- [@external Decorator] → [External Dependencies]

b. Asset Management Layer:
- [Asset Class] → [Reference Management]
- → [State Monitoring]
- → [Readiness Checks]

c. Execution Flow:
- [Task Validation] → [Dependency Resolution] → [State Verification]
- → [Task Execution]

##### Features
- Dry-run capability
- Graph generation
- Logging system
- CLI interface

##### Important Relationships
- [Task] ←→ [Asset]
- [Asset] → [State Check]
- [Workflow] → [Dependency Graph]

Design Guidelines:

##### Generator-based Control Flow
- Three-step yield process
- Task state transitions
- Demonstrate dependency resolution

##### Asset Management
- Reference handling
- Readiness checking
- State monitoring

##### Task Hierarchy
- Regular tasks
- Task collections
- External dependencies

##### Support Systems
- Logging framework
- CLI parser
- Graph generation

##### Integration Points
- External task integration
- File system interaction
- User interface

Key Considerations:

##### Bottom Layer: Task/Asset Management

- Blue: Core system components
- Green: Active/Ready states
- Orange: Pending/Not Ready states
- Gray: External components/dependencies

- State indicators

This design should capture the essential aspects of the workflow engine while maintaining clarity and showing the relationships between components. The emphasis should be on the generator-based control flow and asset management, as these are the key distinguishing features of this implementation.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph CLI
        CLI_Interface["CLI Interface"]
    end

    subgraph Core["Workflow Engine Core"]
        Engine["Workflow Engine"]:::core
        TaskMgmt["Task Management"]:::core
        AssetMgmt["Asset Management"]:::core
        StateSystem["State Management"]:::core
    end

    subgraph TaskLayer["Task Management Layer"]
        TaskDecorator["@task Decorator"]:::decorator
        TasksDecorator["@tasks Decorator"]:::decorator
        ExternalDecorator["@external Decorator"]:::decorator
        TaskDef["Task Definition"]:::task
        TaskColl["Task Collection"]:::task
        ExtDep["External Dependencies"]:::external
    end

    subgraph AssetLayer["Asset Management Layer"]
        AssetClass["Asset Class"]:::asset
        RefMgmt["Reference Management"]:::asset
        StateMon["State Monitoring"]:::asset
        ReadyCheck["Readiness Checks"]:::asset
    end

    subgraph ExecutionFlow["Execution Flow"]
        TaskVal["Task Validation"]:::flow
        DepRes["Dependency Resolution"]:::flow
        StateVer["State Verification"]:::flow
        TaskExec["Task Execution"]:::flow
    end

    subgraph Support["Support Systems"]
        Logging["Logging Framework"]:::support
        GraphGen["Graph Generation"]:::support
        Config["Configuration"]:::support
    end

    %% Connections
    CLI_Interface --> Engine
    Engine --> TaskMgmt
    Engine --> AssetMgmt
    Engine --> StateSystem

    TaskDecorator --> TaskDef
    TasksDecorator --> TaskColl
    ExternalDecorator --> ExtDep

    TaskDef --> TaskVal
    TaskVal --> DepRes
    DepRes --> StateVer
    StateVer --> TaskExec

    AssetClass --> RefMgmt
    AssetClass --> StateMon
    AssetClass --> ReadyCheck

    %% Support System Connections
    Engine -.-> Logging
    Engine -.-> GraphGen
    Engine -.-> Config

    %% Click Events
    click Engine "https://github.com/maddenp/iotaa/blob/main/src/iotaa/__init__.py"
    click Config "https://github.com/maddenp/iotaa/blob/main/src/iotaa/resources/info.json"
    click Support "https://github.com/maddenp/iotaa/tree/main/src/iotaa/resources/"

    %% Styling
    classDef core fill:#2374ab
    classDef decorator fill:#ff7f50
    classDef task fill:#4CAF50
    classDef external fill:#9e9e9e
    classDef asset fill:#ffd700
    classDef flow fill:#87ceeb
    classDef support fill:#deb887

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Decorators"]:::decorator
        L3["Tasks"]:::task
        L4["External"]:::external
        L5["Asset Components"]:::asset
        L6["Flow Control"]:::flow
        L7["Support Systems"]:::support
    end
```
