/minnpost-crime

Crime data processing, analysis, and visualization. Minneapolis only at the moment.

Primary LanguageJavaScriptOtherNOASSERTION

MinnPost Crime

An application that explores crime in Minnesota.

Development and Install

Perquisites

  1. Install Git. On Mac with Homebrew: brew install git
  2. Install NodeJS. On Mac with Homebrew: brew install node
  3. Install Grunt: npm install -g grunt-cli
  4. Install Bower: npm install -g bower
  5. Install Sass: gem install sass
  6. Because Leaflet comes unbuilt, we need to build it with Jake: npm install -g jake

Get the code

  1. Clone the repository with something like: git clone git@github.com:MinnPost/minnpost-crime.git
  2. Go into the code directory: cd minnpost-crime

Install libraries

  1. npm install
  2. bower install
  3. Because Leaflet comes unbuilt, we need to build it: cd bower_components/leaflet/ && npm install && jake; cd -;

Run

  1. Us grunt to watch files for changes and server the files with: grunt server-watch
  2. Go to localhost:8080/index.html in your browser.

Build

  1. grunt

Deploy (for MinnPost)

  1. grunt && grunt mp-deploy

Data processing

  1. To turn MN Compass neighborhood profile data to JSON: node data-processing/mncompass-2010-xlsx-json.js
  2. Create final Minneapolis neighborhood data JSON:
    1. Run: node data-processing/minneapolis-neighborhoods.js

Data

Minneapolis

Crime

  • Scraper of Minneapolis Monthly Reports. Original reports can be found on the MPD stats page. These reports are very similar to the FBI Uniform Crime Reports, except that they use the date of the offense (not reported date) and count each offense of the report (not the worse offense) see details.
    • Due to the fact that the MPD has decided not to release Excel files anymore. This means that PDF's are manually parsed with Tabula and put into the data/crime/mpls-monthly-reports-manual-folder. These are then uploaded to S3 and used in the scraper.
    • Run node data-processing/download-mpls-monthly-reports.js to download the existing Excel files locally. Then do grunt mp-source-data to upload these files to S3.

Demographics

Neighborhoods

  • Definitive list of Minneapolis Neighborhoods last updated 2006-01-01. A scraper of this data has been made. Downloaded locally (data/neighborhoods/minneapolis/minneapolis-neighborhoods-2012.json). These contain keys that should be used throughout the application.
    • Download JSON with this command, though this data should not change anytime soon: wget -O data/neighborhoods/minneapolis/minneapolis-neighborhoods-2012.json "https://api.scraperwiki.com/api/1.0/datastore/sqlite?format=json&name=minneapolis_neighborhoods&query=select%20*%20from%20%60swdata%60"
    • Download CSV: wget -O data/neighborhoods/minneapolis/minneapolis-neighborhoods-2012.csv "https://api.scraperwiki.com/api/1.0/datastore/sqlite?format=csv&name=minneapolis_neighborhoods&query=select%20*%20from%20%60swdata%60"
  • Downloaded shapefile of the neighborhoods was provided by the City of Minneapolis: wget -O data/neighborhoods/minneapolis/minneapolis-neighborhoods.shp.zip "http://www.minneapolismn.gov/www/groups/public/@bis/documents/webcontent/wcms1p-106980.zip". This was extracted with: cd data/neighborhoods/minneapolis/ && unzip minneapolis-neighborhoods.shpfile.zip -d minneapolis-neighborhoods.shpfile; cd -;
    • This has been converted to a GeojSON file with: ogr2ogr -f "GeoJSON" data/neighborhoods/minneapolis/minneapolis-neighborhoods.geo.json data/neighborhoods/minneapolis/minneapolis-neighborhoods.shpfile/NEIGHBORHOODS.shp -t_srs "EPSG:4326"

Hacks

  • Currently using custom version of Backbone.stickit, see pull request.