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

Sector title not included in the activity #1

Open
shenghuang opened this issue Jul 26, 2012 · 2 comments
Open

Sector title not included in the activity #1

shenghuang opened this issue Jul 26, 2012 · 2 comments

Comments

@shenghuang
Copy link

According to the IATI XML schema, sector text description is optional. However, the frontend AidView application requires this to display sector titles in sector breakdown piechart.

For example, for the following sector in an activity:

In the piechart the sector will be displayed as "unknown".

Would it be a good idea to lookup the sector description if it is missing then append to the activity? A code snippet like the following will help:
In iati-wo.xqm, add the following function:
declare function iati-wo:set-sector-text($activity as element(iati-activity)) as element(iati-activity) {
element iati-activity {
$activity/@,
for $sector in $activity/sector
let $sectortext := iati-c:code-value("Sector",$sector/@code)
return
element sector {
$sector/@
,
$sectortext/name/string()
},

  $activity/(* except sector)
}

};

Then for the activity detail search ($query/result eq "details" and empty($query/groupby))
for $activity in $selected-items
let $activity := iati-wo:set-sector-text($activity)
return
element iati-activity {
....

Basically we just need to add one more processing step "let $activity := iati-wo:set-sector-text($activity)". Is this something that we want to merge back to the code repository? Since I just began to use the backend AidView API, I just followed Chris's code to make the function above. Thus my code might not be the optimal one. Please advise. Thanks.

@aidinfolabs
Copy link
Owner

This makes a lot of sense to me. I'm not sure how we best merge in changes to the code before Chris is back - as he wasn't working in GitHub AFAIK, but if you wanted to fork the code for now and edit away that would be great :)

@KitWallace
Copy link

There is a more general problem here. Activities are returned in the AidView API without modification except for the addition of derived data, for example the project value and its distribution to countries, sectors etc. It would be possible to augment the activity with the reference names for codes but in which language should it be expanded, and if we augment with one code (sector) then we should augment with every code. We have to-and-froed on this across the API and its been my assumption that a client would do any substitution client side, but this ambiguity over the text /code in the IATI standard gives rise to the natural assumption that the text is both present and validated, neither of which is the case.

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

3 participants