# jeevilucky143143-create/ai-aqi architecture

> Architecture diagram of the GitHub repository jeevilucky143143-create/ai-aqi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jeevilucky143143-create/ai-aqi
- Repository: https://github.com/jeevilucky143143-create/ai-aqi

## Overview

AI-AQI combines sensor telemetry, calibrated AQI forecasting, patient-contextualized environmental health guidance, and district-level GIS analytics. The primary workflow is sensor data fusion and ingestion, persistence, prediction, and presentation through the dashboard; a separate CDSS workflow stratifies environmental and patient risks and returns preventive guidance. Relationships are limited to sampled calls, SOURCE INDEX references, and explicit README descriptions; unsampled feature internals are represented at their documented directory paths.

Main entry points: [`deployment/api.py`](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/deployment/api.py) (REST API), [`cdss/cdss_service.py`](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/cdss/cdss_service.py) (CDSS orchestrator), [`frontend/src/App.tsx`](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/frontend/src/App.tsx) (React application), [`hardware/environmental_fusion.py`](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/hardware/environmental_fusion.py) (Environmental fusion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User Interface"]
  node_webapp["React application<br/>[App.tsx]"]
  node_dashboard["Telemetry dashboard"]
  node_prediction_ui["Prediction workspace"]
  node_cdss_ui["CDSS workspace"]
  node_gis_ui["GIS explorer"]
end

subgraph group_ingest["Telemetry Platform"]
  node_sensor(("Sensor unit"))
  node_fusion["Environmental fusion"]
  node_preprocess["Live preprocessing"]
  node_api["REST API<br/>[api.py]"]
  node_database[("Telemetry and user records<br/>[database.py]")]
  node_auth["Authentication and roles<br/>[auth.py]"]
end

subgraph group_forecast["AQI Forecasting"]
  node_inference["AQI inference<br/>[inference.py]"]
  node_architecture["Hybrid model<br/>[architecture.py]"]
  node_attention["Temporal attention<br/>[attention.py]"]
  node_data_pipeline["Dataset pipeline<br/>[tf_dataset.py]"]
  node_thresholds["Threshold calibration"]
  node_federated["Federated simulation<br/>[simulation.py]"]
end

subgraph group_clinical["Clinical Guidance"]
  node_cdss_service["CDSS orchestrator<br/>[cdss_service.py]"]
  node_schemas["Input contracts<br/>[schemas.py]"]
  node_environment_risk["Environmental risk"]
  node_dl_adapter["Prediction adapter<br/>[dl_adapter.py]"]
  node_respiratory["Respiratory rules"]
  node_skin["Skin risk rules<br/>[skin_rules.py]"]
  node_recommendations["Preventive guidance"]
end

subgraph group_analytics["Spatial Analytics"]
  node_gis_service["District risk analytics"]
end

node_user(("Platform user"))

node_user -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_dashboard
node_webapp -->|"routes to"| node_prediction_ui
node_webapp -->|"routes to"| node_cdss_ui
node_webapp -->|"routes to"| node_gis_ui
node_sensor -->|"sends readings"| node_fusion
node_fusion -->|"posts telemetry"| node_api
node_api -->|"calls"| node_preprocess
node_api -->|"calls"| node_fusion
node_api -->|"persists records"| node_database
node_api -->|"uses"| node_auth
node_api -->|"calls"| node_inference
node_inference -->|"loads model"| node_architecture
node_architecture -->|"uses layer"| node_attention
node_api -->|"calls"| node_cdss_service
node_api -->|"reads and writes"| node_database
node_dashboard -.->|"requests telemetry"| node_api
node_prediction_ui -.->|"requests forecasts"| node_api
node_gis_ui -->|"explores districts"| node_gis_service
node_cdss_ui -.->|"submits context"| node_api
node_cdss_service -->|"validates inputs"| node_schemas
node_cdss_service -->|"evaluates"| node_environment_risk
node_cdss_service -->|"adapts prediction"| node_dl_adapter
node_cdss_service -->|"stratifies risk"| node_respiratory
node_cdss_service -->|"evaluates risk"| node_skin
node_cdss_service -->|"generates guidance"| node_recommendations
node_data_pipeline -.->|"prepares training data"| node_architecture
node_thresholds -->|"supplies thresholds"| node_inference
node_federated -.->|"simulates edge learning"| node_user

click node_webapp "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/frontend/src/App.tsx"
click node_dashboard "https://github.com/jeevilucky143143-create/ai-aqi/tree/main/frontend/src/features/dashboard"
click node_prediction_ui "https://github.com/jeevilucky143143-create/ai-aqi/tree/main/frontend/src/features/prediction"
click node_cdss_ui "https://github.com/jeevilucky143143-create/ai-aqi/tree/main/frontend/src/features/cdss"
click node_gis_ui "https://github.com/jeevilucky143143-create/ai-aqi/tree/main/frontend/src/features/gis"
click node_fusion "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/hardware/environmental_fusion.py"
click node_preprocess "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/hardware/live_preprocessing.py"
click node_api "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/deployment/api.py"
click node_database "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/deployment/database.py"
click node_auth "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/deployment/auth.py"
click node_inference "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/deep_learning/inference.py"
click node_architecture "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/deep_learning/architecture.py"
click node_attention "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/deep_learning/attention.py"
click node_data_pipeline "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/deep_learning/tf_dataset.py"
click node_thresholds "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/deep_learning/threshold_calibration.py"
click node_federated "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/federated/simulation.py"
click node_cdss_service "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/cdss/cdss_service.py"
click node_schemas "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/cdss/schemas.py"
click node_environment_risk "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/cdss/environmental_risk.py"
click node_dl_adapter "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/cdss/dl_adapter.py"
click node_respiratory "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/cdss/respiratory_rules.py"
click node_skin "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/cdss/skin_rules.py"
click node_recommendations "https://github.com/jeevilucky143143-create/ai-aqi/blob/main/cdss/recommendation_engine.py"
click node_gis_service "https://github.com/jeevilucky143143-create/ai-aqi/tree/main/frontend/src/features/gis"

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_webapp,node_dashboard,node_prediction_ui,node_cdss_ui,node_gis_ui,node_user toneBlue
class node_sensor,node_fusion,node_preprocess,node_api,node_database,node_auth toneAmber
class node_inference,node_architecture,node_attention,node_data_pipeline,node_thresholds,node_federated toneMint
class node_cdss_service,node_schemas,node_environment_risk,node_dl_adapter,node_respiratory,node_skin,node_recommendations toneRose
class node_gis_service toneIndigo
```

## Components

### User Interface

- [React application](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Telemetry dashboard](https://github.com/jeevilucky143143-create/ai-aqi/tree/main/frontend/src/features/dashboard): `frontend/src/features/dashboard`
- [Prediction workspace](https://github.com/jeevilucky143143-create/ai-aqi/tree/main/frontend/src/features/prediction): `frontend/src/features/prediction`
- [CDSS workspace](https://github.com/jeevilucky143143-create/ai-aqi/tree/main/frontend/src/features/cdss): `frontend/src/features/cdss`
- [GIS explorer](https://github.com/jeevilucky143143-create/ai-aqi/tree/main/frontend/src/features/gis): `frontend/src/features/gis`

### Telemetry Platform

- **Sensor unit**
- [Environmental fusion](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/hardware/environmental_fusion.py): `hardware/environmental_fusion.py`
- [Live preprocessing](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/hardware/live_preprocessing.py): `hardware/live_preprocessing.py`
- [REST API](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/deployment/api.py): `deployment/api.py`
- [Telemetry and user records](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/deployment/database.py): `deployment/database.py`
- [Authentication and roles](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/deployment/auth.py): `deployment/auth.py`

### AQI Forecasting

- [AQI inference](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/deep_learning/inference.py): `deep_learning/inference.py`
- [Hybrid model](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/deep_learning/architecture.py): `deep_learning/architecture.py`
- [Temporal attention](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/deep_learning/attention.py): `deep_learning/attention.py`
- [Dataset pipeline](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/deep_learning/tf_dataset.py): `deep_learning/tf_dataset.py`
- [Threshold calibration](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/deep_learning/threshold_calibration.py): `deep_learning/threshold_calibration.py`
- [Federated simulation](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/federated/simulation.py): `federated/simulation.py`

### Clinical Guidance

- [CDSS orchestrator](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/cdss/cdss_service.py): `cdss/cdss_service.py`
- [Input contracts](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/cdss/schemas.py): `cdss/schemas.py`
- [Environmental risk](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/cdss/environmental_risk.py): `cdss/environmental_risk.py`
- [Prediction adapter](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/cdss/dl_adapter.py): `cdss/dl_adapter.py`
- [Respiratory rules](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/cdss/respiratory_rules.py): `cdss/respiratory_rules.py`
- [Skin risk rules](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/cdss/skin_rules.py): `cdss/skin_rules.py`
- [Preventive guidance](https://github.com/jeevilucky143143-create/ai-aqi/blob/main/cdss/recommendation_engine.py): `cdss/recommendation_engine.py`

### Spatial Analytics

- [District risk analytics](https://github.com/jeevilucky143143-create/ai-aqi/tree/main/frontend/src/features/gis): `frontend/src/features/gis`

### Other components

- **Platform user**

## Connections

- Platform user → React application: uses (evidence: `README.md`)
- React application → Telemetry dashboard: routes to (evidence: `frontend/src/App.tsx`)
- React application → Prediction workspace: routes to (evidence: `frontend/src/App.tsx`)
- React application → CDSS workspace: routes to (evidence: `frontend/src/App.tsx`)
- React application → GIS explorer: routes to (evidence: `frontend/src/App.tsx`)
- Sensor unit → Environmental fusion: sends readings (evidence: `README.md`)
- Environmental fusion → REST API: posts telemetry (evidence: `README.md`)
- REST API → Live preprocessing: calls (evidence: `deployment/api.py`)
- REST API → Environmental fusion: calls (evidence: `deployment/api.py`)
- REST API → Telemetry and user records: persists records (evidence: `README.md`)
- REST API → Authentication and roles: uses (evidence: `deployment/api.py`)
- REST API → AQI inference: calls (evidence: `deployment/api.py`)
- AQI inference → Hybrid model: loads model (evidence: `deep_learning/inference.py`)
- Hybrid model → Temporal attention: uses layer (evidence: `deep_learning/architecture.py`)
- REST API → CDSS orchestrator: calls (evidence: `deployment/api.py`)
- REST API → Telemetry and user records: reads and writes (evidence: `deployment/database.py`)
- Telemetry dashboard → REST API: requests telemetry (evidence: `README.md`)
- Prediction workspace → REST API: requests forecasts (evidence: `README.md`)
- GIS explorer → District risk analytics: explores districts (evidence: `README.md`)
- CDSS workspace → REST API: submits context (evidence: `README.md`)
- CDSS orchestrator → Input contracts: validates inputs (evidence: `cdss/cdss_service.py`)
- CDSS orchestrator → Environmental risk: evaluates (evidence: `cdss/cdss_service.py`)
- CDSS orchestrator → Prediction adapter: adapts prediction (evidence: `cdss/cdss_service.py`)
- CDSS orchestrator → Respiratory rules: stratifies risk (evidence: `cdss/cdss_service.py`)
- CDSS orchestrator → Skin risk rules: evaluates risk (evidence: `cdss/cdss_service.py`)
- CDSS orchestrator → Preventive guidance: generates guidance (evidence: `cdss/cdss_service.py`)
- Dataset pipeline → Hybrid model: prepares training data (evidence: `deep_learning/train_phase2d.py`)
- Threshold calibration → AQI inference: supplies thresholds (evidence: `deep_learning/inference.py`)
- Federated simulation → Platform user: simulates edge learning (evidence: `README.md`)
