Repository navigation
feat(referential): stations referential exporter, format 1 (v1.0.0) - #2
Conversation
export-referential builds one JSON file of Île-de-France logical stations (zones de correspondance) with their lines from five open datasets, and validates it against a closed JSON Schema shipped in the package. A release workflow publishes the all-modes export and the schema on each tag, under ODbL. Adds the arrets and zones-de-correspondance datasets, a lazy SDK import (so the package works outside a checkout), a build system and pyproj.
Agent reviewChecked: ruff lint and format, 187 tests (97 new, 98 % coverage on Worth reading first
Not tested: Out of scope, flagged: the broken Not merged, not tagged: both are yours. |
The PRIM portal now answers 403 to automated clients, on the API page and on the direct spec URL alike, so this step failed on main whatever the code. The sync logic is covered by unit tests; the dry-run stays as a visible warning.
|
Follow-up: CI initially failed on the network sync dry-run. The PRIM portal now answers 403 to automated clients, on both the API page and the direct spec URL, and the same failure reproduces on |
What
A new, stable part of the repository:
export-referentialandprim_api.referential. From five IDFM Opendatasoft datasets, it builds one JSON file listing the logical stations of Île-de-France with their lines, in a strict numbered format (format 1) validated by a closed JSON Schema shipped in the package.areas= stop areas served (what SIRI Stop Monitoring queries).METRO,RER,TRAIN,TRAM,BUS,SHUTTLE,FUNICULAR,CABLEWAY);--modesfilters. No notion of city or consumer.version(most recent portaldata_processed),generator,license(ODbL-1.0),attribution,modes.Why
The Everyday France app embeds this referential offline and owns its contract; this repository is its first producer. Two sources (
arrets-lignes,referentiel-des-lignes) are ODbL, so every export is published under ODbL with its notice in the file.Changes
prim_api/referential/:format1.py(pure construction rules),schema.py,cli.py,schemas/stations.format-1.schema.json.manifests/datasets.yml:arrets,zones-de-correspondance(+ generated schemas indata/schema/).prim_api/datasets.py: explicitdata_dir,load_metadata,fetch_dataset_metadata,record_metadata_fields(backward compatible).prim_api/__init__.py:IdFMPrimAPIimported lazily — the generated client only exists in a checkout, and eager import made the installed package unusable.pyproject.toml: version1.0.0, build system (souvx --from git+…@v1.0.0 export-referentialworks),pyproj,export-referentialentry point, Markdown excluded fromruff format(ruff 0.16 now formats Markdown code blocks and would fail CI on untouched docs).release.yml: on av*tag, checks tag = version, lints, tests, exports all modes, publishes export + schema as a GitHub release.samples/browse_referential.py.How it's tested
tests/fixtures/referential/): every construction rule, schema closure, error cases, CLI with--no-downloadand mocked downloads. Coverage 98 % onprim_api.referential.uvx --from dist/*.whl): schema packaged, cache dir used,generator=idfm-prim-api@1.0.0.actionlintclean.To test by hand:
uv sync && uv run export-referential --modes METRO,RER,TRAIN,TRAM -o /tmp/stations.json(~40 s, prints the station count per mode).Limits
release.ymlhas not run yet: it runs on the first tag.sync-datasets…) still do not work (tools/is not packaged) — pre-existing; the README now documentspython -m tools.…, as CI already does.After merge
Push the tag
v1.0.0yourself: it freezes format 1 and triggers the release. Tags are never pushed by an agent.🤖 Generated with Claude Code
https://claude.ai/code/session_01L4aZBkZFaLEiu7ax7RdwiD