# n00bception/ai-powered-5g-openran-optimizer architecture

> Architecture diagram of the GitHub repository n00bception/ai-powered-5g-openran-optimizer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/n00bception/ai-powered-5g-openran-optimizer
- Repository: https://github.com/n00bception/ai-powered-5g-openran-optimizer

## Overview

##### Project Type and Purpose
- This is a Python-based AI/ML optimization system for 5G Open RAN.
- It ingests historical & real-time network data, applies multiple ML models (anomaly detection, predictive planning, dynamic optimization, energy efficiency), and pushes optimization decisions back into the RAN via Open RAN interfaces.

##### File Structure
Top Level
- src/
– data_preparation/ (data ingestion & cleaning)
– models/ (four distinct optimization models)
– utils/ (API wrappers, config, logging, data loaders, prediction helpers)
– main.py (orchestrator entry point)
- docs/ (architecture write-up, developer & user guides)
- tests/ (unit & integration tests)
- requirements.txt (dependencies)

##### README for Additional Insights
- Uses supervised/unsupervised ML, deep learning, reinforcement learning.
- Integrates with Open RAN (O-RAN interfaces).
- CLI‐driven workflow: preprocess → train → evaluate → optimize.

##### Main Components & Their Relationships
A. Data Layer
1. Raw Data Sources
- Historical datasets (traffic logs, signal strength, weather)
- Real-time streaming data from RAN
2. Data Preparation Module (src/data_preparation)
- Extraction → Cleaning → Transformation
- Output: clean feature sets
3. Data Store (could be file system, object storage, or time-series DB)
B. Model Training & Serving
1. Training Subsystem (src/models/*/train.py)
- Four parallel pipelines (each model folder)
- Configurable hyperparameters via utils/config.py
2. Trained Model Repository
- Serialized models (Pickle, ONNX, TensorFlow SavedModel)
3. Prediction/Inference Subsystem (src/models/*/predict.py)
- Loads models from repository
- Wrapped by utils/model_prediction.py
C. Orchestration & API
1. main.py
- CLI arguments route to preprocess, train, evaluate, optimize
2. utils/api.py
- REST/gRPC client to interact with O-RAN southbound interfaces
D. External Services
- Open RAN controllers (via O-RAN API)
- External data providers (weather, geo-location, OSS/BSS)
E. Cross-Cutting Concerns
- Configuration management (utils/config.py)
- Logging (utils/logger.py)
- Testing (tests/)

##### Architectural Patterns & Design Principles
- Layered architecture: Data → ML pipelines → Orchestration → External interfaces
- Plugin-style model modules: new algorithms slot in under src/models
- Separation of batch (training) vs real-time (inference) pipelines
- Single responsibility: each module has a focused purpose
- Config-driven flows to avoid hard-coding parameters

