Inspiration

Checking the arrival time of your usual Unitrans bus every time you want to take it quickly becomes a tedious nuisance. You need to find your phone, unlock your phone, and go to the Nextbus app or Unitrans website, wait for it to load, and then find the right bus in the list of all arrivals. We have made this process easy and automated with our Alexa Skill Davis Bus - the perfect application to inquire about your bus schedule by using verbal commands.

What it does

This Alexa skill allows users to verbally ask her to list all arrivals or the arrivals of a specific Unitrans bus line. For example:

  • "Start Davis bus." Then, "When is the 'O' bus?" or "All lines."
  • "Ask Davis bus for the 'V' line."
  • "Ask Davis bus for all arrivals."

How we built it

We developed a Alexa Skill on the Amazon Developer portal with a Node.JS backend running on AWS lambda. The backend queries the Nextbus API for live predictions, parses the XML, and returns the results to Alexa who tells the user about the next arrivals.

Challenges we ran into

  • We tried using a npm package wrapping the Nextbus API, which turned out to be way too slow as it fetched the whole bus network's data every time. We had to mitigate this by querying the raw API endpoint ourselves and write code to extract the data we need from the XML response.
  • It's very difficult (perhaps impossible) to run the code locally. Instead, we had to ZIP & upload the code to Lambda every time we fixed a missing parenthesis.
  • The speech recognition seems to be spotty, which may be due to malfunctions with the Alexa simulator echosim.io. For instance, it interprets "When is the 'O' line?" as "When is the 'on' line?", despite a list of slot items we had configured.
  • AWS docs could be easier to navigate
  • We had issues dividing up the work between 4 people because we found it hard to parallelize the skill development process
  • There were not enough physical Alexas for our team to access.

Accomplishments that we're proud of

  • It works! The skill does exactly what we wanted it to do. Requirements fulfilled!
  • None of us had Node.JS experience, but we managed to work with it anyway
  • Learned a lot
  • Great team cohesion despite we never met before

What we learned

  • How to write a skill for Alexa
  • Opportunities of the Alexa platform
  • Gained experience in Javascript
  • Working with Node.JS' npm package manager
  • How to deploy code on AWS lambda
  • Testing live data is hard when there is no live data (buses stopped running at night)
  • What hackathons consist of and how they work
  • How to set reasonable goals

What's next for Alexa Unitrans Arrrivals

  • We plan to add a feature in which users can set up their default bus stop. At the moment, the location of the bus stop is hard coded as the inbound La Rue Rd & Orchard bus stop (the one next to the pavilion!) for demo purposes.
  • Another feature would be the ability to ask for future timetables to e.g. plan your evening or your trip back home (when do I need to leave xyz to get home with the last bus?).
  • Reminders ("Next bus is in 50 minutes" - "okay, remind me 10 minutes before")
  • Incorporate long-distance transit (Amtrak, Yolo Bus, Davis Shuttle)
  • Incorporate status messages ("Due to tree on the road, buses are delayed")
  • If the next bus takes too long to arrive, suggest alternatives ("Next bus in 55 minutes. Or walk to class in 20 minutes. Or take Uber for $5.")
  • Ask other UC Davis students for feature requests!! :)
Share this project:

Updates