[feat]: unpacked cluster id and returning destination using the clust…#105
Open
sameerzohy wants to merge 1 commit into
Open
[feat]: unpacked cluster id and returning destination using the clust…#105sameerzohy wants to merge 1 commit into
sameerzohy wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an H3 cluster-based “destinations” capability by extracting clusterId from stop metadata and exposing a new HTTP endpoint + Swagger tag for downstream stop discovery.
Changes:
- Adds a new
/cluster/{gtfs_id}/destinations/{stop_code}route + OpenAPI documentation/tag. - Extracts
clusterIdfromGTFSStop.descJSON and builds an in-memoryby_cluster_idindex. - Implements
GTFSService::get_cluster_destinations_for_stopto compute downstream destinations and deduplicate by cluster.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/swagger.rs |
Registers the new cluster destinations endpoint and adds a Cluster tag. |
src/services/gtfs_service.rs |
Parses clusterId, builds by_cluster_id, and adds the destination computation method. |
src/models.rs |
Extends GTFSStop with cluster_id (and internal desc) and extends GTFSStopData with by_cluster_id. |
src/handlers/routes.rs |
Wires the new HTTP route and adds utoipa docs for the endpoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+815
to
+819
| stop_data | ||
| .by_cluster_id | ||
| .entry(cid.clone()) | ||
| .or_default() | ||
| .push(stop_code.to_string()); |
Comment on lines
+1543
to
+1548
| warn!( | ||
| gtfs_id = %gtfs_id, | ||
| stop_code = %stop_code, | ||
| "destinations: no cluster_id, falling back to single-stop walk", | ||
| ); | ||
| vec![stop_code.clone()] |
Comment on lines
+685
to
+689
| description = "Destination stop_codes reachable downstream of the source on the same trip pattern, \ | ||
| deduplicated by H3 cluster (one representative stop_code per reachable cluster). \ | ||
| Does NOT include destinations reachable via a transfer. \ | ||
| Falls back to a single-stop walk when the source stop has no cluster_id (logged at warn). \ | ||
| Returns 404 on unknown gtfs_id; returns [] for an unknown stop_code or a stop with no outgoing routes.", |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
…er id