# mohannadelhachimi/aquapilot-ai architecture

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

- Interactive diagram: https://gitdiagram.com/mohannadelhachimi/aquapilot-ai
- Repository: https://github.com/mohannadelhachimi/aquapilot-ai

## Overview

AquaPilot AI is a Streamlit water-management prototype with manager and farmer dashboards. Users enter through role-based demo authentication; the selected dashboard presents regional network monitoring or parcel-specific irrigation guidance, including weather-driven risk and energy recommendations, salinity scenarios, and water-token trading. Simulated consumption supports leak analysis, while weather and climatology use external data sources. Edges reflect README descriptions and the supplied source index or excerpts; unsampled implementation details are not inferred.

Main entry points: [`views/farm.py`](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/views/farm.py) (Farmer dashboard), [`views/regional.py`](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/views/regional.py) (Manager dashboard), [`app.py`](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/app.py) (Role navigation), [`core/bourse.py`](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/bourse.py) (Water-token market)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and dashboards"]
  node_app["Role navigation<br/>[app.py]"]
  node_auth["Demo authentication<br/>[auth.py]"]
  node_farm_view["Farmer dashboard<br/>[farm.py]"]
  node_regional_view["Manager dashboard<br/>[regional.py]"]
end

subgraph group_farm["Farm guidance"]
  node_agro["Irrigation planning<br/>[agro.py]"]
  node_evapo["Evapo-Shield<br/>[evapo.py]"]
  node_nexus["Water-energy Nexus<br/>[nexus.py]"]
  node_salinity["SalinityGuard<br/>[salinity.py]"]
  node_climate["Climate archive<br/>[climatology.py]"]
  node_nasa["Historical weather<br/>[nasa_power.py]"]
end

subgraph group_regional["Regional oversight"]
  node_synthetic["Synthetic consumption<br/>[synthetic.py]"]
  node_anomaly["Leak detection<br/>[anomaly.py]"]
  node_network["Network analysis<br/>[network.py]"]
end

subgraph group_shared["Shared services"]
  node_meteo["Weather forecast<br/>[open_meteo.py]"]
  node_farm_store[("Farm configuration<br/>[storage.py]")]
  node_reference["Agronomic references<br/>[reference.py]"]
  node_style["Shared UI components<br/>[style.py]"]
  node_bourse["Water-token market<br/>[bourse.py]"]
  node_market_store[("Market state<br/>[bourse.json]")]
end

node_user(("User"))
node_weather_service["Open-Meteo"]
node_nasa_service["NASA POWER"]

node_user -->|"opens"| node_app
node_app -->|"authenticates"| node_auth
node_app -->|"routes by role"| node_farm_view
node_app -->|"routes by role"| node_regional_view
node_app -->|"uses"| node_style
node_farm_view -->|"renders with"| node_style
node_regional_view -->|"renders with"| node_style
node_farm_view -->|"loads and saves"| node_farm_store
node_farm_view -->|"plans irrigation"| node_agro
node_farm_view -->|"computes risk"| node_evapo
node_farm_view -->|"plans pumping"| node_nexus
node_farm_view -->|"compares scenarios"| node_salinity
node_farm_view -->|"loads climatology"| node_climate
node_farm_view -->|"loads history"| node_nasa
node_farm_view -->|"loads forecast"| node_meteo
node_regional_view -->|"loads forecast"| node_meteo
node_meteo -->|"requests forecast"| node_weather_service
node_nasa -->|"requests history"| node_nasa_service
node_salinity -->|"uses crop water"| node_agro
node_salinity -->|"uses crop parameters"| node_reference
node_agro -->|"uses crop parameters"| node_reference
node_evapo -->|"uses loss limits"| node_reference
node_nexus -->|"applies risk threshold"| node_evapo
node_nexus -->|"uses energy parameters"| node_reference
node_regional_view -->|"detects and diagnoses"| node_anomaly
node_regional_view -->|"loads simulated data"| node_synthetic
node_regional_view -->|"analyzes demand"| node_network
node_regional_view -->|"computes regional plan"| node_nexus
node_regional_view -->|"uses risk model"| node_evapo
node_farm_view -->|"uses token market"| node_bourse
node_regional_view -->|"administers market"| node_bourse
node_bourse -->|"seeds demo accounts"| node_auth
node_bourse -->|"seeds demo farms"| node_synthetic
node_bourse -.->|"persists state"| node_market_store

