Skip to content
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

Add agency name when disambiguating stops #85

Open
barbeau opened this issue Sep 8, 2016 · 2 comments
Open

Add agency name when disambiguating stops #85

barbeau opened this issue Sep 8, 2016 · 2 comments
Milestone

Comments

@barbeau
Copy link
Member

barbeau commented Sep 8, 2016

Summary:

In #83 we added the ability to disambiguate stop numbers within the same region. For example, in Tampa, stop 3105 maps to two stops. The OBA skill will now iterate through the stops by name and ask you if it's the right one.

I'd like to add the agency name(s) serving that stop when iterating through them. Reasoning is that most duplicate stop codes arise from one stop code per agency, and the user will likely know which agency they want, but may not recognize the stop names.

My comments from #53 (comment):

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.

Steps to reproduce:

  1. "Alexa, set my city to Tampa"
  2. "3105" // Stop number

Expected behavior:

Tell me the agency names that serve each stop, when asking me if its the right stop

Observed behavior:

Only the stop names are read

Device:

Amazon Echo

cc @vikram31291

@barbeau barbeau added this to the v1.1 milestone Sep 8, 2016
@vikram31291
Copy link
Contributor

Tampa and 3105 just results in a "OneBusAway could not locate your stop number. Tell me again, what is your stop number?"

Do we have other stop codes that map to multiple stops?

@barbeau
Copy link
Member Author

barbeau commented Dec 21, 2016

See #87 (comment), there are a few others listed there.

@barbeau barbeau modified the milestones: v1.2, v1.1 Mar 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants