Skip to content

HDXDSYS-3011 Add Activity class for CKAN activity streams - #116

Merged
mcarans merged 1 commit into
mainfrom
activity_streams
Oct 14, 2026
Merged

mcarans merged 1 commit into
mainfrom
activity_streams

Conversation

@mcarans

@mcarans mcarans commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Adds read-only support for CKAN activity streams. HDX runs CKAN 2.11.4 with the activity plugin, where the actions are *_activity_list (there is no package_activity_stream).

A new Activity(HDXObject) class holds all activity actions:

Method Wraps
Activity.read_from_hdx(id) activity_show
get_data() activity_data_show (includes snapshot of object)
get_diff(diff_type="unified") activity_diff, object_type derived from activity_type (eg. "changed package" → package)
Activity.get_recently_changed_packages(all_pages, max_activities=1000, **kwargs) recently_changed_packages_activity_list
Activity.get_activities(object_type, identifier, all_pages, **kwargs) {package,organization,group,user}_activity_list

Dataset, Organization, Location and User gain get_activities(all_pages=False, **kwargs) returning a list of Activity objects.

  • Paging: one page by default (offset/limit pass through, HDX max 100 per page). all_pages=True fetches until a short page.
  • get_recently_changed_packages caps all_pages at max_activities (default 1000, None for no cap) since the stream covers all of HDX's history.
  • Create/update/delete/check_required_fields raise HDXError.

A new "Activity Streams" section in documentation/index.md covers usage.

Testing

  • Unit tests with mocked CKAN for all methods, including paging and the cap (tests/hdx/data/test_activity.py).
  • Prod, no key: dataset, organization, location and recently changed lists worked; all_pages=True on one dataset fetched 347 unique activities. User lists, activity_data_show and activity_diff return "Access denied" anonymously; activity_show returns HTTP 500 from HDX (403 with include_data=false), which looks like an HDX bug.
  • Stage, sysadmin key: all methods worked, including all three diff types and user activity lists. Capped all_pages returned 1000 activities in 8.8s. Non-sysadmin permissions and diffs of organization/group activities were not tested live.

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().
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Test Results

180 tests  +11   180 ✅ +11   1m 27s ⏱️ -1s
  1 suites ± 0     0 💤 ± 0 
  1 files   ± 0     0 ❌ ± 0 

Results for commit 6953d9b. ± Comparison against base commit 90f8935.

♻️ This comment has been updated with latest results.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 97.255% (+0.07%) from 97.187% — activity_streams into main

@mcarans
mcarans merged commit 6832186 into main Oct 14, 2026
5 of 6 checks passed
@mcarans mcarans changed the title Add Activity class for CKAN activity streams HDXDSYS-3011 Add Activity class for CKAN activity streams Oct 14, 2026
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

Successfully merging this pull request may close these issues.

2 participants