# teodortodorovski01/home-lab architecture

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

## Overview

Home-LAB is a Raspberry Pi air-quality monitor: it samples local sensors, keeps local readings, detects and records candidate incidents, and serves dashboards and incident labeling. Optional reference feeds are shown separately from local measurements. The README documents the main workflow and integrations; the sampled source is partial, so internal call wiring beyond visible excerpts is not inferred.

Main entry points: [`mesure.py`](https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py) (Sensor sampling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensing["Local sensing"]
  node_sampler["Sensor sampling<br/>[mesure.py]"]
  node_history[("Reading history<br/>[mesure.py]")]
end

subgraph group_incidents["Incident analysis"]
  node_detector["PM event detection<br/>[mesure.py]"]
  node_incident_store[("Incident records<br/>[mesure.py]")]
  node_classifier["Example classifier<br/>[mesure.py]"]
  node_incident_page["Incident page<br/>[mesure.py]"]
end

subgraph group_references["Reference data"]
  node_open_meteo_weather["Open-Meteo weather<br/>[mesure.py]"]
  node_waqi["WAQI station feed<br/>[mesure.py]"]
  node_cams["CAMS model feed<br/>[mesure.py]"]
  node_reference_merge["Reference merging<br/>[mesure.py]"]
end

subgraph group_web["Web interface"]
  node_http["HTTP servers<br/>[mesure.py]"]
  node_dashboard["Dashboard charts<br/>[mesure.py]"]
end

node_operator(("Operator"))
node_dht{{"DHT11"}}
node_sds{{"SDS011"}}
node_browser(("LAN browser"))
node_open_meteo_service{{"Open-Meteo"}}
node_waqi_service{{"WAQI service"}}

node_operator -->|"starts"| node_sampler
node_sampler -->|"reads"| node_dht
node_sampler -->|"reads"| node_sds
node_sampler -->|"stores readings"| node_history
node_detector -->|"scans readings"| node_history
node_detector -->|"saves events"| node_incident_store
node_classifier -->|"uses labeled examples"| node_incident_store
node_incident_page -->|"labels incidents"| node_incident_store
node_incident_page -->|"shows predictions"| node_classifier
node_open_meteo_weather -->|"fetches weather"| node_open_meteo_service
node_waqi -->|"fetches station data"| node_waqi_service
node_cams -->|"fetches model data"| node_open_meteo_service
node_reference_merge -->|"combines station data"| node_waqi
node_reference_merge -->|"fills data gaps"| node_cams
node_http -->|"serves"| node_dashboard
node_http -->|"serves"| node_incident_page
node_browser -->|"requests pages"| node_http
node_dashboard -->|"displays references"| node_reference_merge
node_dashboard -->|"displays local readings"| node_history

click node_sampler "https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py"
click node_history "https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py"
click node_detector "https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py"
click node_incident_store "https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py"
click node_classifier "https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py"
click node_incident_page "https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py"
click node_open_meteo_weather "https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py"
click node_waqi "https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py"
click node_cams "https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py"
click node_reference_merge "https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py"
click node_http "https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py"
click node_dashboard "https://github.com/teodortodorovski01/home-lab/blob/main/mesure.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_sampler,node_history,node_browser toneBlue
class node_detector,node_incident_store,node_classifier,node_incident_page toneAmber
class node_open_meteo_weather,node_waqi,node_cams,node_reference_merge toneMint
class node_http,node_dashboard toneRose
class node_operator,node_dht,node_sds,node_open_meteo_service,node_waqi_service toneIndigo
```

## Components

### Local sensing

- [Sensor sampling](https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py): `mesure.py`
- [Reading history](https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py): `mesure.py`

### Incident analysis

- [PM event detection](https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py): `mesure.py`
- [Incident records](https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py): `mesure.py`
- [Example classifier](https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py): `mesure.py`
- [Incident page](https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py): `mesure.py`

### Reference data

- [Open-Meteo weather](https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py): `mesure.py`
- [WAQI station feed](https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py): `mesure.py`
- [CAMS model feed](https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py): `mesure.py`
- [Reference merging](https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py): `mesure.py`

### Web interface

- [HTTP servers](https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py): `mesure.py`
- [Dashboard charts](https://github.com/teodortodorovski01/home-lab/blob/main/mesure.py): `mesure.py`

### Other components

- **Operator**
- **DHT11**
- **SDS011**
- **LAN browser**
- **Open-Meteo**
- **WAQI service**

## Connections

- Operator → Sensor sampling: starts (evidence: `README.md`)
- Sensor sampling → DHT11: reads (evidence: `README.md`)
- Sensor sampling → SDS011: reads (evidence: `README.md`)
- Sensor sampling → Reading history: stores readings (evidence: `README.md`)
- PM event detection → Reading history: scans readings (evidence: `README.md`)
- PM event detection → Incident records: saves events (evidence: `README.md`)
- Example classifier → Incident records: uses labeled examples (evidence: `README.md`)
- Incident page → Incident records: labels incidents (evidence: `README.md`)
- Incident page → Example classifier: shows predictions (evidence: `README.md`)
- Open-Meteo weather → Open-Meteo: fetches weather (evidence: `README.md`)
- WAQI station feed → WAQI service: fetches station data (evidence: `README.md`)
- CAMS model feed → Open-Meteo: fetches model data (evidence: `README.md`)
- Reference merging → WAQI station feed: combines station data (evidence: `README.md`)
- Reference merging → CAMS model feed: fills data gaps (evidence: `README.md`)
- HTTP servers → Dashboard charts: serves (evidence: `README.md`)
- HTTP servers → Incident page: serves (evidence: `README.md`)
- LAN browser → HTTP servers: requests pages (evidence: `README.md`)
- Dashboard charts → Reference merging: displays references (evidence: `README.md`)
- Dashboard charts → Reading history: displays local readings (evidence: `README.md`)
