Skip to content

[feat]: unpacked cluster id and returning destination using the clust…#105

Open
sameerzohy wants to merge 1 commit into
mainfrom
feat/get_detstination_stops
Open

[feat]: unpacked cluster id and returning destination using the clust…#105
sameerzohy wants to merge 1 commit into
mainfrom
feat/get_detstination_stops

Conversation

@sameerzohy

Copy link
Copy Markdown
Contributor

…er id

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 clusterId from GTFSStop.desc JSON and builds an in-memory by_cluster_id index.
  • Implements GTFSService::get_cluster_destinations_for_stop to 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 thread src/handlers/routes.rs
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.",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants