## Inspiration

The idea: the safest route home.

Most mapping applications give you the fastest route between A and B, but this often takes you through places where you no longer feel safe. What if we can put publicly available crime data through an algorithm that will determine the statistically safest route home?

You're welcome.

## How to use it and what it does

Navigate to: SafeStride Web App Input where you're coming from and where you are going Click 'Show Map!' and the rest is done for you!

Feel free to look through our GitHub page: MMUHack SafeStride GitHub

## How does it work?

We first take the input for the starting & finishing locations and generate a range of viable walking routes between the two points. We then analyse the danger along these routes by modelling them against recent crime.

Crime data is downloaded from a publicly available Police Crime statistic repository, and plotted their locations (latitude and longitude). By plotting the locations and densities of relevant crimes against our start-point and destination, we are able to generate a density that closely corresponds to the historic probability of a crime.

We then need to analyse the viable routes and choose the safest route to present back. Standard B-spline surface fitting algorithms firstly perform the parameterization of data, which associate suitable parameter values for each input point, and then form a linear system with control points as unknowns. This enables an analysis of the total area occupied by a route as if we were performing a 2D line integral.

The route occupying the smallest area, and thus the safest route, is returned. We return that to the user, visualising it on the map.

## How we built it

We allocated work out in to 4 separate areas: data collection using Data.Police.UK API and pre-processing; statistical analysis of the data; Google Maps API* interaction and JSON processing; and **UI. Each area was allocated to one person each, with people pair programming as and when needed.

The first 3 areas were all done using Python, and the front-end was done using Web2py. The web page is being hosted on PythonEveryday, and can be viewed and used here: link

## Challenges we ran into

This was the first time we have used Web2py, which was completely new to us. Working out how to integrate our backend with this frontend, particularly trying to work out the weird way that imports work at 2am, was fairly stressful!

The statistical work is also fairly complex, and required a fair amount of reading around the subject. Finding the optimal way to visualise the data, and ensure functionality that applied to the entire country proved difficult, but b the end we were able to get together a cohesive and functional proof-of-concept.

## Accomplishments that we're proud of

That we have an end-to-end product that has a very decent purpose! We are very happy that we learnt a lot about different Python technologies that we had previously not used. The fact that we can send this link, and have it used on both Desktop and Mobile by anyone in the UK, is a really fulfilling achievement.

## What we learned

We now have a much better understanding of the difficulties of front-end engineering! Particularly with integrating Python, Javascript, HTML and CSS as well as negotiating and collating group project work. It was also a lot of fun to debate about the statistics to use for the project, and was a good intense team building session.

## What's next for SafeStride

We were hoping to be able to post a Heat Map of our crime data results, with the overlay of the route chose, to the web page such that you can see a direct comparison of how it differs to the equivalent route provided by popular mapping apps. We would also like to add additional layers of functionality, interactivity and abstraction, giving the user faster and more varied tools to provide information on their own... SafeStride