A mobile app that helps students stay safe by mapping out crimes nearby campuses.
As a team of USC students, we were shocked when we arrived at TreeHacks to see hundreds of hackers’ laptops and backpacks just lying around Huang unattended with no security guards checking the doors. Thankfully, the surrounding Stanford community does not tend to cause any issues, but things may have played out differently in another city.
University Park, the home of USC, has one of the highest property crime rates in all of Los Angeles, ranking 8th out of 209 neighborhoods. It is nearly impossible to walk more than a block around campus without spotting the lonely remnants of a stolen bike. This pattern repeats not only around USC, but at the home schools of countless other hackers.
New college students, as well as other groups unfamiliar with the area (i.e. tourists, visitors, expats), represent some of the most vulnerable groups to theft and robberies. Becoming the victim does not only stop at losing your belongings--sexual assault is notoriously known to be a serious problem within college campuses. Our hack aims to help people in these situations, as well as provide valuable information to share with those who serve to protect us.
What Flare does
Flare is a mobile app that helps students stay safe within their communities by mapping out crimes around their college campus. Crime pockets can arise within specific areas due to geographical factors (such as location, lighting, police patrol schedules), and Flare helps students identify these areas. Flare shows students that sometimes it’s not always worth it to take a shortcut through that alleyway, or to leave your car a block away for free parking. After all, it only takes one bad incident to change the course of your entire life.
Currently, Flare provides crime mapping services to four college campuses in the Los Angeles area: USC, UCLA, CSUN, and CSULA.
Although other crime mapping solutions exist, they fall into one of two categories: 1) report-by-report crime maps, with informative, yet extremely cluttered interfaces), or 2) neighborhood-generalizing maps used to inform real estate investors or encourage sales of home security systems. Flare combines the best of both worlds, intuitive design cues to present data meaningfully without sacrificing transparency.
How we built it
Flare was built as an iOS app using Xcode and Swift. We used Esri’s ArcGIS Runtime SDK for iOS to display the maps of college campus neighborhoods. In order to get our crime statistics (time, location, description, etc.) we used the LA Times’ crime maps. We had to do some hacking and front-end processing magic in order to use their data, because not only is their API not public, their JSON isn’t returned as a string but rather a JS object encoded as a string. This meant that no JSON parser could parse their json file, because it wasn’t actually a legitimate JSON object. To get around that we did some magic with Swift’s JSContext class by hard coding a js function, calling it using Swift’s JS engine and then getting the object returned as an array of Any objects. We then had to map this to a JSON array and then from there decode them into our Crime models.
After we were able to get the data from LA times, the rest was fairly straightforward. We found the neighbourhoods containing and surrounding the schools we chose for this demo -- USC, UCLA, CSULA, CSUN -- and then loaded those crime statistics on launch. We also used Apple’s location services to detect the real-time threat level based of the user using crime statistics of that month in order to convey to the user what type of danger they are in or if they should be worried at all.
Challenges we ran into
Due to all of the different policing agencies at play and lack of publicly available datasets, we initially had trouble finding data to work with. Our first idea was to use incidence reports sent via. email from campus police to students, however, the low volume of data points and inconsistencies within the data made it a poor choice.
Fortunately, we were able to stumble upon the the Los Angeles Times’ Mapping L.A. API, which sources directly from the LAPD and the LA County Sheriff’s Department. Although this limited the scope of our project to just Los Angeles County, the high quality of the data and ease of use (after jumping over some hurdles) made it a no-brainer to use in our hack.
We also ran into minor technical challenges, such as having to use a JS-specific method in Swift. However, thanks to the great online community at Stack Overflow we were able to find solutions pretty quickly.
Accomplishments that we’re proud of
We’re very proud of the quality of our app given how quickly we had to build it out. We were able to build an almost full-featured app with a fleshed out design that not only has a great UI/UX but also is very useful for students across the US, all in less than a day.
What’s next for Flare
- Collaboration with campus security agencies
- Expansion into non-college markets, other cities in California, and beyond
- Normalize data from all different databases, so we can offer this product/service to every campus