# meronemo/renewable-energy-plant architecture

> Architecture diagram of the GitHub repository meronemo/renewable-energy-plant, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/meronemo/renewable-energy-plant
- Repository: https://github.com/meronemo/renewable-energy-plant

## Overview

##### Main Components

A. Data Pipeline Layer
- It to a "Data Processing Pipeline" that includes:
- Data Extraction (extract.py)
- Data Preprocessing (preprocess.py)
- Outlier Detection (outlier.py, outlier_class.py)

B. Model Development Layer
- Training Components (train.py, train_xgboost.py)
- Hyperparameter Tuning (tuning_grid.py, tuning_random.py)
- Experimentation (exp_max_depth.py, exp_n_estimators.py, knn_experiment.py)

C. Utility Layer
- A "Library Components" section for:
- Feature Analysis (lib/feature_importance.py)
- Data Retrieval (lib/get_data.py)

D. Deployment Layer
- HuggingFace Spaces deployment
- Flask application (app.py)

##### Component Relationships

- Data flow from dataset files through the processing pipeline
- Processed data flow into the model training components
- Model output to the deployment layer
- Utility functions supporting various components

##### Technical Details to Highlight

- XGBoost as the primary model
- KNN experimentation branch
- Multiple dataset handling capability
- Outlier detection system
- Feature importance analysis
- Visualization capabilities

##### Implementation Notes

- Use standardized symbols for databases, processing units, and API endpoints
- Version control integration points
- Requirements.txt dependencies influence
- Monitoring and logging points

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Data_Sources
        DS1[("Wind Data")]:::data
        DS2[("Solar Data")]:::data
        DS3[("Power Plant Data")]:::data
    end

    subgraph Data_Pipeline
        DE["Data Extraction"]:::process
        DP["Data Preprocessing"]:::process
        OD["Outlier Detection"]:::process
        DF["Data Fetching"]:::process
    end

    subgraph Model_Development
        MT["Model Training"]:::model
        HPT["Hyperparameter Tuning"]:::model
        EXP["Experimentation"]:::model
    end

    subgraph Utility_Layer
        FA["Feature Analysis"]:::utility
        DR["Data Retrieval"]:::utility
        VIS["Visualization"]:::utility
    end

    subgraph Deployment
        MA[("model.pkl")]:::artifact
        FL["Flask App"]:::deploy
        HF["HuggingFace Spaces"]:::deploy
    end

    %% Data flow connections
    DS1 & DS2 & DS3 --> DF
    DF --> DE
    DE --> DP
    DP --> OD
    OD --> MT
    MT --> HPT
    HPT --> EXP
    MT --> MA
    MA --> FL
    FL --> HF

    %% Utility connections
    FA -.-> MT
    DR -.-> DE
    VIS -.-> FL

    %% Click events
    click DS1 "https://github.com/meronemo/renewable-energy-plant/blob/main/dataset/wind.csv"
    click DS2 "https://github.com/meronemo/renewable-energy-plant/blob/main/dataset/solar.csv"
    click DS3 "https://github.com/meronemo/renewable-energy-plant/blob/main/dataset/power_plant.csv"
    click DE "https://github.com/meronemo/renewable-energy-plant/blob/main/extract.py"
    click DP "https://github.com/meronemo/renewable-energy-plant/blob/main/preprocess.py"
    click OD "https://github.com/meronemo/renewable-energy-plant/blob/main/outlier.py"
    click MT "https://github.com/meronemo/renewable-energy-plant/blob/main/train.py"
    click HPT "https://github.com/meronemo/renewable-energy-plant/blob/main/tuning_grid.py"
    click EXP "https://github.com/meronemo/renewable-energy-plant/blob/main/exp_max_depth.py"
    click FA "https://github.com/meronemo/renewable-energy-plant/blob/main/lib/feature_importance.py"
    click DR "https://github.com/meronemo/renewable-energy-plant/blob/main/lib/get_data.py"
    click VIS "https://github.com/meronemo/renewable-energy-plant/blob/main/lib/visualize.py"
    click FL "https://github.com/meronemo/renewable-energy-plant/blob/main/app.py"
    click MA "https://github.com/meronemo/renewable-energy-plant/blob/main/model.pkl"
    click DF "https://github.com/meronemo/renewable-energy-plant/blob/main/fetch_data.py"

    %% Styling
    classDef data fill:#3498db,stroke:#2980b9,stroke-width:2px
    classDef process fill:#2ecc71,stroke:#27ae60,stroke-width:2px
    classDef model fill:#f1c40f,stroke:#f39c12,stroke-width:2px
    classDef utility fill:#9b59b6,stroke:#8e44ad,stroke-width:2px
    classDef deploy fill:#e74c3c,stroke:#c0392b,stroke-width:2px
    classDef artifact fill:#95a5a6,stroke:#7f8c8d,stroke-width:2px
```
