Giter VIP home page Giter VIP logo

openoakland / openbudgetoakland Goto Github PK

View Code? Open in Web Editor NEW
95.0 25.0 138.0 21.33 MB

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

Home Page: http://openbudgetoakland.org

License: MIT License

HTML 5.15% JavaScript 39.39% Python 3.66% Shell 0.87% PHP 16.66% Pug 28.62% SCSS 5.66%
openoakland civic-hacking civictech budget data-visualization code-for-america civictechindex

openbudgetoakland's Introduction

Open Budget: Oakland

Contributing

If you're looking for a starter development task to get your feet wet with our codebase, any of our Issues tagged help wanted might be a good fit.

Some of the other Issues are larger and require some deeper design or architectural work; if one of those catches your eye, you'll probably want to talk with us for some more context and background. Either comment on the Issue or โ€” even better โ€” catch up with us at one of OpenOakland's weekly Hack Nights.

Developing Locally

Quick Start Guide for Unix-based systems (Mac or Linux)

  1. Sign into GitHub and fork this repo
  2. Clone the fork onto your machine and navigate to the new folder
  3. While still in the root directory of the repo, create a new folder called "build". This folder will be ignored by our version control system.
  4. Navigate to the _src/ folder, which is where all development work takes place.
  5. Install dependencies with npm install
  6. Serve the website by entering npx @11ty/eleventy --serve --port=8011

Congratulations! Your local copy of Open Budget Oakland's website should now be running at http://localhost:8011. That means you're ready to do the codez if you want to contribute to the codebase of Open Budget Oakland. You will probably want to open a new terminal window, though, to regain access to the command line.

  • Please note that after editing a SASS file you should run npm run build-css from the _src/ folder in order to incorporate your changes into the CSS

Eleventy

This site is built with Eleventy, a JavaScript-based static site generator that parses Markdown, Pug, and other template languages and runs on Node.js. That means you can reproduce our site locally with minimal setup!

You'll need these installed globally:

  • Node is a prerequisite for NPM
  • NPM or Yarn
  • NVM is optional, but very handy for downloading, updating, and switching between versions of NPM

Install & Run Eleventy in _src/

Once you have the NPM package manager installed, you can install Eleventy and the other dependencies listed in package.json. Enter the following from the _src/ folder, where the Eleventy configuration file .eleventy.js lives.

npm install

This command usually runs without a glitch, but if you run into trouble, check your version of node. The latest version of node that we can confirm works with our set-up is v15.14.0.

To start eleventy, simply enter the following. (You may choose any network port on your system that is available; 8011 is just a suggestion.)

npx @11ty/eleventy --serve --port=8011

Frontend Stack

This project is coded with, among other things:

  • Bootstrap, a CSS framework
  • D3, a data visualization library for JavaScript
  • Pug, a JavaScript-friendly HTML templating language
  • React, a rendering library for JavaScript
  • Sass, a CSS preprocessor

Creating & Editing Pages

  • Please note that it is your responsibility to keep your fork of the repo up-to-date with changes made by others working on the project. Doing this diligently should go a long way towards protecting you from scary git merge conflicts.
  • All development activity occurs in _src/. The root folder is only for compiled output for deployment.
  • Page content is inserted into the content block. If you are updating data, be sure you understand how it will be consumed.
  • In many cases you will simple create or update a .pug file, which Eleventy will turn into HTML. If you are making another type of change, you may need to read Pug documentation (which is excellent, by the way!).
  • 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.)

Additional instructions for "flow" diagram pages

  1. Flow pages are built off a template; copy one of the *-budget-flow.pug pages and update the content blocks as necessary.
  2. Data files must be placed in the data/flow directory. Follow the naming convention seen there or your files won't load properly. You also will need to point your page at the appropriate files as seen in the get_datafiles content block.
  3. the following columns are required in your datafile and their names should be normalized as seen here. Other columns should be removed to minimize the data download.
    • budget_year
    • department
    • fund_code
    • account_type (this should be the Expense/Revenue column, if there are duplicate names)
    • account_category
    • amount

