X
    Categories: Uncategorized

How to Visualize Data With OpenSpending

Uploading the data to OpenSpending

The next step we need to take is to upload the Data into OpenSpending. Since OpenSpending does not support direct uploading of data, we’ll have to store the data somewhere on the web. This can be your own website — or in our case a community-driven data portal, AfricaOpenData.org.

Walkthrough: uploading data on AfricaOpenData

Note: This step is optional. You could also use a service like Dropbox or your own website to upload the datafile.

1. Go to [africaopendata.org](http://africaopendata.org) and create a profile.

2. Log in.

3. Now click on the “Add Dataset” button in your dashboard.

4. This will ask you some basic information for the dataset — a name, a description and so on.

5. Click on Next to go ahead.

6. Add a data file by selecting the “Upload a File” tab and choosing your file.

7. Enter some information about the file and click on “Next.”

8. Now you can enter some further information. Then click “Finish.”

Congratulations, you have published a Dataset on AfricaOpenData!

Walkthrough: loading data into OpenSpending

Now that we’ve got our data online, we can work on getting it into OpenSpending.

1. Go to openspending.org.

2. Click on the “Log in/register” tab and register a new account, or log in with a previously registered one.

3. This will open your Dashboard. If you just signed up, this will be empty. Click on the big blue “Import a Dataset” button. This will lead you to a form for you to describe your new dataset. Fill it out.

4. Click on “Next Step.” This puts us into the dashboard for the project. To import a dataset, we have to do several steps.

First, add a source. Click on the “Add a Source” button. Now go back to your uploaded dataset and find the download button (a sample can be found here). Copy the link into the menu that popped up in Open Spending and click on Create.

5. OpenSpending will now analyze the file and see whether it’s good to load. This will take awhile — feel free to reload the page to see whether it’s done. When it’s done, click on the “create model” button.

6. Open Spending will have recognized most of the columns properly — except it wants a column called “time,” and we have to create it. Delete the Year column by clicking on the “X” next to “year” in “Existing Dimensions”.

7. Now let’s add a dimension by clicking on the “New Dimension” button. This opens a menu. Select “date” and name it “time.”

8. Click on “Add” to add this dimension. OpenSpending should have automatically identified the “Year” column as the column you want to have.

9. So far so good. To display data more nicely, OpenSpending needs two dimensions labeled “from” and “to” that refer to who spent the money and for what. In our case, those would be *Top-level-spending-units* for “from” and *sub-economic-category* for “to.”

Let’s do this similarly to how we added “time.” Remove “top-level-spending-units” from the existing dimensions. Create a dimension called “from.”

10. Now you can add all the attributes to “from” here. In our case, it’s just the one column.

11. Now do the same for “sub-economic-category” and “to.”

12. To make sure it doesn’t double-load the data, OpenSpending needs to know how to determine whether a record is already there. This is done by specifying which combination of columns marks an entry as unique.

To define this, select “Set Unique Dimensions.” A popup will appear. Check all dimensions except “amount.”

13. Great — now click on “Update” and then on “Save Dimensions.” This should create a Model in OpenSpending — so it understands what your data looks like.

Once we have created our model, we can load the data. Go back to the Dashboard and click the “Load” button next to your source. This will take awhile and run through. Reload the page and check until the run is finished. Now we can open the dataset. Click on the link next to the “house” icon on the top.

Congratulations! You have uploaded a dataset to OpenSpending.

Creating a visualization on OpenSpending

Now that we have our Dataset on OpenSpending, let’s create a Treemap visualization.

1. Click on the Visualization tab and select “create a visualization.”

2. We want to create a TreeMap, so let’s select “TreeMap.” This gives us the Visualization editor. It allows us to select the parameters by which the dataset is split and filtered.

Let’s start with “Sector.” Then add a new level and select “From”; add another one and select “Economic Category”; and finally add one more level and choose “To.” “To” will be our most fine-grained information on where the money is spent.

3. You can play around with the visualization in the bottom to get an idea what is going on. Once you’re happy, click on “Save or embed”.

4. Name your visualization and click “Save.”

Now you have a visualization, and you can go and embed it on your website.

Stuck? Need further support? Visit ask.schoolofdata.org.

Michael Bauer is a Hacker, Scientist and Activist based in Vienna, Austria. He found a home at OKFN to wrangle data and help create knowledge for everyone out of it.

mbauer :Michael Bauer is a Hacker, Scientist and Activist based in Vienna, Austria. He found a home at OKFN to wrangle data and help create knowledge for everyone out of it.

Comments are closed.