Re: [S67] more Bus Hacking

11 views
Skip to first unread message

Greg Tracy

unread,
Apr 13, 2011, 2:36:09 PM4/13/11
to Walker, Larry, smsmyb...@googlegroups.com
Good news!

A lot in your last email - I'll do my best to answer...

1. Data errors - keep sending me those data errors when you see them.
I have a pretty big chunk of data about the stops so it made it
impossible to double-check all of them by hand. In fact, you may
eventually run across stops that don't have a location associated with
them. But when pointed out, I can go in and fix them.

2. Bus Advocates - I would prefer if you didn't include the SMS
interface in that flyer unless the advocates group was able to make a
fiscal donation to the project. I've never publicized the app because
I can't afford to sustain it if it has wide-spread adoption. Usage has
picked up dramatically in the last three months so it's already
stretching my wallet. All of the cost is in the sending and receiving
of the text messages so if they wanted to use one of the other
interfaces (email or chat), that would be fine. And if they have a
budget for such projects and can pay for some service, I'd be happy to
support all of their members. They could even pick their own phone
number if they'd like.

3. Server load - no worries about API load. The system is quite
efficient at managing those requests. And once I port the various bus
kiosks over to using the API natively, it will get even better.

4. API performance - thanks for articulating the performance problem.
I'm aware of it and I think I have a good idea for addressing it, but
those changes will be more significant so I need to take some more
time to think it through and test. I'll keep you posted.

Just to be clear... is the performance problem you see in a single API
call for 'getnearbystops'? Or is it slow because you have to iterate
over the results and make multiple API calls? If it's the latter, I
could add support to 'getroutes' that allows you to pass in a stopID
to get all routes details for a particular stop. As I type this, this
looks like a big use case. Thoughts?

5. Direction data - the root problem with direction data (for an
individual stop) is that stops are not defined by direction. As you
know, if you look at a stop on the square, there are as many as 30
routes traveling through them and those routes have many different
directions. There are two solutions - (a) make multiple API calls as
you are doing now or (b) change the return values of 'getnearbystops'
so it returns a stop entry for each route and include the destination
in each of those results (this would be similar to what you were
seeing before we made the changes in the last couple of days). I'm
open to experimenting so let's keep discussing.

Again - thank you for helping to flush out the API. These APIs are
important projects to showcase for the city and your input here is
invaluable! When you're ready, it would be nice to post snippets of
your code on the API site to use as examples for other developers.

Also... I'm cc'ing the google group because I think the discussion is
great for the entire API community.

Cheers.

Greg