Additional instructions for treemap diagram pages

  1. Treemap pages are built off a template; copy one of the *-budget-tree.pug pages and update the content blocks as necessary.
  2. Instructions for generating the necessary data files can be found here. Add them to the data/tree/ directory following the naming convention seen in the existing files.
  3. Update the datafiles content block with the appropriate metadata and file path for the data files you generated.

Additional instructions for the Compare page

  1. The Compare page is a React application. The source files are in _src/js/compare/ and are are bundled with Webpack.
  2. When developing on the Compare page, run yarn to install all the necessary node dependencies and yarn run watch to watch the source files for changes and rebuild the asset bundles accordingly.
  3. The Compare page communicates with a separately maintained API to fetch its data. Documentation for that API can be found in our wiki.

Publishing Changes

Make changes and review them on your local development site. If everyting looks good, push your changes to your personal fork and merge the commit(s) into your master branch. Finally, issue a pull request and we'll take it from there!

Issuing a pull request

Simply push your code changes to your repo in whatever branch you used locally, then merge into master. At this point you can either 1) push from your master to the staging branch of the upstream repo or 2) just tell an admin of the upstream repo that your work is ready for review. (Anyone with admin privileges on the original repo will be able to create a pull request from your repo). Your changes will then be reviewed, tested, and (if everything looks good) pushed into the master branch.

Starting in March 2020, code changes pushed to the master branch of the (original) repo will use GitHub Actions to trigger a continuous integration process that (among other things):

  • runs WebPack;
  • builds static files with Eleventy; and
  • deploys the updated web files to GitHub Pages

Generating the API

Background

Oakland budget data are hosted in a special table that lives in the database of a WordPress site. This site exists primarily for the purpose of managing this data, and is not intended for public consumption. Should you need access to the backend of the site, please contact Felicia on Slack.

The API we have built is completely independent of the Open Budget Oakland site, and can be consumed by anyone. Thus far, we have not had to place any limits on traffic to the server, but that may change in the future. To learn how to use the API, please see the documentation in our GitHub wiki.

Using the plugin to generate the API

The WordPress plugin (OBO Custom Routes) that generates our API can be installed and used on any WordPress site, providing a database table with the expected column names is present. Currently, the plugin is hard-coded to expect a table called oakland_budget_items. Obviously, that would be something you'd want to change if you were to use the plugin for another project. Additionally, database queries can easily be altered to fit a different table structure and to create different kinds of endpoints with a bit of PHP skill.

Developing locally

To develop new features for the API, you may want to run Wordpress locally. This repo includes a configuration file for doing so with Docker Compose. With Docker Compose installed, simply run docker-compose up in wordpress plugin for custom API endpoints/ to activate linked containers for Wordpress, MySQL, and PhpMyAdmin. The Wordpress container will mount that directory as though it were Wordpress' plugins/ directory, allowing your edits to the plugin files in obo_custom_routes/ to be reflected in your Wordpress instance. (Additional plugins that are not part of this repository will appear in that directory; they should be ignored by git.)

openbudgetoakland's People

Contributors

adstiles avatar asuth avatar bitdeli-chef avatar ckingbailey avatar commahawk avatar daguar avatar dependabot[bot] avatar emilyperi avatar ixley avatar macfarlandian avatar markbrough avatar mikeubell avatar mwleeds avatar notpeter avatar nydame avatar ppopp avatar saivishy avatar tdooner avatar tinyherocarrot avatar villatrue avatar wrought avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openbudgetoakland's Issues

Bookmark a line item

Part of

  • UX personalization
  • Social marketing

Let me:

  • "star" or otherwise mark categories or line items
  • see/sort/filter my list
  • edit my list without going back to the line item's page
  • share my list by email, twitter, facebook, or as a spreadsheet
  • subscribe to updates affecting my list
    So that:
  • I don't have to repeat the discovery process each time I return
  • I can show what I've done and share it with others

Treemap tooltip gets clipped on right side

The tooltip on the new treemap can get clipped off (float offstage) on the right side when the right side of the treemap is right against the edge of the browser window.

Expand the list of questions people ask of the budget

The visualizations so far seem to answer two questions:

  • How do I navigate the tree?
  • Where does the money for this program come from?

There's more to ask.

Budget vs. Reality.

  • Did the last budget get funded?
  • Did the City spend those funds?
  • How have those changed over time?
  • Winners? Losers?

