# orpheus-ai/zeus architecture

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

- Interactive diagram: https://gitdiagram.com/orpheus-ai/zeus
- Repository: https://github.com/orpheus-ai/zeus

## Overview

##### Main Components
- Frontend/Presentation is minimal here – the focus is on backend processes and decentralized interactions. However, note the “static” directory that hosts visuals (e.g. the Zeus logo).
- Core functional modules:
- Miner Node: Found in directories like “neurons” and “zeus/base/miner.py”. This component runs the forecasting models and integrates with the Bittensor network.
- Validator Node: Found in “neurons/validator.py” and “zeus/validator” directory. Validators evaluate miner outputs and run checks using predefined protocols.
- Data Ingestion & Processing: Under “zeus/data” (including the ERA5 modules and sample loader) which is responsible for handling environmental datasets.
- API & Communication Layer: The “zeus/api” directory (e.g. eager_dendrite.py, proxy.py) shows that there are API endpoints facilitating communication both internally within the subnet and possibly externally.
- Utility & Support: Additional directories like “zeus/utils” and “zeus/base/utils” provide common functions such as logging, configuration, coordinate handling, and weight utilities.
- Verification & Testing: “verify” scripts and “tests” ensure that the system components are validated and work as expected.
- Operational Scripts: Startup scripts such as “start_miner.sh” and “start_validator.sh” and CI/build configurations like “min_compute.yml” help with deployment and continuous integration.

- How the Miner queries and uses the ERA5 dataset via the “zeus/data” components.
- How the API layer (zeus/api) sits between internal processing components and possibly external users or services (e.g., integration with Bittensor network endpoints).
- The utility modules should be represented as helper blocks that serve both Miner and Validator components.
- Deployment scripts and configuration files (setup.py, setup.sh, scripts) are noted as part of the deployment and orchestration layer but not necessarily part of the runtime architecture.

##### Architectural Patterns and Detail
- The project clearly uses a modular approach, likely leveraging an MVC-style or microservices-inspired pattern given separate modules for APIs, data, utilities, and the miner/validator logic.
- Design principles such as loose coupling between the miner and validator components. Their interactions are coordinated via well-defined API calls (as seen in the zeus/api and protocol files).

##### Technologies, Frameworks, and Libraries
- Python is the core language (with __init__.py files across modules).
- The project builds on the Bittensor framework as indicated by references in both the README and the codebase.
- Data handling for large environmental datasets (ERA5) and neural architectures (mining and validation) are central, so denote any specialized libraries explicitly if they appear in requirements.txt.

##### Additional Elements
- Notes or small callouts describing important files and scripts (like “run_neuron.py”, “start_miner.sh”, “setup.sh”) that are pivotal for deployment and running the system.
- External dependencies or systems (e.g., reference to the Bittensor network and CDS from the Copernicus programme).
- To capture the dynamic nature of the architecture with indications for continuous model evolution (as stated in the README under “Model Evolution”) and the incentive mechanism for environmental forecasting.

This detailed approach should enable any principal software engineer to clearly understand the underlying architecture and flow of the Zeus Environmental Forecasting Subnet.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Presentation Layer"
        A1["Frontend/Static Visuals"]:::presentation
    end

    subgraph "External Dependencies"
        D1["Bittensor Network"]:::external
    end

    subgraph "Backend Modules"
        B4["API & Communication Layer"]:::api
        B3["Data Ingestion & Processing"]:::data
        B1["Miner Component"]:::miner
        B2["Validator Component"]:::validator
        B5["Utility & Support"]:::utility
    end

    subgraph "Deployment & Testing"
        C1["Operational Scripts"]:::deployment
        C2["Verification & Testing"]:::testing
    end

    %% Data and Communication flows
    A1 -->|"visualizes"| B4
    D1 -- "externalCalls" --> B4
    B4 -->|"forecastRequest"| B1
    B4 -->|"validationRequest"| B2
    B1 -->|"forecastResponse"| B4
    B2 -->|"validationFeedback"| B4
    B3 -->|"dataFeed"| B1
    B1 -->|"challengeResult"| B2
    B2 -->|"challenge"| B1
    B5 -->|"supports"| B1
    B5 -->|"supports"| B2
    C1 -->|"startScripts"| B1
    C1 -->|"startScripts"| B2
    B1 -->|"reports"| C2
    B2 -->|"reports"| C2
    B4 -->|"sendResponse"| D1

    %% Click Events for Component Mapping
    click A1 "https://github.com/orpheus-ai/zeus/tree/main/static"
    click B1 "https://github.com/orpheus-ai/zeus/blob/main/neurons/miner.py"
    click B1 "https://github.com/orpheus-ai/zeus/blob/main/zeus/base/miner.py"
    click B1 "https://github.com/orpheus-ai/zeus/blob/main/run_neuron.py"
    click B2 "https://github.com/orpheus-ai/zeus/blob/main/neurons/validator.py"
    click B2 "https://github.com/orpheus-ai/zeus/tree/main/zeus/validator"
    click B3 "https://github.com/orpheus-ai/zeus/tree/main/zeus/data"
    click B3 "https://github.com/orpheus-ai/zeus/tree/main/zeus/data/era5"
    click B3 "https://github.com/orpheus-ai/zeus/blob/main/zeus/data/sample.py"
    click B4 "https://github.com/orpheus-ai/zeus/tree/main/zeus/api"
    click B4 "https://github.com/orpheus-ai/zeus/blob/main/zeus/api/eager_dendrite.py"
    click B4 "https://github.com/orpheus-ai/zeus/blob/main/zeus/api/proxy.py"
    click B5 "https://github.com/orpheus-ai/zeus/tree/main/zeus/utils"
    click B5 "https://github.com/orpheus-ai/zeus/tree/main/zeus/base/utils"
    click B5 "https://github.com/orpheus-ai/zeus/blob/main/zeus/base/utils/weight_utils.py"
    click C1 "https://github.com/orpheus-ai/zeus/blob/main/start_miner.sh"
    click C1 "https://github.com/orpheus-ai/zeus/blob/main/start_validator.sh"
    click C1 "https://github.com/orpheus-ai/zeus/blob/main/setup.py"
    click C1 "https://github.com/orpheus-ai/zeus/blob/main/setup.sh"
    click C1 "https://github.com/orpheus-ai/zeus/blob/main/min_compute.yml"
    click C2 "https://github.com/orpheus-ai/zeus/tree/main/verify"
    click C2 "https://github.com/orpheus-ai/zeus/tree/main/tests"

    %% Styles
    classDef miner fill:#a8dadc,stroke:#457b9d,stroke-width:2px;
    classDef validator fill:#f4a261,stroke:#e76f51,stroke-width:2px;
    classDef data fill:#e9c46a,stroke:#f4a261,stroke-width:2px;
    classDef api fill:#2a9d8f,stroke:#264653,stroke-width:2px;
    classDef utility fill:#e76f51,stroke:#264653,stroke-width:2px;
    classDef deployment fill:#8ecae6,stroke:#219ebc,stroke-width:2px;
    classDef testing fill:#ffb703,stroke:#fb8500,stroke-width:2px;
    classDef presentation fill:#b5838d,stroke:#6d6875,stroke-width:2px;
    classDef external fill:#cad2c5,stroke:#84a98c,stroke-width:2px;
```
