Repository navigation
HDXDSYS-3011 Add Activity class for CKAN activity streams - #116
Merged
Merged
Conversation
Wraps package/organization/group/user_activity_list, recently_changed_packages_activity_list, activity_show, activity_data_show and activity_diff. Dataset, Organization, Location and User gain get_activities().
This file contains hidden or 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
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.
Adds read-only support for CKAN activity streams. HDX runs CKAN 2.11.4 with the
activityplugin, where the actions are*_activity_list(there is nopackage_activity_stream).A new
Activity(HDXObject)class holds all activity actions:Activity.read_from_hdx(id)activity_showget_data()activity_data_show(includes snapshot of object)get_diff(diff_type="unified")activity_diff,object_typederived fromactivity_type(eg. "changed package" →package)Activity.get_recently_changed_packages(all_pages, max_activities=1000, **kwargs)recently_changed_packages_activity_listActivity.get_activities(object_type, identifier, all_pages, **kwargs){package,organization,group,user}_activity_listDataset,Organization,LocationandUsergainget_activities(all_pages=False, **kwargs)returning a list ofActivityobjects.offset/limitpass through, HDX max 100 per page).all_pages=Truefetches until a short page.get_recently_changed_packagescapsall_pagesatmax_activities(default 1000,Nonefor no cap) since the stream covers all of HDX's history.HDXError.A new "Activity Streams" section in
documentation/index.mdcovers usage.Testing
tests/hdx/data/test_activity.py).all_pages=Trueon one dataset fetched 347 unique activities. User lists,activity_data_showandactivity_diffreturn "Access denied" anonymously;activity_showreturns HTTP 500 from HDX (403 withinclude_data=false), which looks like an HDX bug.all_pagesreturned 1000 activities in 8.8s. Non-sysadmin permissions and diffs of organization/group activities were not tested live.