Project:ZenodoDocumentation

From MaRDI portal

Overview

The Zenodo importer retrieves metadata for Zenodo items in json format using the API, parses them, and upload them to the MaRDI portal.

The general steps executed by the importer are as follows:

  1. The Zenodo API is used to retrieve the Zenodo IDs of the items to be imported in the pull() function.
  2. Each Zenodo ID is used to retrieve a json file with the relevant metadata to create a Zenodo item that is uploaded to the MaRDI graph (code).
  3. The metadata is parsed and processed appropriately.
  4. Claims are added as properties of the Zenodo item in the create() function.
  5. The item is created and uploaded to the MarRDI portal if it doesn't already exists, and updated if it does.

Details on how to set up the repository and run the importer can be found here.

Execution

Execute the import.py script in the scripts folder:

python3 import.py --mode zenodo

The importer can be run with one or more of the following optional arguments:

  • communities: List[str]: a list of Zenodo community IDs.
  • resourceTypes: List[str]: a list of Zenodo resource types (check here for valid values).
  • orcid_id_file: str: path to a comma separated csv file containing information about the authors. The file must contain a column ‘orcid’.
  • customQ: str: see here how to build a custom query.

The arguments can currently directly be modified from the import.py script as parameters to the function ZenodoSource(). While the arguments are all optional, it is (very) recommended that they are used, otherwise the importer will attempt to import the entire Zenodo database.

Note: this might later be changed so that the parameters are passed in a config file instead. Instructions will be updated then

Updating code

The importer source code can be found and modified in the GitHub repository here.

to modify a zenodo resource (eg. add/modify properties), modify the code in

/mardi_importer/mardi_importer/publications/ZenodoResource.py

to change how queries to the zenodo API are run, modify the code in

/mardi_importer/mardi_importer/zenodo/ZenodoSource.py