# ehmahm/final_yr_prototype architecture

> Architecture diagram of the GitHub repository ehmahm/final_yr_prototype, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ehmahm/final_yr_prototype
- Repository: https://github.com/ehmahm/final_yr_prototype

## Overview

This repository is a research prototype for electrical-load forecasting. Its visible runtime workflow acquires household or ELIA load data, prepares hourly/daily series and forecasting sequences, then trains an LSTM autoencoder to produce latent features. Separate modules retrieve ELIA exports and recent EIA demand. The README also describes teacher-ensemble training, distillation, ONNX export, API serving, and deployment, but those implementations are not present in the supplied tree; they are shown as documented capabilities, not verified runtime connections. Edges reflect source calls or README statements; no unsampled implementation details are inferred.

Main entry points: [`src/autoencoder.py`](https://github.com/ehmahm/final_yr_prototype/blob/main/src/autoencoder.py) (LSTM autoencoder), [`src/data.py`](https://github.com/ehmahm/final_yr_prototype/blob/main/src/data.py) (Resampling and targets), [`src/download_elia.py`](https://github.com/ehmahm/final_yr_prototype/blob/main/src/download_elia.py) (ELIA paged fetch), [`src/download_elia_export.py`](https://github.com/ehmahm/final_yr_prototype/blob/main/src/download_elia_export.py) (ELIA CSV export)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["Data acquisition"]
  node_household["Household loader<br/>[data.py]"]
  node_elia_paged["ELIA paged fetch<br/>[download_elia.py]"]
  node_elia_export["ELIA CSV export"]
  node_eia_live["EIA live demand<br/>[live_feed.py]"]
end

subgraph group_preparation["Temporal preparation"]
  node_temporal["Resampling and targets<br/>[data.py]"]
  node_sequences["Sequence builder<br/>[data.py]"]
end

subgraph group_modeling["Forecasting and serving"]
  node_autoencoder["LSTM autoencoder<br/>[autoencoder.py]"]
  node_teacher["Teacher ensemble"]
  node_distillation["Student distillation"]
  node_onnx["ONNX edge model"]
  node_service["Forecast API service"]
  node_replay["CSV replay client"]
  node_deployment["Cloud deployment"]
end

node_elia_api(("ELIA Open Data"))
node_eia_api(("EIA API"))

node_elia_paged -->|"fetches records"| node_elia_api
node_elia_export -->|"downloads export"| node_elia_api
node_eia_live -->|"requests demand"| node_eia_api
node_household -->|"provides series"| node_temporal
node_temporal -->|"builds windows"| node_sequences
node_autoencoder -->|"loads data"| node_household
node_autoencoder -->|"resamples series"| node_temporal
node_autoencoder -->|"builds sequences"| node_sequences
node_teacher -.->|"teacher outputs"| node_distillation
node_distillation -.->|"exports student"| node_onnx
node_onnx -.->|"serves inference"| node_service
node_replay -.->|"sends CSV input"| node_service
node_service -.->|"deployed via"| node_deployment

click node_household "https://github.com/ehmahm/final_yr_prototype/blob/main/src/data.py"
click node_elia_paged "https://github.com/ehmahm/final_yr_prototype/blob/main/src/download_elia.py"
click node_elia_export "https://github.com/ehmahm/final_yr_prototype/blob/main/src/download_elia_export.py"
click node_eia_live "https://github.com/ehmahm/final_yr_prototype/blob/main/src/live_feed.py"
click node_temporal "https://github.com/ehmahm/final_yr_prototype/blob/main/src/data.py"
click node_sequences "https://github.com/ehmahm/final_yr_prototype/blob/main/src/data.py"
click node_autoencoder "https://github.com/ehmahm/final_yr_prototype/blob/main/src/autoencoder.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_household,node_elia_paged,node_elia_export,node_eia_live toneBlue
class node_temporal,node_sequences toneAmber
class node_autoencoder,node_teacher,node_distillation,node_onnx,node_service,node_replay,node_deployment,node_eia_api toneMint
class node_elia_api toneIndigo
```

## Components

### Data acquisition

- [Household loader](https://github.com/ehmahm/final_yr_prototype/blob/main/src/data.py): `src/data.py`
- [ELIA paged fetch](https://github.com/ehmahm/final_yr_prototype/blob/main/src/download_elia.py): `src/download_elia.py`
- [ELIA CSV export](https://github.com/ehmahm/final_yr_prototype/blob/main/src/download_elia_export.py): `src/download_elia_export.py`
- [EIA live demand](https://github.com/ehmahm/final_yr_prototype/blob/main/src/live_feed.py): `src/live_feed.py`

### Temporal preparation

- [Resampling and targets](https://github.com/ehmahm/final_yr_prototype/blob/main/src/data.py): `src/data.py`
- [Sequence builder](https://github.com/ehmahm/final_yr_prototype/blob/main/src/data.py): `src/data.py`

### Forecasting and serving

- [LSTM autoencoder](https://github.com/ehmahm/final_yr_prototype/blob/main/src/autoencoder.py): `src/autoencoder.py`
- **Teacher ensemble**
- **Student distillation**
- **ONNX edge model**
- **Forecast API service**
- **CSV replay client**
- **Cloud deployment**

### Other components

- **ELIA Open Data**
- **EIA API**

## Connections

- ELIA paged fetch → ELIA Open Data: fetches records (evidence: `src/download_elia.py`)
- ELIA CSV export → ELIA Open Data: downloads export (evidence: `src/download_elia_export.py`)
- EIA live demand → EIA API: requests demand (evidence: `src/live_feed.py`)
- Household loader → Resampling and targets: provides series (evidence: `src/data.py`)
- Resampling and targets → Sequence builder: builds windows (evidence: `src/data.py`)
- LSTM autoencoder → Household loader: loads data (evidence: `src/autoencoder.py`)
- LSTM autoencoder → Resampling and targets: resamples series (evidence: `src/autoencoder.py`)
- LSTM autoencoder → Sequence builder: builds sequences (evidence: `src/autoencoder.py`)
- Teacher ensemble → Student distillation: teacher outputs (evidence: `README.md`)
- Student distillation → ONNX edge model: exports student (evidence: `README.md`)
- ONNX edge model → Forecast API service: serves inference (evidence: `README.md`)
- CSV replay client → Forecast API service: sends CSV input (evidence: `README.md`)
- Forecast API service → Cloud deployment: deployed via (evidence: `README.md`)
