You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 :)
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.
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()
},
};
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.
The text was updated successfully, but these errors were encountered: