An explorable budget visualization for the state of New York
- D3 (for CSV manipulation)
- Highcharts (charting library)
- Datatables (sortable HTML tables)
How to update this New York visualization
1. Update Data
The csv inputs that may need to be updated going forward are:
- the budget numbers (
- the budget descriptions (
cleanup.py is a python script that requires pandas and xlrd. You can install them by running:
pip install -r requirements.txt
When updating either of the above csvs, run the
cleanup.py script to generate the finished budget,
2. Update settings
The settings in
js/settings.js that may need to be updated going forward are:
endYear(for example, if the last year in the budget is '2015-16', set the end year to 2016)
projectionStartYear(for example, if the first year of estimates is '2015-16', set this to 2016)
plotBandBuffer(this determines the # months of padding for the beginning of the estimates plot band. if there are multiple years of estimates, set a small buffer like -1, otherwise set it to a larger negative number, e.g. -7, for more space)
To preview changes locally:
python -m SimpleHTTPServer
To deploy, push the changes into the
git push origin master git push origin master:gh-pages
How to adapt this to another budget
This code can be customized to visualize another data set.
####Data Prepatation The budget data must be a csv that adheres to a fixed format in order for the app to process it properly. Budget column headers include: Fund ID, Fund, Department ID, Department, Short Title, Link to Website, Department Description, and Control Officer. Values for estimates and actuals must be broken down into a separate column for each year.
See examples of prepped data:
If you need to do any preparation on your raw data to get it into the finished format (e.g. formatting dollar amounts, removing whitespace, adding descriptions), do it in a script so that it will be repeatable in the future. See an example script in
Put your finished budget csv file in the
Next, set the configuration variables in
- Cathy Deng, DataMade
- Derek Eder, DataMade
Errors / bugs
If something is not behaving intuitively, it is a bug, and should be reported as an issue
You can also email email@example.com or tweet @DataMadeCo.
Note on patches/pull requests
- Fork the project.
- Make your feature addition or bug fix.
- Commit and send me a pull request. Bonus points for topic branches.
Copyright and Attribution
Copyright (c) 2016 DataMade. Released under the MIT License.