[openspending-dev] Sanity checking numbers on Minas Gerais' satellite site
Vitor Baptista
vitor at vitorbaptista.com
Fri Feb 15 15:27:00 UTC 2013
Hey Stefan,
I've found where's the problem is, but not sure what the fix would look
like yet. Any ideas?
Cheers,
Vítor.
2013/2/15 Stefan Wehrmeyer <stefan.wehrmeyer at okfn.org>
> Hi Vitor,
>
> thanks for tracking that down.
> I also noticed the issue a while ago when sanity checking some treemaps
> but couldn't get to the bottom of it.
> There should definitely be (regression) tests for this kind of stuff.
>
> Cheers
> Stefan
>
> On 14.02.2013, at 23:15 , Vitor Baptista <vitor at vitorbaptista.com> wrote:
>
> > 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
> >
> > _______________________________________________
> > openspending-dev mailing list
> > openspending-dev at lists.okfn.org
> > http://lists.okfn.org/mailman/listinfo/openspending-dev
> > Unsubscribe: http://lists.okfn.org/mailman/options/openspending-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/openspending-dev/attachments/20130215/e362e9d5/attachment.html>
More information about the openspending-dev
mailing list