Getting around a city like Detroit can sound trivial; there's the bus, there's walking, there's Uber, etc. But each of these modes has pros and cons. Uber is safe, but expensive. Transit is often safer (but still not as safe as Uber), but takes longer. Walking is free, but walking through certain parts of a city isn't the safest. We wanted to quantify those ideas to help Detroit citizens make the best informed choices of how to get from Point A to Point B.

What it does

Tim is a friendly chatbot that users simply ask how to get somewhere. No fiddling with Google Maps. No guesswork; it's just like asking a friend. Tim then analyzes all the modes of transportation to get somewhere, from Uber to walking to biking to transit directions for multiple possible routes. Each route for each mode of transportation is evaluated by calculating the time it would take to follow that route, the cost of that route, and the safeness of that route, based on historical crime data. However, Tim is smart. Tim realizes that if you in an Uber driving through an unsafe neighborhood matters less than if you are walking. Tim realizes that more recent crimes and more severe crimes matter more. TIm weighs in all those factors, and more.

The safety, cost, and time scores are then averaged using a weighted average and Tim presents the best option for each user. It turns out that the best option isn't always obvious. Sometimes taking one biking route is the best, but taking another suggested biking route may not be nearly as good as taking an Uber or public transit.

How we built it

The front-end is built using the Facebook Messenger Platform SDK which integrates with a Flask backend. First, we utilize natural language processing to translate a user's request into an intent. We then process that intent using our backend. All of the crime data is stored in MongoDB and then each route is found using the Google Maps APIs for transit, walking, and biking and Uber data is found using the Uber API. The mathematical rankings are all proprietary as described above.

Challenges we ran into

We want Tim to be fast. However, sifting through over a million individual pieces of crime data is no trivial task. Originally the average request took 3 minutes just to sift through our database. Threading and concurrent requests finally allowed us to get that down to only a few seconds, but that was very hard to do.

Accomplishments that we're proud of

It works, it's fast, and the mathematical algorithms are well thought out.

What we learned

Speed and memory allocation are super important for big data. Computers can't do everything by themselves.

What's next for Tim

More data, more customizations, and improved natural language processing.

Built With

Share this project: