7 Days of Source Day #4 – BC Budget Visualization Tool

BC Budget Visualization Tool

Project: BC Budget Visualization Tool
Date: September, 2009
Language: Processing
Key Concepts: Data visualization, data organization, sticking it to the man

Overview:

More and more data is being released to the public every day. Big initiatives like the US data.gov and the UK’s upcoming data.hmg.gov.uk are resulting in a mountain of interesting data sets. These transparency initiatives are a step in the right direction, but we are quickly going to find ourself with a surfeit of data, and a very limited number of people with the skill set to do something with it.

One solution to this is to standardize the data so that generic tools can be built to dig into the data sets. This is a great idea – but it will take a lot of work, along with something that governments are not typically too good at: consensus.

Until that happens, tools like Processing offer another solution – make small, custom tools for individual data sets which can be built quickly and can be used specifically to work with the characteristics of a specific data set. Because Processing is fairly simple, journalists, researchers and activists can all be empowered to investigate data themselves, without having to rely on expensive or difficult to acquire resources.

This sketch is an example of how this might work. I wanted to investigate the recently announced staggering Arts & Culture cuts in my local government’s budget, and built a simple tool to do that. All told, it took about 5 hours to gather the data, produce this tool and get the results out on the web – certainly a turnaround time that would be useful for media and for activists looking to be quick with their responses.

Getting Started:

Move the sketches into your Processing sketch folder. Open Processing and open the BCBudget sketch from the File > Sketchbook menu. You’ll find detailed instructions in the header of the main tab (the BCBudget.pde file).

Thanks:

Again, this project uses Karsten Schmidt’s amazing and incredibly useful toxiclibs.

Download: BCBudget.zip (12k)


CC-GNU GPL

This software is licensed under the CC-GNU GPL version 2.0 or later.

Share:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • Tumblr
Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL.

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

17 Comments

  1. Posted October 17, 2009 at 5:20 pm | Permalink

    Thanks for sharing this code.

    When I try to run the sketch, I get an error: NumberFormatException: empty String. This happens for the string cs in the function process() in CBA.pde.

    Any ideas?

  2. Posted October 18, 2009 at 1:39 pm | Permalink

    Hi Marc,

    I'll have a look at this – the sketch runs fine for me (obviously). I will post back here once I've had a closer look.

    Cheers,

    -Jer

  3. Posted October 19, 2009 at 2:37 am | Permalink

    Same with me. I'm on a Mac running 10.5.

  4. Posted October 19, 2009 at 2:50 am | Permalink

    Hi guys,

    Can you put this println call into the process function on the CBA tab and tell me what happens (you should get a whole pile of numbers output):

    void process(String s) {
    String[] sa = split(s, \” \”);
    amounts = new float[sa.length];
    for (int i = 0; i < sa.length; i++) {
    String[] ca = sa[i].split(\”,\”);
    String cs = join(ca, \”\”);
    println(cs); //**** ADD THIS LINE
    float d = Float.parseFloat(cs);
    amounts[i] = d;
    if (d > maxx) maxx = d;
    };
    };

  5. Posted October 19, 2009 at 3:07 am | Permalink

    I'm still getting the error: "NumberFormatException: empty String." I commented out the entire function and the sketched seemed to load and run, but the only thing it displayed was a single zero in the middle of the screen.

  6. Posted October 19, 2009 at 3:09 am | Permalink

    You know, perhaps it's the String s that is not loading properly.

  7. Posted October 19, 2009 at 3:12 am | Permalink

    this is what I got when put a println(s); after the first left curly:

    ControlP5 0.3.14 infos, comments, questions at http://www.sojamo.de/libraries/controlP5
    LOAD DATA
    41,608 53,984 28,254 26,596
    41608
    53984
    28254
    26596
    8,091 4,281 4,281 4,281
    8091
    4281
    4281
    4281

  8. Posted October 19, 2009 at 3:19 am | Permalink

    hmmm, now I'm getting this:

    ControlP5 0.3.14 infos, comments, questions at http://www.sojamo.de/libraries/controlP5
    LOAD DATA
    41608
    53984
    28254
    26596
    8091
    4281
    4281
    4281

  9. Posted October 19, 2009 at 4:56 am | Permalink

    OK. That is what you should be getting.

    Can you try replacing the line:

    float d = Float.parseFloat(cs);

    With:

    float d = float(cs);

    Thanks!

  10. Posted October 19, 2009 at 2:03 pm | Permalink

    It's working now. Thanks!

  11. Posted October 19, 2009 at 9:35 pm | Permalink

    That worked. Thank you.

  12. Akash Murgai
    Posted November 2, 2009 at 1:31 am | Permalink

    Hi Jer,

    I am trying to run your sketch but I get the error "The package toxi.util does not exist". Any ideas on how this can be resolved?

    I have installed the toxiclabscore library into my "libraries" folder but still no go… I suspect the issue is with finding "import toxi.util.datatypes.*;" but am not sure as I am still learning the Processing environment.

    Any help would be much appreciated.

    -Akash

  13. Posted November 2, 2009 at 6:53 pm | Permalink

    Hi Akash,

    You can remove the import line:

    //FIRST, IMPORT SOME LIBRARIES —————————-
    import processing.video.*;

    //import toxi.util.datatypes.*; << remove or comment out this line
    import toxi.math.noise.*;
    import toxi.math.waves.*;
    import toxi.geom.*;
    import toxi.math.*;
    import toxi.math.conversion.*;
    import toxi.geom.util.*;

    It's actually not used in the sketch. I'll post up a revised version later today.

    Cheers,

    -Jer

  14. Akash Murgai
    Posted November 2, 2009 at 11:04 pm | Permalink

    Thank you for the quick response Jer!

    I will try it out later today.

    Again, thank you for sharing your source code. It definitely helps the learning process.

    -Akash

  15. ur_firstfloor
    Posted January 11, 2010 at 9:17 pm | Permalink

    hi,

    I get the error message
    "package "processing.video" does not exist. You might missing a library.

    which processing.video libary are using there?

  16. Posted January 14, 2010 at 2:58 am | Permalink

    Hi,

    This is the standard Processing video library – you should be able to import it from the menu bar: Sketch > Import Library … > Video

    Cheers,

    -Jer

  17. Tahero
    Posted January 20, 2010 at 8:08 pm | Permalink

    Hi Jer. Questions for the budget.txt source data:

    what do the 4 numerical amounts represent: *41,608 53,984 28,254 26,596* & how are they represented in the visualization?

    and

    are the titles: *Aboriginal Relations and Reconciliation* differentiated from the line items: *Negotiations*

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*