BaseGovDataReader (in mloda_plugin_govdata/feature_groups/govdata/reader.py) does the plumbing: locator coercion, CKAN discovery, cached download with retries, and column selection. Subclasses implement _parse (or, for plain CSVs, just set schema on a GovDataReader subclass), plus suffix when the payload is not CSV. Each data source lives in its own module (population.py, bundeswahlleiterin.py, uba.py); shared source-agnostic code (client, cache, discovery, locator, CSV parsing) lives in core/.
To connect a new dataset:
- Check whether
GovDataReaderalready handles it. A GovData slug or a direct CSV URL with a regular single-row header needs no code; every column is read as a string. For typed columns, subclassGovDataReaderin a new module and setschema(seepopulation.py). - For a different payload shape, subclass
BaseGovDataReaderand implement_parse(andsuffixfor non-CSV payloads);bundeswahlleiterin.pyanduba.pyshow the pattern. - Keep source-specific parse logic in the source's module as a
parse_*_bytesfunction plus a path wrapper, likeuba.py. Generic parsing belongs incore/parse.py. That keeps it testable from fixture files without network access. - Add tests under
mloda_plugin_govdata/feature_groups/govdata/tests/with a small real sample intests/fixtures/. - Export the reader from
feature_groups/govdata/__init__.pyand add a usage snippet to the README. - Run
tox(pytest, ruff, mypy strict, bandit); it must pass before a PR.