# xrothmans/ifb102_2025 architecture

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

- Interactive diagram: https://gitdiagram.com/xrothmans/ifb102_2025
- Repository: https://github.com/xrothmans/ifb102_2025

## Overview

This is a sensor-monitoring application: a DHT11 collector records temperature and humidity in CSV, while a Flask web app serves a page and exposes date-range data and analysis routes. Analysis summarizes readings and attempts to generate an HTML report with an OpenAI client; the repository excerpt does not show that client being initialized. A separate Express service emails reports. The README is empty, and the page template and CSV contents were not sampled, so their UI behavior and data format beyond the Python code are not inferred.

Main entry points: [`backend/sensor_readings.csv`](https://github.com/xrothmans/ifb102_2025/blob/main/backend/sensor_readings.csv) (Readings CSV), [`app.py`](https://github.com/xrothmans/ifb102_2025/blob/main/app.py) (Flask app), [`backend/analyse.py`](https://github.com/xrothmans/ifb102_2025/blob/main/backend/analyse.py) (Range analysis route), [`backend/dht11.py`](https://github.com/xrothmans/ifb102_2025/blob/main/backend/dht11.py) (DHT11 sensor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Sensor collection"]
  node_sensor["DHT11 sensor<br/>[dht11.py]"]
  node_readings[("Readings CSV")]
end

subgraph group_web["Web and analysis"]
  node_flask["Flask app<br/>[app.py]"]
  node_page["Dashboard page<br/>[index.html]"]
  node_chart_data["Range data route<br/>[analyse.py]"]
  node_analysis["Range analysis route<br/>[analyse.py]"]
end

subgraph group_delivery["Report delivery"]
  node_email_server["Email server<br/>[emailServer.js]"]
end

node_user(("User"))
node_openai["OpenAI service"]
node_gmail["Gmail service"]

node_sensor -->|"writes readings"| node_readings
node_flask -->|"renders page"| node_page
node_flask -->|"registers routes"| node_chart_data
node_chart_data -->|"reads range"| node_readings
node_analysis -->|"reads range"| node_readings
node_analysis -->|"requests report"| node_openai
node_email_server -->|"sends email"| node_gmail

click node_sensor "https://github.com/xrothmans/ifb102_2025/blob/main/backend/dht11.py"
click node_readings "https://github.com/xrothmans/ifb102_2025/blob/main/backend/sensor_readings.csv"
click node_flask "https://github.com/xrothmans/ifb102_2025/blob/main/app.py"
click node_page "https://github.com/xrothmans/ifb102_2025/blob/main/templates/index.html"
click node_chart_data "https://github.com/xrothmans/ifb102_2025/blob/main/backend/analyse.py"
click node_analysis "https://github.com/xrothmans/ifb102_2025/blob/main/backend/analyse.py"
click node_email_server "https://github.com/xrothmans/ifb102_2025/blob/main/static/emailServer.js"

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_sensor,node_readings,node_user toneBlue
class node_flask,node_page,node_chart_data,node_analysis toneAmber
class node_email_server toneMint
class node_openai,node_gmail toneIndigo
```

## Components

### Sensor collection

- [DHT11 sensor](https://github.com/xrothmans/ifb102_2025/blob/main/backend/dht11.py): `backend/dht11.py`
- [Readings CSV](https://github.com/xrothmans/ifb102_2025/blob/main/backend/sensor_readings.csv): `backend/sensor_readings.csv`

### Web and analysis

- [Flask app](https://github.com/xrothmans/ifb102_2025/blob/main/app.py): `app.py`
- [Dashboard page](https://github.com/xrothmans/ifb102_2025/blob/main/templates/index.html): `templates/index.html`
- [Range data route](https://github.com/xrothmans/ifb102_2025/blob/main/backend/analyse.py): `backend/analyse.py`
- [Range analysis route](https://github.com/xrothmans/ifb102_2025/blob/main/backend/analyse.py): `backend/analyse.py`

### Report delivery

- [Email server](https://github.com/xrothmans/ifb102_2025/blob/main/static/emailServer.js): `static/emailServer.js`

### Other components

- **User**
- **OpenAI service**
- **Gmail service**

## Connections

- DHT11 sensor → Readings CSV: writes readings (evidence: `backend/dht11.py`)
- Flask app → Dashboard page: renders page (evidence: `app.py`)
- Flask app → Range data route: registers routes (evidence: `app.py`)
- Range data route → Readings CSV: reads range (evidence: `backend/analyse.py`)
- Range analysis route → Readings CSV: reads range (evidence: `backend/analyse.py`)
- Range analysis route → OpenAI service: requests report (evidence: `backend/analyse.py`)
- Email server → Gmail service: sends email (evidence: `static/emailServer.js`)
