Skip to content

What should happen when an activity has both 2 countries AND 2 regions with %'s defined? #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ghost opened this issue Dec 10, 2024 · 6 comments · May be fixed by #9
Open

What should happen when an activity has both 2 countries AND 2 regions with %'s defined? #6

ghost opened this issue Dec 10, 2024 · 6 comments · May be fixed by #9

Comments

@ghost
Copy link

ghost commented Dec 10, 2024

A basic algorithm would then result in 4 split transactions:

  • Country A, Region A
  • Country A, Region B
  • Country B, Region A
  • Country B, Region B

But should we be taking into account anything about those regions? Maybe region A and B only exist in country A for instance? Is this bad input data?

I'm sure I remember reading something about this in one of the other writeups but now I can't find it.

@ghost ghost mentioned this issue Dec 10, 2024
@ghost
Copy link
Author

ghost commented Dec 10, 2024

See test test_split_by_everything which currently doesn't actually do that - but it shouldn't till this Q is resolved.

@Bjwebb
Copy link

Bjwebb commented Dec 11, 2024

Both the country and region percentages should sum together to make 100%.

https://iatistandard.org/en/iati-standard/203/activity-standard/iati-activities/iati-activity/recipient-country/#example-usage

When both the recipient-region and recipient-country are declared, then the @percentage values should sum to 100% per region vocabulary for the specific iati-activity.

<recipient-country code="AF" percentage="50" />
<recipient-region code="489" vocabulary="1" percentage="50" />
<recipient-region code="A1" vocabulary="99" percentage="50" vocabulary-uri="http://example.com/vocab.html" />

@ghost
Copy link
Author

ghost commented Dec 11, 2024

Ah, I had heard that but didn't understand the significance.

So, when an activity has both 2 countries AND 2 regions with %'s defined you should get:

  • Country A
  • Country B
  • Region A
  • Region B

And the sum value of those 4 transactions should be the same as the value on the original transaction?

@Bjwebb
Copy link

Bjwebb commented Dec 16, 2024

That's right. But it gets more complicated when there's regions from multiple vocabularies.

@ghost
Copy link
Author

ghost commented Dec 17, 2024

Ok, how should it work in that case?

Activity has 2 countries (A and B) and 2 regions in one vocab (C and D) and 2 regions in another (E and F), the split on each is 25%.

Should you get?

  • Country A, 25%
  • Country B, 25%
  • Region C, 25%
  • Region D, 25%
  • Region E, 25%
  • Region F, 25%

So now adding up all the values of all these transactions gets you more than the original value! But if you add up per vocab (and including anything not marked for a region vocab) you get:

  • A + B + C + D = 100%
  • A + B + E + F = 100%

[ Except the adding up gets more complicated as sectors can also have multiple vocabs ]

@Bjwebb
Copy link

Bjwebb commented Dec 17, 2024

Yes, that's right.

@leilafarsani leilafarsani linked a pull request May 6, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant