-
Notifications
You must be signed in to change notification settings - Fork 0
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
implemented decode->flatten->filter->unflatten->encode enhancement #8
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
greebie
reviewed
Jul 7, 2021
greebie
reviewed
Jul 7, 2021
greebie
reviewed
Jul 7, 2021
Returns a list of keys whose values should be strigified json objects | ||
""" | ||
return [ | ||
"metadata-point-of-contact", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually it would be good to move these to constants.
greebie
approved these changes
Jul 7, 2021
…ion from public view of datasets
greebie
reviewed
Jul 12, 2021
# UNFLATTEN filtered dictionary | ||
unflattened = unflatten(flattened, splitter='path') | ||
|
||
# STRIGIFY required json fields |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
STRINGIFY
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
During filtering the pkg_dict data structure now goes through the following process:
This process allows finer grained filtering of metadata values. Before this update, the plugin was capable of filtering 66 values, with this enhancement, it can filter 89. The new roster of filterable metadata fields is as follows, and can also be found in the vitality_docs repo.
Care must still be taken when filtering some of the new fields to ensure that the cioos-theme is able to gracefully handle their absence.
Additionally, certain stringified lists of json objects still contain 'unfilterable' fields as mentioned in issue 7.
The ckan library flatten and unflatten functions:
ckan.lib.navl.dictization_functions.flatten_dict(data_dict)
andckan.lib.navl.dictization_functions.unflatten(translated_flattened)
reduce keys into tuples which don't really lend themselves as nicely for our filtering needs as thepath
reducer from theflatten_dict
python package that has been used here.It is interesting to note however that the ckan flatten and unflatten functions do appear to do a better job of handling list values, where as the
flatten_dict
plugin has issues unflattening such values. If we're ever required to dive into fixing issue 7, perhaps we can use the ckan flatten function to handle the list values after applying theflatten_dict
flatten function first.An issue exists on the
flatten_dict
github repo regarding unflattening list values, see issue-8.