# hai-mian-33/wec-risk-platform architecture

> Architecture diagram of the GitHub repository hai-mian-33/wec-risk-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hai-mian-33/wec-risk-platform
- Repository: https://github.com/hai-mian-33/wec-risk-platform

## Overview

WEC-Risk is a bilingual desktop application for turning an existing SWAT2012 watershed project into annual water-capacity results, two pollution-risk classes, and interactive maps. The principal flow runs from project selection and SWAT data parsing through factor screening, adaptive standards, capacity and risk calculations, then into map and chart views. The graph combines sampled source relationships with README-documented domain stages; unsampled subsystem links are omitted rather than inferred.

Main entry points: [`wec_platform/pipeline.py`](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/pipeline.py) (Analysis pipeline), [`wec_platform/ui/panels.py`](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/ui/panels.py) (Workflow panels), [`wec_platform/mapview.py`](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/mapview.py) (Interactive map), [`main.py`](https://github.com/hai-mian-33/wec-risk-platform/blob/main/main.py) (GUI / CLI entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_entry["GUI / CLI entry<br/>[main.py]"]
  node_window["Main window<br/>[main_window.py]"]
  node_panels["Workflow panels<br/>[panels.py]"]
  node_state["Application state<br/>[state.py]"]
  node_bridge["Map bridge<br/>[bridge.py]"]
  node_style["UI styling<br/>[style.py]"]
end

subgraph group_project["Project inputs"]
  node_project_model["Project configuration<br/>[project.py]"]
  node_swat_io["SWAT parsers<br/>[swat_io.py]"]
  node_swat_data["SWAT outputs and watershed data"]
end

subgraph group_analysis["Analysis engine"]
  node_screening["Factor screening<br/>[calibration.py]"]
  node_thresholds["Threshold configuration<br/>[calibration.py]"]
  node_pipeline["Analysis pipeline<br/>[pipeline.py]"]
  node_standards["Adaptive standard<br/>[pipeline.py]"]
  node_capacity_risk["Capacity and risk<br/>[pipeline.py]"]
  node_config["Pollutant parameters<br/>[config.py]"]
end

subgraph group_presentation["Maps and results"]
  node_geo["Geospatial processing<br/>[geo.py]"]
  node_mapview["Interactive map<br/>[mapview.py]"]
  node_charts["Charts and details<br/>[charts.py]"]
  node_i18n["Bilingual labels<br/>[i18n.py]"]
  node_basemaps["External map tiles"]
end

node_user(("User"))

node_user -->|"starts"| node_entry
node_entry -->|"loads project"| node_project_model
node_entry -->|"runs analysis"| node_pipeline
node_entry -->|"opens GUI"| node_window
node_entry -->|"applies style"| node_style
node_window -->|"builds tabs"| node_panels
node_window -->|"shares state"| node_state
node_window -->|"adds chart tab"| node_charts
node_user -->|"configures workflow"| node_panels
node_panels -->|"loads and saves"| node_project_model
node_panels -->|"starts analysis"| node_pipeline
node_panels -->|"configures screening"| node_screening
node_panels -->|"uses map"| node_mapview
node_panels -->|"uses bridge"| node_bridge
node_state -->|"runs stages"| node_pipeline
node_state -->|"loads geometry"| node_geo
node_project_model -->|"uses parsers"| node_swat_io
node_swat_data -->|"parses inputs"| node_swat_io
node_swat_io -->|"uses parameters"| node_config
node_pipeline -->|"screens factors"| node_screening
node_pipeline -->|"estimates thresholds"| node_thresholds
node_pipeline -->|"derives standard"| node_standards
node_pipeline -->|"calculates capacity and risk"| node_capacity_risk
node_pipeline -->|"uses parameters"| node_config
node_pipeline -->|"uses project settings"| node_project_model
node_screening -->|"uses factor definitions"| node_config
node_charts -->|"subscribes to results"| node_state
node_state -->|"provides map results"| node_mapview
node_geo -->|"reads shapefiles"| node_swat_data
node_mapview -->|"uses geospatial data"| node_geo
node_mapview -->|"uses risk colors"| node_config
node_mapview -->|"uses translations"| node_i18n
node_charts -->|"uses translations"| node_i18n
node_user -->|"views results"| node_mapview
node_mapview -.->|"loads map tiles"| node_basemaps

click node_entry "https://github.com/hai-mian-33/wec-risk-platform/blob/main/main.py"
click node_window "https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/ui/main_window.py"
click node_panels "https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/ui/panels.py"
click node_state "https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/ui/state.py"
click node_bridge "https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/ui/bridge.py"
click node_style "https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/ui/style.py"
click node_project_model "https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/project.py"
click node_swat_io "https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/swat_io.py"
click node_screening "https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/calibration.py"
click node_thresholds "https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/calibration.py"
click node_pipeline "https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/pipeline.py"
click node_standards "https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/pipeline.py"
click node_capacity_risk "https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/pipeline.py"
click node_config "https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/config.py"
click node_geo "https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/geo.py"
click node_mapview "https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/mapview.py"
click node_charts "https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/ui/charts.py"
click node_i18n "https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/i18n.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_entry,node_window,node_panels,node_state,node_bridge,node_style,node_user toneBlue
class node_project_model,node_swat_io,node_swat_data toneAmber
class node_screening,node_thresholds,node_pipeline,node_standards,node_capacity_risk,node_config toneMint
class node_geo,node_mapview,node_charts,node_i18n,node_basemaps toneRose
```

## Components

### Application

- [GUI / CLI entry](https://github.com/hai-mian-33/wec-risk-platform/blob/main/main.py): `main.py`
- [Main window](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/ui/main_window.py): `wec_platform/ui/main_window.py`
- [Workflow panels](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/ui/panels.py): `wec_platform/ui/panels.py`
- [Application state](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/ui/state.py): `wec_platform/ui/state.py`
- [Map bridge](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/ui/bridge.py): `wec_platform/ui/bridge.py`
- [UI styling](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/ui/style.py): `wec_platform/ui/style.py`

### Project inputs

- [Project configuration](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/project.py): `wec_platform/project.py`
- [SWAT parsers](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/swat_io.py): `wec_platform/swat_io.py`
- **SWAT outputs and watershed data**

### Analysis engine

- [Factor screening](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/calibration.py): `wec_platform/calibration.py`
- [Threshold configuration](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/calibration.py): `wec_platform/calibration.py`
- [Analysis pipeline](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/pipeline.py): `wec_platform/pipeline.py`
- [Adaptive standard](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/pipeline.py): `wec_platform/pipeline.py`
- [Capacity and risk](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/pipeline.py): `wec_platform/pipeline.py`
- [Pollutant parameters](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/config.py): `wec_platform/config.py`

### Maps and results

- [Geospatial processing](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/geo.py): `wec_platform/geo.py`
- [Interactive map](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/mapview.py): `wec_platform/mapview.py`
- [Charts and details](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/ui/charts.py): `wec_platform/ui/charts.py`
- [Bilingual labels](https://github.com/hai-mian-33/wec-risk-platform/blob/main/wec_platform/i18n.py): `wec_platform/i18n.py`
- **External map tiles**

### Other components

- **User**

## Connections

- User → GUI / CLI entry: starts (evidence: `README.md`)
- GUI / CLI entry → Project configuration: loads project (evidence: `main.py`)
- GUI / CLI entry → Analysis pipeline: runs analysis (evidence: `main.py`)
- GUI / CLI entry → Main window: opens GUI (evidence: `main.py`)
- GUI / CLI entry → UI styling: applies style (evidence: `main.py`)
- Main window → Workflow panels: builds tabs (evidence: `wec_platform/ui/main_window.py`)
- Main window → Application state: shares state (evidence: `wec_platform/ui/main_window.py`)
- Main window → Charts and details: adds chart tab (evidence: `wec_platform/ui/main_window.py`)
- User → Workflow panels: configures workflow (evidence: `README.md`)
- Workflow panels → Project configuration: loads and saves (evidence: `wec_platform/ui/panels.py`)
- Workflow panels → Analysis pipeline: starts analysis (evidence: `wec_platform/ui/panels.py`)
- Workflow panels → Factor screening: configures screening (evidence: `wec_platform/ui/panels.py`)
- Workflow panels → Interactive map: uses map (evidence: `wec_platform/ui/panels.py`)
- Workflow panels → Map bridge: uses bridge (evidence: `wec_platform/ui/panels.py`)
- Application state → Analysis pipeline: runs stages (evidence: `wec_platform/ui/state.py`)
- Application state → Geospatial processing: loads geometry (evidence: `wec_platform/ui/state.py`)
- Project configuration → SWAT parsers: uses parsers (evidence: `wec_platform/project.py`)
- SWAT outputs and watershed data → SWAT parsers: parses inputs (evidence: `README.md`)
- SWAT parsers → Pollutant parameters: uses parameters (evidence: `wec_platform/swat_io.py`)
- Analysis pipeline → Factor screening: screens factors (evidence: `README.md`)
- Analysis pipeline → Threshold configuration: estimates thresholds (evidence: `README.md`)
- Analysis pipeline → Adaptive standard: derives standard (evidence: `README.md`)
- Analysis pipeline → Capacity and risk: calculates capacity and risk (evidence: `README.md`)
- Analysis pipeline → Pollutant parameters: uses parameters (evidence: `wec_platform/pipeline.py`)
- Analysis pipeline → Project configuration: uses project settings (evidence: `wec_platform/pipeline.py`)
- Factor screening → Pollutant parameters: uses factor definitions (evidence: `wec_platform/calibration.py`)
- Charts and details → Application state: subscribes to results (evidence: `wec_platform/ui/charts.py`)
- Application state → Interactive map: provides map results (evidence: `wec_platform/ui/state.py`)
- Geospatial processing → SWAT outputs and watershed data: reads shapefiles (evidence: `README.md`)
- Interactive map → Geospatial processing: uses geospatial data (evidence: `wec_platform/mapview.py`)
- Interactive map → Pollutant parameters: uses risk colors (evidence: `wec_platform/mapview.py`)
- Interactive map → Bilingual labels: uses translations (evidence: `wec_platform/mapview.py`)
- Charts and details → Bilingual labels: uses translations (evidence: `wec_platform/ui/charts.py`)
- User → Interactive map: views results (evidence: `README.md`)
- Interactive map → External map tiles: loads map tiles (evidence: `README.md`)
