/openbudgetokc

Visualizations of OKC's budget data, and explanations about the budget process.

Primary LanguageJavaScript

Open Budget OKC

Chat

Join the Code for OKC Slack room here: http://slack.codeforokc.org/. Once there, check out the #openbudgetokc channel for discussion about this project.

Getting Started

Fork me!

Fork and clone the project!

git clone git@github.com:[your-user]/openbudgetokc.git
  • cd, checkout to branch

Developing Locally

Harp

This site is built on Harp using Node.js That means you can run it locally with minimal setup!

What you'll need:

Install & Run

Once you have npm installed,

# to install dependencies and run
npm install && npm start

# npm install can be omitted on subsequent runs
npm start

Making Changes

This project is coded with:

Creating & Editing Pages

  • Page content is inserted into the layout.jade file (which includes basic header and footer snippets)
  • Create your .jade file
  • Add a link to the main nav in the appropriate place
  • Add relevant metadata in _data.json (page title, page slug (url), ...)
  • If your page uses custom page-specific css, add it to a new .scss partial and import it into the main stylesheet. (Make sure to namespace it the same way the others are.)

Adding additional datasets to the Flow diagram page

To request revenue and expense data for a new fiscal year, submit an Open Records request and type the following in the description field. Update FYXX with the last two digits of the year (ex: FY16).

-A csv file of the City of Oklahoma City revenue and expenditure budget for FYXX, including Fund, Fund name, Operating Unit, Operating Unit Description, Program ID, Program Name, Line of Business ID, Line of Business name, Account, Account Name, Account Description, Budget Amount. (Budget database query names qry_Current_Yr_Budget_detail and qry_Current_Yr_Budget_Detail_Revenue)

This chart takes as input the full budget datatable from data.oaklandnet.com (in CSV format)

Right now the 2015-17 Proposed page is an unpublished placeholder, pending the data release. When the data becomes available:

  1. add the CSV to _src/data/proposed_1517_flow/ and remove the placeholder file FY13-14__FY14-15.csv
  2. rename the file to include the two fiscal years it includes, separated by two underscores ("FY15-16__FY16-17.csv")
  3. open the csv and make sure all column headings are standardized to the following names:
    • budget_year
    • department
    • division
    • org_code
    • org_description
    • fund_code
    • fund_description
    • account_type (this should be the Expense/Revenue column, if there are duplicate names)
    • account_category
    • account_code
    • account_description
    • amount
    • (any other columns should be deleted)
  4. test it in Harp in the dev branch, and it should compile properly for deployment

Sandbox

Most of the new development on Oklahoma City data visualizations is currently occuring in the sandbox directory. Each of the charts can be viewed by opening them directly in your browser.

This area is in active development so all of the graphs may not be functioning correctly.

Publishing Changes

Make changes on your personal fork or branch. If you have repo access, and your changes are ready for review, you can merge them into the development branch and publish to the staging site for review. You can also publish changes to your own server and merge to development afterwards.

Publishing to Staging

If you have access to the openoakland repo, you can easily publish a preview of your changes to staging.openbudgetoakland.org with the script below.

# Run shell script to publish changes from your current branch to the staging 
# Because of path referencing, you'll need to run this script from inside the _src directory for now
bash ../_publish-preview.sh

Publishing to Production

Even though Harp runs locally, static files need to be compiled for the live site (hosted on Github pages). Once you have made all your changes, you'll need to compile everything in order for it to run on gh-pages. Because of how Harp compiles (that it clears the target directory), this workflow gets a bit wonky. We'll try to make it a little less fragile if people begin publishing changes more often.

# make sure your repo is up to date and you are on the master branch
git fetch
git checkout master

# merge your changes from your branch or development into master
git merge origin/development

# here's where it gets hacky - open to suggestions for an improved workflow
# delete the gh-pages branch and then recreate it as an orphan (untracked) branch
git branch -D gh-pages
git checkout --orphan gh-pages

# move into the _src directory and compile source files to the root
cd _src
harp compile ./ ../

# move back to the root, and add and commit files
cd ../
git add -A
git commit -m "deploy"
  
# push changes to remote gh-pages branch using *gasp* --force! 
# !!! Never push --force on any public branch besides gh-pages!
git push --set-upstream origin gh-pages --force  

# make sure your changes are showing up and you didn't break anything

merge your changes from your branch or development into master

git merge origin/development

If you are on a forked branch, create a pull request to have your changes reviewed for merge!