Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Minnpost Hazmat

A look at HAZMAT accidents


Data compiled by IRE and exported for MN only data. We do not have premission to reproduce here, but there files should be put in the data folder with the following structure:

  • data/original/Minnesota.csv
  • data/original/hazmat_layout.xlsx
  • data/original/state by decade.xlsx


The rpt_num field is a unique identifier for an incident, but each incident can have more than one record, depending on how many different chemicals were spilled (one record for each substance). Therefore, when counting incidents by various things, we mostly used COUNT(DISTINCT rpt_num).

Only about 4 percent of incidents are considered "serious" (HMIS_serious_inc_ind), following these qualifications:

  • A fatality or major injury caused by the release of a hazardous material
  • the evacuation of 25 or more employees or responders or any number of the general public as a result of release of a hazardous material or exposure to fire
  • a release or exposure to fire which results in the closure of a major transportation artery
  • the alteration of an aircraft flight plan or operation
  • the release of radioactive materials from Type B packaging
  • the suspected release of a Risk Group 3 or 4 infectious substance
  • the release of over 11.9 gallons or 88.2 pounds of a severe marine pollutant
  • the release of a bulk quantity (over 119 gallons or 882 pounds) of a hazardous material.

Data processing

  1. The layout information originally recieved was not fully accurate or complete, so some minor updates were made and saved to data/layour-cleaned.csv.
  2. To import the data into an SQLite database at data/hazmat.db, run the following: python data-processing/
    • Note that this may take some time.
    • This is a destructive process and will remove data from the database.
    • If you are running into some errors, try removing the database first with rm data/hazmat.db
    • You may recieve a warning that is something like "SAWarning: Dialect sqlite+pysqlite does not support Decimal objects natively," but this should not cause any issues.
  3. Create JSON files of specific sets of data with: python data-processing/

Development and running locally


All commands are assumed to on the command line, often called the Terminal, unless otherwise noted. The following will install technologies needed for the other steps and will only needed to be run once on your computer so there is a good chance you already have these technologies on your computer.

  1. Install Git.
    • On a Mac, install Homebrew, then do: brew install git
  2. Install NodeJS.
    • On a Mac, do: brew install node
  3. Optionally, for development, install Grunt: npm install -g grunt-cli
  4. Install Bower: npm install -g bower
  5. Install Ruby, though it is probably already installed on your system.
  6. Install Bundler: gem install bundler
  7. Install Sass: gem install sass
    • On a Mac do: sudo gem install sass
  8. Install Compass: gem install compass
    • On a Mac do: sudo gem install compass
  9. Install pip: easy_install pip

Get code and install packages

Get the code for this project and install the necessary dependency libraries and packages.

  1. Check out this code with Git: git clone
  2. Go into the template directory: cd minnpost-hazmat
  3. Install NodeJS packages: npm install
  4. Install Bower components: bower install
  5. (optional) Use a virtualenv. If you don't use a virtualenv, you may have to use sudo to install Python packages.
  6. Install Python packages: pip install -r requirements.txt


  1. Run: grunt server
    • This will run a local webserver for development and you can view the application in your web browser at http://localhost:8848.
    • Utilize index.html for development, while index-deploy.html is used for the deployed version, and index-build.html is used to test the build before deployment.
    • The server runs grunt watch which will watch for linting JS files and compiling SASS. If you have your own webserver, feel free to use that with just this command.


To build or compile all the assets together for easy and efficient deployment, do the following. It will create all the files in the dist/ folder.

  1. Run: grunt


Deploying will push the relevant files up to Amazon's AWS S3 so that they can be easily referenced on the MinnPost site. This is specific to MinnPost, and your deployment might be different.

  1. Run: grunt deploy


List any hacks used in this project, such as forked repos. Link to pull request or repo and issue.