Skip to content
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

2. Filter for activities relevant to Bangladesh #3

Closed
tvldev02 opened this issue Feb 25, 2016 · 2 comments
Closed

2. Filter for activities relevant to Bangladesh #3

tvldev02 opened this issue Feb 25, 2016 · 2 comments

Comments

@tvldev02
Copy link
Member

untitled

In real data, we see that heirarchy1 activities have no Aid Type and related activities at hierarchy2 have different aid types. In this situation which aid type should we display?

@markbrough
Copy link
Member

OK you are right this can be a little more complicated to calculate. We are likely to find similar issues in other fields that can be reported at different / multiple levels, so this will be a useful general script to be able to use later. In the case of aid type, you are right that it can be reported on each of the activities but also on each transaction.

So the way I would do this is (stop whenever you get an answer):

  1. Begin with the hierarchy selected in the previous step (e.g. hierarchy 1 for DFID). If there is a default-aid-type/@code, take that.

  2. If there are transactions in that activity, sum up the value of all commitment transactions for each aid type. In the data this will look like this (in the example I exclude some elements in transactions like dates to make it easier to read):

    <transaction>
       <transaction-type code="C">Commitment</transaction-type>
       <aid-type code="C01">Project-type interventions</aid-type>
       <value>500</value>
    </transaction>
    <transaction>
       <transaction-type code="C">Commitment</transaction-type>
       <aid-type code="D01">Donor country personnel</aid-type>
       <value>50</value>
    </transaction>
    <transaction>
       <transaction-type code="C">Commitment</transaction-type>
       <aid-type code="D01">Donor country personnel</aid-type>
       <value>100</value>
    </transaction>
    Aid type Total value of commitments
    C01 500
    D01 150

    in this case, the aid type should be C01(Project-type interventions).

  3. Look at all of the child activities - get the default-aid-type/@code and total value of commitments for each activity - in xpath this would be something like:

    sum(transaction[transaction-type/@code="C"]/value/text())
    

    Then you get:

    Activity Aid type Total value of commitments
    GB-1-107368-101 C01 500
    GB-1-107368-102 D01 150
  4. If the hierarchy-2 activities don't contain a default-aid-type but only report the aid type on transactions, we may want to repeat step 2 for each of the children, but we can probably leave this out for now.

@markbrough
Copy link
Member

NB: in time -- not necessary right now -- a similar process could also apply to getting the most relevant implementing organisation for each activity (e.g. for "3. Filter DP activities" in the mockup), when these are stated as transaction/receiver-org. In DFID data there is often better data in transaction/receiver-org than in the activity's participating-org/@role="Implementing". I ran some tests on DFID data in this script:
https://github.com/BD-IATI/donor-data/blob/master/dfid/dfid.ipynb

I looked at disbursements rather than commitments, as the disbursements provided a better breakdown of value by different organisations.

In this case, we would also take the dominant organisation by value - e.g. in the case of project GB-1-107402, the implementing organisation name OTHER. provides us with very little information. Harewelle International Limited. -- the dominant receiver-org by value -- would be a more helpful name of the implementing organisation (see the above link to the dfid.ipynb script for the data). Perhaps we would combine the implementing organisation and the receiver-org into "OTHER: Harewelle International Limited."

But we can come back to this in later sprints - no need to do this right now, just writing it here for reference.

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

No branches or pull requests

2 participants