On Wed, Apr 13, 2011 at 12:31 PM, Walker, Larry <walk...@gmail.com> wrote:
> Greg:
> Excellent! This seems to have done it. Boy do I get a lot of stops now!
> For Univ & Farley, max radius:
> http://www.smsmybus.com/api/v1/getnearbystops?key=B24JK9A4&lat=43.0732692&lon=-89.4337454&radius=5000
>
> status = 0
> stop :
> 10 :
> stopID = 2822
> longitude = -89.4288621
> latitude = 43.0744313
> intersection = HIGHLAND & VA HOSP
>
> 11 :
> stopID = 2270
> longitude = -89.438444
> latitude = 43.0748776
> intersection = UNIV AVE & MARSHALL
>
> 12 :
> stopID = 2393
> longitude = -89.4286723
> latitude = 43.0741412
> intersection = HIGHLAND & FOREST PROD
>
> 13 :
> stopID = 2643
> longitude = -89.42858
> latitude = 43.072487
> intersection = HIGHLAND & UNIV AVE
>
> 14 :
> stopID = 0809
> longitude = -89.42858
> latitude = 43.072487
> intersection = UNIVERSITY &
> HIGHLAND|STP-UW||26;**43.0732878|-89.4112861|CAMPUS & BABCOCK RR
>
> 15 :
> stopID = 2177
> longitude = -89.4386396
> latitude = 43.0713213
> intersection = KENDALL & RIDGE
>
> 16 :
> stopID = 2561
> longitude = -89.4282862
> latitude = 43.0720253
> intersection = UNIV AVE & HIGHLAND
>
> 17 :
> stopID = 0470
> longitude = -89.4282862
> latitude = 43.0720253
> intersection = UNIVERSITY & HIGHLAND|OLD
> UNIVERSITY||19;**43.0716871|-89.3928722|BASSETT & DAYTON
>
> 18 :
> stopID = 2742
> longitude = -89.4392031
> latitude = 43.0713457
> intersection = BLUFF & RIDGE
>
> 1 :
> stopID = 2465
> longitude = -89.4339695
> latitude = 43.0733764
> intersection = UNIV AVE & FARLEY
>
> 2 :
> stopID = 2131
> longitude = -89.4336658
> latitude = 43.0739718
> intersection = U BAY & UNIV AVE
>
> 3 :
> stopID = 2570
> longitude = -89.4338965
> latitude = 43.073966
> intersection = U BAY & UNIV AVE
>
> 4 :
> stopID = 2698
> longitude = -89.4346124
> latitude = 43.0738486
> intersection = UNIV AVE & U BAY
>
> 5 :
> stopID = 2494
> longitude = -89.4363007
> latitude = 43.0738936
> intersection = FRANKLIN & UNIV AVE
>
> 6 :
> stopID = 2443
> longitude = -89.4309454
> latitude = 43.0725927
> intersection = UNIV AVE & GRAND
>
> 7 :
> stopID = 2965
> longitude = -89.4364763
> latitude = 43.0714326
> intersection = KENDALL & FRANKLIN
>
> 8 :
> stopID = 2998
> longitude = -89.4365961
> latitude = 43.0715136
> intersection = KENDALL & FRANKLIN
>
> 9 :
> stopID = 2945
> longitude = -89.4384811
> latitude = 43.0746334
> intersection = UNIV AVE & RIDGE
>
> [FYI: note the odd values for 'intersection' on items 14 & 17...]
>
> When I crank down the radius, I get just the result I'm after:
> http://www.smsmybus.com/api/v1/getnearbystops?key=B24JK9A4&lat=43.0732692&lon=-89.4337454&radius=100
>
> status = 0
> stop :
> 1 :
> stopID = 2465
> longitude = -89.4339695
> latitude = 43.0733764
> intersection = UNIV AVE & FARLEY
>
> 2 :
> stopID = 2131
> longitude = -89.4336658
> latitude = 43.0739718
> intersection = U BAY & UNIV AVE
>
> 3 :
> stopID = 2570
> longitude = -89.4338965
> latitude = 43.073966
> intersection = U BAY & UNIV AVE
>
> 4 :
> stopID = 2698
> longitude = -89.4346124
> latitude = 43.0738486
> intersection = UNIV AVE & U BAY
>
> Changing topics: The Madison Bus Advocates group asked if they could
> publicize our apps. I'd prepared a quick handout for them (which I'll
> attach). Now that the By Location feature is working, I'm going to tell them
> later today they can send the info to their mailing list, unless you have
> reservations. Seems like a good way to put some load on things and see how
> they hold up...
> Larry
> ps: I hope I'm not abusing your server with my By Location feature: after
> getting the nearby stops, I get the routes at each stop and pull the
> direction info for each route at the stop, so I can concatenate them
> together and display them, to be able to tell which direction each stop
> serves. It takes rather a long time to return when I do a Cap Sq stop even
> at a low radius!
> That info shows up thusly:
>
>
> Perhaps you could noodle on whether there's a more efficient way to include
> direction info with stops? I wouldn't be surprised if this isn't feasible,
> just thought I'd ask. I think that this feature will be the less-used-path,
> so maybe the time/load issue doesn't matter much...
>
>
>
>

Walker, Larry

unread,
Apr 13, 2011, 3:28:05 PM4/13/11
to Greg Tracy, smsmyb...@googlegroups.com
Greg:

Lots of replies to lots of Qs, so I'm going to embed my replies below:

On Apr 13, 2011, at 1:36 PM, Greg Tracy wrote:

Good news!

A lot in your last email - I'll do my best to answer...

1. Data errors - keep sending me those data errors when you see them.
I have a pretty big chunk of data about the stops so it made it
impossible to double-check all of them by hand. In fact, you may
eventually run across stops that don't have a location associated with
them. But when pointed out, I can go in and fix them.

