-
Notifications
You must be signed in to change notification settings - Fork 0
006 download rinf topology #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
46b3838
specs: add rinf download spec
MathiasVDA 67c56bc
specs: add technical plan for rinf download
MathiasVDA 18fab0e
specs: add tasklist for rinf download feature
MathiasVDA 6b824b7
feat: first implementation of rinf download
MathiasVDA 9226470
fix: cli still required --network to be defined
MathiasVDA 043ad92
feat: add support for naive timestamp (timezone-less) input
MathiasVDA 25e7681
Merge branch 'agents/fix-pypi-version-update-workflow' into 006-downl…
MathiasVDA 4ea3a6a
feat: add fetch-topology subcommand to investigate any topology relat…
MathiasVDA 0e6cf46
feat: make the rinf topology validation less severe on the coarse req…
MathiasVDA af4e845
docs: added test-data set with explanation about the RINF download fe…
MathiasVDA 796870a
chore: fix test due to new time handling feature
MathiasVDA f95a430
chore: fix linting issues
MathiasVDA b51d23a
chore: allow MPL-2.0 license for Mozilla's webpki-roots library
MathiasVDA 433fc2d
chore: remove invalid test after support for UTC-less timestamps was …
MathiasVDA 450795d
chore: added wrong license allowed for webpki-roots
MathiasVDA a066d0d
chore: address review comments
MathiasVDA bca22c8
docs: address review comments
MathiasVDA b8f658f
feat: made sure simple-projection also triggers RINF download
MathiasVDA df74a18
chore: improve test coverage
MathiasVDA File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
specs/006-download-rinf-topology/checklists/requirements.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Specification Quality Checklist: ERA RINF Network Download | ||
|
|
||
| **Purpose**: Validate specification completeness and quality before proceeding to planning | ||
| **Created**: 2026-05-13 | ||
| **Feature**: [spec.md](../spec.md) | ||
|
|
||
| ## Content Quality | ||
|
|
||
| - [x] No implementation details (languages, frameworks, APIs) | ||
| - [x] Focused on user value and business needs | ||
| - [x] Written for non-technical stakeholders | ||
| - [x] All mandatory sections completed | ||
|
|
||
| ## Requirement Completeness | ||
|
|
||
| - [x] No [NEEDS CLARIFICATION] markers remain | ||
| - [x] Requirements are testable and unambiguous | ||
| - [x] Success criteria are measurable | ||
| - [x] Success criteria are technology-agnostic (no implementation details) | ||
| - [x] All acceptance scenarios are defined | ||
| - [x] Edge cases are identified | ||
| - [x] Scope is clearly bounded | ||
| - [x] Dependencies and assumptions identified | ||
|
|
||
| ## Feature Readiness | ||
|
|
||
| - [x] All functional requirements have clear acceptance criteria | ||
| - [x] User scenarios cover primary flows | ||
| - [x] Feature meets measurable outcomes defined in Success Criteria | ||
| - [x] No implementation details leak into specification | ||
|
|
||
| ## Notes | ||
|
|
||
| - Validation passed on first review. | ||
| - External source behavior is specified in outcome terms only; technical query design is intentionally deferred to planning. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,194 @@ | ||
| # API Contracts: ERA RINF Topology Retrieval | ||
|
|
||
| **Phase**: Phase 1 — Design & Contracts | ||
| **Date**: 2026-05-13 | ||
| **Feature**: `006-download-rinf-topology` | ||
|
|
||
| This document specifies the public contracts for automatic topology retrieval across the external SPARQL boundary and the repo's user-facing integration surfaces. | ||
|
|
||
| --- | ||
|
|
||
| ## 1. External SPARQL Contract | ||
|
|
||
| ### Endpoint | ||
|
|
||
| - `POST https://graph.data.era.europa.eu/repositories/rinf-plus` | ||
| - Request content type: `application/sparql-query` or standard form-encoded `query=` payload | ||
| - Response content type: `application/sparql-results+json` | ||
|
|
||
| ### Query A: Netelements by Search Polygon | ||
|
|
||
| **Inputs**: | ||
| - `search_polygon_wkt: string` in WGS84 lon/lat order | ||
|
|
||
| **Result columns**: | ||
| - `netelement` | ||
| - `netelement_wkt` | ||
|
|
||
| **Contract requirements**: | ||
| - Returns every `era:LinearElement` whose geometry intersects the search polygon. | ||
| - Returned `netelement_wkt` must be parseable into a LineString. | ||
|
|
||
| ### Query B: Netrelations by Retrieved Elements | ||
|
|
||
| **Inputs**: | ||
| - `seed element IRIs` from Query A | ||
| - current date for validity filtering | ||
|
|
||
| **Result columns**: | ||
| - `netrelation` | ||
| - `netelementA` | ||
| - `netelementB` | ||
| - `isOnOriginOfElementA` | ||
| - `isOnOriginOfElementB` | ||
| - `navigability` | ||
|
|
||
| **Contract requirements**: | ||
| - Only currently valid netrelations are returned. | ||
| - Each row must reference two netelements that can be mapped into the retrieved topology bundle. | ||
|
|
||
| --- | ||
|
|
||
| ## 2. CLI Contract (`tp-cli`) | ||
|
|
||
| Topology-dependent commands continue to support manual topology input and gain automatic retrieval when `--network` is omitted. | ||
|
|
||
| ### Default / `calculate-path` | ||
|
|
||
| ```text | ||
| tp-cli calculate-path --gnss <FILE> [--network <FILE>] [--rinf-endpoint <URL>] [--rinf-buffer-meters <N>] | ||
| ``` | ||
|
|
||
| **Behavior**: | ||
| - If `--network` is provided, CLI uses supplied topology and does not contact RINF. | ||
| - If `--network` is omitted, CLI derives a search polygon from GNSS, retrieves RINF topology, validates it, and then runs path calculation. | ||
|
|
||
| **Failure outcomes**: | ||
| - Invalid GNSS input: non-zero exit, stderr explains GNSS input is empty/invalid. | ||
| - Missing coverage: non-zero exit, stderr explains no topology was available for the area. | ||
| - Incomplete topology: non-zero exit, stderr explains coarse geometry or missing netrelations. | ||
| - Endpoint failure: non-zero exit, stderr explains retrieval failed upstream. | ||
|
|
||
| ### `simple-projection` and other topology-dependent commands | ||
|
|
||
| Same source-selection rule applies: omit `--network` to trigger automatic RINF retrieval. | ||
|
|
||
|
MathiasVDA marked this conversation as resolved.
|
||
| --- | ||
|
|
||
| ## 3. Python Binding Contract (`tp-py`) | ||
|
|
||
| ### Retrieval options class | ||
|
|
||
| ```python | ||
| class RinfRetrievalOptions: | ||
| endpoint_url: str = "https://graph.data.era.europa.eu/repositories/rinf-plus" | ||
| buffer_meters: float = 1000.0 | ||
| ``` | ||
|
|
||
| ### Projection | ||
|
|
||
| ```python | ||
| project_gnss( | ||
| gnss_file: str, | ||
| gnss_crs: str, | ||
| network_file: str | None = None, | ||
| network_crs: str | None = None, | ||
| target_crs: str | None = None, | ||
| config: ProjectionConfig | None = None, | ||
| rinf_options: RinfRetrievalOptions | None = None, | ||
| ) | ||
| ``` | ||
|
|
||
| ### Path calculation | ||
|
|
||
| ```python | ||
| calculate_train_path( | ||
| gnss_file: str, | ||
| gnss_crs: str, | ||
| network_file: str | None = None, | ||
| network_crs: str | None = None, | ||
| config: PathConfig | None = None, | ||
| rinf_options: RinfRetrievalOptions | None = None, | ||
| ) | ||
| ``` | ||
|
|
||
| ### Detections preparation | ||
|
|
||
| ```python | ||
| prepare_detections( | ||
| gnss_file: str, | ||
| detections_file: str, | ||
| network_file: str | None = None, | ||
| rinf_options: RinfRetrievalOptions | None = None, | ||
| ) | ||
| ``` | ||
|
|
||
| **Behavior**: | ||
| - `network_file is not None`: supplied topology is authoritative; no retrieval. | ||
| - `network_file is None`: bindings invoke Rust retrieval/validation logic using `rinf_options` (or defaults). | ||
| - Missing coverage and endpoint failures surface as typed Python exceptions | ||
| (`InvalidGnssInputError`, `RinfMissingCoverageError`, | ||
| `RinfIncompleteTopologyError`, `RinfRetrievalFailedError`). | ||
|
|
||
| --- | ||
|
|
||
| ## 4. .NET Contract (`tp-net`) | ||
|
|
||
| Because C# overload resolution cannot distinguish overloads that differ only | ||
| in nullable-reference annotations, the auto-retrieval entry points use the | ||
| `*Auto` suffix. | ||
|
|
||
| ### Projection | ||
|
|
||
| ```csharp | ||
| public static IReadOnlyList<ProjectedPosition> Projection.ProjectGnssAuto( | ||
| NetworkInput? network, | ||
| GnssInput gnss, | ||
| ProjectionConfig? config = null, | ||
| RinfRetrievalOptions? rinfOptions = null); | ||
| ``` | ||
|
|
||
| ### Path calculation | ||
|
|
||
| ```csharp | ||
| public static PathResult PathCalculation.CalculateTrainPathAuto( | ||
| NetworkInput? network, | ||
| GnssInput gnss, | ||
| PathConfig? config = null, | ||
| PreparedDetections? detections = null, | ||
| RinfRetrievalOptions? rinfOptions = null); | ||
| ``` | ||
|
|
||
| ### Retrieval options type | ||
|
|
||
| ```csharp | ||
| public sealed class RinfRetrievalOptions | ||
| { | ||
| public string EndpointUrl { get; set; } = "https://graph.data.era.europa.eu/repositories/rinf-plus"; | ||
| public double BufferMeters { get; set; } = 1000.0; | ||
| } | ||
| ``` | ||
|
|
||
| **Behavior**: | ||
| - `network != null`: no RINF retrieval is attempted. | ||
| - `network == null`: the wrapper calls the Rust retrieval workflow before | ||
| invoking the existing algorithms. | ||
| - Failures surface as distinct typed exceptions: | ||
| `TpLibInvalidGnssInputException`, `TpLibRinfMissingCoverageException`, | ||
| `TpLibRinfIncompleteTopologyException`, `TpLibRinfRetrievalFailedException`. | ||
|
|
||
| --- | ||
|
|
||
| ## 5. Shared Outcome Contract | ||
|
|
||
| All surfaces must preserve the same semantic outcome categories: | ||
|
|
||
| | Outcome | Meaning | | ||
| |---|---| | ||
| | `success` | Topology was supplied or retrieved and validated successfully | | ||
| | `invalid_input` | GNSS data was empty or unusable before any retrieval attempt | | ||
| | `missing_coverage` | No suitable topology could be retrieved for the search region | | ||
| | `incomplete_topology` | Retrieved topology failed validation, including coarse geometry or zero netrelations | | ||
| | `endpoint_failure` | The external SPARQL request failed or returned an unusable response | | ||
|
|
||
| No interface is allowed to collapse these categories into a generic failure message. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.