OneBusAway / onebusaway-alexa

An Java-based app to communicate with Amazon Alexa for devices such as the Amazon Echo
Other
52 stars 18 forks source link

Speak stop code, not stop ID #19

Closed philipmw closed 8 years ago

philipmw commented 8 years ago

Fixes issue #13.

barbeau commented 8 years ago

@philipmw can you add persisting stop_code too? We'll need this if we want to support reading out currently selected stop without hitting the OBA API again.

philipmw commented 8 years ago

How would we keep it synchronized? Is there any reason to avoid hitting the OBA API for this every time?

barbeau commented 8 years ago

How would we keep it synchronized?

Good question - we will have the same issue in #14 with region info. For stops in my experience these fields rarely change. Typically stop_code has the same level of consistency as stop_Id. In GTFS there is no guarantee that the same stop even has the same stop_ID across GTFS datasets over time. In the case of stop_code changing, I think we are OK even in the situation where we are still using the old stop_code. Either the user is not aware of the change, in which case the old stop_code still makes sense, or they are aware, in which case they would know the old to new mapping.

That being said, looking at the Lambda FAQ it looks like threads are allowed? One option would be to have a thread try and sync changes on each execution.

Is there any reason to avoid hitting the OBA API for this every time?

Latency and UX would be the primary reason. This is a bigger issue with #14 where we would be caching the obaBaseUrl and using this in each request. For stop code this probably isn't as big of a deal as getting the stop_code via the API isn't in the normal execution flow and would happen only when the user specifically asks for it.

Thinking more, maybe this isn't worth the extra work for stop_code.

Thoughts?

barbeau commented 8 years ago

Going to go ahead and merge this. We can always revisit persisting stop_code when we use it elsewhere in the skill.

philipmw commented 8 years ago

(Way belated reply) Yeah, I don't have strong feelings on persisting this. I see the pros and cons. I agree with deferring this until needed.