# arnor-sigurdsson/eir architecture

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

## Overview

##### Main Components and Architecture

The system should be divided into these major components:

a. Core Components:
- Data Loading Layer
- Model Layer
- Training Layer
- Prediction Layer
- Serving Layer
- Configuration Layer

b. Input Processing Components:
- Genotype Processor
- Tabular Processor
- Sequence Processor
- Image Processor
- Array Processor
- Binary Processor

c. Output Processing Components:
- Tabular Output Handler
- Sequence Output Handler
- Image Output Handler
- Array Output Handler
- Survival Analysis Handler

##### Component Relationships

a. Data Flow:
- Input Data → Data Loading Layer → Model Layer → Output Handlers
- Configuration Files → Configuration Layer → All Components
- Model Layer → Training Layer → Evaluation Components
- Model Layer → Prediction Layer → Serving Layer

b. Control Flow:
- Configuration Layer controlling all component initialization
- Training Layer orchestrating model training and evaluation
- Serving Layer managing model deployment and inference

##### Detailed Component Breakdown

For each major component, include:

a. Data Loading Layer:
- Storage Engine
- Data Preparation Modules
- Data Streaming Components

b. Model Layer:
- Input Models (CNN, Transformer, etc.)
- Fusion Models
- Output Models
- Tensor Broker

c. Training Layer:
- Optimization Modules
- Evaluation Handlers
- Metrics Computation
- Step Logic

##### Additional Details

Elements:

a. Configuration:
- YAML configuration flow
- Model setup paths
- Experiment configuration

b. Integration Points:
- External model integration
- Data source connections
- API endpoints

c. Processing Flows:
- Training workflow
- Inference workflow
- Serving workflow

##### Notes

Important notes about:

- Scalability aspects
- Distributed training support
- Memory management
- Resource requirements

Remember to show both the high-level architecture and provide zoom-in views of critical components to balance between overview and detail. This will help developers understand both the big picture and the specific implementation details they need to work with.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Legend
        L_CORE[Core Component]:::core
        L_INPUT[Input Processor]:::input
        L_OUTPUT[Output Handler]:::output
        L_MODEL[Model Component]:::model
        L_UTIL[Utility Component]:::util
        L_FLOW["--> Data Flow"]
        L_CONTROL["-.-> Control Flow"]
    end

    subgraph Core["Core System Components"]
        CONFIG[Configuration Layer]:::core
        click CONFIG "https://github.com/arnor-sigurdsson/EIR/tree/master/eir/setup/"
        
        DL[Data Loading Layer]:::core
        click DL "https://github.com/arnor-sigurdsson/EIR/tree/master/eir/data_load/"
        
        ML[Model Layer]:::core
        click ML "https://github.com/arnor-sigurdsson/EIR/tree/master/eir/models/"
        
        TL[Training Layer]:::core
        click TL "https://github.com/arnor-sigurdsson/EIR/tree/master/eir/train_utils/"
        
        PL[Prediction Layer]:::core
        click PL "https://github.com/arnor-sigurdsson/EIR/tree/master/eir/predict_modules/"
        
        SL[Serving Layer]:::core
        click SL "https://github.com/arnor-sigurdsson/EIR/tree/master/eir/serve_modules/"
    end

    subgraph Input["Input Processing"]
        GP[Genotype Processor]:::input
        click GP "https://github.com/arnor-sigurdsson/EIR/blob/master/eir/data_load/data_preparation_modules/prepare_omics.py"
        
        TP[Tabular Processor]:::input
        click TP "https://github.com/arnor-sigurdsson/EIR/blob/master/eir/data_load/data_preparation_modules/prepare_tabular.py"
        
        SP[Sequence Processor]:::input
        click SP "https://github.com/arnor-sigurdsson/EIR/blob/master/eir/data_load/data_preparation_modules/prepare_sequence.py"
        
        IP[Image Processor]:::input
        click IP "https://github.com/arnor-sigurdsson/EIR/blob/master/eir/data_load/data_preparation_modules/prepare_image.py"
        
        AP[Array Processor]:::input
        click AP "https://github.com/arnor-sigurdsson/EIR/blob/master/eir/data_load/data_preparation_modules/prepare_array.py"
        
        BP[Binary Processor]:::input
        click BP "https://github.com/arnor-sigurdsson/EIR/blob/master/eir/data_load/data_preparation_modules/prepare_bytes.py"
    end

    subgraph Model["Model Components"]
        TB[Tensor Broker]:::model
        click TB "https://github.com/arnor-sigurdsson/EIR/tree/master/eir/models/tensor_broker/"
        
        MS[Model Setup]:::model
        click MS "https://github.com/arnor-sigurdsson/EIR/tree/master/eir/models/model_setup_modules/"
        
        SE[Storage Engine]:::model
        click SE "https://github.com/arnor-sigurdsson/EIR/blob/master/eir/data_load/storage_engine.py"
        
        ES[Evaluation System]:::model
        click ES "https://github.com/arnor-sigurdsson/EIR/tree/master/eir/train_utils/evaluation_modules/"
    end

    subgraph Output["Output Processing"]
        TOH[Tabular Output Handler]:::output
        click TOH "https://github.com/arnor-sigurdsson/EIR/tree/master/eir/models/output/tabular/"
        
        SOH[Sequence Output Handler]:::output
        click SOH "https://github.com/arnor-sigurdsson/EIR/tree/master/eir/models/output/sequence/"
        
        AOH[Array Output Handler]:::output
        click AOH "https://github.com/arnor-sigurdsson/EIR/tree/master/eir/models/output/array/"
        
        SAH[Survival Analysis Handler]:::output
        click SAH "https://github.com/arnor-sigurdsson/EIR/blob/master/eir/predict_modules/predict_output_modules/predict_survival_output.py"
    end

    %% Core Connections
    CONFIG -.-> DL & ML & TL & PL & SL
    DL --> ML
    ML --> TL
    TL --> PL
    PL --> SL

    %% Input Connections
    GP & TP & SP & IP & AP & BP --> DL

    %% Model Connections
    TB --> ML
    MS --> ML
    SE --> DL
    ES --> TL

    %% Output Connections
    ML --> TOH & SOH & AOH & SAH

    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef input fill:#2ecc71,stroke:#27ae60,color:white
    classDef output fill:#e67e22,stroke:#d35400,color:white
    classDef model fill:#9b59b6,stroke:#8e44ad,color:white
    classDef util fill:#95a5a6,stroke:#7f8c8d,color:white
```