##### Essential Architectural Elements
- Distinct separation of concerns (data vs ML vs API)
- Clear depiction of both batch and streaming pathways
- Explicit model management lifecycle (train → store → load → infer)
- Integration touchpoints with external Open RAN interfaces

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Offline Batch Processing
    subgraph "Offline Batch Processing"
        RawData["Raw Data Sources"]:::dataStore
        subgraph "Data Preparation (src/data_preparation)"
            DataExtraction["DataExtraction()"]:::module
            DataCleaning["DataCleaning()"]:::module
            DataTransformation["DataTransformation()"]:::module
        end
        FeatureStore["Feature Store"]:::dataStore
    end

    RawData --> DataExtraction --> DataCleaning --> DataTransformation --> FeatureStore

    %% Model Training
    subgraph "Model Training (Batch)"
        subgraph "Model Suite"
            subgraph "Dynamic Network Optimization"
                DNO_Train["Train Pipeline"]:::module
            end
            subgraph "Energy Efficiency Optimization"
                EEO_Train["Train Pipeline"]:::module
            end
            subgraph "Network Anomaly Detection"
                NAD_Train["Train Pipeline"]:::module
            end
            subgraph "Predictive Network Planning"
                PNP_Train["Train Pipeline"]:::module
            end
        end
        ModelRepo["Model Repository"]:::dataStore
    end

    FeatureStore --> DNO_Train --> ModelRepo
    FeatureStore --> EEO_Train --> ModelRepo
    FeatureStore --> NAD_Train --> ModelRepo
    FeatureStore --> PNP_Train --> ModelRepo

    %% Orchestration
    main["Orchestrator (CLI)"]:::module
    main --> DataExtraction
    main --> DNO_Train
    main --> EEO_Train
    main --> NAD_Train
    main --> PNP_Train

    %% Utils & Config
    subgraph "Utils & Config"
        Config["Config Management"]:::module
        Logger["Logging"]:::module
        DataLoader["Data Loader Helpers"]:::module
        DataPrepHelpers["Data Preprocessing Helpers"]:::module
        ModelPrediction["Prediction Wrapper"]:::module
        APIClient["API Client (O-RAN Interfaces)"]:::module
    end

    main --> Config
    main --> Logger
    DNO_Train --> Config
    EEO_Train --> Config
    NAD_Train --> Config
    PNP_Train --> Config

    %% Online Real-Time Processing
    subgraph "Online Real-Time Processing"
        RealTimeData["Real-Time Data Streams"]:::external
        subgraph "Inference & Optimization"
            subgraph "Dynamic Network Optimization Predict"
                DNO_Pred["Predict"]:::module
            end
            subgraph "Energy Efficiency Optimization Predict"
                EEO_Pred["Predict"]:::module
            end
            subgraph "Network Anomaly Detection Predict"
                NAD_Pred["Predict"]:::module
            end
            subgraph "Predictive Network Planning Predict"
                PNP_Pred["Predict"]:::module
            end
            Optimizer["Optimizer Aggregator"]:::module
            O_RAN_API["O-RAN API Client"]:::external
            OpenRAN["Open RAN Controllers"]:::external
        end
    end

    RealTimeData --> DNO_Pred
    RealTimeData --> EEO_Pred
    RealTimeData --> NAD_Pred
    RealTimeData --> PNP_Pred

    ModelRepo --> DNO_Pred
    ModelRepo --> EEO_Pred
    ModelRepo --> NAD_Pred
    ModelRepo --> PNP_Pred

    DNO_Pred --> Optimizer
    EEO_Pred --> Optimizer
    NAD_Pred --> Optimizer
    PNP_Pred --> Optimizer

    Optimizer --> O_RAN_API --> OpenRAN

    %% Click Events
    click DataExtraction "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/data_preparation/data_extraction.py"
    click DataCleaning "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/data_preparation/data_cleaning.py"
    click DataTransformation "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/data_preparation/data_transformation.py"
    click main "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/main.py"
    click DNO_Train "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/models/dynamic_network_optimization/train.py"
    click EEO_Train "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/models/energy_efficiency_optimization/train.py"
    click NAD_Train "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/models/network_anomaly_detection/train.py"
    click PNP_Train "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/models/predictive_network_planning/train.py"
    click DNO_Pred "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/models/dynamic_network_optimization/predict.py"
    click EEO_Pred "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/models/energy_efficiency_optimization/predict.py"
    click NAD_Pred "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/models/network_anomaly_detection/predict.py"
    click PNP_Pred "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/models/predictive_network_planning/predict.py"
    click Config "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/utils/config.py"
    click Logger "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/utils/logger.py"
    click APIClient "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/utils/api.py"
    click DataLoader "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/utils/data_loader.py"
    click DataPrepHelpers "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/utils/data_preprocessing.py"
    click ModelPrediction "https://github.com/n00bception/ai-powered-5g-openran-optimizer/blob/main/src/utils/model_prediction.py"

    %% Styles
    classDef dataStore fill:#ADD8E6,stroke:#333,stroke-width:1px;
    classDef module fill:#98FB98,stroke:#333,stroke-width:1px;
    classDef external fill:#FFA500,stroke:#333,stroke-width:1px;
```
