# kratzert/rivretrieve-python architecture

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

- Interactive diagram: https://gitdiagram.com/kratzert/rivretrieve-python
- Repository: https://github.com/kratzert/rivretrieve-python

## Overview

RivRetrieve is a Python library that unifies access to streamflow observations from country-specific providers. The principal workflow is to choose a provider fetcher, request a gauge, variable, and date range, and receive standardized tabular data; the README demonstrates this with the UK Environment Agency fetcher. Country modules implement distinct provider-specific retrieval and parsing, supported by a shared fetcher interface and common constants/utilities. The graph retains the core country modules listed in the source index. Some fetchers and their provider connections were not excerpted, so those relationships are not inferred.

Main entry points: [`rivretrieve/utils.py`](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/utils.py) (Shared utilities), [`rivretrieve/base.py`](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/base.py) (Fetcher interface), [`rivretrieve/constants.py`](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/constants.py) (Data conventions), [`rivretrieve/uk_ea.py`](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/uk_ea.py) (UK EA fetcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Shared interface"]
  node_base["Fetcher interface<br/>[base.py]"]
  node_utils["Shared utilities<br/>[utils.py]"]
  node_constants["Data conventions<br/>[constants.py]"]
end

subgraph group_europe["European fetchers"]
  node_uk_ea["UK EA fetcher<br/>[uk_ea.py]"]
  node_uk_nrfa["UK NRFA fetcher<br/>[uk_nrfa.py]"]
  node_france["France fetcher<br/>[france.py]"]
  node_germany["Berlin fetcher<br/>[germany_berlin.py]"]
  node_czech["Czech fetcher<br/>[czech.py]"]
  node_poland["Poland fetcher<br/>[poland.py]"]
  node_portugal["Portugal fetcher<br/>[portugal.py]"]
  node_spain["Spain fetcher<br/>[spain.py]"]
  node_slovenia["Slovenia fetcher<br/>[slovenia.py]"]
  node_norway["Norway fetcher<br/>[norway.py]"]
  node_lithuania["Lithuania fetcher<br/>[lithuania.py]"]
end

subgraph group_asia_oceania["Asia-Pacific fetchers"]
  node_japan["Japan fetcher<br/>[japan.py]"]
  node_australia["Australia fetcher<br/>[australia.py]"]
end

subgraph group_americas_africa["Americas and Africa"]
  node_brazil["Brazil fetcher<br/>[brazil.py]"]
  node_canada["Canada fetcher<br/>[canada.py]"]
  node_chile["Chile fetcher<br/>[chile.py]"]
  node_southafrica["South Africa fetcher<br/>[southafrica.py]"]
  node_usa["USA fetcher<br/>[usa.py]"]
end

node_user(("Library user"))
node_result["Standardized data"]

node_user -->|"requests data"| node_uk_ea
node_uk_ea -->|"returns data"| node_result
node_australia -->|"imports interface"| node_base
node_brazil -->|"imports interface"| node_base
node_canada -->|"imports interface"| node_base
node_chile -->|"imports interface"| node_base
node_czech -->|"imports interface"| node_base
node_france -->|"imports interface"| node_base
node_germany -->|"imports interface"| node_base
node_japan -->|"imports interface"| node_base
node_lithuania -->|"imports interface"| node_base
node_norway -->|"imports interface"| node_base
node_poland -->|"imports interface"| node_base
node_portugal -->|"imports interface"| node_base
node_slovenia -->|"imports interface"| node_base
node_southafrica -->|"imports interface"| node_base
node_spain -->|"imports interface"| node_base
node_uk_ea -->|"imports interface"| node_base
node_uk_nrfa -->|"imports interface"| node_base
node_usa -->|"imports interface"| node_base
node_australia -->|"uses utilities"| node_utils
node_brazil -->|"uses utilities"| node_utils
node_canada -->|"uses utilities"| node_utils
node_chile -->|"uses utilities"| node_utils
node_czech -->|"uses utilities"| node_utils
node_france -->|"uses utilities"| node_utils
node_germany -->|"uses utilities"| node_utils
node_japan -->|"uses utilities"| node_utils
node_lithuania -->|"uses utilities"| node_utils
node_norway -->|"uses utilities"| node_utils
node_poland -->|"uses utilities"| node_utils
node_portugal -->|"uses utilities"| node_utils
node_slovenia -->|"uses utilities"| node_utils
node_southafrica -->|"uses utilities"| node_utils
node_spain -->|"uses utilities"| node_utils
node_uk_ea -->|"uses utilities"| node_utils
node_uk_nrfa -->|"uses utilities"| node_utils
node_usa -->|"uses utilities"| node_utils
node_utils -->|"uses conventions"| node_constants
node_brazil -->|"uses conventions"| node_constants
node_canada -->|"uses conventions"| node_constants
node_czech -->|"uses conventions"| node_constants
node_japan -->|"uses conventions"| node_constants
node_norway -->|"uses conventions"| node_constants
node_poland -->|"uses conventions"| node_constants
node_portugal -->|"uses conventions"| node_constants
node_southafrica -->|"uses conventions"| node_constants
node_spain -->|"uses conventions"| node_constants

click node_uk_ea "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/uk_ea.py"
click node_uk_nrfa "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/uk_nrfa.py"
click node_france "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/france.py"
click node_germany "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/germany_berlin.py"
click node_czech "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/czech.py"
click node_poland "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/poland.py"
click node_portugal "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/portugal.py"
click node_spain "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/spain.py"
click node_slovenia "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/slovenia.py"
click node_norway "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/norway.py"
click node_japan "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/japan.py"
click node_australia "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/australia.py"
click node_lithuania "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/lithuania.py"
click node_brazil "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/brazil.py"
click node_canada "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/canada.py"
click node_chile "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/chile.py"
click node_southafrica "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/southafrica.py"
click node_usa "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/usa.py"
click node_base "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/base.py"
click node_utils "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/utils.py"
click node_constants "https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/constants.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_base,node_utils,node_constants,node_user toneBlue
class node_uk_ea,node_uk_nrfa,node_france,node_germany,node_czech,node_poland,node_portugal,node_spain,node_slovenia,node_norway,node_lithuania toneAmber
class node_japan,node_australia toneMint
class node_brazil,node_canada,node_chile,node_southafrica,node_usa toneRose
class node_result toneIndigo
```

## Components

### Shared interface

- [Fetcher interface](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/base.py): `rivretrieve/base.py`
- [Shared utilities](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/utils.py): `rivretrieve/utils.py`
- [Data conventions](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/constants.py): `rivretrieve/constants.py`

### European fetchers

- [UK EA fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/uk_ea.py): `rivretrieve/uk_ea.py`
- [UK NRFA fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/uk_nrfa.py): `rivretrieve/uk_nrfa.py`
- [France fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/france.py): `rivretrieve/france.py`
- [Berlin fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/germany_berlin.py): `rivretrieve/germany_berlin.py`
- [Czech fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/czech.py): `rivretrieve/czech.py`
- [Poland fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/poland.py): `rivretrieve/poland.py`
- [Portugal fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/portugal.py): `rivretrieve/portugal.py`
- [Spain fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/spain.py): `rivretrieve/spain.py`
- [Slovenia fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/slovenia.py): `rivretrieve/slovenia.py`
- [Norway fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/norway.py): `rivretrieve/norway.py`
- [Lithuania fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/lithuania.py): `rivretrieve/lithuania.py`

### Asia-Pacific fetchers

- [Japan fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/japan.py): `rivretrieve/japan.py`
- [Australia fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/australia.py): `rivretrieve/australia.py`

### Americas and Africa

- [Brazil fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/brazil.py): `rivretrieve/brazil.py`
- [Canada fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/canada.py): `rivretrieve/canada.py`
- [Chile fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/chile.py): `rivretrieve/chile.py`
- [South Africa fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/southafrica.py): `rivretrieve/southafrica.py`
- [USA fetcher](https://github.com/kratzert/rivretrieve-python/blob/main/rivretrieve/usa.py): `rivretrieve/usa.py`

### Other components

- **Library user**
- **Standardized data**

## Connections

- Library user → UK EA fetcher: requests data (evidence: `README.md`)
- UK EA fetcher → Standardized data: returns data (evidence: `README.md`)
- Australia fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/australia.py`)
- Brazil fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/brazil.py`)
- Canada fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/canada.py`)
- Chile fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/chile.py`)
- Czech fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/czech.py`)
- France fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/france.py`)
- Berlin fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/germany_berlin.py`)
- Japan fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/japan.py`)
- Lithuania fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/lithuania.py`)
- Norway fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/norway.py`)
- Poland fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/poland.py`)
- Portugal fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/portugal.py`)
- Slovenia fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/slovenia.py`)
- South Africa fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/southafrica.py`)
- Spain fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/spain.py`)
- UK EA fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/uk_ea.py`)
- UK NRFA fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/uk_nrfa.py`)
- USA fetcher → Fetcher interface: imports interface (evidence: `rivretrieve/usa.py`)
- Australia fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/australia.py`)
- Brazil fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/brazil.py`)
- Canada fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/canada.py`)
- Chile fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/chile.py`)
- Czech fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/czech.py`)
- France fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/france.py`)
- Berlin fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/germany_berlin.py`)
- Japan fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/japan.py`)
- Lithuania fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/lithuania.py`)
- Norway fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/norway.py`)
- Poland fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/poland.py`)
- Portugal fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/portugal.py`)
- Slovenia fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/slovenia.py`)
- South Africa fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/southafrica.py`)
- Spain fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/spain.py`)
- UK EA fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/uk_ea.py`)
- UK NRFA fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/uk_nrfa.py`)
- USA fetcher → Shared utilities: uses utilities (evidence: `rivretrieve/usa.py`)
- Shared utilities → Data conventions: uses conventions (evidence: `rivretrieve/utils.py`)
- Brazil fetcher → Data conventions: uses conventions (evidence: `rivretrieve/brazil.py`)
- Canada fetcher → Data conventions: uses conventions (evidence: `rivretrieve/canada.py`)
- Czech fetcher → Data conventions: uses conventions (evidence: `rivretrieve/czech.py`)
- Japan fetcher → Data conventions: uses conventions (evidence: `rivretrieve/japan.py`)
- Norway fetcher → Data conventions: uses conventions (evidence: `rivretrieve/norway.py`)
- Poland fetcher → Data conventions: uses conventions (evidence: `rivretrieve/poland.py`)
- Portugal fetcher → Data conventions: uses conventions (evidence: `rivretrieve/portugal.py`)
- South Africa fetcher → Data conventions: uses conventions (evidence: `rivretrieve/southafrica.py`)
- Spain fetcher → Data conventions: uses conventions (evidence: `rivretrieve/spain.py`)