click node_app "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/app.py"
click node_auth "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/auth.py"
click node_farm_view "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/views/farm.py"
click node_regional_view "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/views/regional.py"
click node_agro "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/agro.py"
click node_evapo "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/evapo.py"
click node_nexus "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/nexus.py"
click node_salinity "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/salinity.py"
click node_climate "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/connectors/climatology.py"
click node_nasa "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/connectors/nasa_power.py"
click node_meteo "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/connectors/open_meteo.py"
click node_farm_store "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/storage.py"
click node_reference "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/reference.py"
click node_style "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/ui/style.py"
click node_synthetic "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/synthetic.py"
click node_anomaly "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/anomaly.py"
click node_network "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/network.py"
click node_bourse "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/bourse.py"
click node_market_store "https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/data/bourse.json"

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_app,node_auth,node_farm_view,node_regional_view,node_user toneBlue
class node_agro,node_evapo,node_nexus,node_salinity,node_climate,node_nasa toneAmber
class node_synthetic,node_anomaly,node_network toneMint
class node_meteo,node_farm_store,node_reference,node_style,node_bourse,node_market_store toneRose
class node_weather_service,node_nasa_service toneIndigo
```

## Components

### Entry and dashboards

- [Role navigation](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/app.py): `app.py`
- [Demo authentication](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/auth.py): `core/auth.py`
- [Farmer dashboard](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/views/farm.py): `views/farm.py`
- [Manager dashboard](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/views/regional.py): `views/regional.py`

### Farm guidance

- [Irrigation planning](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/agro.py): `core/agro.py`
- [Evapo-Shield](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/evapo.py): `core/evapo.py`
- [Water-energy Nexus](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/nexus.py): `core/nexus.py`
- [SalinityGuard](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/salinity.py): `core/salinity.py`
- [Climate archive](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/connectors/climatology.py): `connectors/climatology.py`
- [Historical weather](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/connectors/nasa_power.py): `connectors/nasa_power.py`

### Regional oversight

- [Synthetic consumption](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/synthetic.py): `core/synthetic.py`
- [Leak detection](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/anomaly.py): `core/anomaly.py`
- [Network analysis](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/network.py): `core/network.py`

### Shared services

- [Weather forecast](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/connectors/open_meteo.py): `connectors/open_meteo.py`
- [Farm configuration](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/storage.py): `core/storage.py`
- [Agronomic references](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/reference.py): `core/reference.py`
- [Shared UI components](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/ui/style.py): `ui/style.py`
- [Water-token market](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/core/bourse.py): `core/bourse.py`
- [Market state](https://github.com/mohannadelhachimi/aquapilot-ai/blob/main/data/bourse.json): `data/bourse.json`

### Other components

- **User**
- **Open-Meteo**
- **NASA POWER**

## Connections

- User → Role navigation: opens (evidence: `README.md`)
- Role navigation → Demo authentication: authenticates (evidence: `app.py`)
- Role navigation → Farmer dashboard: routes by role (evidence: `README.md`)
- Role navigation → Manager dashboard: routes by role (evidence: `README.md`)
- Role navigation → Shared UI components: uses (evidence: `app.py`)
- Farmer dashboard → Shared UI components: renders with (evidence: `views/farm.py`)
- Manager dashboard → Shared UI components: renders with (evidence: `views/regional.py`)
- Farmer dashboard → Farm configuration: loads and saves (evidence: `views/farm.py`)
- Farmer dashboard → Irrigation planning: plans irrigation (evidence: `views/farm.py`)
- Farmer dashboard → Evapo-Shield: computes risk (evidence: `views/farm.py`)
- Farmer dashboard → Water-energy Nexus: plans pumping (evidence: `views/farm.py`)
- Farmer dashboard → SalinityGuard: compares scenarios (evidence: `views/farm.py`)
- Farmer dashboard → Climate archive: loads climatology (evidence: `views/farm.py`)
- Farmer dashboard → Historical weather: loads history (evidence: `views/farm.py`)
- Farmer dashboard → Weather forecast: loads forecast (evidence: `views/farm.py`)
- Manager dashboard → Weather forecast: loads forecast (evidence: `views/regional.py`)
- Weather forecast → Open-Meteo: requests forecast (evidence: `connectors/open_meteo.py`)
- Historical weather → NASA POWER: requests history (evidence: `README.md`)
- SalinityGuard → Irrigation planning: uses crop water (evidence: `core/salinity.py`)
- SalinityGuard → Agronomic references: uses crop parameters (evidence: `core/salinity.py`)
- Irrigation planning → Agronomic references: uses crop parameters (evidence: `core/agro.py`)
- Evapo-Shield → Agronomic references: uses loss limits (evidence: `core/evapo.py`)
- Water-energy Nexus → Evapo-Shield: applies risk threshold (evidence: `core/nexus.py`)
- Water-energy Nexus → Agronomic references: uses energy parameters (evidence: `core/nexus.py`)
- Manager dashboard → Leak detection: detects and diagnoses (evidence: `views/regional.py`)
- Manager dashboard → Synthetic consumption: loads simulated data (evidence: `views/regional.py`)
- Manager dashboard → Network analysis: analyzes demand (evidence: `views/regional.py`)
- Manager dashboard → Water-energy Nexus: computes regional plan (evidence: `views/regional.py`)
- Manager dashboard → Evapo-Shield: uses risk model (evidence: `views/regional.py`)
- Farmer dashboard → Water-token market: uses token market (evidence: `views/farm.py`)
- Manager dashboard → Water-token market: administers market (evidence: `views/regional.py`)
- Water-token market → Demo authentication: seeds demo accounts (evidence: `core/bourse.py`)
- Water-token market → Synthetic consumption: seeds demo farms (evidence: `core/bourse.py`)
- Water-token market → Market state: persists state (evidence: `README.md`)
