Around 6 million people get into car crashes every year in the United States. 20 percent (1.2 million) of those crashes are weather related. Those 1.2 million could be avoided with just a proper warning. Sending warnings is the goal for this software.

What it does

It takes data from previous crashes from the beginning of 2016 to the middle of 2019 and It compares it with live weather data to determine if there is a high risk to driving now. Once it detects a risk, it sends an email to the user telling them exactly where not to drive.

How I built it

I picked up a free data set of some previous crashes, the same one as listed above, and loaded it into Jupyter Notebook. I then used that data to train a sci-kit learn decision tree to detect bad weather. I then use OpenWeatherMap, an API that sends live weather data for free, to get the current weather. I then compare this weather to the previous weather to see if they are similar. If they are very similar, I use smtp to send an email to the user. All of this is looped through once every minute

Challenges I ran into

Most of the problems I had were part of the last part of my program, the emailing. At first, I couldn't establish a connection with the Gmail servers. This was because my router was blocking the connection. I quickly troubleshooted that and I could send emails. When I ran the program and manually gave it bad weather inputs, it kept looping through, spamming my inbox full of "don't drive now". I fixed this by adding a safety that only triggers once per spell of bad weather.

Another big challenge I had was the time limit. If I had more time, I could have turned it into a subscription service and instead of taking one email address, I could have had a mailing list to help the not so tech savvy.

Accomplishments that I'm proud of

This is my first time using SMTP and my first time using an external API

What I learned

As explained earlier, I learned how to use SMTP and I learned how to scrape data from the internet.

What's next for Preventing Car Crashes with Weather Data

If I have to update, I would probably add a subscription service and a mailing list instead of everyone running this locally on their own machines

Share this project: