# ddg-64/waterqualityprediction_cn architecture

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

- Interactive diagram: https://gitdiagram.com/ddg-64/waterqualityprediction_cn
- Repository: https://github.com/ddg-64/waterqualityprediction_cn

## Overview

This repository builds probabilistic water-quality forecasts for Chinese monitoring stations. Its main workflow acquires remote-sensing inputs and combines them with station observations and yearbook indicators; processing prepares features, splitting creates horizon-specific samples, and training produces quantile forecasts that evaluation scores and visualizes. The graph preserves documented 3-day and 14-day prediction paths and the four-modality model. Some processing and splitting links are documented rather than visible in sampled code; the README is cited for those relationships.

Main entry points: [`data_processing/run_pipeline.py`](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_processing/run_pipeline.py) (Processing runner), [`data_download/run_download.py`](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_download/run_download.py) (Download runner), [`training/evaluate.py`](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/training/evaluate.py) (Evaluation reports), [`config/settings.py`](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/config/settings.py) (GEE setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["Data acquisition"]
  node_download_runner["Download runner<br/>[run_download.py]"]
  node_gee_settings["GEE setup<br/>[settings.py]"]
  node_cams["CAMS download<br/>[download_cams.py]"]
  node_era5["ERA5 download<br/>[download_era5.py]"]
  node_dynamic_world["Dynamic World download<br/>[download_dw.py]"]
  node_population["Population download"]
end

subgraph group_processing["Feature processing"]
  node_pipeline_runner["Processing runner<br/>[run_pipeline.py]"]
  node_era5_features["ERA5 features"]
  node_cams_alignment["CAMS alignment"]
  node_landuse["Land-use fusion"]
  node_feature_merge["Feature merge<br/>[step6_merge_all.py]"]
  node_clean_combine["Clean and combine"]
  node_climate_zone["Climate assignment"]
  node_population_yearbook["Population and yearbook"]
end

subgraph group_learning["Forecast modeling"]
  node_splitting["Horizon data splitting"]
  node_model["Quantile model<br/>[model.py]"]
  node_losses["Training losses<br/>[losses.py]"]
  node_metrics["Evaluation metrics<br/>[metrics.py]"]
end

subgraph group_operations["Training and evaluation"]
  node_dataset["Dataset loaders<br/>[dataset.py]"]
  node_trainer["Model training<br/>[train.py]"]
  node_evaluator["Evaluation reports<br/>[evaluate.py]"]
end

node_researcher(("Researcher"))
node_gee[("Google Earth Engine")]

node_researcher -->|"runs downloads"| node_download_runner
node_download_runner -->|"dispatches"| node_cams
node_download_runner -->|"dispatches"| node_era5
node_download_runner -->|"dispatches"| node_dynamic_world
node_download_runner -->|"dispatches"| node_population
node_cams -->|"uses setup"| node_gee_settings
node_era5 -->|"uses setup"| node_gee_settings
node_dynamic_world -->|"uses setup"| node_gee_settings
node_population -->|"uses setup"| node_gee_settings
node_cams -->|"queries"| node_gee
node_era5 -->|"queries"| node_gee
node_dynamic_world -->|"queries"| node_gee
node_population -.->|"queries"| node_gee
node_researcher -->|"runs processing"| node_pipeline_runner
node_pipeline_runner -->|"calls"| node_era5_features
node_pipeline_runner -->|"calls"| node_cams_alignment
node_pipeline_runner -->|"runs fusion"| node_landuse
node_pipeline_runner -->|"calls"| node_feature_merge
node_pipeline_runner -->|"dispatches"| node_clean_combine
node_pipeline_runner -->|"dispatches"| node_climate_zone
node_pipeline_runner -->|"dispatches"| node_population_yearbook
node_feature_merge -->|"feeds features"| node_clean_combine
node_clean_combine -->|"enriches data"| node_population_yearbook
node_researcher -->|"prepares horizons"| node_splitting
node_splitting -->|"writes split inputs"| node_dataset
node_dataset -->|"builds loaders"| node_trainer
node_trainer -->|"trains"| node_model
node_trainer -->|"computes loss"| node_losses
node_researcher -->|"evaluates forecasts"| node_evaluator
node_evaluator -->|"loads splits"| node_dataset
node_evaluator -->|"loads forecasts"| node_model
node_evaluator -->|"computes scores"| node_metrics

click node_download_runner "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_download/run_download.py"
click node_gee_settings "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/config/settings.py"
click node_cams "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_download/download_cams.py"
click node_era5 "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_download/download_era5.py"
click node_dynamic_world "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_download/download_dw.py"
click node_population "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_download/download_population.py"
click node_pipeline_runner "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_processing/run_pipeline.py"
click node_era5_features "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_processing/step1_era5_features.py"
click node_cams_alignment "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_processing/step3_cams_align.py"
click node_landuse "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_processing/landuse_image_fusion.py"
click node_feature_merge "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_processing/step6_merge_all.py"
click node_clean_combine "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_processing/step7_clean_combine.py"
click node_climate_zone "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_processing/assign_climate_zone.py"
click node_population_yearbook "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_processing/step9_statistical_yearbook.py"
click node_splitting "https://github.com/ddg-64/waterqualityprediction_cn/tree/main/data_splitting"
click node_dataset "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/training/dataset.py"
click node_model "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/models/model.py"
click node_losses "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/models/losses.py"
click node_trainer "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/training/train.py"
click node_metrics "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/models/metrics.py"
click node_evaluator "https://github.com/ddg-64/waterqualityprediction_cn/blob/main/training/evaluate.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_download_runner,node_gee_settings,node_cams,node_era5,node_dynamic_world,node_population toneBlue
class node_pipeline_runner,node_era5_features,node_cams_alignment,node_landuse,node_feature_merge,node_clean_combine,node_climate_zone,node_population_yearbook,node_gee toneAmber
class node_splitting,node_model,node_losses,node_metrics toneMint
class node_dataset,node_trainer,node_evaluator toneRose
class node_researcher toneIndigo
```

## Components

### Data acquisition

- [Download runner](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_download/run_download.py): `data_download/run_download.py`
- [GEE setup](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/config/settings.py): `config/settings.py`
- [CAMS download](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_download/download_cams.py): `data_download/download_cams.py`
- [ERA5 download](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_download/download_era5.py): `data_download/download_era5.py`
- [Dynamic World download](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_download/download_dw.py): `data_download/download_dw.py`
- [Population download](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_download/download_population.py): `data_download/download_population.py`

### Feature processing

- [Processing runner](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_processing/run_pipeline.py): `data_processing/run_pipeline.py`
- [ERA5 features](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_processing/step1_era5_features.py): `data_processing/step1_era5_features.py`
- [CAMS alignment](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_processing/step3_cams_align.py): `data_processing/step3_cams_align.py`
- [Land-use fusion](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_processing/landuse_image_fusion.py): `data_processing/landuse_image_fusion.py`
- [Feature merge](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_processing/step6_merge_all.py): `data_processing/step6_merge_all.py`
- [Clean and combine](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_processing/step7_clean_combine.py): `data_processing/step7_clean_combine.py`
- [Climate assignment](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_processing/assign_climate_zone.py): `data_processing/assign_climate_zone.py`
- [Population and yearbook](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/data_processing/step9_statistical_yearbook.py): `data_processing/step9_statistical_yearbook.py`

### Forecast modeling

- [Horizon data splitting](https://github.com/ddg-64/waterqualityprediction_cn/tree/main/data_splitting): `data_splitting`
- [Quantile model](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/models/model.py): `models/model.py`
- [Training losses](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/models/losses.py): `models/losses.py`
- [Evaluation metrics](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/models/metrics.py): `models/metrics.py`

### Training and evaluation

- [Dataset loaders](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/training/dataset.py): `training/dataset.py`
- [Model training](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/training/train.py): `training/train.py`
- [Evaluation reports](https://github.com/ddg-64/waterqualityprediction_cn/blob/main/training/evaluate.py): `training/evaluate.py`

### Other components

- **Researcher**
- **Google Earth Engine**

## Connections

- Researcher → Download runner: runs downloads (evidence: `README.md`)
- Download runner → CAMS download: dispatches (evidence: `data_download/run_download.py`)
- Download runner → ERA5 download: dispatches (evidence: `data_download/run_download.py`)
- Download runner → Dynamic World download: dispatches (evidence: `data_download/run_download.py`)
- Download runner → Population download: dispatches (evidence: `data_download/run_download.py`)
- CAMS download → GEE setup: uses setup (evidence: `data_download/download_cams.py`)
- ERA5 download → GEE setup: uses setup (evidence: `data_download/download_era5.py`)
- Dynamic World download → GEE setup: uses setup (evidence: `data_download/download_dw.py`)
- Population download → GEE setup: uses setup (evidence: `data_download/download_population.py`)
- CAMS download → Google Earth Engine: queries (evidence: `data_download/download_cams.py`)
- ERA5 download → Google Earth Engine: queries (evidence: `data_download/download_era5.py`)
- Dynamic World download → Google Earth Engine: queries (evidence: `data_download/download_dw.py`)
- Population download → Google Earth Engine: queries
- Researcher → Processing runner: runs processing (evidence: `README.md`)
- Processing runner → ERA5 features: calls (evidence: `data_processing/run_pipeline.py`)
- Processing runner → CAMS alignment: calls (evidence: `data_processing/run_pipeline.py`)
- Processing runner → Land-use fusion: runs fusion (evidence: `README.md`)
- Processing runner → Feature merge: calls (evidence: `data_processing/run_pipeline.py`)
- Processing runner → Clean and combine: dispatches (evidence: `data_processing/run_pipeline.py`)
- Processing runner → Climate assignment: dispatches (evidence: `data_processing/run_pipeline.py`)
- Processing runner → Population and yearbook: dispatches (evidence: `data_processing/run_pipeline.py`)
- Feature merge → Clean and combine: feeds features (evidence: `README.md`)
- Clean and combine → Population and yearbook: enriches data (evidence: `README.md`)
- Researcher → Horizon data splitting: prepares horizons (evidence: `README.md`)
- Horizon data splitting → Dataset loaders: writes split inputs (evidence: `README.md`)
- Dataset loaders → Model training: builds loaders (evidence: `training/dataset.py`)
- Model training → Quantile model: trains (evidence: `training/train.py`)
- Model training → Training losses: computes loss (evidence: `training/train.py`)
- Researcher → Evaluation reports: evaluates forecasts (evidence: `README.md`)
- Evaluation reports → Dataset loaders: loads splits (evidence: `training/evaluate.py`)
- Evaluation reports → Quantile model: loads forecasts (evidence: `training/evaluate.py`)
- Evaluation reports → Evaluation metrics: computes scores (evidence: `training/evaluate.py`)
