# guhan2006-k/h2s-project architecture

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

- Interactive diagram: https://gitdiagram.com/guhan2006-k/h2s-project
- Repository: https://github.com/guhan2006-k/h2s-project

## Overview

SensaBand is a prototype H₂S exposure-monitoring system. A supervisor uploads a test-strip photo through the demo frontend; the Flask API saves it, asks the predictor to estimate exposure and classify risk, stores the scan, and returns results. A separate ESP32/MQ-136 path posts device telemetry, which the API stores and exposes for retrieval. The README documents frontend and Arduino capabilities, but their source was not sampled, so their internal behavior and unconfirmed links are not expanded. The prediction formula is explicitly a placeholder.

Main entry points: [`backend/app.py`](https://github.com/guhan2006-k/h2s-project/blob/main/backend/app.py) (Flask API), [`backend/database.py`](https://github.com/guhan2006-k/h2s-project/blob/main/backend/database.py) (SQLite Storage), [`frontend/sensaband-website-2.html`](https://github.com/guhan2006-k/h2s-project/blob/main/frontend/sensaband-website-2.html) (Demo Frontend), [`arduino/sensaband_esp32c3/sensaband_esp32c3.ino`](https://github.com/guhan2006-k/h2s-project/blob/main/arduino/sensaband_esp32c3/sensaband_esp32c3.ino) (ESP32 / MQ-136)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User Interface"]
  node_frontend["Demo Frontend"]
end

subgraph group_api["Backend API"]
  node_api_app["Flask API<br/>[app.py]"]
end

subgraph group_analysis["Exposure Analysis"]
  node_predictor["H₂S Predictor<br/>[predictor.py]"]
end

subgraph group_telemetry["Device Telemetry"]
  node_esp32["ESP32 / MQ-136"]
end

subgraph group_storage["Persistent Data"]
  node_database[("SQLite Storage<br/>[database.py]")]
end

node_supervisor(("Supervisor"))

node_supervisor -->|"uses"| node_frontend
node_frontend -->|"uploads scan"| node_api_app
node_api_app -->|"returns results"| node_frontend
node_api_app -->|"requests estimate"| node_predictor
node_api_app -->|"stores scan"| node_database
node_api_app -->|"reads history"| node_database
node_esp32 -->|"posts telemetry"| node_api_app
node_api_app -->|"stores telemetry"| node_database
node_api_app -->|"reads telemetry"| node_database

click node_frontend "https://github.com/guhan2006-k/h2s-project/blob/main/frontend/sensaband-website-2.html"
click node_api_app "https://github.com/guhan2006-k/h2s-project/blob/main/backend/app.py"
click node_predictor "https://github.com/guhan2006-k/h2s-project/blob/main/ai/predictor.py"
click node_esp32 "https://github.com/guhan2006-k/h2s-project/blob/main/arduino/sensaband_esp32c3/sensaband_esp32c3.ino"
click node_database "https://github.com/guhan2006-k/h2s-project/blob/main/backend/database.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_frontend toneBlue
class node_api_app toneAmber
class node_predictor toneMint
class node_esp32 toneRose
class node_database,node_supervisor toneIndigo
```

## Components

### User Interface

- [Demo Frontend](https://github.com/guhan2006-k/h2s-project/blob/main/frontend/sensaband-website-2.html): `frontend/sensaband-website-2.html`

### Backend API

- [Flask API](https://github.com/guhan2006-k/h2s-project/blob/main/backend/app.py): `backend/app.py`

### Exposure Analysis

- [H₂S Predictor](https://github.com/guhan2006-k/h2s-project/blob/main/ai/predictor.py): `ai/predictor.py`

### Device Telemetry

- [ESP32 / MQ-136](https://github.com/guhan2006-k/h2s-project/blob/main/arduino/sensaband_esp32c3/sensaband_esp32c3.ino): `arduino/sensaband_esp32c3/sensaband_esp32c3.ino`

### Persistent Data

- [SQLite Storage](https://github.com/guhan2006-k/h2s-project/blob/main/backend/database.py): `backend/database.py`

### Other components

- **Supervisor**

## Connections

- Supervisor → Demo Frontend: uses
- Demo Frontend → Flask API: uploads scan
- Flask API → Demo Frontend: returns results
- Flask API → H₂S Predictor: requests estimate
- Flask API → SQLite Storage: stores scan
- Flask API → SQLite Storage: reads history
- ESP32 / MQ-136 → Flask API: posts telemetry
- Flask API → SQLite Storage: stores telemetry
- Flask API → SQLite Storage: reads telemetry
