# swisscatplus/glas architecture

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

- Interactive diagram: https://gitdiagram.com/swisscatplus/glas
- Repository: https://github.com/swisscatplus/glas

## Overview

##### File structure
Top-level files and directories:
- base.py, parser.py, jwt.py, logger.py, models.py
– Core runtime entrypoints: configuration loader, workflow parser, logging and authentication utilities, common domain models.
- database/
– Connector, schema setup, ORM models, and CRUD modules for workflows, tasks, nodes, execution/access logs.
- nodes/
– Abstract base classes, enums, models and implementations of “node” plugins that perform real-world lab operations.
- orchestrator/
– Core scheduler logic: decision engines, state machines, domain models for scheduling.
- task/
– Task-level abstractions, enums and models.
- workflow/
– Workflow definitions, core logic to manage workflow life-cycle.
- GLAS.postman_collection.json
– Hints at an HTTP API (Postman definitions for endpoints).
- .env.example, requirements.txt, GitHub Actions workflows, pylintrc
– Configuration, dependency and CI setup.

##### README for additional insights
- Suggests it is consumed as a service or library; likely exposes an HTTP or CLI interface (Postman collection).

##### Elements
- Blue for core services (Parser, Orchestrator)
- Green for plugins (nodes/)
- Orange for persistence (Database)
- Gray for external systems (Git Repo, Lab Devices)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Client Layer"
        API["Client Interface\n(HTTP API / CLI)"]:::external
    end

    subgraph "Core Services"
        Base["Configuration Loader\n(base.py)"]:::core
        Auth["Authentication (JWT)\n(jwt.py)"]:::core
        Logger["Logging Utility\n(logger.py)"]:::core
        Parser["Workflow Parser\n(parser.py)"]:::core
        subgraph "Orchestrator"
            OrInit["__init__.py"]:::core
            OrBase["base.py"]:::core
            OrEnums["enums.py"]:::core
            OrModels["models.py"]:::core
        end
        subgraph "Task Engine"
            TeInit["__init__.py"]:::core
            TeCore["core.py"]:::core
            TeEnums["enums.py"]:::core
            TeModels["models.py"]:::core
        end
    end

    subgraph "Plugin Layer"
        NPInit["__init__.py"]:::plugin
        NPABC["abc.py"]:::plugin
        NPBase["base.py"]:::plugin
        NPEnums["enums.py"]:::plugin
        NPModels["models.py"]:::plugin
    end

    subgraph "Persistence"
        DBConn["Connector\n(database/connector.py)"]:::persistence
        DBSchema["Schema\n(database/setup/schema.sql)"]:::persistence
        subgraph "DB Models & CRUD"
            DbModels["models.py"]:::persistence
            AccessLogs["access_logs.py"]:::persistence
            ExecutionLogs["execution_logs.py"]:::persistence
            Logs["logs.py"]:::persistence
            NodeTbl["node.py"]:::persistence
            NodeCall["node_call_record.py"]:::persistence
            NodeProp["node_property.py"]:::persistence
            Step["step.py"]:::persistence
            TasksTbl["tasks.py"]:::persistence
            WorkflowTbl["workflow.py"]:::persistence
            UsageRec["workflow_usage_record.py"]:::persistence
        end
    end

    subgraph "Common Models"
        Common["models.py"]:::core
    end

    subgraph "External Systems"
        GitRepo["Git Repository"]:::external
        LabDev["Lab Devices"]:::external
    end

    API -->|triggers| Auth
    API -->|calls| Base
    API -->|calls| Parser
    Parser -->|fetches definitions| GitRepo
    Parser -->|produces model| OrInit
    OrModels -->|schedules workflows| TeInit
    OrInit -->|uses| TeInit
    TeCore -->|dispatches tasks| NPInit
    NPBase -->|invokes| LabDev
    NPBase -->|logs to| DBConn
    OrInit -->|records execution| DBConn
    Auth -->|verifies| DBConn
    DBConn -->|applies schema| DBSchema
    DBConn -->|CRUD operations| DbModels
    DbModels -->|manages| WorkflowTbl
    DbModels -->|manages| TasksTbl
    DbModels -->|manages| NodeTbl
    DbModels -->|manages| Step
    DbModels -->|manages| NodeProp
    DbModels -->|manages| NodeCall
    DbModels -->|manages| UsageRec
    DbModels -->|manages| AccessLogs
    DbModels -->|manages| ExecutionLogs
    Parser -->|uses models| Common

    click API "https://github.com/swisscatplus/glas/blob/main/GLAS.postman_collection.json"
    click Base "https://github.com/swisscatplus/glas/blob/main/base.py"
    click Auth "https://github.com/swisscatplus/glas/blob/main/jwt.py"
    click Logger "https://github.com/swisscatplus/glas/blob/main/logger.py"
    click Parser "https://github.com/swisscatplus/glas/blob/main/parser.py"
    click OrInit "https://github.com/swisscatplus/glas/blob/main/orchestrator/__init__.py"
    click OrBase "https://github.com/swisscatplus/glas/blob/main/orchestrator/base.py"
    click OrEnums "https://github.com/swisscatplus/glas/blob/main/orchestrator/enums.py"
    click OrModels "https://github.com/swisscatplus/glas/blob/main/orchestrator/models.py"
    click TeInit "https://github.com/swisscatplus/glas/blob/main/task/__init__.py"
    click TeCore "https://github.com/swisscatplus/glas/blob/main/task/core.py"
    click TeEnums "https://github.com/swisscatplus/glas/blob/main/task/enums.py"
    click TeModels "https://github.com/swisscatplus/glas/blob/main/task/models.py"
    click NPInit "https://github.com/swisscatplus/glas/blob/main/nodes/__init__.py"
    click NPABC "https://github.com/swisscatplus/glas/blob/main/nodes/abc.py"
    click NPBase "https://github.com/swisscatplus/glas/blob/main/nodes/base.py"
    click NPEnums "https://github.com/swisscatplus/glas/blob/main/nodes/enums.py"
    click NPModels "https://github.com/swisscatplus/glas/blob/main/nodes/models.py"
    click DBConn "https://github.com/swisscatplus/glas/blob/main/database/connector.py"
    click DBSchema "https://github.com/swisscatplus/glas/blob/main/database/setup/schema.sql"
    click DbModels "https://github.com/swisscatplus/glas/blob/main/database/models.py"
    click AccessLogs "https://github.com/swisscatplus/glas/blob/main/database/access_logs.py"
    click ExecutionLogs "https://github.com/swisscatplus/glas/blob/main/database/execution_logs.py"
    click Logs "https://github.com/swisscatplus/glas/blob/main/database/logs.py"
    click NodeTbl "https://github.com/swisscatplus/glas/blob/main/database/node.py"
    click NodeCall "https://github.com/swisscatplus/glas/blob/main/database/node_call_record.py"
    click NodeProp "https://github.com/swisscatplus/glas/blob/main/database/node_property.py"
    click Step "https://github.com/swisscatplus/glas/blob/main/database/step.py"
    click TasksTbl "https://github.com/swisscatplus/glas/blob/main/database/tasks.py"
    click WorkflowTbl "https://github.com/swisscatplus/glas/blob/main/database/workflow.py"
    click UsageRec "https://github.com/swisscatplus/glas/blob/main/database/workflow_usage_record.py"
    click Common "https://github.com/swisscatplus/glas/blob/main/models.py"

    classDef core fill:#aed6f1,stroke:#1f618d,color:#1b2631
    classDef plugin fill:#a9dfbf,stroke:#196f3d,color:#1b2631
    classDef persistence fill:#f9e79f,stroke:#b9770e,color:#1b2631
    classDef external fill:#d5dbdb,stroke:#566573,color:#1b2631
```
