Inspiration

As students, we get into daily routines. Here are two of them: walking from our classes and waking up to a Cal WarnMe email from a tragedy occurring right outside our building. This is not the way we envisioned our new home, and we, therefore, sought a solution to mitigate this topical problem. We were inspired by the Google Maps interface and Waze crowdsourced traffic-volume detection to create an app that prioritizes both the time and safety of our peers.

What it does

SafePaths is a route-generation application that optimizes the time and safety of its users.

Route Generation: No matter where you are, you can get anywhere through Berkeley with your close friend SafePaths by your side, covering you in many situations.

Late night frat party? SafePaths will take you home, sending you through the most time-efficient paths with the fewest crimes during the night.

Lost in downtown Berkeley? SafePaths knows where you are and also knows how you can get home without going through an unknown area that could put you at risk.

Path Prioritization: With our app, we can not only tell you how to get home but also the safest way to do it. Every crime reported is ranked by severity to help assess the level of risk.

High-Crime Area Reports: Accidentally entering a dangerous area, no problem! We will automatically alert you to the risk and promptly redirect you to home sweet home.

How we built it

Our Stack: We used Flutter and Dart for our front end, Node.js, Express.js, AWS Lambda, and CockroachDB for our back end, and Python, BeautifulSoup, Cohere.AI, and Flask for our AI/ML and data processing pipeline.

Front End: We used Flutter for the front end. We incorporated Google Maps API to create the routes and the map needed for functionality. There is also a loading screen with our company logo.

Back End: We first created a Node.js and Express.js application to test our CockroachDB locally. Once our read and write capabilities were finished, we deployed our local server on AWS Lambda with serverless and tested with Postman. To transfer our server to AWS, we used AWS S3 to store our files and created three lambda functions for each function (write, read, and remove). We then use our write API to transfer the data gathered from the AI/ML & data processing pipeline to CockroachDB. The front end gains access to the geolocation information in the database through the read API, and the users crowdsource crime data using the write API.

AI/ML & Data Processing Pipeline: We first scrape Berkeley Police Department’s website using BeautifulSoup for a list of links that each correspond to a pdf with crime information each day. We go through each scraped link’s corresponding pdf and save tabulated tables with crime and location information. After preprocessing the crime and location information, we use Cohere.AI’s classification pipeline to train a supervised NLP model on hand-labeled data indicating the severity of the crime committed. We use Google Maps API to return longitude and latitude pairs for each crime location and push it via a POST request to CockroachDB using Flask.

Challenges we ran into

Transferring our local server to AWS took a considerable amount of time. Due to the tricky nature of async functions and unfamiliarity with Node.js syntax, deploying to AWS took many attempts. We eventually were able to solve our numerous bugs with help from mentors (shoutout to Krishna).

We also faced challenges with scraping regularly-updated crime data. Although there was an online platform that had information in a tabular format, it was protected from web scraping by a backend layer. Thus, we were forced to execute a significantly more difficult scraping task than expected. We also faced initial challenges with using Cohere.AI, but solved them by using larger language models and hand-labeling more training data.

Accomplishments that we're proud of

We are proud of venturing out of our comfort zone and learning new technologies such as Node.js, CockroachDB, Flask, and Cohere.AI. We chose a problem that was a significant technical challenge and are proud to have individually executed our parts in the full-stack that has allowed us to put together a fully functional application.

What we learned

In this project, we learned how to properly make plans and split our workload based on skill set. Completing this app individually would have been a challenge for all of us. With two members familiar with AI, one member familiar with back-end and servers, and the other a front-end wizard, we became one cohesive unit, learning each portion of the full stack from each other.

What's next for SafePaths

Initial Deployment: Our next step for SafePaths is incorporating a crowdsourcing-based “report-crime” function and testing it on the Berkeley campus. After we field-test the product, we plan on launching it on the AppStore Google Play, expanding our scope to not just Berkeley but country-wide.

Additional Features: We understand that the app is in its beta form, and here are some ideas we plan on implementing (we would love to hear feedback too!)

An emergency call, so if in danger, a simple button could be clicked Location sharing with friends, so you know the paths they walk Specific icons per reported crime (fire for arson or money for robbery) Crime prediction in areas based on time of year and day

Share this project:

Updates