After living in Cambridge as students for over a year, we realized the magnitude of the challenges faced by cyclists. From proliferating bike theft to erratic cycling conditions, there are many dangers that cyclists here face. We felt that, in our position as budding engineers and mathematicians, we could come up with a solution to keep our peers and the wider community safe. Our solution addresses the 2 main challenges associated with cycling: 1) The dangers of cycling on the road 2) Parking in spots prone to bike theft and other serious crimes
What it does
Cycl~One takes a users current GPS location and uses past crime data from the UK police database to identify regions around them of high crime risk. It then takes the end destination provided by the user and calculates the optimum path for the user to travel factoring in both speed and the safety of the user. The user can control how much importance is given to speed and safety by means of a slider allowing them to speed up their journey if in a rush. It also factors in traffic accident rates at any given position, again giving the safest routes. Finally, it also provides a crime/bike theft heatmap of the destination location, thereby allowing the user to pick a safe parking spot.
How we built it
Cycl-One was designed in 3 main stages. Firstly, using the current GPS co-ordinates, we extract relevant crime data from the UK police database. Then, we assign weightings to different crimes depending on their severity. Using the geo-coordinates of the crimes and applying a smoothing function on a matrix of crime weightings, we create a graphical heatmap of a 6x6 mile square region around the user's current location. This is then made translucent using the PIL library and overlayed over a static image from google maps taken from the API, giving an image of the most dangerous areas. Using a map, we get a safety weighting for 100 x 100m region which leads us to the second stage. Using the google maps api we find nodes at every street junction that define the roadways around the user. Each of these nodes is given a safety weighting based on the heatmap. After creating a Graph Object using the Networkx library in Python, we penalise the distance between successive nodes of the Graph depending on the user's preference for safety. We then apply Dijkstra's algorithm for finding the shortest path. This creates different routes depending on how risk averse the user is. This was all done using python. Finally, we created a stylish, simple and user-friendly front end using html and css using jinja to connect the back end to the front end and google's api to integrate an interactive map in the site showing the route. We used glitch to host this site so it can be accessed by all.
Challenges we ran into
Accomplishments that we're proud of
1) Creating the heat maps of the relative danger of accident and the risk of crime in a given region 2) Applying and learning about graph theory on the job, as our work involved constructing a graph with thousands of nodes and edges, and optimizing the path taken along these edges.
What we learned
1) We learnt a lot about web design and usage of various APIs in improving the aesthetics and functionality of the front-end of our application. 2) We learnt about applying complex mathematical operations in the context of app development. 3) We learnt about connecting front-end and back-end programs in an efficient and simple way allowing for an intuitive UI 4) We learnt too use Git properly to work on code collaboratively as a team
What's next for Cycl~One
We hope to convert the website into an app instead which could work easily and efficiently for both android and apple. We also hope to use machine learning to find the optimal path as graph theory proved to be slightly rudimentary. Additionally, we hope to expand the capabilities of Cycl-one to include cars travelling over long distances.