Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
Gemfile
Gemfile.lock
LCR_codes.csv
LCR_codes.xlsx
README.md
env.rb
find_duplicate_incidents.rb
import.rb
part_1_crimes_with_counts.csv
sample_queries.sql
summarize_part_1_crime.log
summarize_part_1_crime.rb
summarize_part_1_crime_categories.log
summarize_part_1_crime_categories.rb
summarize_part_2_crime.rb
summarize_part_2_crime_categories.rb

README.md

reports

Generate data for summarized reports. Export all Socrata data to CSV file, which can be imported into local mySQL DB using load.sql.

SQL

  1. sample_queries.sql example SQL queries to analyze data

Ruby code

  1. import.rb imports data into database from CSV file, takes 1 argument csv_filename and can run like this ruby import.rb All_Police_Crime_Data.csv
  2. summarize_part_1_crime.rb generates data for Part 1 Police Crime reports
  3. find_duplicate_incidents.rb find duplicate incident numbers in data (which are supposed to be unique)

Output

  1. part_1_crimes_with_counts.csv CSV file with all Local Crime Reporting (LCR) codes, descriptions and counts for all data
  2. LCR_codes.xlsx original CSV file that lists all of the LCR codes for Part 1 crime along with descriptions

Configuration

env.rb contains default configuration options for database connections. To override with your own values add named .env_overrides.rb at the root of the project and set the values you need such as the following.

# .env_overrides.rb

ENV['DATABASE_USER'] = 'YOUR_USERNAME'
ENV['DATABASE_PASSWORD'] = 'YOUR_PASSWORD'
Something went wrong with that request. Please try again.