IATI / D-Portal

http://d-portal.org/
Other
30 stars 23 forks source link

Total organisational budgets not summed over ISO codes #647

Open IsabelBirds opened 1 year ago

IsabelBirds commented 1 year ago

Hi!

Where there are multiple annual budgets for the same ISO code in an org file - for example, to differentiate between budgets for the Syrian Arab Republic and North-west Syria - the total annual budget is only showing one budget, not their sum.

This org file contains two 2022 budgets, both under the SY recipient-country code:

Screenshot 2023-02-16 at 11 21 16

But the 2022 total only shows the value of the first budget:

image

Would it be possible to sum these to allow the org file to contain this level of detail without affecting the total budget?

Thanks!

xriss commented 1 year ago

Can you tell me which publisher we are looking at here?

and I'll take a look at how things are calculated here, I would expect them to be added but maybe something else is happening.

xriss commented 1 year ago

Ahh, it is not getting added, thinking back I can remember there being some discussion on this sort of thing and the conclusion was that the budgets as published in the org file should be one per country per year and an attempt to combine them might make things worse. So we just pick one for display.

Easy enough to change and I think it makes sense to do so. Just let me know what page you are looking at so I can do some before and after tests that it's doing the right thing there.

IsabelBirds commented 1 year ago

Hi @xriss, thanks!

My example is from GAVI's data http://d-portal.org/ctrack.html?reporting_ref=47122#view=countries&year=2021

xriss commented 1 year ago

This is a dquery that shows which publishers / countries would be effected by this change sorted by size of change in USD.

http://d-portal.org/dquery/#%20%0ASELECT%20aid,budget_country,SUM(budget_usd_sum)-SUM(budget_usd_max)%20AS%20diff%20FROM(%0A%20%0A%20SELECT%0A%20%20%20%20aid,%0A%20%20%20%20budget_country,%0A%20%20%20%20budget_day_start,%0A%20%20%20%20SUM(budget_usd)%20AS%20budget_usd_sum,%0A%20%20%20%20MAX(budget_usd)%20AS%20budget_usd_max%0A%20%20%20%20%0AFROM%20budget%0A%0AWHERE%0A%20%20%20%20budget%20=%20'country'%0A%0AGROUP%20BY%0A%20%20%20%20aid,%0A%20%20%20%20budget_country,%0A%20%20%20%20budget_day_start%0A%0AORDER%20BY%0A%20%20%20%20aid,%0A%20%20%20%20budget_country,%0A%20%20%20%20budget_day_start%0A%20%20%20%20%0A)%20AS%20maxsum%0A%0AWHERE%0A%20%20%20%20budget_usd_sum!=budget_usd_max%0A%0AGROUP%20BY%0A%20%20%20%20aid,budget_country%0A%20%20%20%20%0AORDER%20BY%0A%20%20%20%203%20DESC

From this I found that US-GOV-1 reporting seems to involve double budgets for the same year with the same IATI status but with a different usg:type attribute. EG

<recipient-country-budget status="2" usg:type="Actual">
...
<recipient-country-budget status="2" usg:type="Appropriation">

Currently we are just picking one of these which seems to be more correct than adding them up.

So now I'm not sure if we should be making this change unless we talk to US-GOV-1 about this first.

Although it would fix it for you by a small amount it would double the number by a rather large amount in a lot of other cases. cc- @markbrough @stevieflow