-
Notifications
You must be signed in to change notification settings - Fork 3
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
Reorganize realtime arrival times to show times by stop #278
Comments
Return trip_updates data's departure times as an array of times (similar to route_stops_grouped) and have it returned in the websocket |
Update 5/19/2023@matikin9 @albertkun met to discuss the re-organization of this endpoint. Target JSON endpointDiagramNext Steps
|
Notes 2023-09-21
|
Research:
After this we can strategize on what our next steps should be. |
This query will bring up a count of unique select route_id, count(distinct shape_id) as unique_shape_ids
from metro_api.trips
group by route_id
order by unique_shape_ids desc; Example output
Initial findings
|
Todo List
|
These are the routes that each have 3 distinct shape_ids: select route_id, shape_id
from metro_api.trips
where route_id in (
'94-13168',
'161-13168',
'232-13168',
'158-13168',
'662-13168',
'211-13168',
'DSE-US',
'205-13168',
'164-13168',
'344-13168',
'601-13168',
'244-13168'
)
group by route_id, shape_id
order by route_id, shape_id; |
This query should pull up the distinct sequence of stops and shape geometries for line 94 select direction_id, t.shape_id, stop_id, stop_sequence, sh.geometry
from metro_api.trips t, metro_api.stop_times st, metro_api.trip_shapes sh
where t.trip_id = st.trip_id and t.shape_id = sh.shape_id
and route_id in ('94-13168')
group by direction_id, t.shape_id, stop_id, stop_sequence, sh.geometry
order by shape_id, stop_sequence; |
-- remove existing trip_shapes
truncate trip_shapes;
-- update trip_shapes
update trip_shapes
set geometry = sh.geometry
from (
select
shape_id,
ST_MakeLine(
shapes.geometry order by shape_pt_sequence
) as geometry
from metro_api.shapes
group by shape_id
) as sh
where trip_shapes.shape_id = sh.shape_id; |
Currently, our Trip Updates endpoint is at:
/{agency_id}/trip_updates/...
and the data is returned in this structure:
We need a new endpoint that returns the same data in this structure:
The text was updated successfully, but these errors were encountered: