# DriveWise: Building a Safer Future in Route Planning

Motor vehicle crashes are the leading cause of death among teens, with over a third of teen fatalities resulting from traffic accidents. This represents one of the most pressing public safety issues today. While many route-planning algorithms exist, most prioritize speed over safety, often neglecting the inherent risks associated with certain routes. We set out to create a route-planning app that leverages past accident data to help users navigate safer routes.

## Inspiration

The inexperience of young drivers contributes to the sharp rise in accidents and deaths as can be seen in the figure below.

![Injuries and Deaths in Motor Vehicle Crashes](https://raw.githubusercontent.com/pranavponnusamy/Drivewise/refs/heads/main/AccidentsByAge.webp)

This issue is further intensified by challenging driving conditions, road hazards, and the lack of real-time risk assessment tools. With limited access to information about accident-prone areas and little experience on the road, new drivers often unknowingly enter high-risk zones—something traditional route planners like Waze or Google Maps fail to address. However, new drivers are often willing to sacrifice speed for safer, less-traveled routes. Addressing this gap requires providing insights that promote safer driving choices.

## What It Does

We developed **DriveWise**, a route-planning app that empowers users to make informed decisions about the safest routes. The app analyzes 22 years of historical accident data and utilizes a modified A\* heuristic for personalized planning. Based on this data, it suggests alternative routes that are statistically safer, tailoring recommendations to the driver’s skill level. By factoring in variables such as driver skill, accident density, and turn complexity, we aim to create a comprehensive tool that prioritizes road safety above all else.

### How It Works

Our route-planning algorithm is novel in its incorporation of historical accident data directly into the routing process. Traditional algorithms like those used by Google Maps or Waze prioritize the shortest or fastest routes, often overlooking safety considerations. **DriveWise** integrates safety metrics into the edge weights of the routing graph, allowing the A\* algorithm to favor routes with lower accident risk.

**Key components of our algorithm include:**

* **Accident Density Mapping**: We map over 3.1 million historical accident data points to the road network using spatial queries. Each road segment is assigned an accident count based on nearby accidents.
* **Turn Penalties**: Sharp turns are more challenging for new drivers and have been shown to contribute to unsafe routes. We calculate turn angles between road segments and apply penalties for turns exceeding a certain threshold.
* **Skillfulness Metric**: We introduce a driver skill level parameter that adjusts the influence of accident risk and turn penalties on route selection. New drivers are guided through safer, simpler routes, while experienced drivers receive more direct paths.
* **Risk-Aware Heuristic**: Unlike traditional A\* implementations that use distance-based heuristics, we modify the heuristic to account for accident density, further steering the route away from high-risk areas.

By integrating these elements, **DriveWise** offers personalized route recommendations that adapt as the driver's skill level increases, ultimately aiming to reduce the likelihood of accidents for new drivers.

## Accomplishments We're Proud Of

We are proud of developing an algorithm that not only works effectively but also has the potential to make a real difference in road safety. Creating a route-planning tool that factors in historical accident data is, to our knowledge, a novel approach in this domain. We successfully combined complex data analysis with an intuitive user interface, resulting in an app that is both powerful and user-friendly.

We are also kinda proud about our website. Learn more about us at [idontwannadie.lol](https://idontwannadie.lol/)

## Challenges We Faced

This was one of our first hackathons, and we faced several challenges. Having never deployed anything before, we spent a significant amount of time learning, debugging, and fixing deployment issues. Designing the algorithm to analyze accident patterns while keeping the route planning relatively simple added considerable complexity. We had to balance predictive analytics with real-world usability, ensuring that the app remained intuitive while delivering sophisticated results.

Another challenge was creating a user interface that encourages engagement without overwhelming the driver. We wanted users to trust the app’s recommendations without feeling burdened by excessive information. Striking the right balance between simplicity and effectiveness through gamified metrics proved to be an elegant solution.

## What We Learned

We learned a great deal about integrating large datasets into real-time applications, the complexities of route optimization algorithms, and the importance of user-centric design. Working with the OpenStreetMap and OSMnx libraries required a deep dive into geospatial analysis, which was both challenging and rewarding. We also discovered the joys and pains of deploying an application, from server configurations to domain name setups.

## Future Plans

In the future, we see the potential for **DriveWise** to go beyond individual drivers and benefit broader communities. Urban planners, law enforcement agencies, and policymakers could use aggregated data to identify high-risk areas and make informed decisions about where to invest in road safety improvements. By expanding our dataset and refining our algorithms, we aim to make **DriveWise** functional in more regions and for a wider audience.

## Links

* **Paper**: [Mathematical Background](https://drive.google.com/drive/folders/1Q9MRjBWQtXKwtlzObdAxtfBpXgLR7yfQ?usp=sharing)
* **GitHub**: [DriveWise Repository](https://github.com/pranavponnusamy/Drivewise)
* **Website**: [idontwannadie.lol](https://idontwannadie.lol/)
* **Video Demo**: [DriveWise Demo](https://www.veed.io/view/81d727bc-ed6b-4bba-95c1-97ed48b1738d?panel=share)
## Inspiration

With everything being done virtually these days, including this hackathon, we spend a lot of time at our desks and behind screens. It's more important now than ever before to take breaks from time to time, but it's easy to get lost in our activities. Studies show that breaks increases over overall energy and productivity, and decreases exhaustion and fatigue. If only we had something to help us from forgetting..

## What it does

The screen connected to the microcontrollers tells you when it's time to give your eyes a break, or to move around a bit to get some exercise. Currently, it tells you to take a 20-second break for your eyes for every 20 minutes of sitting, and a few minutes of break to exercise for every hour of sitting.

## How we built it

The hardware includes a RPi 3B+, aluminum foil contacts underneath the chair cushion, a screen, and wires to connect all these components. The software includes the RPi.GPIO library for reading the signal from the contacts and the tkinter library for the GUI displayed on the screen.

## Challenges we ran into

Some python libraries were written for Python 2 and others for Python 3, so we took some time to resolve these dependency issues. The compliant structure underneath the cushion had to be a specific size and rigidity to allow the contacts to move appropriately when someone gets up/sits down on the chair. Finally, the contacts were sometimes inconsistent in the signals they sent to the microcontrollers.

## Accomplishments that we're proud of

We built this system in a few hours and were successful in not spending all night or all day working on the project!

## What we learned

Tkinter takes some time to learn to properly utilize its features, and hardware debugging needs to be a very thorough process!

## What's next for iBreak

Other kinds of reminders could be implemented later like reminder to drink water, or some custom exercises that involve sit up/down repeatedly.
## Problem Definition

Every year, thousands of Canadians succumb to fatal and personal injury vehicular collisions on public roads. In 2018, the number of fatalities due to road collisions reached 1922, a 3.6% increase from 2017’s number of fatalities. This further signifies a growing need for a practical solution that aims to prevent the loss of life in a serious vehicle. More specifically, ensuring instant live-reporting of road accidents could potentially diminish the number of annual fatalities.

## Inspiration

The inspiration of RoadSense derived upon discovering emerging technologies that interconnect city-traffic infrastructures and using that to fight against the rising number of fatalities due to vehicular collisions.

## What it does

RoadSense, an extension of GE Current’s CityIQ, utilizes machine learning and real-time audio feedback to recognize the occurrence of vehicular collisions near the CityIQ device. It would then pinpoint the location for an immediate emergency response without the need for an individual to dial 911. Afterwards, the data is relayed to the RoadSense database to be displayed on the RoadSense dashboard and finally, a call is placed to 911 with information regarding the accident. Functionality is also added allowing us to pinpoint other crimes, such as gunshots or glass breaking.

## How we built it

First, we used Current's CityIQ API and skicit-learn to compare and analyze the data that is being received. We stored data such as; location (latitude, longitude), the time elapsed since the incident, and other components in the Firebase database. We then used Flask and set up Twilio (a cloud communications platform) so that we could programmatically receive phone calls when another accident occurs. The accidents would then appear as an icon on our Google Maps that is in the frontend where we utilized React.js for the overall layout and functionality.

## Challenges we ran into

The primary challenge that took a long process to overcome was the lack of data to complement the machine-learning component of RoadSense. Most of this data either had a high cost or required approval by an individual at an organization (eg. Mivia). This was overcome by simply extracting audio clips from popular websites that contain crashes and gunshots. With that, this process required a fair bit of work and only yielded a small dataset (approx 200 points).

Likewise, the API linking us to the CityIQ wasn't perfect and at times wouldn't yield any results when doing a basic API call. This can be easily overcome overtime by having CityIQ make the API more reliable.

## Accomplishments that we're proud of

We are proud of our ability to combine IoT and machine-learning technologies to provide a practical solution to enhancing the interconnectedness of cities.

## What we learned

It was our first time using scikit-learn for machine-learning models to merge it with CityIQ's IoT platform.

## What's next for RoadSense

We plan to take on several steps to ultimately improve the functionality and practicality of RoadSense. More specifically, we intend for RoadSense to detect not only vehicular collisions but also criminal-related noises such as gun-firing and robberies involved with some forms of sound transmission (ex. breaking of windows). In addition to audio processing, we plan to integrate video capture by RoadSense at the time of the incident to provide a greater depth of data related to the incident.