[openspending-dev] OpenSpending visualizations in CKAN

Tryggvi Björgvinsson tryggvi.bjorgvinsson at okfn.org
Fri Apr 25 14:31:48 UTC 2014


On fös 25.apr 2014 14:06, Stéphane Guidoin wrote:
> I would like to directly integrate a budget treemap based on a CKAN budget
> dataset _in CKAN_ (so without loading the dataset in openspending.org or an
> openspending instance).

That's great stuff (although I don't understand why you'd want to skip
the openspending loading step since that's what openspending.org is all
about enabling). I'm really interested in hearing why :)

> I've had a look to the github account of openspendingjs and found some
> traces of work done to include openspending in CKAN, but nothing
> compelling. CKAN has started to implement custom visualization plugins so
> it should be possible to create a custom viz module.

We have recently been moving away from the heavy integration of
openspendingjs with openspending. The interesting code is in src/ where
we've tried to make things configurable (so you don't have to interface
with openspenidng.org but at the moment what you interface with must
return same structure are openspending.org.

If you like to change that to be more inclusive then that's great. Just
submit a pull request so we can all benefit :-)

With these changes our hope has been to enable users to create treemaps
with a simple jQuery extension:

$('#myawesomeidentifier').treemap({
    data: { url: 'https://openspending.org',
                dataset: 'thedatasetidentifier',
                ... }
    more configurations ...
});

(also via a shortcut method of automatically creating treemaps for every
dom element with the class treemap (and configurable via the html
data-attributes)).

If you make changes please try to confine yourself to this setup so that
openspendingjs can continue to be useful as a standalone library.

Everything in the src/ folder is in the new versioned releases where
this convention is used (vendor/ is external dependencies and almost
everything else is stuff we're trying to move away from so sorry for an
unclean repo but we don't want to break stuff that relies on
openspendingjs as it was).

> My questions:
> - can openspending be used outside of openspending?

Yes (I assume you're talking about openspendingjs). As I said, it's
about configuring the data.url to something else but at the moment that
is restricted to the openspending API (because that's what we know so
feel free to add something that can use CKAN).

> - Is there some examples of such use of openspendingjs?

Not that I know of so I refer this to others on the list.

> - I seached as much as I could but couldn't figure how and in which format
> openspendingjs reads the data... (I have to admit I understand JS but I'm
> not really proficient)

The magic happens in src/utils/openspending.aggregator.js which
interfaces with the openspending aggregation API. You can read more
about that here:
http://docs.openspending.org/en/latest/api.html

Just let us know if you run into trouble. I think this is a great
project to help us separate openspendingjs from openspending more --
which is what we want to do) and pleeease let us know when you have
something cool to show :)

-- 

Tryggvi Björgvinsson

Technical Lead, OpenSpending

The Open Knowledge Foundation <http://okfn.org>

/Empowering through Open Knowledge/

http://okfn.org/ | @okfn <http://twitter.com/OKFN> | OKF on Facebook
<https://facebook.com/OKFNetwork> | Blog <http://blog.okfn.org/> |
Newsletter <http://okfn.org/about/newsletter>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/openspending-dev/attachments/20140425/a63b6d9e/attachment-0002.html>


More information about the openspending-dev mailing list