mloda-plugin-govdata 0.2.1__tar.gz → 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mloda_plugin_govdata-0.2.3/PKG-INFO +152 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/README.md +4 -4
- mloda_plugin_govdata-0.2.3/mloda_plugin_govdata.egg-info/PKG-INFO +152 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/pyproject.toml +9 -1
- mloda_plugin_govdata-0.2.1/PKG-INFO +0 -29
- mloda_plugin_govdata-0.2.1/mloda_plugin_govdata.egg-info/PKG-INFO +0 -29
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/LICENSE +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/__init__.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/__init__.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/__init__.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/bundeswahlleiterin.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/core/__init__.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/core/cache.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/core/client.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/core/discovery.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/core/locator.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/core/parse.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/feature.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/population.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/reader.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/tests/__init__.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/tests/conftest.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/tests/test_cache.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/tests/test_client.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/tests/test_discovery.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/tests/test_parse.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/tests/test_parse_hypothesis.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/tests/test_reader.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/tests/test_uba.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata/feature_groups/govdata/uba.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata.egg-info/SOURCES.txt +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata.egg-info/dependency_links.txt +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata.egg-info/requires.txt +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata.egg-info/top_level.txt +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/setup.cfg +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/tests/test_demo_definition.py +0 -0
- {mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/tests/test_mloda_imports.py +0 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mloda-plugin-govdata
|
|
3
|
+
Version: 0.2.3
|
|
4
|
+
Summary: mloda plugin providing connectors and harmonization for German government data (GovData.de CKAN API, Destatis GENESIS API v3).
|
|
5
|
+
Author-email: Tom Kaltofen <tomkaltofen@mloda.ai>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/mloda-ai/mloda-plugin-govdata
|
|
8
|
+
Project-URL: Repository, https://github.com/mloda-ai/mloda-plugin-govdata
|
|
9
|
+
Project-URL: Issues, https://github.com/mloda-ai/mloda-plugin-govdata/issues
|
|
10
|
+
Project-URL: Releases, https://github.com/mloda-ai/mloda-plugin-govdata/releases
|
|
11
|
+
Project-URL: Prototype Fund, https://www.prototypefund.de/projects/mloda-plugin-govdata
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: mloda<0.11.0,>=0.10.0
|
|
16
|
+
Requires-Dist: mloda-testing>=0.3.1
|
|
17
|
+
Requires-Dist: httpx>=0.27
|
|
18
|
+
Requires-Dist: pandas>=2.0
|
|
19
|
+
Requires-Dist: pyarrow>=17.0
|
|
20
|
+
Requires-Dist: pydantic>=2.0
|
|
21
|
+
Requires-Dist: tenacity>=8.0
|
|
22
|
+
Provides-Extra: demo
|
|
23
|
+
Requires-Dist: marimo>=0.14; extra == "demo"
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: tox; extra == "dev"
|
|
26
|
+
Requires-Dist: tox-uv; extra == "dev"
|
|
27
|
+
Requires-Dist: uv>=0.11.15; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest; extra == "dev"
|
|
29
|
+
Requires-Dist: ruff; extra == "dev"
|
|
30
|
+
Requires-Dist: mypy; extra == "dev"
|
|
31
|
+
Requires-Dist: bandit; extra == "dev"
|
|
32
|
+
Requires-Dist: hypothesis; extra == "dev"
|
|
33
|
+
Requires-Dist: respx; extra == "dev"
|
|
34
|
+
Requires-Dist: pandas-stubs; extra == "dev"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
[](https://github.com/mloda-ai/mloda-plugin-govdata/blob/main/LICENSE)
|
|
38
|
+
[](https://github.com/mloda-ai/mloda)
|
|
39
|
+
[](https://www.python.org/)
|
|
40
|
+
[](https://github.com/mloda-ai/mloda-plugin-govdata/actions/workflows/test.yml?query=branch%3Amain)
|
|
41
|
+
[](https://prototypefund.de)
|
|
42
|
+
|
|
43
|
+
# mloda-plugin-govdata
|
|
44
|
+
|
|
45
|
+
Connectors for German open government data, built on [mloda](https://github.com/mloda-ai/mloda). Request the columns you want as mloda features; the plugin handles CKAN discovery, download with caching and retries, and parsing (German CSV or publisher JSON) into a typed Arrow table.
|
|
46
|
+
|
|
47
|
+
Three example datasets cover the M1 themes: population (GovData CSV), elections (Bundeswahlleiterin `kerg.csv`), and environment (UBA Air Data JSON).
|
|
48
|
+
|
|
49
|
+
## Status
|
|
50
|
+
|
|
51
|
+
Young but working. All three example readers run end to end, with paginated dataset search, cached downloads with retries, and unit plus property-based tests behind them. Every reader is a thin subclass of `BaseGovDataReader` that overrides only the parse step; new datasets follow the same path (see [docs/adding-a-reader.md](https://github.com/mloda-ai/mloda-plugin-govdata/blob/main/docs/adding-a-reader.md)). Development happens in a 6-month Prototype Fund stage (June to November 2026), so the API may still shift between releases.
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
Read the Stuttgart population dataset (via GovData) as a typed PyArrow table:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from mloda.user import Feature, mloda
|
|
59
|
+
from mloda_plugin_govdata.feature_groups.govdata import StuttgartPopulationReader
|
|
60
|
+
|
|
61
|
+
slug = "einwohner-nach-altersgruppen-und-stadtbezirken"
|
|
62
|
+
result = mloda.run_all(
|
|
63
|
+
[
|
|
64
|
+
Feature("Einwohner", options={StuttgartPopulationReader: slug}),
|
|
65
|
+
Feature("Stadtbezirk", options={StuttgartPopulationReader: slug}),
|
|
66
|
+
],
|
|
67
|
+
compute_frameworks=["PyArrowTable"],
|
|
68
|
+
)
|
|
69
|
+
table = result[0] # pyarrow.Table with the requested columns
|
|
70
|
+
result.plan # resolved execution steps: which FeatureGroup ran on which framework
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The options key is the reader class or its class-name string; both select the same reader. The option value is a GovData dataset slug or a direct distribution URL. The license is read from the CKAN distribution metadata. Set `BaseGovDataReader.cache_dir` to control where downloads are cached. For any other GovData CSV dataset, `GovDataReader` works out of the box and reads every column as a string; subclass it and set `schema` for typed columns.
|
|
74
|
+
|
|
75
|
+
Don't know the slug yet? Search GovData with the paginated CKAN `package_search` API:
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
from mloda_plugin_govdata.feature_groups.govdata import build_client, search_datasets
|
|
79
|
+
|
|
80
|
+
with build_client() as client:
|
|
81
|
+
for dataset in search_datasets(client, "einwohner stuttgart", max_results=10):
|
|
82
|
+
print(dataset.name, "|", dataset.title)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`search_datasets` walks the result pages lazily (`page_size` per request) and stops at `max_results` or the end of the result set.
|
|
86
|
+
|
|
87
|
+
Got a slug but not the column names? `peek` lists what you can request as features:
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
StuttgartPopulationReader.peek(slug) # {"Stichtag": "date32[day]", "Stadtbezirk": "string", ...}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
It works on every reader (`BundeswahlleiterinReader.peek(kerg)`, `UbaAirReader.peek(url)`) and downloads through the cache, so the actual feature request reuses the file. A typo in a feature name fails with the available columns and a close-match suggestion instead of a raw KeyError.
|
|
94
|
+
|
|
95
|
+
The elections reader handles a direct CSV URL whose file has a multi-row merged header (Bundeswahlleiterin `kerg.csv`):
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from mloda_plugin_govdata.feature_groups.govdata import BundeswahlleiterinReader
|
|
99
|
+
|
|
100
|
+
kerg = "https://www.bundeswahlleiterin.de/bundestagswahlen/2025/ergebnisse/opendata/btw25/csv/kerg.csv"
|
|
101
|
+
result = mloda.run_all(
|
|
102
|
+
[Feature("Gebiet", options={BundeswahlleiterinReader: kerg})],
|
|
103
|
+
compute_frameworks=["PyArrowTable"],
|
|
104
|
+
)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The environment reader fetches the Umweltbundesamt (UBA) Air Data v4 `measures` endpoint (REST JSON) and flattens it to one typed row per station and timestamp. `uba_measures_url` builds the query (here: hourly ozone at station 143):
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from mloda_plugin_govdata.feature_groups.govdata import UbaAirReader, uba_measures_url
|
|
111
|
+
|
|
112
|
+
url = uba_measures_url(station=143, component=3, scope=2, date_from="2025-01-01", date_to="2025-01-01")
|
|
113
|
+
result = mloda.run_all(
|
|
114
|
+
[
|
|
115
|
+
Feature("date_start", options={UbaAirReader: url}),
|
|
116
|
+
Feature("value", options={UbaAirReader: url}),
|
|
117
|
+
],
|
|
118
|
+
compute_frameworks=["PyArrowTable"],
|
|
119
|
+
)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Columns are `station_id`, `date_start`, `component_id`, `scope_id`, `value`, `date_end`, and `index` (the air-quality index). Component and scope ids come from the UBA `components` and `scopes` endpoints.
|
|
123
|
+
|
|
124
|
+
## Demo
|
|
125
|
+
|
|
126
|
+
An interactive [marimo](https://marimo.io) notebook walks through dataset discovery and all three example datasets. The notebook lives in the repository (not in the published package), so run it from a source checkout:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
git clone https://github.com/mloda-ai/mloda-plugin-govdata.git
|
|
130
|
+
cd mloda-plugin-govdata
|
|
131
|
+
uv sync --all-extras
|
|
132
|
+
uv run marimo edit demos/govdata_demo.py
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The notebook hits the live GovData, Bundeswahlleiterin, and UBA endpoints; downloads are cached locally after the first run.
|
|
136
|
+
|
|
137
|
+
## Related Repositories
|
|
138
|
+
|
|
139
|
+
- **[mloda](https://github.com/mloda-ai/mloda)**: the core library this plugin builds on. You declare which features you need; mloda resolves how to compute them.
|
|
140
|
+
|
|
141
|
+
- **[mloda-registry](https://github.com/mloda-ai/mloda-registry)**: plugin registry and development guides for the mloda ecosystem.
|
|
142
|
+
|
|
143
|
+
## Funding
|
|
144
|
+
|
|
145
|
+
Developed as part of the [Prototype Fund](https://prototypefund.de) (Round 2 / Jahrgang 02), funded by the German Federal Ministry of Research, Technology and Space (BMFTR) and supported by the [Open Knowledge Foundation Deutschland](https://okfn.de). Funding code (Förderkennzeichen): **16IS26S11**. Stage 1 funding period: 6 months from June 2026.
|
|
146
|
+
|
|
147
|
+
<p>
|
|
148
|
+
<img src="https://raw.githubusercontent.com/mloda-ai/mloda-plugin-govdata/main/logos/bmftr.png" alt="Funded by the Federal Ministry of Research, Technology and Space (BMFTR)" height="110">
|
|
149
|
+
|
|
150
|
+
<img src="https://raw.githubusercontent.com/mloda-ai/mloda-plugin-govdata/main/logos/prototypefund.png" alt="Supported by the Prototype Fund" height="110">
|
|
151
|
+
</p>
|
|
152
|
+
|
|
@@ -12,7 +12,7 @@ Three example datasets cover the M1 themes: population (GovData CSV), elections
|
|
|
12
12
|
|
|
13
13
|
## Status
|
|
14
14
|
|
|
15
|
-
Young but working. All three example readers run end to end, with paginated dataset search, cached downloads with retries, and unit plus property-based tests behind them. Every reader is a thin subclass of `BaseGovDataReader` that overrides only the parse step; new datasets follow the same path (see [docs/adding-a-reader.md](docs/adding-a-reader.md)). Development happens in a 6-month Prototype Fund stage (June to November 2026), so the API may still shift between releases.
|
|
15
|
+
Young but working. All three example readers run end to end, with paginated dataset search, cached downloads with retries, and unit plus property-based tests behind them. Every reader is a thin subclass of `BaseGovDataReader` that overrides only the parse step; new datasets follow the same path (see [docs/adding-a-reader.md](https://github.com/mloda-ai/mloda-plugin-govdata/blob/main/docs/adding-a-reader.md)). Development happens in a 6-month Prototype Fund stage (June to November 2026), so the API may still shift between releases.
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
@@ -90,7 +90,7 @@ Columns are `station_id`, `date_start`, `component_id`, `scope_id`, `value`, `da
|
|
|
90
90
|
An interactive [marimo](https://marimo.io) notebook walks through dataset discovery and all three example datasets. The notebook lives in the repository (not in the published package), so run it from a source checkout:
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
|
-
git clone https://github.com/
|
|
93
|
+
git clone https://github.com/mloda-ai/mloda-plugin-govdata.git
|
|
94
94
|
cd mloda-plugin-govdata
|
|
95
95
|
uv sync --all-extras
|
|
96
96
|
uv run marimo edit demos/govdata_demo.py
|
|
@@ -109,8 +109,8 @@ The notebook hits the live GovData, Bundeswahlleiterin, and UBA endpoints; downl
|
|
|
109
109
|
Developed as part of the [Prototype Fund](https://prototypefund.de) (Round 2 / Jahrgang 02), funded by the German Federal Ministry of Research, Technology and Space (BMFTR) and supported by the [Open Knowledge Foundation Deutschland](https://okfn.de). Funding code (Förderkennzeichen): **16IS26S11**. Stage 1 funding period: 6 months from June 2026.
|
|
110
110
|
|
|
111
111
|
<p>
|
|
112
|
-
<img src="logos/bmftr.png" alt="Funded by the Federal Ministry of Research, Technology and Space (BMFTR)" height="110">
|
|
112
|
+
<img src="https://raw.githubusercontent.com/mloda-ai/mloda-plugin-govdata/main/logos/bmftr.png" alt="Funded by the Federal Ministry of Research, Technology and Space (BMFTR)" height="110">
|
|
113
113
|
|
|
114
|
-
<img src="logos/prototypefund.png" alt="Supported by the Prototype Fund" height="110">
|
|
114
|
+
<img src="https://raw.githubusercontent.com/mloda-ai/mloda-plugin-govdata/main/logos/prototypefund.png" alt="Supported by the Prototype Fund" height="110">
|
|
115
115
|
</p>
|
|
116
116
|
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mloda-plugin-govdata
|
|
3
|
+
Version: 0.2.3
|
|
4
|
+
Summary: mloda plugin providing connectors and harmonization for German government data (GovData.de CKAN API, Destatis GENESIS API v3).
|
|
5
|
+
Author-email: Tom Kaltofen <tomkaltofen@mloda.ai>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/mloda-ai/mloda-plugin-govdata
|
|
8
|
+
Project-URL: Repository, https://github.com/mloda-ai/mloda-plugin-govdata
|
|
9
|
+
Project-URL: Issues, https://github.com/mloda-ai/mloda-plugin-govdata/issues
|
|
10
|
+
Project-URL: Releases, https://github.com/mloda-ai/mloda-plugin-govdata/releases
|
|
11
|
+
Project-URL: Prototype Fund, https://www.prototypefund.de/projects/mloda-plugin-govdata
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: mloda<0.11.0,>=0.10.0
|
|
16
|
+
Requires-Dist: mloda-testing>=0.3.1
|
|
17
|
+
Requires-Dist: httpx>=0.27
|
|
18
|
+
Requires-Dist: pandas>=2.0
|
|
19
|
+
Requires-Dist: pyarrow>=17.0
|
|
20
|
+
Requires-Dist: pydantic>=2.0
|
|
21
|
+
Requires-Dist: tenacity>=8.0
|
|
22
|
+
Provides-Extra: demo
|
|
23
|
+
Requires-Dist: marimo>=0.14; extra == "demo"
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: tox; extra == "dev"
|
|
26
|
+
Requires-Dist: tox-uv; extra == "dev"
|
|
27
|
+
Requires-Dist: uv>=0.11.15; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest; extra == "dev"
|
|
29
|
+
Requires-Dist: ruff; extra == "dev"
|
|
30
|
+
Requires-Dist: mypy; extra == "dev"
|
|
31
|
+
Requires-Dist: bandit; extra == "dev"
|
|
32
|
+
Requires-Dist: hypothesis; extra == "dev"
|
|
33
|
+
Requires-Dist: respx; extra == "dev"
|
|
34
|
+
Requires-Dist: pandas-stubs; extra == "dev"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
[](https://github.com/mloda-ai/mloda-plugin-govdata/blob/main/LICENSE)
|
|
38
|
+
[](https://github.com/mloda-ai/mloda)
|
|
39
|
+
[](https://www.python.org/)
|
|
40
|
+
[](https://github.com/mloda-ai/mloda-plugin-govdata/actions/workflows/test.yml?query=branch%3Amain)
|
|
41
|
+
[](https://prototypefund.de)
|
|
42
|
+
|
|
43
|
+
# mloda-plugin-govdata
|
|
44
|
+
|
|
45
|
+
Connectors for German open government data, built on [mloda](https://github.com/mloda-ai/mloda). Request the columns you want as mloda features; the plugin handles CKAN discovery, download with caching and retries, and parsing (German CSV or publisher JSON) into a typed Arrow table.
|
|
46
|
+
|
|
47
|
+
Three example datasets cover the M1 themes: population (GovData CSV), elections (Bundeswahlleiterin `kerg.csv`), and environment (UBA Air Data JSON).
|
|
48
|
+
|
|
49
|
+
## Status
|
|
50
|
+
|
|
51
|
+
Young but working. All three example readers run end to end, with paginated dataset search, cached downloads with retries, and unit plus property-based tests behind them. Every reader is a thin subclass of `BaseGovDataReader` that overrides only the parse step; new datasets follow the same path (see [docs/adding-a-reader.md](https://github.com/mloda-ai/mloda-plugin-govdata/blob/main/docs/adding-a-reader.md)). Development happens in a 6-month Prototype Fund stage (June to November 2026), so the API may still shift between releases.
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
Read the Stuttgart population dataset (via GovData) as a typed PyArrow table:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from mloda.user import Feature, mloda
|
|
59
|
+
from mloda_plugin_govdata.feature_groups.govdata import StuttgartPopulationReader
|
|
60
|
+
|
|
61
|
+
slug = "einwohner-nach-altersgruppen-und-stadtbezirken"
|
|
62
|
+
result = mloda.run_all(
|
|
63
|
+
[
|
|
64
|
+
Feature("Einwohner", options={StuttgartPopulationReader: slug}),
|
|
65
|
+
Feature("Stadtbezirk", options={StuttgartPopulationReader: slug}),
|
|
66
|
+
],
|
|
67
|
+
compute_frameworks=["PyArrowTable"],
|
|
68
|
+
)
|
|
69
|
+
table = result[0] # pyarrow.Table with the requested columns
|
|
70
|
+
result.plan # resolved execution steps: which FeatureGroup ran on which framework
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The options key is the reader class or its class-name string; both select the same reader. The option value is a GovData dataset slug or a direct distribution URL. The license is read from the CKAN distribution metadata. Set `BaseGovDataReader.cache_dir` to control where downloads are cached. For any other GovData CSV dataset, `GovDataReader` works out of the box and reads every column as a string; subclass it and set `schema` for typed columns.
|
|
74
|
+
|
|
75
|
+
Don't know the slug yet? Search GovData with the paginated CKAN `package_search` API:
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
from mloda_plugin_govdata.feature_groups.govdata import build_client, search_datasets
|
|
79
|
+
|
|
80
|
+
with build_client() as client:
|
|
81
|
+
for dataset in search_datasets(client, "einwohner stuttgart", max_results=10):
|
|
82
|
+
print(dataset.name, "|", dataset.title)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`search_datasets` walks the result pages lazily (`page_size` per request) and stops at `max_results` or the end of the result set.
|
|
86
|
+
|
|
87
|
+
Got a slug but not the column names? `peek` lists what you can request as features:
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
StuttgartPopulationReader.peek(slug) # {"Stichtag": "date32[day]", "Stadtbezirk": "string", ...}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
It works on every reader (`BundeswahlleiterinReader.peek(kerg)`, `UbaAirReader.peek(url)`) and downloads through the cache, so the actual feature request reuses the file. A typo in a feature name fails with the available columns and a close-match suggestion instead of a raw KeyError.
|
|
94
|
+
|
|
95
|
+
The elections reader handles a direct CSV URL whose file has a multi-row merged header (Bundeswahlleiterin `kerg.csv`):
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from mloda_plugin_govdata.feature_groups.govdata import BundeswahlleiterinReader
|
|
99
|
+
|
|
100
|
+
kerg = "https://www.bundeswahlleiterin.de/bundestagswahlen/2025/ergebnisse/opendata/btw25/csv/kerg.csv"
|
|
101
|
+
result = mloda.run_all(
|
|
102
|
+
[Feature("Gebiet", options={BundeswahlleiterinReader: kerg})],
|
|
103
|
+
compute_frameworks=["PyArrowTable"],
|
|
104
|
+
)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The environment reader fetches the Umweltbundesamt (UBA) Air Data v4 `measures` endpoint (REST JSON) and flattens it to one typed row per station and timestamp. `uba_measures_url` builds the query (here: hourly ozone at station 143):
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from mloda_plugin_govdata.feature_groups.govdata import UbaAirReader, uba_measures_url
|
|
111
|
+
|
|
112
|
+
url = uba_measures_url(station=143, component=3, scope=2, date_from="2025-01-01", date_to="2025-01-01")
|
|
113
|
+
result = mloda.run_all(
|
|
114
|
+
[
|
|
115
|
+
Feature("date_start", options={UbaAirReader: url}),
|
|
116
|
+
Feature("value", options={UbaAirReader: url}),
|
|
117
|
+
],
|
|
118
|
+
compute_frameworks=["PyArrowTable"],
|
|
119
|
+
)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Columns are `station_id`, `date_start`, `component_id`, `scope_id`, `value`, `date_end`, and `index` (the air-quality index). Component and scope ids come from the UBA `components` and `scopes` endpoints.
|
|
123
|
+
|
|
124
|
+
## Demo
|
|
125
|
+
|
|
126
|
+
An interactive [marimo](https://marimo.io) notebook walks through dataset discovery and all three example datasets. The notebook lives in the repository (not in the published package), so run it from a source checkout:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
git clone https://github.com/mloda-ai/mloda-plugin-govdata.git
|
|
130
|
+
cd mloda-plugin-govdata
|
|
131
|
+
uv sync --all-extras
|
|
132
|
+
uv run marimo edit demos/govdata_demo.py
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The notebook hits the live GovData, Bundeswahlleiterin, and UBA endpoints; downloads are cached locally after the first run.
|
|
136
|
+
|
|
137
|
+
## Related Repositories
|
|
138
|
+
|
|
139
|
+
- **[mloda](https://github.com/mloda-ai/mloda)**: the core library this plugin builds on. You declare which features you need; mloda resolves how to compute them.
|
|
140
|
+
|
|
141
|
+
- **[mloda-registry](https://github.com/mloda-ai/mloda-registry)**: plugin registry and development guides for the mloda ecosystem.
|
|
142
|
+
|
|
143
|
+
## Funding
|
|
144
|
+
|
|
145
|
+
Developed as part of the [Prototype Fund](https://prototypefund.de) (Round 2 / Jahrgang 02), funded by the German Federal Ministry of Research, Technology and Space (BMFTR) and supported by the [Open Knowledge Foundation Deutschland](https://okfn.de). Funding code (Förderkennzeichen): **16IS26S11**. Stage 1 funding period: 6 months from June 2026.
|
|
146
|
+
|
|
147
|
+
<p>
|
|
148
|
+
<img src="https://raw.githubusercontent.com/mloda-ai/mloda-plugin-govdata/main/logos/bmftr.png" alt="Funded by the Federal Ministry of Research, Technology and Space (BMFTR)" height="110">
|
|
149
|
+
|
|
150
|
+
<img src="https://raw.githubusercontent.com/mloda-ai/mloda-plugin-govdata/main/logos/prototypefund.png" alt="Supported by the Prototype Fund" height="110">
|
|
151
|
+
</p>
|
|
152
|
+
|
|
@@ -6,8 +6,9 @@ build-backend = "setuptools.build_meta"
|
|
|
6
6
|
name = "mloda-plugin-govdata"
|
|
7
7
|
# Always start at least at 0.2.0 to make semver work.
|
|
8
8
|
# Initial release for semver needs also a manually pushed minimum tag (likely 0.2.0).
|
|
9
|
-
version = "0.2.
|
|
9
|
+
version = "0.2.3"
|
|
10
10
|
description = "mloda plugin providing connectors and harmonization for German government data (GovData.de CKAN API, Destatis GENESIS API v3)."
|
|
11
|
+
readme = "README.md"
|
|
11
12
|
license = "Apache-2.0"
|
|
12
13
|
authors = [{ name = "Tom Kaltofen", email = "tomkaltofen@mloda.ai" }]
|
|
13
14
|
dependencies = [
|
|
@@ -21,6 +22,13 @@ dependencies = [
|
|
|
21
22
|
]
|
|
22
23
|
requires-python = ">=3.10"
|
|
23
24
|
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://github.com/mloda-ai/mloda-plugin-govdata"
|
|
27
|
+
Repository = "https://github.com/mloda-ai/mloda-plugin-govdata"
|
|
28
|
+
Issues = "https://github.com/mloda-ai/mloda-plugin-govdata/issues"
|
|
29
|
+
Releases = "https://github.com/mloda-ai/mloda-plugin-govdata/releases"
|
|
30
|
+
"Prototype Fund" = "https://www.prototypefund.de/projects/mloda-plugin-govdata"
|
|
31
|
+
|
|
24
32
|
[project.optional-dependencies]
|
|
25
33
|
demo = ["marimo>=0.14"]
|
|
26
34
|
dev = [
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: mloda-plugin-govdata
|
|
3
|
-
Version: 0.2.1
|
|
4
|
-
Summary: mloda plugin providing connectors and harmonization for German government data (GovData.de CKAN API, Destatis GENESIS API v3).
|
|
5
|
-
Author-email: Tom Kaltofen <tomkaltofen@mloda.ai>
|
|
6
|
-
License-Expression: Apache-2.0
|
|
7
|
-
Requires-Python: >=3.10
|
|
8
|
-
License-File: LICENSE
|
|
9
|
-
Requires-Dist: mloda<0.11.0,>=0.10.0
|
|
10
|
-
Requires-Dist: mloda-testing>=0.3.1
|
|
11
|
-
Requires-Dist: httpx>=0.27
|
|
12
|
-
Requires-Dist: pandas>=2.0
|
|
13
|
-
Requires-Dist: pyarrow>=17.0
|
|
14
|
-
Requires-Dist: pydantic>=2.0
|
|
15
|
-
Requires-Dist: tenacity>=8.0
|
|
16
|
-
Provides-Extra: demo
|
|
17
|
-
Requires-Dist: marimo>=0.14; extra == "demo"
|
|
18
|
-
Provides-Extra: dev
|
|
19
|
-
Requires-Dist: tox; extra == "dev"
|
|
20
|
-
Requires-Dist: tox-uv; extra == "dev"
|
|
21
|
-
Requires-Dist: uv>=0.11.15; extra == "dev"
|
|
22
|
-
Requires-Dist: pytest; extra == "dev"
|
|
23
|
-
Requires-Dist: ruff; extra == "dev"
|
|
24
|
-
Requires-Dist: mypy; extra == "dev"
|
|
25
|
-
Requires-Dist: bandit; extra == "dev"
|
|
26
|
-
Requires-Dist: hypothesis; extra == "dev"
|
|
27
|
-
Requires-Dist: respx; extra == "dev"
|
|
28
|
-
Requires-Dist: pandas-stubs; extra == "dev"
|
|
29
|
-
Dynamic: license-file
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: mloda-plugin-govdata
|
|
3
|
-
Version: 0.2.1
|
|
4
|
-
Summary: mloda plugin providing connectors and harmonization for German government data (GovData.de CKAN API, Destatis GENESIS API v3).
|
|
5
|
-
Author-email: Tom Kaltofen <tomkaltofen@mloda.ai>
|
|
6
|
-
License-Expression: Apache-2.0
|
|
7
|
-
Requires-Python: >=3.10
|
|
8
|
-
License-File: LICENSE
|
|
9
|
-
Requires-Dist: mloda<0.11.0,>=0.10.0
|
|
10
|
-
Requires-Dist: mloda-testing>=0.3.1
|
|
11
|
-
Requires-Dist: httpx>=0.27
|
|
12
|
-
Requires-Dist: pandas>=2.0
|
|
13
|
-
Requires-Dist: pyarrow>=17.0
|
|
14
|
-
Requires-Dist: pydantic>=2.0
|
|
15
|
-
Requires-Dist: tenacity>=8.0
|
|
16
|
-
Provides-Extra: demo
|
|
17
|
-
Requires-Dist: marimo>=0.14; extra == "demo"
|
|
18
|
-
Provides-Extra: dev
|
|
19
|
-
Requires-Dist: tox; extra == "dev"
|
|
20
|
-
Requires-Dist: tox-uv; extra == "dev"
|
|
21
|
-
Requires-Dist: uv>=0.11.15; extra == "dev"
|
|
22
|
-
Requires-Dist: pytest; extra == "dev"
|
|
23
|
-
Requires-Dist: ruff; extra == "dev"
|
|
24
|
-
Requires-Dist: mypy; extra == "dev"
|
|
25
|
-
Requires-Dist: bandit; extra == "dev"
|
|
26
|
-
Requires-Dist: hypothesis; extra == "dev"
|
|
27
|
-
Requires-Dist: respx; extra == "dev"
|
|
28
|
-
Requires-Dist: pandas-stubs; extra == "dev"
|
|
29
|
-
Dynamic: license-file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{mloda_plugin_govdata-0.2.1 → mloda_plugin_govdata-0.2.3}/mloda_plugin_govdata.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|