Inspiration

There is a fundamental problem regarding roads and traffic safety in the United States: over 42 million speeding tickets are issued across the country every year, with speeding being the culprit of 26% of all traffic fatalities — with 3,623 deaths in California alone. It is vital to address these issues, especially as motor vehicles become increasingly capable of traveling at faster speeds. Our goal was to create a tool to visualize areas where speeding is significant with the purpose of informing city governments and other municipalities where change is needed. This in turn allows them to develop case-specific action plans to save lives.

What it does

This tool gathers data from INRIX APIs to reveal where current speeds are greater than the estimated speed limit on roads in San Francisco. Using this data, we highlight scenarios where speeding occurs as a visualization on a map that law enforcement agencies or other municipalities can utilize.

How we built it

We used React.JS, JavaScript, HTML, and CSS to program this tool. We used two INRIX APIs. The authAppToken API was used to get the App Key, allowing us to use the segment speed API to gather the majority of data. After parsing through the resulting JSON file, we used INRIX published longitude and latitude coordinates of road segments and aligned them with the speed that was being published by INRIX.

We focused our efforts on San Francisco as the API limited our data to that coordinate box, but we programmed scalability within to expand our display if we wanted to expand the impact of the project in the future. Our front end, powered by React.JS, uses the Google Maps API to display a variable map where react.js overlays are used to display our data.

Challenges we ran into

One issue that we ran into was accessing the segment speed API offered by INRIX. When originally using the fetch() call, we originally lacked the correct header parameters in the function. This caused a CORS error that stumped us; however, after correcting the headers, the new implementation was successful.

Another challenge that we ran into was integrating the back end (written in plain JavaScript) and the front end (utilizing react.js). Because the overall functionality of react.js differed from JS, the functionality of the backend needed to change in order to be compatible. When changing the backend, we also ran into timing issues, which were quickly resolved with the correct implementation of await.

Accomplishments that we're proud of

We are proud of our simple and accessible GUI that our targeted demographic — city municipalities and law enforcement — can understand and utilize. Oftentimes, large printouts and/or spreadsheets of data can be intimidating and difficult to understand, so having an intuitive interface that is displayed in a familiar method is very helpful. Furthermore, we took into consideration the limitations of public systems and allowed parameters to be customized to decrease the load on the computers.

Another aspect that we are proud of is the opportunity to scale this beyond the local scope of San Francisco; by utilizing the Google Maps API, we can expand it to other parts of the US or other countries. Because we create the appToken every time the program runs, we ensure security as well as growth beyond the scope of the original program.

What we learned

The majority of what we did for this project was learned on-site. Most of our team knew next to nothing about Javascript and APIs, and we were pretty inexperienced in Github and other aspects of team programming overall. We learned that the ability to access API’s (specifically utilizing the “fetch” command) is the most important aspect of a hackathon, simply because we would never learn this aspect of programming in a classroom environment.

What's next for Speedprix

In the future, we would like to scale this project beyond San Francisco to other parts of the country and globally to make all roads safer. We would also like to have access to the speed limits on a specific section of road to make our analysis more accurate. Furthermore, in the future, we would like to merge this data with weather data to adjust for the higher risk of crashes (due to speed) because of bad weather, also incorporating traffic conditions to make the visualization more cohesive.

Built With

Share this project:

Updates