-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat(api): Add API for getting active replacement services #1116
base: master
Are you sure you want to change the base?
Conversation
9c6aaeb
to
6892dc3
Compare
@@ -21,6 +21,12 @@ defmodule Arrow.Disruptions.ReplacementService do | |||
shuttle: Shuttle.t() | Ecto.Association.NotLoaded.t() | |||
} | |||
|
|||
@service_type_to_workbook_abbreviation %{ | |||
:weekday => "WKDY", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these felt like magic values to me, but I didn't want to mess with the parsing code too much so I just made service_types
externally exposed as atoms.
fa6e8b0
to
dbb3288
Compare
join: sr in assoc(s, :routes), | ||
join: rs in assoc(sr, :route_stops), | ||
left_join: gs in assoc(rs, :gtfs_stop), | ||
left_join: st in assoc(rs, :stop), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Human whining about an interface meant for computers: I don't think we need the GTFS and Arrow stops themselves. We really only need the stop_id
. GTFS stops are already in GTFS and GTFS Creator will already have any arrow managed stops by virtue of calling /api/shuttle-stops
.
I also sort of hate how difficult JSON:API makes it for me as a human to make sense of the output, but I suppose that ship has sailed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't appear to meet the requirements in the ticket. Unless I'm missing something this is encoding the database structures rather than generating the timetables as described.
Or I take that back, I think it is trying to. But my test shuttle is returning null timetables for all days. Looking deeper. |
) do | ||
service_type_abbreviation = Map.get(@service_type_to_workbook_abbreviation, service_type_atom) | ||
|
||
if Map.has_key?(workbook_data, service_type_abbreviation) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chasing my lack of timetables backwards, it looks like this if
will never be true. The keys on the workbook are ["SAT headways and runtimes", "SUN headways and runtimes", "WKDY headways and runtimes", "version"]
, but your trying to look up SAT
/SUN
/WKDY
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
G35 Dec 6-20 Ops Summary2.xlsx is the workbook I'm testing with. For better or worse, it looks like the parsing code is strict about the sheet name when parsing, and uses the sheet name verbatim, so those are the keys that will always be there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh good point! I missed adding the headways and runtimes
part in
Summary of changes
Asana Ticket: 🏹 Implement /replacement_service API endpoint
Problem:
gtfs_creator needs to be able to know what alternative service options are available for all active disruptions so that it can create new trips and other GTFS entities
Solution:
Add
replacement_service
API that gtfs_creator can read to get all service that provided as a result of disruptionsReviewer Checklist