Project:ZenodoDocumentation: Difference between revisions

From MaRDI portal
Rim (talk | contribs)
mNo edit summary
Rim (talk | contribs)
No edit summary
Line 8: Line 8:
The importer can be run with one or more of the following optional arguments:
The importer can be run with one or more of the following optional arguments:


* communities: List[str] : a list of zenodo community IDs
* communities: List[str] : a list of Zenodo community IDs.
* resourceTypes: List[str]: a list of zenodo resource types (check here <nowiki>https://help.zenodo.org/guides/search/</nowiki> for valid values)
* resourceTypes: List[str]: a list of Zenodo resource types (check [https://help.zenodo.org/guides/search/ here] for valid values).
* orcid_id_file: str: path to a file contianing information about the authors. must contain a column ‘orcid’
* orcid_id_file: str: path to a file containing information about the authors. must contain a column ‘orcid’.
* customQ: str: see here <nowiki>https://help.zenodo.org/guides/search/</nowiki> how to build a custom query
* customQ: str: see [https://help.zenodo.org/guides/search/ 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()
The arguments can currently directly be modified from the import.py script as parameters to the function ZenodoSource()


!!!! note: is it better to have these as a config file passed as a parameter to the importer script or is it fine to add the params inside the import script
(note: this might later bee changed so that the parameters are passed in a config file instead)


= Updating code =
= Updating code =
The importer source code can be found and modified in the GitHub repository [https://github.com/MaRDI4NFDI/docker-importer here].
The importer source code can be found and modified in the GitHub repository [https://github.com/MaRDI4NFDI/docker-importer here].


to modify a zenodo resource (eg. add/modify properties): modify the code in
to modify a zenodo resource (eg. add/modify properties), modify the code in
  <code>/mardi_importer/mardi_importer/publications/ZenodoResource.py</code>
  <code>/mardi_importer/mardi_importer/publications/ZenodoResource.py</code>
to change how queries to the zenodo API are run, modify the code in<syntaxhighlight lang="bash">
to change how queries to the zenodo API are run, modify the code in<syntaxhighlight lang="bash">
/mardi_importer/mardi_importer/zenodo/ZenodoSource.py
/mardi_importer/mardi_importer/zenodo/ZenodoSource.py
</syntaxhighlight>
</syntaxhighlight>
*
* add links for these:
* How to test your changes locally
* How to run on the staging server
* How to run on the portal

Revision as of 12:50, 12 March 2025

Overview

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

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 file containing information about the authors. 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()

(note: this might later bee changed so that the parameters are passed in a config file instead)

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
  • add links for these:
  • How to test your changes locally
  • How to run on the staging server
  • How to run on the portal