Prefer default vocabulary (if a default exists) #568
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The problem
Some attributes can contain values from different codelists, depending on the
@vocabulary
used. The dashboard doesn’t have a means of showing this, as per the yellow banner shown on dashboard codelists, and #174.Given the dashboard doesn’t have the functionality to select from multiple vocabularies, it needs to choose which vocabulary to use. Where a default vocabulary exists, it seems to make sense to prefer that one. That doesn’t necessarily happen at the moment, so this PR fixes that.
So for example, in the case of
iati-activity/sector/@code
, the default vocabulary isSector
. However, the dashboard currently uses the SectorCategory vocabulary:Similarly (as reported in #567),
iati-activity/default-aid-type/@code
uses the AidType vocabulary by default. However, the dashboard currently uses the (rarely used) CashAndVoucherModalities vocabulary:The proposed solution
This PR ensures that when a default vocabulary exists for a given attribute, it is preferred on dashboard codelist pages.
For
iati-activity/sector/@code
, that’s Sector:For
iati-activity/default-aid-type/@code
, that’s AidType:It’s worth noting that for a small number of IATI attributes, there is no default codelist. For example,
iati-activity/tag/@code
. In such cases, we use the codelist for the first mapping for that attribute found in the mapping file.Fixes #567.