# menchelab/datadivr architecture

> Architecture diagram of the GitHub repository menchelab/datadivr, 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/menchelab/datadivr
- Repository: https://github.com/menchelab/datadivr

## Overview

##### Main Components

a. Core Components:
- Project Management System (datadivr/project/)
- Transport Layer (datadivr/transport/)
- Handlers System (datadivr/handlers/)
- Visualization Module (datadivr/viz/)
- Calculation Module (datadivr/calc/)
- CLI Interface (datadivr/cli.py)

b. External Interfaces:
- Web Server Interface
- Client Interface
- CLI Interface

##### Component Relationships

Top Layer:
- External Interfaces (Web, CLI, Client)

Middle Layer:
- Project Management
- Transport System
- Handler Registry

Bottom Layer:
- Calculation Engine
- Visualization Engine
- Data Models

##### Specific Elements

a. Transport Layer:
- WebSocket Server (transport/server.py)
- Web Server (transport/web_server.py)
- Client (transport/client.py)
- Message Models (transport/messages.py)

b. Project Management:
- Project Manager
- JSON Handler
- Texture Management
- Project Models

c. Handler System:
- Handler Registry
- Built-in Handlers
- Custom Handler Extension Point

##### Specific Relationships to Highlight

- How the CLI interfaces with the Project Manager
- WebSocket communication between Client and Server
- Demonstrate how Handlers integrate with the core system
- Visualization pipeline from data to rendered output

##### Implementation Details

- Message flow between components
- Handler registration and execution path
- Project data structure flow
- Visualization pipeline stages

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef interface fill:#90EE90,stroke:#333,stroke-width:2px
    classDef core fill:#ADD8E6,stroke:#333,stroke-width:2px
    classDef handler fill:#FFB6C1,stroke:#333,stroke-width:2px
    classDef data fill:#FFD700,stroke:#333,stroke-width:2px
    classDef utils fill:#DDA0DD,stroke:#333,stroke-width:2px

    %% External Interfaces Layer
    subgraph Interfaces
        CLI["CLI Interface"]:::interface
        WEB["Web Interface"]:::interface
        CLIENT["Client Interface"]:::interface
    end

    %% Core Components Layer
    subgraph Core
        PM["Project Manager"]:::core
        TS["Transport System"]:::core
        HR["Handler Registry"]:::core
        VM["Visualization Module"]:::core
        CM["Calculation Module"]:::core
    end

    %% Handler System
    subgraph Handlers
        BH["Built-in Handlers"]:::handler
        CH["Custom Handlers"]:::handler
    end

    %% Project Management Components
    subgraph ProjectManagement
        JH["JSON Handler"]:::core
        TM["Texture Management"]:::core
        PM_MODEL["Project Models"]:::core
    end

    %% Transport Components
    subgraph Transport
        WS["WebSocket Server"]:::core
        WS_SERVER["Web Server"]:::core
        TC["Transport Client"]:::core
        MM["Message Models"]:::core
        TM_MODELS["Transport Models"]:::core
    end

    %% Utility Components
    subgraph Utils
        LOG["Logging System"]:::utils
        EXC["Exception Handler"]:::utils
    end

    %% Relationships
    CLI --> PM
    WEB --> WS_SERVER
    CLIENT --> TC
    
    PM --> JH
    PM --> TM
    PM --> PM_MODEL
    
    TS --> WS
    TS --> WS_SERVER
    TS --> TC
    TS --> MM
    TS --> TM_MODELS
    
    HR --> BH
    HR --> CH
    
    %% Component Mappings
    click CLI "https://github.com/menchelab/datadivr/blob/main/datadivr/cli.py"
    click PM "https://github.com/menchelab/datadivr/blob/main/datadivr/project/project_manager.py"
    click JH "https://github.com/menchelab/datadivr/blob/main/datadivr/project/json.py"
    click TM "https://github.com/menchelab/datadivr/blob/main/datadivr/project/textures.py"
    click PM_MODEL "https://github.com/menchelab/datadivr/blob/main/datadivr/project/model.py"
    click WS "https://github.com/menchelab/datadivr/blob/main/datadivr/transport/server.py"
    click WS_SERVER "https://github.com/menchelab/datadivr/blob/main/datadivr/transport/web_server.py"
    click TC "https://github.com/menchelab/datadivr/blob/main/datadivr/transport/client.py"
    click MM "https://github.com/menchelab/datadivr/blob/main/datadivr/transport/messages.py"
    click TM_MODELS "https://github.com/menchelab/datadivr/blob/main/datadivr/transport/models.py"
    click HR "https://github.com/menchelab/datadivr/blob/main/datadivr/handlers/registry.py"
    click BH "https://github.com/menchelab/datadivr/tree/main/datadivr/handlers/builtin/"
    click CH "https://github.com/menchelab/datadivr/blob/main/datadivr/handlers/custom_handlers.py"
    click VM "https://github.com/menchelab/datadivr/blob/main/datadivr/viz/plotly.py"
    click CM "https://github.com/menchelab/datadivr/blob/main/datadivr/calc/sample_data.py"
    click LOG "https://github.com/menchelab/datadivr/blob/main/datadivr/utils/logging.py"
    click EXC "https://github.com/menchelab/datadivr/blob/main/datadivr/exceptions.py"

    %% Legend
    subgraph Legend
        L1["Interface Component"]:::interface
        L2["Core Component"]:::core
        L3["Handler Component"]:::handler
        L4["Data Component"]:::data
        L5["Utility Component"]:::utils
    end
```