Geography.

  • Where are building funds spent? Alameda County shows the capital budget by zip code.
  • How has that changed since the last budget?

Bureaucracy.

  • Who has financial power? Could we list the City staff that have responsibility for spending over $50 million? Show relative spending power?
  • Who has headcount? Who's getting more or losing some?

Results.

  • How has spending correlated with KPIs for major programs? e.g. overall crime stats for OPD, infrastructure metrics for Public Works, etc. What are we paying for? How are those KPIs comparable to other cities of our size? To California and US as a whole?

Add a blog to the site

The project has lots of public communication to do. Including:

  • New-data announcements (as we refresh)
  • OBO Launch activities
  • New feature introductions and explanations
  • Request for testers and other volunteers
  • Announcing City Council activity re: the budget
  • Pointing to public reporting and analysis of OBO and the budget
  • Kudos and thanks to other brigades for their projects; to Oakland staff for opening up the data
  • Project media kit for reporters (pictures of the app, the team; quotable text; links to resources)

Add subscriptions to OBO updates

What

  • Form: "Leave your email address, twitter name, or mobile number and we'll let you know when we have fresh updates."
    -- Capture to a google spreadsheet
    -- Add emails to an OBO mailchimp list
    -- Send confirmation email with opt-out link
  • Manage-my-subscription page
  • Push blogged updates to the list for each communication channel (email, twitter, SMS)

Why
Growth:

  • Drive return visits
  • Create shareable moments
  • Measure a higher level of engagement that a "visit"

Twitter integration

Current widget only shows tweets from openbudgetoak - it wont bring in any other tweets others make using our hashtag #OAKbudget
This is on i fit is just an integration to show our posts- but it's richer and more dynamic to feature content w the hashtag too!

URGENT: budget comparison visualization(s)

Using never-before-public data, create a budget comparison tool that will have a big impact on Oakland's budget process (no hyperbole). Ideally with D3, the visualization(s) will make side-by-side comparison of the mayor's proposed budget and 2-3 council proposals. Ask @adstiles for details.

Data will be collected in this format: https://docs.google.com/spreadsheet/ccc?key=0AqpW8uWGhwkudGlPTFJnb1hQU0xPdXgwdWwyR0VKUlE&usp=sharing#gid=9

Possible code / inspiration:

http://bl.ocks.org/mbostock/3943967

http://bl.ocks.org/mbostock/3886394

http://bl.ocks.org/mbostock/3886208

http://bl.ocks.org/mbostock/3887051

https://live.zoomdata.com/zoomdata/visualization?__target=embedded&key=544fb187e4b0f4966438c4c3#51db7ad4e4b04caf9ab346db-5411ace4e4b065842f0df371

Can't find the documentation

Hi! I live in Bangor, Maine and I think our city would love to adapt this for our local budget. Is there documentation somewhere?

Add disqus to new treemap and flow diagram pages

This will also require deciding where to put comments. Below the visual, either the table data or comments, but not both since that will bury content way down on the page. Suggest putting comments or table data in a column to the right of the visual.

add footer

consider the following:

  • summary of site
  • OpenOakland affiliation
  • full nav?
  • social + contact links?
  • creative commons license

Remove Spaces from Treemap URL Hash

When clicking through the treemap, the hash in the url updates so that the link can be shared. Spaces can sometimes screw up the auto-linking on email clients, so we should make the system work sans-spaces.

Review and update any broken Disqus threads

some Disqus comment threads are tagged by location (url), rather than page (content-based), meaning some threads might become 'unlinked' if the url changes at all. Look into converting the association to be based on unique page ids (most already are).

Generate unique URLs on each click of visualization; trigger reload of comments

Goal: When user clicks on a department, and then unit, unique URLs are created. See: http://openbudgetoakland.org/oak11-13adopted.html

This will allow people to share specific views or levels of the budget, and will allow a unique set of comments to load for each view/level.

Example: http://slovakia.openspending.org/municipality/#banska-bystrica/year:2012

Once unique URLs are being created on each click, this seems to be the Disqus instructions for reloading the comment thread:
http://help.disqus.com/customer/portal/articles/472107-using-disqus-on-ajax-sites

We also want each level of this visual to have breadcrumbs. See: https://github.com/adstiles/openbudgetoakland/issues/6