I'll keep watching for them and passing them on...


2. Bus Advocates - I would prefer if you didn't include the SMS
interface in that flyer unless the advocates group was able to make a
fiscal donation to the project. I've never publicized the app because
I can't afford to sustain it if it has wide-spread adoption. Usage has
picked up dramatically in the last three months so it's already
stretching my wallet. All of the cost is in the sending and receiving
of the text messages so if they wanted to use one of the other
interfaces (email or chat), that would be fine. And if they have a
budget for such projects and can pay for some service, I'd be happy to
support all of their members. They could even pick their own phone
number if they'd like.

I will remove the SMS info...


3. Server load - no worries about API load. The system is quite
efficient at managing those requests. And once I port the various bus
kiosks over to using the API natively, it will get even better.

4. API performance - thanks for articulating the performance problem.
I'm aware of it and I think I have a good idea for addressing it, but
those changes will be more significant so I need to take some more
time to think it through and test. I'll keep you posted.

Just to be clear... is the performance problem you see in a single API
call for 'getnearbystops'? Or is it slow because you have to iterate
over the results and make multiple API calls? If it's the latter, I
could add support to 'getroutes' that allows you to pass in a stopID
to get all routes details for a particular stop. As I type this, this
looks like a big use case. Thoughts?

The performance to 'getnearbystops' is fine, plenty fast as far as I'm concerned; it's when I iterate through a largish number of API calls that I get very slow results:

repeat for each stop-returned
-- get the arrivals at this stop # and grab their destinations
    -- fetch the routes arriving at each stop,
    -- then pull out and concat the direction info for each route
    -- and use it to populate the pull-down menu of stops
end repeat

The idea of enhancing 'getroutes' sounded attractive until you mentioned "big use case". I think that for now, it makes sense to leave my app as it is, until we get a feel for how much the By Location feature is even used. Carol suggested putting up a caution "this request may take a long time; please be patient". I'll see if I can do that, or throw together a progress bar of some sort. But I hate to spend a ton of time/effort to speed up a feature that may not get used that much, especially if/when I can get time to implement cookies or client-side storage, so the app remembers (and displays in a pull-down) all the stops a given user has asked for in the past. That should reduce the number of times someone needs to enter a location...


5. Direction data - the root problem with direction data (for an
individual stop) is that stops are not defined by direction. As you
know, if you look at a stop on the square, there are as many as 30
routes traveling through them and those routes have many different
directions. There are two solutions - (a) make multiple API calls as
you are doing now or (b) change the return values of 'getnearbystops'
so it returns a stop entry for each route and include the destination
in each of those results (this would be similar to what you were
seeing before we made the changes in the last couple of days). I'm
open to experimenting so let's keep discussing.

Again, let's wait and see how much that feature is used and if we get complaints.

Route directions are so frustrating; the system architect in me just wants to scream "bad design!", but I do realize it's not a trivial problem, especially given Madison's unique geography.

I have noticed that there SEEMS to be an even/odd numbering convention (odd = "eastbound/northbound", even = "westbound/southbound"): are you able to confirm/deny this? If it's true, maybe a small message to that effect somewhere on the app's UI would be all that's needed. Carol does keep reminding me that the app does not have to assume a totally naive user: if they're trying to ride the bus, they likely have some level of prior knowledge of Metro and of Madison geography...


Again - thank you for helping to flush out the API. These APIs are
important projects to showcase for the city and your input here is
invaluable! When you're ready, it would be nice to post snippets of
your code on the API site to use as examples for other developers.

I would be happy, even delighted to share my code, but my apps are all written in a language that no one's ever heard of, so that may be a problem. It is a pretty readable language (to me anyway, and especially compared to Java or Objective-C), so maybe it'd be OK, plus it would be another chance to evangelize for LiveCode as The Programming Language For The Rest Of Us :-)


Also... I'm cc'ing the google group because I think the discussion is
great for the entire API community.


I'll try cc/ing the group with my reply as well..

Cheers.


And thanks for all your great work on this!
Reply all
Reply to author
Forward
0 new messages