Skip to content

Instantly share code, notes, and snippets.

@birkin
Last active April 21, 2026 11:50
Show Gist options
  • Select an option

  • Save birkin/a3f1051b29fd6ead69fc40671a19e24c to your computer and use it in GitHub Desktop.

Select an option

Save birkin/a3f1051b29fd6ead69fc40671a19e24c to your computer and use it in GitHub Desktop.
example `collection-activity` tool usage

BDR Collection Activity examples

Example-usage of one of the newer bdr-api-tools...

This tool takes a collection-pid, and shows a monthly count of items-added.


Opening-the-Archives / Brazil

BDR collection: https://repository.library.brown.edu/studio/collections/bdr:318398/

Usage: % uv run https://brown-university-library.github.io/bdr-api-tools/display_collection_activity.py --collection-pid bdr:318399

{
 "_meta_": {
   "timestamp": "2026-04-09T13:09:26.474233-04:00",
   "collection_pid": "bdr:318399",
   "collection_title": "`Opening the Archives: Documenting U.S.-Brazil Relations, 1960s-80s` -- (from parent-collection `History`)",
   "search_url": "https://repository.library.brown.edu/api/search/",
   "date_field_used": "deposit_date",
   "date_fields_used": [
     "deposit_date"
   ],
   "num_found": 52194,
   "items_counted": 52194,
   "items_skipped": 0,
   "http_calls": 106
 },
 "monthly_counts": {
   "2014-03": 3827,
   "2014-07": 5312,
   "2016-02": 317,
   "2016-05": 148,
   "2016-06": 2118,
   "2016-07": 4299,
   "2017-03": 2388,
   "2017-04": 523,
   "2017-06": 40,
   "2018-02": 119,
   "2018-03": 225,
   "2018-04": 17,
   "2018-06": 4465,
   "2018-07": 2125,
   "2018-09": 906,
   "2019-03": 888,
   "2019-04": 1,
   "2019-05": 202,
   "2019-09": 928,
   "2019-11": 810,
   "2019-12": 190,
   "2020-03": 568,
   "2020-04": 949,
   "2020-05": 581,
   "2020-06": 2255,
   "2020-07": 1899,
   "2020-08": 2106,
   "2020-09": 1000,
   "2020-10": 228,
   "2020-11": 137,
   "2020-12": 1022,
   "2021-01": 1746,
   "2021-03": 508,
   "2021-04": 171,
   "2022-06": 1,
   "2022-10": 3,
   "2022-11": 1,
   "2023-01": 400,
   "2023-02": 678,
   "2023-04": 1848,
   "2024-02": 4800,
   "2024-03": 1443,
   "2024-05": 1,
   "2024-08": 1
 }
}
%

Opening-the-Archives / Dominican Republic

BDR Collection: https://repository.library.brown.edu/studio/collections/bdr:3zwe379d/

Usage: % uv run https://brown-university-library.github.io/bdr-api-tools/display_collection_activity.py --collection-pid bdr:3zwe379d

{
 "_meta_": {
   "timestamp": "2026-04-09T14:17:05.871439-04:00",
   "collection_pid": "bdr:3zwe379d",
   "collection_title": "`Opening the Archives Dominican Republic Project` -- (from parent-collection `History`)",
   "search_url": "https://repository.library.brown.edu/api/search/",
   "date_field_used": "deposit_date",
   "date_fields_used": [
     "deposit_date"
   ],
   "num_found": 3180,
   "items_counted": 3180,
   "items_skipped": 0,
   "http_calls": 8
 },
 "monthly_counts": {
   "2019-11": 25,
   "2019-12": 106,
   "2020-03": 175,
   "2020-04": 106,
   "2020-06": 684,
   "2020-07": 473,
   "2020-08": 458,
   "2020-10": 257,
   "2020-11": 459,
   "2021-01": 435,
   "2025-07": 2
 }
}
%

(end of output)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment