/bus-alert

Lexington mobile app to remind you when your bus is approaching

Primary LanguageRuby

bus-alert

Lexington mobile app that reminds you when your bus is approaching.

User experience

  1. Choose a stop.
  2. Wait.
  3. Get an alert when the bus is near.

Available information from Lextran API

  • Given a bus, we know incoming/outgoing, last stop, current position
  • Given a stop, we know next arrival time(s) for given route (HTML) or all routes (noscript)
  • Given a route, we know stop IDs, bus IDs, and KML for route

Resources

This app's JSON API

// GET /
// GET /bus_routes
{
  routes: [
    { name: 'Hamburg Pavilion', id: 10 }
  ]
}

// GET /bus_routes/10/bus_stops
{
  stops: [
    { id: 943, name: 'Vendor Way @ Best Buy', lat:  '38.023392', long: '-84.419754', route_id: 10 }
  ]
}

// GET /bus_routes/10/bus_stops/943/bus_arrivals
{
  arrivals: [
    { bus_id: '415', scheduled_at: '14:30:00-0500', estimated_at: '14:32:00-0500' },
    { bus_id: '415', scheduled_at: '14:35:00-0500', estimated_at: '' }
  ]
}

// GET /bus_routes/10/bus_stops/943/bus_arrivals/next
{ bus_id: '415', scheduled_at: '14:30:00-0500', estimated_at: '14:32:00-0500' }

Current status

Route, stop, and arrival endpoints are working and returning JSON.

We're currently scraping scheduled arrivals from the noscript web pages (departures.aspx). The HTML API that the realtime tracking site uses to display arrival info on bus stop map markers requires an active user session. It remembers which route the user clicked so it can list the active route's arrivals first when the user clicks a stop on the map. Unfortunately, if there isn't a valid session when the arrivals are requested, the ASP crashes. So, back to parsing HTML.

Future expansion

API data that would make this app better:

  • XML for departure times
  • XML for bus direction, status (early/late/on-time)
  • Given a stop, is it inbound or outbound?
    • If both, are scheduled departures inbound or outbound?
  • Given a bus, what's its next stop (id)?