Skip to content

About

Zenodo Usage Statistics collector (for a given Zenodo community)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Zenodo Copim Community Usage Statistics Exporter

Export metadata and usage statistics for records in the Copim Community on Zenodo.

The script uses a hybrid approach:

  1. OAI-PMH harvesting to enumerate all records in the Zenodo community.
  2. Zenodo REST API enrichment to retrieve record-level metadata and usage statistics.

This avoids relying solely on Zenodo search pagination while still capturing usage statistics that are not available through OAI-PMH metadata alone.

Note: The script can easily be applied to any Zenodo community by adjusting the community parameter as descibred in Usage > Step 2

Output

The script writes a CSV with the following columns:

Column Description
resource_type Zenodo resource type, such as presentation, dataset, report, or publication
title Record title
url Public Zenodo record URL
doi Zenodo DOI
publication_date Publication date normalized to YYYY-MM-DD
views Zenodo usage-stat views, where available
downloads Zenodo usage-stat downloads, where available

Default output file:

zenodo_deposits_full.csv

Requirements

Python 3.9 or newer is recommended.

Install dependencies:

pip install -r requirements.txt

Usage

Run the default Copim export:

python zenodo_copim_oai_hybrid.py

Specify the community and OAI-PMH set explicitly:

python zenodo_copim_oai_hybrid.py --community copim --set user-copim

Specify an output filename:

python zenodo_copim_oai_hybrid.py --output copim_zenodo_deposits_full.csv

Use a Zenodo token via command-line argument:

python zenodo_copim_oai_hybrid.py --token YOUR_ZENODO_TOKEN

Or set the token as an environment variable.

Windows Command Prompt:

set ZENODO_TOKEN=YOUR_ZENODO_TOKEN
python zenodo_copim_oai_hybrid.py

PowerShell:

$env:ZENODO_TOKEN="YOUR_ZENODO_TOKEN"
python .\zenodo_copim_oai_hybrid.py

macOS/Linux:

export ZENODO_TOKEN=YOUR_ZENODO_TOKEN
python zenodo_copim_oai_hybrid.py

A token is usually not required for public records, but it may help reduce throttling during repeated runs.

Publication date handling

The script normalizes publication dates to YYYY-MM-DD.

Source value Output
2024 2024-01-01
2024-05 2024-05-01
2024-05-17 2024-05-17
2024-05-17T12:34:00Z 2024-05-17

When the REST record includes a more precise publication date, the script prefers the REST value and falls back to the OAI-PMH value only if needed.

Rate limits

The script includes retry logic for HTTP 429, 500, 502, 503, and 504 responses and sleeps between REST enrichment calls.

The default delay is:

2.2 seconds

You can adjust it:

python zenodo_copim_oai_hybrid.py --pause-seconds 5

CLI options

--community          Zenodo community identifier. Default: copim
--set                Explicit OAI-PMH set, e.g. user-copim
--metadata-prefix    OAI metadata prefix. Default: oai_datacite
--output             Output CSV path. Default: zenodo_deposits_full.csv
--token              Optional Zenodo access token
--pause-seconds      Delay between REST API requests. Default: 2.2

Repository structure

.
├── README.md
├── requirements.txt
├── zenodo_copim_oai_hybrid.py
├── .gitignore
└── LICENSE

Notes

OAI-PMH is used for robust community enumeration because it is designed for metadata harvesting. Zenodo usage statistics are retrieved through the REST API because they are not part of the OAI-PMH metadata formats.

License

Apache 2.0 License.

About

Zenodo Usage Statistics collector (for a given Zenodo community)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages