Closed barbeau closed 8 years ago
Starting on this task, I'm still waiting for a onebusaway token.
@vikram31291 Great! Yes, just use TEST
until you get your personal API key.
@vikram31291 Just wanted to check in on this - have you been able to make any progress confirming that the custom slots with "a", "b", etc. actually work to select the correct stop from the list? I still haven't heard from anyone else a best practice for selecting an item from a list that is an open set, so curious if this actually works.
I haven't made too much progress on this yet, but will report back by Monday evening
@barbeau I'm trying to see if it will distinguish stop "alphabet" vs stop "number."
If there are usually only two or three duplicate stops, we can just ask the user 'did you mean stop [name]?' and use a Yes or No intent. We can just loop through the three stops we identified until they say yes. This seems common on the Alexa examples. Thoughts on this method?
A loop with "yes/no" answers sounds like a reasonable solution. Most of the time the duplicate stops will each be operated by a different agency (usually fairly geographically separated), so we should probably add the agency name(s) that provides service to that stop as well. Users might not know the stop name but they should know the agency.
In the future when we have more precise user location data we can also stop location to help differentiate between stops, ordered by proximity to user. This yes/no model would actually work pretty well with that as well.
So I would say go with the yes/no approach. On May 16, 2016 4:55 AM, "Vikram" notifications@github.com wrote:
@barbeau https://github.com/barbeau I'm trying to see if it will distinguish stop "alphabet" vs stop "number."
If there are usually only two or three duplicate stops, we can just ask the user 'did you mean stop [name]?' and use a Yes or No intent. We can just loop through the three stops we identified until they say yes. This seems common on the Alexa examples. Thoughts on this method?
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/OneBusAway/onebusaway-alexa/issues/53#issuecomment-219379494
@barbeau Is there an api that maps stop id to agency? I found I can either get a list of all the stops for a given agency, but haven't been able to find a field in the stop class that can get me agency.
You should be able to pull the agency name for a given stopId from the same stops-for-location response object. There is an ObaReferences object you can get from the response object, and should be able to do the lookup there. Corresponds to the references section of API docs. Not in front of my machine right now but I'll try to include more links later. On May 19, 2016 8:03 PM, "Vikram" notifications@github.com wrote:
@barbeau https://github.com/barbeau Is there an api that maps stop id to agency? I found I can either get a list of all the stops for a given agency, but haven't been able to find a field in the stop class that can get me agency.
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/OneBusAway/onebusaway-alexa/issues/53#issuecomment-220483657
@vikram31291 So I believe you'll need to refactor ObaUserClient.getStopFromCode()
to return the ObaStopsForLocationResponse
instead of just the array of stops. You can then get the route IDs for each stop, and for each route ID get the agency ID for that route and then the agency name for each agency ID. A stop in OBA can serve more than one agency, which is why this is a little convoluted.
Code should look something like this:
ObaStop stop = getObaStop(); // Get a reference to a ObaStop - this will be a loop for you, likely getting all stops from response.getStops();
String[] routeIds = stop.getRouteIds();
Set<String> agencyIds = new HashSet<>();
for (int i = 0; i < routeIds.length; i++) {
agencyIds.add(agencyIds[i]);
}
Set<String> agencyNames = new HashSet<>();
for (String agencyId : agencyIds) {
agencyNames.add(response.getAgency(agencyId).getName());
}
// agencyNames should now contain all the agency names (one or more) that have routes that visit this stop
I'd probably put the above in a utility method.
I started a PR for this that works, but it doesn't pull agency names yet. Will do that next, but please take a look at the request. I've been coding this in VS Code, but having trouble with the eclipse project so the exact style hasn't been applied yet.
Thanks! I'll try to take a look soon. I've actually been using IntelliJ for this project and have been using the default style guide there and haven't been good about applying the OBA Eclipse style myself, so we'll have to see how well it matches up. On Jun 12, 2016 1:02 AM, "Vikram" notifications@github.com wrote:
I started a PR for this that works, but it doesn't pull agency names yet. Will do that next, but please take a look at the request. I've been coding this in VS Code, but having trouble with the eclipse project so the exact style hasn't been applied yet.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OneBusAway/onebusaway-alexa/issues/53#issuecomment-225410383, or mute the thread https://github.com/notifications/unsubscribe/AA4pLY9gCLLmh4LtP2BXUtrJfvTNEl9Mks5qK5LdgaJpZM4IDwn7 .
Summary:
If you currently search for a
stop_code
in a region where more than one stop with thatstop_code
exists (usually where a region contains more than one agency), you'll get the message:"I expected to find exactly one stop for the number you gave, but instead found 2. This is not yet supported."
Steps to reproduce:
Set region to Tampa, set stop to
3105
.Proposed solution:
We could have Alexa enumerate the found stops, along with an identifier that we could capture to identify the stop they are interested in.
For example, if we defined a custom slot with "a, b, c, d...", we could read back the stops like:
"I found X stops with the number you gave. Say "a" to select University Area Transit Center, "b" to select Fletcher and 42nd St., ..."
We should be able to store the stops response as an object in the
Session
variable, and then when the user responds retrieve the response from theSession
and find the index for the stop based on the identifier spoken by the user.@philipmw Thoughts? Other ideas?