Use rbenv to manage Ruby versions.
- If you need to install rbenv on MacOS, installation with Homebrew is easiest. Make sure you follow the directions to set up rbenv in your shell.
- Middleman
gem install middleman
- Yarn
brew install yarn
After installing prerequisites, run the following commands at the root of the project
bundle install
yarn install
Run
bundle exec foreman start
First build a static version of the project using the following command
bundle exec middleman build
Now copy contents of ./build
folder to the amazon S3 bucket.
PS: If you have developer access keys, you can add a ∏rake task to automate this.
Because of a breaking change in Google Drive and Sheets API, the data update process includes manual steps at the moment.
- Manually update
data/amazon.json
file Convert contents of the Google Sheet to json using a CSV to JSON converter such as csv2json
The json output should be a hash where the facility codes are the keys and each row is an array attached to the key. See
data\amazon.json
for reference
- Remove
/
from key names To prevent processing errors, rename
(Injury Rate)/(5.2, Industry Injury Rate)
to
(Injury Rate)(5.2, Industry Injury Rate)
and
(Serious Injury Rate)/(4, Industry Serious Injury Rate for 2018)
to
(Serious Injury Rate)(4, Industry Serious Injury Rate for 2018)
- Run script to process data
Run
bundle exec ruby ./scripts/process_data.rb