[openspending-dev] Sanity checking numbers on Minas Gerais' satellite site

Vitor Baptista vitor at vitorbaptista.com
Thu Feb 14 22:15:31 UTC 2013


Hey Friedrich,

Not sure what you mean. But I guess I'm a bit closer founding the culprit.

I've added a counter into Aggregator.addBreakdown call, and it's called
once per breakdown or drilldown. In Minas Gerais' case, 4 times. There, we
end up double (or triple) counting amounts that end up being added to the
root node. If I comment this line,
https://github.com/openspending/openspendingjs/blob/master/lib/aggregator.js#L224,
the problem disappears, but I'm still wondering what's the use of that, and
what are the complications.

Cheers,
Vítor.

2013/2/14 Friedrich Lindenberg <friedrich.lindenberg at okfn.org>

> Did you consider the geographic breakdown? Maybe the aggregator only
> includes sums which are allocated to a region or otherwise discards some of
> that dimension?
>
> - Friedrich
>
>
> On Thu, Feb 14, 2013 at 8:34 PM, Vitor Baptista <vitor at vitorbaptista.com>wrote:
>
>> If you open http://minasgerais.playground.openspending.org/bubblemap.html,
>> and set a breakpoint into aggregator.js, line 183, you can see:
>>
>> > nodes.root.amount
>> 61554809596.11001
>> > total = 0; for (i in nodes.root.breakdowns) { total += nodes.root.breakdowns[i].amount; }
>> 73659290793.70004
>> > total = 0; for (i in nodes.root.children) { total += nodes.root.children[i].amount; }
>> 61554809596.11003
>>
>> The difference between nodes.root.amount and the sum of
>> nodes.root.children amounts seems to be just a precision error. But the
>> breakdowns have a huge difference. I'm trying to understand what's
>> happening, but haven't had much luck.
>>
>> My first hypothesis was that we're counting a few values twice. I thought
>> about it because, if you check:
>>
>> > data.drilldown[0].region.id
>> "1"
>>
>> I thought that Aggregator.toNode could change that to "root__1", which
>> would conflict with a cofog1 ID. But doesn't seems to be the case.
>>
>> Any ideas?
>>
>>
>> Cheers,
>>
>> Vítor.
>>
>
>
>
> --
> Friedrich Lindenberg | OpenSpending & OKFN Labs | @pudo
> http://openspending.org | http://okfnlabs.org | http://pudo.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/openspending-dev/attachments/20130214/641a4775/attachment.html>


More information about the openspending-dev mailing list