Currently, whenever individuals visit different regions of the U.S., whether it be for college visits, tourism, business trips, etc., nobody is truly certain about the danger levels of the location they are in. Individuals often judge the safety of their location based upon the demographic of the population which is readily visible, the current state of buildings, as well as the state of the local law enforcement to generate their decisions. As students living in Chicago, we often hear about all the crime that happens in the city. So we decided to build an app to help people stay safe and informed about anywhere they're going. The name comes from the Latin word "Caveat", which means "beware". Caveat analyzes the crime data reported by city governments and constructing an easily interpretable visual for users to determine the relative safety of their location.


What it does

Using the Google Maps API and the Chicago Crime Data updated weekly by law enforcement, Caveat will use matching algorithms to display the radius (unfixed, dependent upon crime density) and severity of a dangerous area near you. The application displays a circle around the user which is shaded in with either one of three colors based upon the severity - red for extremely dangerous, yellow for moderately dangerous, and green for relatively safe. Caveat then uses machine learning algorithms to look for any trends in order to predict when and where a type of crime might occur; though there's no way a prediction like this could be perfect, advanced machine learning algorithms are capable of analyzing large amounts of data much better than humans can, leading to more feasible Furthermore, there is a tab at the bottom right which when pressed will pull up a pi-chart containing the percentage of each classification of crime as well a line graph tracking the # of crimes within the current year. Near the data analysis tab is a circular button which users can use to report crimes occurring near them.

How I built it

We split up the project into its major components to start off - a MongoDB server that holds crime data, a Node.js Express Server to serve data to clients, and an iOS app as the end product. Our first step was to then parse Chicago's Crime Data files into the MongoDB server, uniformly assigning a type (assault, theft, etc) and weight (murder is worse than identity theft!) to each crime, along with verifying the crime's data was sufficient - rejecting those lacking in data. Then, we setup the server so client apps could request crimes in their area, along with a radius of danger and its severity. The machine learning algorithm, via means of a decision tree, would also predict the next most likely crime to occur within the region. All the while, the team was also developing the iOS client app, which beautifully reports the crime data at the user's local coordinates while offering useful insights into the region.

Challenges I ran into

One of the biggest challenges we ran into was incorporating Python's powerful machine learning libraries into our Node.js server, as the two use entirely different languages. However in the end, we were able to establish a link between the two and effectively utilize them in tandem. Furthermore, crime data is formatted extremely strangely and it was a hassle trying to shrink it down so that we only had what we needed, rather than a huge mess of numbers. We ended up having to write a program to parse out serial numbers, addresses, along with various other miscellaneous information before we finally were able to get it to a usable form in a .json file. Additionally, there were also challenges in determining which type of AI to use, whether it be through Polynomial Regression, Naives Bayes classifier, Support Vector Machines, etc.

Accomplishments that I'm proud of

Along with overcoming the language barriers, we are especially proud of the independent and encapsulated facets of our products. The Mongo Database by itself could be used by law enforcement to catalog crimes in an effective manner, allowing for quick queries into the past - looking at past crimes on a certain street, for instance. The Node server serves as an open book for any client app - from our own local crime reporting app to a large scale city analyzer or safe home shopping service, the possibilities with a centralized and free server are endless. Overall, we feel like we've created more than just a useful iOS app.

What I learned

A lot of our team experienced their first introduction to Node.js and Mongo, while all of us benefited from learning about artificial intelligence algorithms. We feel that being on the edge of a new technology like machine learning offers a fun way to educate ourselves about how to program the future.

What's next for Caveat, CodeDay Chicago (May 2017)

Caveat has some very obvious yet fruitful expansion paths. We hope to be able to implement heat-maps rather than an ever changing radius to decrease loading times as well as being able to provide users with an ability to determine the danger levels of nearby locations as well. Furthermore, an implementation of a GPS feature finding the safest route rather than the shortest is also on the to-do list. We feel that we could augment the app's presence by importing data from more cities, allowing it to spread across the states and the world.

Share this project: