Skip to content

cailinpitt/AwareOSU

Repository files navigation

Logo

Background

OSU students (well, college students in general) enjoy being safe. Whenever a crime occurs on campus that has a continuing safety threat, OSU sends every student and staff an email briefly explaining the crime. However, OSU doesn't send crime alerts for all crimes that occur on and around campus (where many students live). The reality is that we live in a dangerous world, and we want to be aware of what is happening around us.

Features

AwareOSU visits the Columbus Police Department's unofficial web report portal (to find off-campus crimes committed in zone 4, more on zone 4 later) and the OSU Police department's daily log system, finds information related to crimes committed in the university area the previous day, and sends this information out to users.

For users who select the daily delivery option, AwareOSU will send an email each morning at 10:15 AM containing crime information from the previous day. For users who select the weekly delivery option, AwareOSU will send an email containing crime information from the previous week at 10:20 AM every Saturday morning.

AwareOSU also performs analytics. On the first day of every month, AwareOSU will send out a detailed report to users containing breakdowns of crime occurrances, locations, and monthly trends.

Great overview. What is the code actually doing?

  • Main.rb - This Ruby script runs daily at 10:15 AM. It utilizes three great gems (Mechanize, Nokogiri, and Mail) to visit the CPD web portal and OSU PD online log system (listed above) using Mechanize, parses the HTML of the search page containing all crimes committed yesterday using Nokogiri, and sends the information out in a HTML table using Mail.

  • Weekly.rb - This Ruby script runs every morning at 10:20 AM. It utilizes three great gems (Mechanize, Nokogiri, and Mail) to visit the CPD web portal and OSU PD online log system (listed above) using Mechanize, parse the HTML of the search page containing all crimes committed yesterday using Nokogiri, and write this information to texts files everday. On every Saturday morning, This script will gather all crime information for the week and email the information out in a HTML table using Mail.

  • Analytics.rb - This Ruby script runs on the first day of every month at 10:00 AM. It utilizes three great gems (Mail and Gchart) to analyze crime information from the previous month, inserts data into charts using Gchart, and sends the information out using Mail. Analytics also attaches two CSV files containing all the crime information AwareOSU analyzes for the entire month, in case users want to perform their own analysis.

  • getData.rb - This script is used to supplement Analytics.rb. Basically, it gathers crime information from a specific period in time by asking the user what dates it wants to search between (ex. crime information from 01/01/2016 - 01/31/2016).

  • network-reset.sh - My Pi sometimes runs into an issue where it has trouble staying connected to the Internet while using an ethernet connection, and will drop packets. This script resets the ethernet connection every morning one minute before an AwareOSU script is scheduled to run, ensuring that the Pi has a valid, working internet connection.

Please note: AwareOSU is run on a Raspberry Pi.

Images

Daily Email From AwareOSU

Daily Email from AwareOSU Daily Email from AwareOSU


Weekly Email From AwareOSU

Weekly Email from AwareOSU Weekly Email from AwareOSU


Monthly AwareOSU Analytics Report

Crime Occurrences Crime Locations Top 5 Busiest Days Monthly Trend

Off-campus crime information is pulled from parts of Zone 4 (Districts 30, 33, 34, 40, 41, 42, 43, 44, 50, and 53), visualized here

Zone 4

AwareOSU is run on a Raspberry Pi

Pi

Why are some crimes listed multiple times?

For example:

Sometimes you may see crimes listed multiple times in a digest

This is because some crimes may have multiple victims, as seen on the Columbus Police Department's web portal: Multiple crimes

Currently, victim names aren't included in emails.

What does the shell script do?

My Pi sometimes runs into an issue where it has trouble staying connected to the Internet while using an ethernet connection. It will say that it has a connection, but in actuality I cannot access the internet. This seems to be a semi-common problem among Pis, and this also causes problems for AwareOSU since it can't access the internet if there isn't a connection. This script resets the ethernet connection every morning one minute before AwareOSU is scheduled to run, ensuring that the Pi has a valid, working internet connection.

Goals

  1. Develop AwareOSU mobile applications for Android and iOS.
  • AwareOSU for Android has been released! Download it here.
  • AwareOSU for iOS is currently being developed.

How to sign up

Visit the AwareOSU Google form to sign-up for either a daily or weekly delivery option.

Milestones

  • 02/16/2016 - AwareOSU analytics is released.

  • 01/13/2016 - AwareOSU has 800 users.

  • 01/09/2016 - AwareOSU for Android is released.

  • 12/18/2015 - Development of AwareOSU for Android begins.

  • 12/10/2015 - AwareOSU now has a weekly delivery option, in addition to a daily delivery option.

  • 12/03/2015 - AwareOSU has 700 users.

  • 12/01/2015 - AwareOSU now includes static Google Maps so users can visualize where crimes occurred.

  • 11/25/2015 - AwareOSU has 600 users.

  • 11/24/2015 - AwareOSU has 500 users.

  • 10/27/2015 - AwareOSU has 400 users (note that 10/27/2015 was the day OSU recieved an online threat).

  • 10/27/2015 - AwareOSU has 300 users.

  • 10/27/2015 - AwareOSU has 200 users.

  • 10/24/2015 - AwareOSU is now running from a Raspberry Pi! What does this mean? Basically, this means that AwareOSU is just about fully automated. The only thing I do now is add emails to the Google Group of people who have subscribed, and the Pi uses a CRON job to run Aware OSU every morning at 10:15.

  • 10/22/2015 - Program now searches and retrieves on-campus crimes, in addition to off-campus crimes.

  • 10/17/2015 - AwareOSU has 100 users.

  • 10/17/2015 - Apparently Google only lets users send out a max of 100 emails/day, so the awareosu@gmail.com account got suspended for a day. From now on, I will be using a Google Group to mass email everyone who signed up through the Google Form. For future software engineers: this is why we test every aspect of our code.

  • 10/16/2015 - AwareOSU is released.

Press

Disclaimer

Crimes listed on CPD's web portal is not representative of all crimes that have occurred.

Contributing

At this point, all core members have been chosen, but please submit a PR if you feel you have something to contribute!

Running the code

We use Docker to run the server-side scripts (only scrape.rb for now). You will need the Docker Compose service installed on your machine. The commands to run these services are as follows.

To bring up all services (starts the scraper):
docker-compose up

To run the scraper interactively (for debugging):
docker-compose run --service-ports scraper

To only run the database:
docker-compose up database

About

Be aware of crimes around the Ohio State campus area.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published