Inspiration

As New Yorkers, we strive to reduce our carbon footprint however way we can. A great way to do that is through the use of public transportation. Thousands of New Yorkers use buses everyday, and technology has really helped improve the experience. One of the best things MTA has done was introduce MTA BusTime, which provides the city with real-time data of buses. This data includes arrival times and GPS coordinates of each vehicle.

Unfortunately, this functionality was limited to their website and the "mobile app" which is basically a wrapper around the website. There does not exist any way for users to quickly ask when the next bus is.

Similar apps that use the BusTime API require manually saying bus stop six-digit ID numbers, which wasn't user friendly to the average consumer. We felt that these apps did not fully utilize the technology to its potential.

What it does

When you first use our Alexa skill, it will ask which bus route you normally take. It will then locate the 5 closest stops served by that bus route to the address set for the Echo. You can then select one of these stops as their preferred stop.

From here on, asking about the next bus is as simple as saying "Ask Find My Bus where my next bus is". Alexa will automatically tell you when the next bus will arrive, using the preferences set earlier.

You: "Ask Find My Bus where my next bus is"

Alexa: "You do not have your preferred route and stop set yet. Would you like to set them now?"

You: "Yes"

Alexa: "Please select a preferred route."

You: "M60"

Alexa: "You selected M60. Nearby stops are: Choose 1 for Broadway and 116 Street, Northeast bound Choose 2 for Broadway and 116 Street, Southwest bound Choose 3 for Broadway and 114 Street, Northeast bound Choose 4 for Broadway and 114 Street, Southwest bound"

You: "3"

Alexa: "Okay, you have set your preferred stop to Broadway and 114 Street, Northeast bound on the M60"

(later...)

You: "Ask Find My Bus where my next bus is"

Alexa: "The next M60 will arrive in 5.7 minutes. It is 2.3 miles away from Broadway and 114 Street."

How we built it

The skill is built using the Flask-Ask library and geopy for translating addresses into longitude and latitude. We also made use of MTA BusTime's API, including nearest stop and real time stop arrival information.

Data is persisted across sessions in AWS DynamoDB and our code runs in AWS Lambda.

Challenges we ran into

This was our first experience using Amazon Web Services. As an enterprise service, it tries to cover every possible use case and as such, the documentation was very daunting.

We were also new to the Amazon Alexa platform and were initially unsure of its capabilities and limitations. The platform is very rapidly evolving and much of the documentation we found around the web was outdated and/or simply did not work.

Accomplishments that we're proud of

We were able to complete the core features of our project within the 24 hour hackathon, including covering many edge cases such as invalid route numbers.

What we learned

We learned about Amazon Web Services and how different components can talk to each other via IAM Roles and Policies. Lambda functions are a useful way to run functions without having to deal with the hassle of managing a full server.

What's next for Find My Bus

We hope to add a "time to leave" notification based on the expected bus arrival time and the amount of time it would take to walk to the selected bus stop. This notification can be done via SMS, phone, Alexa reminders, etc...

A useful addition would be integration with published schedules, which would allow asking about estimated arrival times in the future, rather than only the next bus.

In addition to the bus app, we want to also develop an Alexa skill for subway and train stations as well. Due to timing limitations, we chose to focus on one transportation system, but the overall goal is to develop a complete public transportation skill that's very user-friendly.

In addition, we hope to expand to other voice platforms including Google Assistant.

Share this project:

Updates