Merge pages: Timeline and Budget 101; Move Tools/Projects page to diff nav button

Add timeline to current "Oakland Budget 101" page, above links

In nav bar: Move "Oakland Budget 101" from "Resources" tab to "Oakland's Budget" tab

This would leave the "Resources" tab with just "Tools and Projects", so suggest moving this to the "About" tab, since it is framed as "resources that have helped or inspired our work"

Delete "Resources" from nav bar.

"Uncaught TypeError" in boot.js

Hi Max,

I got rid of all errors except 2 related to boot.js. See: http://openbudgetoakland.org/draft/oak11-13adopted.html

I get this:

Uncaught TypeError: Object function (e,t){return new y.fn.init(e,t,n)} has no method 'sub' boot.js:3
(anonymous function) boot.js:3
(anonymous function) boot.js:3
Uncaught TypeError: Cannot read property 'webkit' of undefined boot.js:2
e.support.transition.r.end boot.js:2
(anonymous function) boot.js:2
(anonymous function) boot.js:2
l foundation.min.js:18
c.fireWith foundation.min.js:18
y.extend.ready foundation.min.js:18
M

Any guesses?

THANKS.

@maxogden

Budget process timeline shouldn't show "12:00am" on all the items

It's an easy fix, but it's to the data in the Google Spreadsheet, so I can't make a pull request. You need to change all the Start Date and End Date items so that they don't include hours/minutes/seconds. (When I clicked on each one, and then selected the date using the date picker, the sheet automatically updated to include the date but not the time.)

For example, see the first few items of my copy of the spreadsheet here:
https://docs.google.com/spreadsheets/d/1uPj_zOgjthPm3Ki4Bz4Mvr8APEq1Vpf-r9-qznMm_II/edit?usp=sharing
When I run the same code with this spreadsheet, it doesn't show the 12:00am times.

Internationalization

What approach could we take to make this whole site useful to spanish and chinese speakers/readers? Right now a lot of our community can't use this and it's super helpful information. Fork site? Duplicate viz items?

Give every line item its own page

What:

  • Today the furthest down you can drill is "Budget > General Fund: General Purpose > Police Department > Sworn Salaries" for example, and two detail rows for "Sworn: Regular" and "Sworn: Paid Leave Charge". You can't drill down on the detail rows.
  • Create a page for each of the line items. (canonical urls)
    • (are we running into too-long URLs as we keep the human-readable name?)
  • On each line item page:
    • Usual navigation (breadcrumbs, tree, search, etc.)(maybe without the tree)
    • Name of line item and money in/out
    • Description of line if available
    • History. e.g. was this line item in previous budgets; if so when, how much. last actuals.
    • Disqus (or whatever conversation tools we're using) pointing to this line item.
    • Sharing tools - pointing to this line item.
    • Trackbacks pointing to where this item was mentioned (links that point here)

Why:

  • To enable discussion specific to a line item
  • To enable sharing (twitter, email, etc.) specific to a line item

1 infographic card per row

slide1a
in a very basic way, i'd like each element of the tree to generate its own little pinable infographic "card" showing:

  • its place in the tree,
  • a name,
  • any attributes, and
  • a link back to its OBO page.

for visuals,

  • dollar amounts compared to human-referencable things (7 Priuses, 3.5 FTE employees).

if there's history, show

  • up/down arrow if more than 10% change.

so we'd have 9K+ infographics for people to share. and discuss

slide2

Broken image links in budget process timeline

Two images in the timeline are broken:

  1. "Proposed Policy Budget Released": Image of the mayor (hotlink to an image of Jean Quan at zennie62, which does not load). Maybe use this image of Libby Schaaf from the Oakland city website: http://www2.oaklandnet.com/oakca1/groups/ceda/documents/image/oak051245.jpg
  2. "Budget Town Hall Meetings and Community Input": Image of the map of city council districts (hotlink to a wiki cache image from oaklandwiki.org which no longer works). You could use this URL from the wiki which is an up-to-date cache image: https://oaklandwiki.org/media/cache/04/b7/04b77a395728f8e1f59ae98899fbca62.jpg Better, though, would be downloading the screenshot, hosting on some permanent site and then linking directly to it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.