# lyesprojet/hydroclair architecture

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

- Interactive diagram: https://gitdiagram.com/lyesprojet/hydroclair
- Repository: https://github.com/lyesprojet/hydroclair

## Overview

HydroClair is a Flask site for consulting drinking-water quality in France. Users browse departments or the regional map, select a commune, and view its water network, recent analyses, and conformity alerts. The application delegates lookups to the data model, which queries SQLite. Separate importers populate static geographic/network metadata and network-linked analyses from Hub’eau; the README documents these as the database preparation workflow. The database file is generated locally and is not in the tree, so its node has no source path. Routes and importer links reflect the sampled code; unsampled page behavior is not expanded.

Main entry points: [`models/Back/import_analyses.py`](https://github.com/lyesprojet/hydroclair/blob/main/models/Back/import_analyses.py) (Analysis import), [`app.py`](https://github.com/lyesprojet/hydroclair/blob/main/app.py) (Flask routes), [`models/Back/import_static.py`](https://github.com/lyesprojet/hydroclair/blob/main/models/Back/import_static.py) (Static data import), [`models/Back/update_database.py`](https://github.com/lyesprojet/hydroclair/blob/main/models/Back/update_database.py) (Parameter updates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_flask["Flask routes<br/>[app.py]"]
  node_pages["Page templates"]
end

subgraph group_domain["Water data access"]
  node_data_model["Queries and regions<br/>[models.py]"]
  node_database[("SQLite water database")]
end

subgraph group_ingest["Data ingestion"]
  node_static_import["Static data import<br/>[import_static.py]"]
  node_analysis_import["Analysis import<br/>[import_analyses.py]"]
  node_maintenance["Parameter updates<br/>[update_database.py]"]
end

node_visitor(("Site visitor"))
node_hubeau{{"Hub’eau API"}}

node_visitor -->|"sends requests"| node_flask
node_flask -->|"renders pages"| node_pages
node_flask -->|"requests lookups"| node_data_model
node_data_model -->|"queries"| node_database
node_static_import -->|"fetches reference data"| node_hubeau
node_static_import -->|"writes metadata"| node_database
node_analysis_import -->|"reads communes"| node_database
node_analysis_import -->|"fetches analyses"| node_hubeau
node_analysis_import -->|"writes analyses"| node_database
node_maintenance -.->|"fetches updates"| node_hubeau
node_maintenance -.->|"updates metadata"| node_database

click node_flask "https://github.com/lyesprojet/hydroclair/blob/main/app.py"
click node_pages "https://github.com/lyesprojet/hydroclair/tree/main/Vue/templates"
click node_data_model "https://github.com/lyesprojet/hydroclair/blob/main/models/models.py"
click node_static_import "https://github.com/lyesprojet/hydroclair/blob/main/models/Back/import_static.py"
click node_analysis_import "https://github.com/lyesprojet/hydroclair/blob/main/models/Back/import_analyses.py"
click node_maintenance "https://github.com/lyesprojet/hydroclair/blob/main/models/Back/update_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_flask,node_pages toneBlue
class node_data_model,node_database toneAmber
class node_static_import,node_analysis_import,node_maintenance,node_hubeau toneMint
class node_visitor toneIndigo
```

## Components

### Web experience

- [Flask routes](https://github.com/lyesprojet/hydroclair/blob/main/app.py): `app.py`
- [Page templates](https://github.com/lyesprojet/hydroclair/tree/main/Vue/templates): `Vue/templates`

### Water data access

- [Queries and regions](https://github.com/lyesprojet/hydroclair/blob/main/models/models.py): `models/models.py`
- **SQLite water database**

### Data ingestion

- [Static data import](https://github.com/lyesprojet/hydroclair/blob/main/models/Back/import_static.py): `models/Back/import_static.py`
- [Analysis import](https://github.com/lyesprojet/hydroclair/blob/main/models/Back/import_analyses.py): `models/Back/import_analyses.py`
- [Parameter updates](https://github.com/lyesprojet/hydroclair/blob/main/models/Back/update_database.py): `models/Back/update_database.py`

### Other components

- **Site visitor**
- **Hub’eau API**

## Connections

- Site visitor → Flask routes: sends requests
- Flask routes → Page templates: renders pages
- Flask routes → Queries and regions: requests lookups
- Queries and regions → SQLite water database: queries
- Static data import → Hub’eau API: fetches reference data
- Static data import → SQLite water database: writes metadata
- Analysis import → SQLite water database: reads communes
- Analysis import → Hub’eau API: fetches analyses
- Analysis import → SQLite water database: writes analyses
- Parameter updates → Hub’eau API: fetches updates
- Parameter updates → SQLite water database: updates metadata
