Skip to content

Development Provider Zenodo

Alex Valcourt Caron edited this page Oct 20, 2026 · 2 revisions

Provider: Zenodo

← Providers

Records from Zenodo, downloaded with zenodo_get.

sequenceDiagram
  actor User
  participant CLI as npdb convert bagel zenodo
  participant Zenodo
  participant Fetch as Output staging folder
  participant Prep as Shared preparation
  participant Pipeline as Conversion pipeline
  User->>CLI: record ID / DOI + optional token
  CLI->>Zenodo: Resolve record and request files
  Zenodo-->>Fetch: Record files and archives
  CLI->>Prep: Extract archives and prepare BIDS root
  CLI->>Pipeline: Validate, annotate, export
  Pipeline-->>User: JSON-LD output
Loading

Install

uv sync --active --extra zenodo

Access

  • Public records: nothing to do.

  • Restricted or embargoed records: a Zenodo access token, passed with --token or exported:

    export NP_ZENODO_TOKEN=<token>

    npdb passes it to zenodo_get as access_token (the ZENODO_ACCESS_TOKEN variable is not read by zenodo_get).

Download

npdb convert bagel zenodo <record_id_or_doi> <output> [--cache-dir <cache>] [conversion options]

npdb convert bagel zenodo <record_id> ./out
npdb convert bagel zenodo 10.5281/zenodo.<record_id> ./out --token "$NP_ZENODO_TOKEN"

Details

  • The record's file list and MD5 checksums are read first; absolute paths, .. and backslashes in file keys are rejected before anything is downloaded.
  • Files are downloaded into the cache at <cache-dir>/zenodo/<record>/. Cache location precedence is --cache-dir, then NP_NPDB_CACHE_DIR, then $XDG_CACHE_HOME/npdb/downloads (or ~/.cache/npdb/downloads). Files whose MD5 already matches are not downloaded again; corrupt or partial files are replaced.
  • Only the record's files are copied, after an MD5 check, into <output>/zenodo_<record>, keeping nested keys (GitHub releases use <repo>/<release>.zip). Archives are then extracted and the wrapped BIDS root, for example spine-generic/spine-generic-data-multi-subject-<commit>/, is selected before conversion.
  • Leave room for the cached archive in the cache, and for the staged archive plus its extracted content on the output disk. The cache and the staging folder must not overlap.

Clone this wiki locally