Skip to content
Snippets Groups Projects
Commit 97afb945 authored by Enrique Garcia's avatar Enrique Garcia
Browse files

Upload records to the OSSR on notebook and improve __repr__ on Records class

parent 23f20804
No related branches found
No related tags found
1 merge request!45Upload records to the OSSR on notebook and improve __repr__ on Records class
...@@ -415,7 +415,6 @@ class ZenodoAPI: ...@@ -415,7 +415,6 @@ class ZenodoAPI:
"\t https://escape2020.pages.in2p3.fr/wp3/ossr-pages/page/contribute/publish_tutorial/#3-add-the-following-code-snippet \n" "\t https://escape2020.pages.in2p3.fr/wp3/ossr-pages/page/contribute/publish_tutorial/#3-add-the-following-code-snippet \n"
"In case you do, please contact us !\n") "In case you do, please contact us !\n")
def get_user_records(self): def get_user_records(self):
request = self.fetch_user_entries() request = self.fetch_user_entries()
return [Record[hit] for hit in request.json()] return [Record[hit] for hit in request.json()]
...@@ -433,7 +432,7 @@ class Record: ...@@ -433,7 +432,7 @@ class Record:
return f"Record #{self.id} : {self.title}" return f"Record #{self.id} : {self.title}"
def __repr__(self): def __repr__(self):
return f"Record({self.data})" return json.dumps(self.data, indent=4, sort_keys=True)
@property @property
def id(self): def id(self):
...@@ -479,7 +478,6 @@ class Record: ...@@ -479,7 +478,6 @@ class Record:
return binder_zenodo_url + doi return binder_zenodo_url + doi
def get_zenodo_records(search='', sandbox=False, **kwargs): def get_zenodo_records(search='', sandbox=False, **kwargs):
""" """
Search Zenodo for records whose names or descriptions include the provided string `search`. Search Zenodo for records whose names or descriptions include the provided string `search`.
...@@ -534,6 +532,3 @@ def get_record(record_id, sandbox=False): ...@@ -534,6 +532,3 @@ def get_record(record_id, sandbox=False):
raise ValueError(f"Error {json['status']} : {json['message']}") raise ValueError(f"Error {json['status']} : {json['message']}")
else: else:
return Record(json) return Record(json)
%% Cell type:markdown id:83cfb991 tags: %% Cell type:markdown id:83cfb991 tags:
# Example of protocols to harvest metadata from Zenodo # Example of protocols to harvest metadata from Zenodo
%% Cell type:markdown id:b0fcf1bf tags: %% Cell type:markdown id:b0fcf1bf tags:
--------------------- ---------------------
#### Notebook outline #### Notebook outline
- Zenodo OAI-PMH protocol - Zenodo OAI-PMH protocol
- Zenodo REST API - Zenodo REST API
- Explore the REST API answer (payload) with the `request` library - Explore the REST API answer (payload) with the `request` library
- Using `eossr` library - Using `eossr` library
- Pros and cons of both methods - Pros and cons of both methods
--------------------- ---------------------
%% Cell type:markdown id:2529eacc tags: %% Cell type:markdown id:2529eacc tags:
## Pros and cons of each method ## Pros and cons of each method
- Using AOI-PMH for harvesting; - Using AOI-PMH for harvesting;
+ $+$ More efficient harvest: + $+$ More efficient harvest:
- faster, - faster,
- thought for large and continues queries of a repository. - thought for large and continues queries of a repository.
+ $-$ Metadata representation of files is provided by the data provider. + $-$ Metadata representation of files is provided by the data provider.
- Using the REST API; - Using the REST API;
+ $+$ Access to the full entry/record/community information. + $+$ Access to the full entry/record/community information.
+ $-$ Harvest not optimised for large searches. + $-$ Harvest not optimised for large searches.
%% Cell type:markdown id:2193adc5 tags: %% Cell type:markdown id:2193adc5 tags:
## OAI-PMH protocol ## OAI-PMH protocol
%% Cell type:markdown id:9bb7e516 tags: %% Cell type:markdown id:9bb7e516 tags:
#### - First have a lookg to a nice [tutorial to the protocol](https://indico.cern.ch/event/5710/sessions/108048/attachments/988151/1405129/Simeon_tutorial.pdf). #### - First have a lookg to a nice [tutorial to the protocol](https://indico.cern.ch/event/5710/sessions/108048/attachments/988151/1405129/Simeon_tutorial.pdf).
%% Cell type:markdown id:1bcf7733 tags: %% Cell type:markdown id:1bcf7733 tags:
The [OAI-PMH protocol](https://www.openarchives.org/pmh/) uses a base URL + special syntax ('verbs') to query and find metadata representation(s) of a data provider. The [OAI-PMH protocol](https://www.openarchives.org/pmh/) uses a base URL + special syntax ('verbs') to query and find metadata representation(s) of a data provider.
In the case of zenodo the base URL is: https://zenodo.org/oai2d. In the case of zenodo the base URL is: https://zenodo.org/oai2d.
For example; For example;
- to retrieve all the entries (`verb=ListRecords`) - to retrieve all the entries (`verb=ListRecords`)
- belonging to escape2020 community (`set=user-escape2020`) - belonging to escape2020 community (`set=user-escape2020`)
- in the OAI DataCite metadata representation (`metadataPrefix=oai_datacite`) - in the OAI DataCite metadata representation (`metadataPrefix=oai_datacite`)
https://zenodo.org/oai2d?verb=ListRecords&set=user-escape2020&metadataPrefix=oai_datacite https://zenodo.org/oai2d?verb=ListRecords&set=user-escape2020&metadataPrefix=oai_datacite
Ex2: Ex2:
- To obtain a single entry (`verb=GetRecord`) - To obtain a single entry (`verb=GetRecord`)
- of a certain zenodo record - identified by the entry_id (`identifier=oai:zenodo.org:4105896`) - of a certain zenodo record - identified by the entry_id (`identifier=oai:zenodo.org:4105896`)
- in the Dublin Core metadata representation (`metadataPrefix=oai_dc`) - in the Dublin Core metadata representation (`metadataPrefix=oai_dc`)
https://zenodo.org/oai2d?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai:zenodo.org:4105896 https://zenodo.org/oai2d?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai:zenodo.org:4105896
%% Cell type:markdown id:26eba497 tags: %% Cell type:markdown id:26eba497 tags:
### Example with the OAI-PMH protocol: A python OAI-Harvester ### Example with the OAI-PMH protocol: A python OAI-Harvester
%% Cell type:markdown id:145835bd tags: %% Cell type:markdown id:145835bd tags:
``` ```
pip install oaiharvest pip install oaiharvest
oai-harvest -h oai-harvest -h
# Examples of usage # Examples of usage
oai-harvest https://zenodo.org/oai2d -s "user-escape2020" -d oai_dc oai-harvest https://zenodo.org/oai2d -s "user-escape2020" -d oai_dc
oai-harvest https://zenodo.org/oai2d -s "user-escape2020" -d oai_datacite4 oai-harvest https://zenodo.org/oai2d -s "user-escape2020" -d oai_datacite4
oai-harvest https://zenodo.org/oai2d -s "user-escape2020" -d datacite3 oai-harvest https://zenodo.org/oai2d -s "user-escape2020" -d datacite3
# Example of output # Example of output
$ oai-harvest https://zenodo.org/oai2d -s "user-escape2020" -d datacite3 $ oai-harvest https://zenodo.org/oai2d -s "user-escape2020" -d datacite3
$ cd datacite3 $ cd datacite3
$ ls $ ls
oai:zenodo.org:1689986.oai_dc.xml oai:zenodo.org:3884963.oai_dc.xml oai:zenodo.org:1689986.oai_dc.xml oai:zenodo.org:3884963.oai_dc.xml
oai:zenodo.org:2533132.oai_dc.xml oai:zenodo.org:3967386.oai_dc.xml oai:zenodo.org:2533132.oai_dc.xml oai:zenodo.org:3967386.oai_dc.xml
oai:zenodo.org:2542652.oai_dc.xml oai:zenodo.org:4012169.oai_dc.xml oai:zenodo.org:2542652.oai_dc.xml oai:zenodo.org:4012169.oai_dc.xml
oai:zenodo.org:2542664.oai_dc.xml oai:zenodo.org:4028908.oai_dc.xml oai:zenodo.org:2542664.oai_dc.xml oai:zenodo.org:4028908.oai_dc.xml
oai:zenodo.org:3356656.oai_dc.xml oai:zenodo.org:4044010.oai_dc.xml oai:zenodo.org:3356656.oai_dc.xml oai:zenodo.org:4044010.oai_dc.xml
oai:zenodo.org:3362435.oai_dc.xml oai:zenodo.org:4055176.oai_dc.xml oai:zenodo.org:3362435.oai_dc.xml oai:zenodo.org:4055176.oai_dc.xml
oai:zenodo.org:3572655.oai_dc.xml oai:zenodo.org:4105896.oai_dc.xml oai:zenodo.org:3572655.oai_dc.xml oai:zenodo.org:4105896.oai_dc.xml
oai:zenodo.org:3614662.oai_dc.xml oai:zenodo.org:4311271.oai_dc.xml oai:zenodo.org:3614662.oai_dc.xml oai:zenodo.org:4311271.oai_dc.xml
oai:zenodo.org:3659184.oai_dc.xml oai:zenodo.org:4419866.oai_dc.xml oai:zenodo.org:3659184.oai_dc.xml oai:zenodo.org:4419866.oai_dc.xml
oai:zenodo.org:3675081.oai_dc.xml oai:zenodo.org:4601451.oai_dc.xml oai:zenodo.org:3675081.oai_dc.xml oai:zenodo.org:4601451.oai_dc.xml
oai:zenodo.org:3734091.oai_dc.xml oai:zenodo.org:4687123.oai_dc.xml oai:zenodo.org:3734091.oai_dc.xml oai:zenodo.org:4687123.oai_dc.xml
oai:zenodo.org:3743489.oai_dc.xml oai:zenodo.org:4786641.oai_dc.xml oai:zenodo.org:3743489.oai_dc.xml oai:zenodo.org:4786641.oai_dc.xml
oai:zenodo.org:3743490.oai_dc.xml oai:zenodo.org:4790629.oai_dc.xml oai:zenodo.org:3743490.oai_dc.xml oai:zenodo.org:4790629.oai_dc.xml
oai:zenodo.org:3854976.oai_dc.xml oai:zenodo.org:3854976.oai_dc.xml
$ cat <FILE> $ cat <FILE>
``` ```
%% Cell type:markdown id:f9ad3584 tags: %% Cell type:markdown id:f9ad3584 tags:
No token is needed to fetch metadata files provided by Zenodo (the provider). No token is needed to fetch metadata files provided by Zenodo (the provider).
However please note that the **metadata schema representation of the records is chosen by the provider !** However please note that the **metadata schema representation of the records is chosen by the provider !**
Zenodo supports the following schema representations: Zenodo supports the following schema representations:
- `DataCite` (various version), - `DataCite` (various version),
- `Dublin Core`, - `Dublin Core`,
- `MARC21`, - `MARC21`,
- However it **does not provide** metadata under the `codemeta.json` schema. - However it **does not provide** metadata under the `codemeta.json` schema.
%% Cell type:markdown id:c6a47567 tags: %% Cell type:markdown id:c6a47567 tags:
## Zenodo's REST API ## Zenodo's REST API
%% Cell type:code id:26424a79 tags: %% Cell type:code id:26424a79 tags:
``` python ``` python
# pip install request # pip install request
``` ```
%% Cell type:code id:e7a84906 tags: %% Cell type:code id:e7a84906 tags:
``` python ``` python
import requests import requests
``` ```
%% Cell type:markdown id:87f186f9 tags: %% Cell type:markdown id:87f186f9 tags:
We would need to specify some arguments to reduce the search We would need to specify some arguments to reduce the search
%% Cell type:code id:5ee3a192 tags: %% Cell type:code id:5ee3a192 tags:
``` python ``` python
parameters = {'communities': 'escape2020', parameters = {'communities': 'escape2020',
'size':100} 'size':100}
``` ```
%% Cell type:markdown id:e268aef2 tags: %% Cell type:markdown id:e268aef2 tags:
**NOTE** No token is needed to fetch/communicate with the REST API. **NOTE** No token is needed to fetch/communicate with the REST API.
However, you would need to [create one](https://zenodo.org/account/settings/applications/) if you would like to write or publish through the API. However, you would need to [create one](https://zenodo.org/account/settings/applications/) if you would like to write or publish through the API.
%% Cell type:markdown id:4cd8011b tags: %% Cell type:markdown id:4cd8011b tags:
### Example with the `requests` lib ### Example with the `requests` lib
How to recover all ESCAPE2020 community records ? How to recover all ESCAPE2020 community records ?
%% Cell type:code id:fde5ee19 tags: %% Cell type:code id:fde5ee19 tags:
``` python ``` python
escape2020 = requests.get('https://zenodo.org/api/records', params=parameters).json() escape2020 = requests.get('https://zenodo.org/api/records', params=parameters).json()
escape2020.keys() escape2020.keys()
``` ```
%% Output %% Output
dict_keys(['aggregations', 'hits', 'links']) dict_keys(['aggregations', 'hits', 'links'])
%% Cell type:markdown id:9e564b25 tags: %% Cell type:markdown id:9e564b25 tags:
Let's explore the REST API payload to find the desired information. Let's explore the REST API payload to find the desired information.
%% Cell type:code id:2506740f tags: %% Cell type:code id:2506740f tags:
``` python ``` python
# Nice summary of the request we just made # Nice summary of the request we just made
escape2020['aggregations'] escape2020['aggregations']
``` ```
%% Output %% Output
{'access_right': {'buckets': [{'doc_count': 15, 'key': 'open'}], {'access_right': {'buckets': [{'doc_count': 15, 'key': 'open'}],
'doc_count_error_upper_bound': 0, 'doc_count_error_upper_bound': 0,
'sum_other_doc_count': 0}, 'sum_other_doc_count': 0},
'file_type': {'buckets': [{'doc_count': 7, 'key': 'zip'}, 'file_type': {'buckets': [{'doc_count': 7, 'key': 'zip'},
{'doc_count': 4, 'key': 'pdf'}, {'doc_count': 4, 'key': 'pdf'},
{'doc_count': 3, 'key': 'gz'}, {'doc_count': 3, 'key': 'gz'},
{'doc_count': 2, 'key': 'json'}, {'doc_count': 2, 'key': 'json'},
{'doc_count': 1, 'key': ''}, {'doc_count': 1, 'key': ''},
{'doc_count': 1, 'key': 'md'}, {'doc_count': 1, 'key': 'md'},
{'doc_count': 1, 'key': 'simg'}, {'doc_count': 1, 'key': 'simg'},
{'doc_count': 1, 'key': 'tar'}], {'doc_count': 1, 'key': 'tar'}],
'doc_count_error_upper_bound': 0, 'doc_count_error_upper_bound': 0,
'sum_other_doc_count': 0}, 'sum_other_doc_count': 0},
'keywords': {'buckets': [{'doc_count': 3, 'key': 'ESCAPE'}, 'keywords': {'buckets': [{'doc_count': 3, 'key': 'ESCAPE'},
{'doc_count': 2, 'key': 'CTA'}, {'doc_count': 2, 'key': 'CTA'},
{'doc_count': 2, 'key': 'python'}, {'doc_count': 2, 'key': 'python'},
{'doc_count': 1, 'key': 'AGN'}, {'doc_count': 1, 'key': 'AGN'},
{'doc_count': 1, 'key': 'EOSC'}, {'doc_count': 1, 'key': 'EOSC'},
{'doc_count': 1, {'doc_count': 1,
'key': 'European Open Science Cloud, ESFRI, e-Infrastructures'}, 'key': 'European Open Science Cloud, ESFRI, e-Infrastructures'},
{'doc_count': 1, 'key': 'Horizon Europe'}, {'doc_count': 1, 'key': 'Horizon Europe'},
{'doc_count': 1, 'key': 'Interoperability'}, {'doc_count': 1, 'key': 'Interoperability'},
{'doc_count': 1, 'key': 'MWL'}, {'doc_count': 1, 'key': 'MWL'},
{'doc_count': 1, {'doc_count': 1,
'key': 'Machine Learning, Big Data, Aapche Kafka, Gravitational Wave'}], 'key': 'Machine Learning, Big Data, Aapche Kafka, Gravitational Wave'}],
'doc_count_error_upper_bound': 0, 'doc_count_error_upper_bound': 0,
'sum_other_doc_count': 17}, 'sum_other_doc_count': 17},
'type': {'buckets': [{'doc_count': 10, 'type': {'buckets': [{'doc_count': 10,
'key': 'software', 'key': 'software',
'subtype': {'buckets': [], 'subtype': {'buckets': [],
'doc_count_error_upper_bound': 0, 'doc_count_error_upper_bound': 0,
'sum_other_doc_count': 0}}, 'sum_other_doc_count': 0}},
{'doc_count': 3, {'doc_count': 3,
'key': 'publication', 'key': 'publication',
'subtype': {'buckets': [{'doc_count': 1, 'key': 'other'}, 'subtype': {'buckets': [{'doc_count': 1, 'key': 'other'},
{'doc_count': 1, 'key': 'report'}, {'doc_count': 1, 'key': 'report'},
{'doc_count': 1, 'key': 'workingpaper'}], {'doc_count': 1, 'key': 'workingpaper'}],
'doc_count_error_upper_bound': 0, 'doc_count_error_upper_bound': 0,
'sum_other_doc_count': 0}}, 'sum_other_doc_count': 0}},
{'doc_count': 1, {'doc_count': 1,
'key': 'lesson', 'key': 'lesson',
'subtype': {'buckets': [], 'subtype': {'buckets': [],
'doc_count_error_upper_bound': 0, 'doc_count_error_upper_bound': 0,
'sum_other_doc_count': 0}}, 'sum_other_doc_count': 0}},
{'doc_count': 1, {'doc_count': 1,
'key': 'poster', 'key': 'poster',
'subtype': {'buckets': [], 'subtype': {'buckets': [],
'doc_count_error_upper_bound': 0, 'doc_count_error_upper_bound': 0,
'sum_other_doc_count': 0}}], 'sum_other_doc_count': 0}}],
'doc_count_error_upper_bound': 0, 'doc_count_error_upper_bound': 0,
'sum_other_doc_count': 0}} 'sum_other_doc_count': 0}}
%% Cell type:code id:dd36b4be tags: %% Cell type:code id:dd36b4be tags:
``` python ``` python
# Total number of entries in the payload # Total number of entries in the payload
print(escape2020['hits'].keys()) print(escape2020['hits'].keys())
print(escape2020['hits']['total']) print(escape2020['hits']['total'])
``` ```
%% Output %% Output
dict_keys(['hits', 'total']) dict_keys(['hits', 'total'])
15 15
%% Cell type:code id:0550cffb tags: %% Cell type:code id:0550cffb tags:
``` python ``` python
all_entries = escape2020['hits']['hits'] all_entries = escape2020['hits']['hits']
``` ```
%% Cell type:code id:94a4e8c9 tags: %% Cell type:code id:94a4e8c9 tags:
``` python ``` python
# The content of the first entry of the payload - It contain all the info that we can also find in Zenodo # The content of the first entry of the payload - It contain all the info that we can also find in Zenodo
all_entries[0] all_entries[0]
``` ```
%% Output %% Output
{'conceptdoi': '10.5281/zenodo.5176088', {'conceptdoi': '10.5281/zenodo.5176088',
'conceptrecid': '5176088', 'conceptrecid': '5176088',
'created': '2021-08-16T07:21:15.005975+00:00', 'created': '2021-08-16T07:21:15.005975+00:00',
'doi': '10.5281/zenodo.5176089', 'doi': '10.5281/zenodo.5176089',
'files': [{'bucket': '409f3f8e-cb73-4a10-b718-3b8fc238a616', 'files': [{'bucket': '409f3f8e-cb73-4a10-b718-3b8fc238a616',
'checksum': 'md5:eab8fbaa4c318cbd75629eb6a7719ecb', 'checksum': 'md5:eab8fbaa4c318cbd75629eb6a7719ecb',
'key': 'EOSC_SYMPOSIUM_2021_Report.pdf', 'key': 'EOSC_SYMPOSIUM_2021_Report.pdf',
'links': {'self': 'https://zenodo.org/api/files/409f3f8e-cb73-4a10-b718-3b8fc238a616/EOSC_SYMPOSIUM_2021_Report.pdf'}, 'links': {'self': 'https://zenodo.org/api/files/409f3f8e-cb73-4a10-b718-3b8fc238a616/EOSC_SYMPOSIUM_2021_Report.pdf'},
'size': 1654918, 'size': 1654918,
'type': 'pdf'}], 'type': 'pdf'}],
'id': 5176089, 'id': 5176089,
'links': {'badge': 'https://zenodo.org/badge/doi/10.5281/zenodo.5176089.svg', 'links': {'badge': 'https://zenodo.org/badge/doi/10.5281/zenodo.5176089.svg',
'bucket': 'https://zenodo.org/api/files/409f3f8e-cb73-4a10-b718-3b8fc238a616', 'bucket': 'https://zenodo.org/api/files/409f3f8e-cb73-4a10-b718-3b8fc238a616',
'conceptbadge': 'https://zenodo.org/badge/doi/10.5281/zenodo.5176088.svg', 'conceptbadge': 'https://zenodo.org/badge/doi/10.5281/zenodo.5176088.svg',
'conceptdoi': 'https://doi.org/10.5281/zenodo.5176088', 'conceptdoi': 'https://doi.org/10.5281/zenodo.5176088',
'doi': 'https://doi.org/10.5281/zenodo.5176089', 'doi': 'https://doi.org/10.5281/zenodo.5176089',
'html': 'https://zenodo.org/record/5176089', 'html': 'https://zenodo.org/record/5176089',
'latest': 'https://zenodo.org/api/records/5176089', 'latest': 'https://zenodo.org/api/records/5176089',
'latest_html': 'https://zenodo.org/record/5176089', 'latest_html': 'https://zenodo.org/record/5176089',
'self': 'https://zenodo.org/api/records/5176089'}, 'self': 'https://zenodo.org/api/records/5176089'},
'metadata': {'access_right': 'open', 'metadata': {'access_right': 'open',
'access_right_category': 'success', 'access_right_category': 'success',
'communities': [{'id': 'envri'}, 'communities': [{'id': 'envri'},
{'id': 'eosc_synergy'}, {'id': 'eosc_synergy'},
{'id': 'eoscsecretariat'}, {'id': 'eoscsecretariat'},
{'id': 'escape2020'}, {'id': 'escape2020'},
{'id': 'expands'}, {'id': 'expands'},
{'id': 'ni4os-europe'}, {'id': 'ni4os-europe'},
{'id': 'sshoc'}], {'id': 'sshoc'}],
'contributors': [{'affiliation': 'Trust-IT Services', 'contributors': [{'affiliation': 'Trust-IT Services',
'name': 'Ferguson, Nicholas', 'name': 'Ferguson, Nicholas',
'orcid': '0000-0001-5523-6430', 'orcid': '0000-0001-5523-6430',
'type': 'WorkPackageLeader'}], 'type': 'WorkPackageLeader'}],
'creators': [{'affiliation': 'Technopolis Group Belgium', 'creators': [{'affiliation': 'Technopolis Group Belgium',
'name': 'Bertacchini, Veronica'}, 'name': 'Bertacchini, Veronica'},
{'affiliation': 'Trust-IT Services', {'affiliation': 'Trust-IT Services',
'name': 'Drago, Federico', 'name': 'Drago, Federico',
'orcid': '0000-0002-1333-4478'}, 'orcid': '0000-0002-1333-4478'},
{'affiliation': 'TU Wien', {'affiliation': 'TU Wien',
'name': 'Flicker, Katharina', 'name': 'Flicker, Katharina',
'orcid': '0000-0001-6040-2798'}, 'orcid': '0000-0001-6040-2798'},
{'affiliation': 'KIT', 'name': 'Gebreyesus, Netsanet'}, {'affiliation': 'KIT', 'name': 'Gebreyesus, Netsanet'},
{'affiliation': 'GÉANT', 'name': 'Grant, Annabel'}, {'affiliation': 'GÉANT', 'name': 'Grant, Annabel'},
{'affiliation': 'CERN', {'affiliation': 'CERN',
'name': 'Jones, Bob', 'name': 'Jones, Bob',
'orcid': '0000-0001-9092-4589'}, 'orcid': '0000-0001-9092-4589'},
{'affiliation': 'CSC-IT Center for Science', 'name': 'Liinamaa, Iiris'}, {'affiliation': 'CSC-IT Center for Science', 'name': 'Liinamaa, Iiris'},
{'affiliation': 'CSC-IT Center for Science', 'name': 'Märkälä, Anu'}, {'affiliation': 'CSC-IT Center for Science', 'name': 'Märkälä, Anu'},
{'affiliation': 'Athena Research Center', {'affiliation': 'Athena Research Center',
'name': 'Marinos-Kouris, Christos'}, 'name': 'Marinos-Kouris, Christos'},
{'affiliation': 'GO FAIR Foundation', {'affiliation': 'GO FAIR Foundation',
'name': 'Meerman, Bert', 'name': 'Meerman, Bert',
'orcid': '0000-0002-0071-2660'}, 'orcid': '0000-0002-0071-2660'},
{'affiliation': 'TU Wien', {'affiliation': 'TU Wien',
'name': 'Saurugger, Bernd', 'name': 'Saurugger, Bernd',
'orcid': '0000-0001-5730-3983'}, 'orcid': '0000-0001-5730-3983'},
{'affiliation': 'Trust-IT Services', {'affiliation': 'Trust-IT Services',
'name': 'Smith, Zachary', 'name': 'Smith, Zachary',
'orcid': '0000-0002-9984-008X'}], 'orcid': '0000-0002-9984-008X'}],
'description': '<p>The EOSC Symposium 2021 provided a key engagement opportunity for the EOSC community after the European Open Science Cloud finally entered its highly-anticipated implementation phase in 2021. Delivered online to just under 1,000 EOSC stakeholders from over 63 different countries, this was not only the largest EOSC Symposium yet, but it was also an essential opportunity for convergence and alignment on principles and priorities.</p>\n\n<p>The EOSC Association will play an important role in this phase. With already over 210 member and observer organisations from across Europe, the Association represents a single voice for the advocacy and representation of the broader EOSC Stakeholder community in Europe, promoting alignment of EU research policy and priorities.</p>\n\n<p>The Association will continuously develop the EOSC Strategic Research and Innovation Agenda (SRIA) which will influence future EOSC activities at institutional, national and EU level (including the EOSC-related work programmes in Horizon Europe). This living document will adapt to the changing EOSC ecosystem and the needs of EOSC stakeholders. The Association is setting up a series of Advisory Groups (AG) with Task Forces (TF) to engage with the EOSC community around priority areas, namely:</p>\n\n<ul>\n\t<li>Implementation of EOSC</li>\n\t<li>Metadata and Data Quality</li>\n\t<li>Research Careers and Curricula</li>\n\t<li>Sustaining&nbsp;EOSC</li>\n\t<li>Technical Challenges on EOSC</li>\n</ul>\n\n<p>The Symposium was the first opportunity for the Association to present the draft charters of the Task Forces. A key objective of the event was also for the Association to understand what work has been carried out, is in progress, or is planned on the topics of the AGs and TFs. A call for contributions ran throughout May 2021, with a total of 137 applications received. Through presentations, lightning talks, and panels, over 70 community members were able to highlight key findings and recommendations for the AGs and TFs to take into consideration for their work.</p>', 'description': '<p>The EOSC Symposium 2021 provided a key engagement opportunity for the EOSC community after the European Open Science Cloud finally entered its highly-anticipated implementation phase in 2021. Delivered online to just under 1,000 EOSC stakeholders from over 63 different countries, this was not only the largest EOSC Symposium yet, but it was also an essential opportunity for convergence and alignment on principles and priorities.</p>\n\n<p>The EOSC Association will play an important role in this phase. With already over 210 member and observer organisations from across Europe, the Association represents a single voice for the advocacy and representation of the broader EOSC Stakeholder community in Europe, promoting alignment of EU research policy and priorities.</p>\n\n<p>The Association will continuously develop the EOSC Strategic Research and Innovation Agenda (SRIA) which will influence future EOSC activities at institutional, national and EU level (including the EOSC-related work programmes in Horizon Europe). This living document will adapt to the changing EOSC ecosystem and the needs of EOSC stakeholders. The Association is setting up a series of Advisory Groups (AG) with Task Forces (TF) to engage with the EOSC community around priority areas, namely:</p>\n\n<ul>\n\t<li>Implementation of EOSC</li>\n\t<li>Metadata and Data Quality</li>\n\t<li>Research Careers and Curricula</li>\n\t<li>Sustaining&nbsp;EOSC</li>\n\t<li>Technical Challenges on EOSC</li>\n</ul>\n\n<p>The Symposium was the first opportunity for the Association to present the draft charters of the Task Forces. A key objective of the event was also for the Association to understand what work has been carried out, is in progress, or is planned on the topics of the AGs and TFs. A call for contributions ran throughout May 2021, with a total of 137 applications received. Through presentations, lightning talks, and panels, over 70 community members were able to highlight key findings and recommendations for the AGs and TFs to take into consideration for their work.</p>',
'doi': '10.5281/zenodo.5176089', 'doi': '10.5281/zenodo.5176089',
'grants': [{'acronym': 'EOSCsecretariat.eu', 'grants': [{'acronym': 'EOSCsecretariat.eu',
'code': '831644', 'code': '831644',
'funder': {'acronyms': [], 'funder': {'acronyms': [],
'doi': '10.13039/501100000780', 'doi': '10.13039/501100000780',
'links': {'self': 'https://zenodo.org/api/funders/10.13039/501100000780'}, 'links': {'self': 'https://zenodo.org/api/funders/10.13039/501100000780'},
'name': 'European Commission'}, 'name': 'European Commission'},
'links': {'self': 'https://zenodo.org/api/grants/10.13039/501100000780::831644'}, 'links': {'self': 'https://zenodo.org/api/grants/10.13039/501100000780::831644'},
'program': 'H2020', 'program': 'H2020',
'title': 'EOSCsecretariat.eu'}], 'title': 'EOSCsecretariat.eu'}],
'keywords': ['EOSC', 'Open Science', 'Horizon Europe', 'Interoperability'], 'keywords': ['EOSC', 'Open Science', 'Horizon Europe', 'Interoperability'],
'language': 'eng', 'language': 'eng',
'license': {'id': 'CC-BY-4.0'}, 'license': {'id': 'CC-BY-4.0'},
'publication_date': '2021-08-10', 'publication_date': '2021-08-10',
'related_identifiers': [{'identifier': '10.5281/zenodo.5176088', 'related_identifiers': [{'identifier': '10.5281/zenodo.5176088',
'relation': 'isVersionOf', 'relation': 'isVersionOf',
'scheme': 'doi'}], 'scheme': 'doi'}],
'relations': {'version': [{'count': 1, 'relations': {'version': [{'count': 1,
'index': 0, 'index': 0,
'is_last': True, 'is_last': True,
'last_child': {'pid_type': 'recid', 'pid_value': '5176089'}, 'last_child': {'pid_type': 'recid', 'pid_value': '5176089'},
'parent': {'pid_type': 'recid', 'pid_value': '5176088'}}]}, 'parent': {'pid_type': 'recid', 'pid_value': '5176088'}}]},
'resource_type': {'subtype': 'report', 'resource_type': {'subtype': 'report',
'title': 'Report', 'title': 'Report',
'type': 'publication'}, 'type': 'publication'},
'title': 'EOSC Symposium 2021 Report'}, 'title': 'EOSC Symposium 2021 Report'},
'owners': [91736], 'owners': [91736],
'revision': 8, 'revision': 8,
'stats': {'downloads': 479.0, 'stats': {'downloads': 479.0,
'unique_downloads': 411.0, 'unique_downloads': 411.0,
'unique_views': 514.0, 'unique_views': 514.0,
'version_downloads': 479.0, 'version_downloads': 479.0,
'version_unique_downloads': 411.0, 'version_unique_downloads': 411.0,
'version_unique_views': 514.0, 'version_unique_views': 514.0,
'version_views': 537.0, 'version_views': 537.0,
'version_volume': 792705722.0, 'version_volume': 792705722.0,
'views': 537.0, 'views': 537.0,
'volume': 792705722.0}, 'volume': 792705722.0},
'updated': '2021-08-24T14:27:14.603504+00:00'} 'updated': '2021-08-24T14:27:14.603504+00:00'}
%% Cell type:code id:0b48bcff tags: %% Cell type:code id:0b48bcff tags:
``` python ``` python
# Example to retrieve entries_ids and titles # Example to retrieve entries_ids and titles
for entry in all_entries: for entry in all_entries:
print(f"{entry['id']} \t {entry['metadata']['title']}") print(f"{entry['id']} \t {entry['metadata']['title']}")
``` ```
%% Output %% Output
5176089 EOSC Symposium 2021 Report 5176089 EOSC Symposium 2021 Report
5153369 agnpy: Modelling Active Galactic Nuclei radiative processes with python. 5153369 agnpy: Modelling Active Galactic Nuclei radiative processes with python.
5093909 ESCAPE Data Science Summer School 2021 5093909 ESCAPE Data Science Summer School 2021
4923992 ESCAPE template project 4923992 ESCAPE template project
4786641 ZenodoCI 4786641 ZenodoCI
4601451 gLike: numerical maximization of heterogeneous joint likelihood functions of a common free parameter plus nuisance parameters 4601451 gLike: numerical maximization of heterogeneous joint likelihood functions of a common free parameter plus nuisance parameters
4419866 IndexedConv/IndexedConv: v1.3 4419866 IndexedConv/IndexedConv: v1.3
4044010 EOSC - a tool for enabling Open Science in Europe 4044010 EOSC - a tool for enabling Open Science in Europe
3854976 FairRootGroup/DDS 3854976 FairRootGroup/DDS
3743489 ESCAPE the maze 3743489 ESCAPE the maze
3675081 ESFRI cluster projects - Position papers on expectations and planned contributions to the EOSC 3675081 ESFRI cluster projects - Position papers on expectations and planned contributions to the EOSC
3659184 ctapipe_io_mchdf5 3659184 ctapipe_io_mchdf5
3614662 FairRoot 3614662 FairRoot
3362435 FairMQ 3362435 FairMQ
3356656 A prototype for a real time pipeline for the detection of transient signals and their automatic classification 3356656 A prototype for a real time pipeline for the detection of transient signals and their automatic classification
%% Cell type:code id:e2afd195 tags: %% Cell type:code id:e2afd195 tags:
``` python ``` python
# Example of all the keywords within each entry # Example of all the keywords within each entry
for entry in all_entries: for entry in all_entries:
try: try:
print(f"{entry['id']} \t {entry['metadata']['keywords']}") print(f"{entry['id']} \t {entry['metadata']['keywords']}")
except KeyError: except KeyError:
pass pass
``` ```
%% Output %% Output
5176089 ['EOSC', 'Open Science', 'Horizon Europe', 'Interoperability'] 5176089 ['EOSC', 'Open Science', 'Horizon Europe', 'Interoperability']
5153369 ['radiative processes', 'blazars', 'radio galaxies', 'AGN', 'jets', 'MWL', 'astropy', 'numpy', 'python'] 5153369 ['radiative processes', 'blazars', 'radio galaxies', 'AGN', 'jets', 'MWL', 'astropy', 'numpy', 'python']
5093909 ['python', 'lesson'] 5093909 ['python', 'lesson']
4923992 ['ESCAPE', 'jupyter-notebook'] 4923992 ['ESCAPE', 'jupyter-notebook']
4786641 ['ESCAPE'] 4786641 ['ESCAPE']
4419866 ['CTA'] 4419866 ['CTA']
4044010 ['European Open Science Cloud, ESFRI, e-Infrastructures'] 4044010 ['European Open Science Cloud, ESFRI, e-Infrastructures']
3743489 ['ESCAPE'] 3743489 ['ESCAPE']
3659184 ['CTA'] 3659184 ['CTA']
3614662 ['geant4', 'c-plus-plus', 'cmake', 'reconstruction', 'vmc', 'modular', 'analysis', 'simulation'] 3614662 ['geant4', 'c-plus-plus', 'cmake', 'reconstruction', 'vmc', 'modular', 'analysis', 'simulation']
3356656 ['Machine Learning, Big Data, Aapche Kafka, Gravitational Wave'] 3356656 ['Machine Learning, Big Data, Aapche Kafka, Gravitational Wave']
%% Cell type:markdown id:e9007eef tags: %% Cell type:markdown id:e9007eef tags:
#### A specific ESCAPE2020 entry: `agnpy`. #### A specific ESCAPE2020 entry: `agnpy`.
%% Cell type:code id:75b4de93 tags: %% Cell type:code id:75b4de93 tags:
``` python ``` python
agnpy = requests.get('https://zenodo.org/api/records/4687123', params=parameters).json() agnpy = requests.get('https://zenodo.org/api/records/4687123', params=parameters).json()
agnpy.keys() agnpy.keys()
``` ```
%% Output %% Output
dict_keys(['conceptdoi', 'conceptrecid', 'created', 'doi', 'files', 'id', 'links', 'metadata', 'owners', 'revision', 'stats', 'updated']) dict_keys(['conceptdoi', 'conceptrecid', 'created', 'doi', 'files', 'id', 'links', 'metadata', 'owners', 'revision', 'stats', 'updated'])
%% Cell type:code id:39be15f1 tags: %% Cell type:code id:39be15f1 tags:
``` python ``` python
agnpy['metadata'] agnpy['metadata']
``` ```
%% Output %% Output
{'access_right': 'open', {'access_right': 'open',
'access_right_category': 'success', 'access_right_category': 'success',
'communities': [{'id': 'escape2020'}], 'communities': [{'id': 'escape2020'}],
'creators': [{'affiliation': "Institut de Física d'Altes Energies (IFAE)", 'creators': [{'affiliation': "Institut de Física d'Altes Energies (IFAE)",
'name': 'Cosimo Nigro'}, 'name': 'Cosimo Nigro'},
{'name': 'Julian Sitarek'}, {'name': 'Julian Sitarek'},
{'affiliation': 'Minnesota State University Moorhead', 'name': 'Matt Craig'}, {'affiliation': 'Minnesota State University Moorhead', 'name': 'Matt Craig'},
{'name': 'Paweł Gliwny'}, {'name': 'Paweł Gliwny'},
{'affiliation': '@sourcery-ai', 'name': 'Sourcery AI'}], {'affiliation': '@sourcery-ai', 'name': 'Sourcery AI'}],
'description': '<p>In this release the major features added are:</p>\n<ul>\n<li><p>an exponential cutoff power-law for the electron spectra;</p>\n</li>\n<li><p>the possibility to compute the gamma-gamma opacity for misaligned sources (<code>viewing angle != 0</code>) for the following targets: point source behind the jet, BLR and the DT.</p>\n</li>\n</ul>', 'description': '<p>In this release the major features added are:</p>\n<ul>\n<li><p>an exponential cutoff power-law for the electron spectra;</p>\n</li>\n<li><p>the possibility to compute the gamma-gamma opacity for misaligned sources (<code>viewing angle != 0</code>) for the following targets: point source behind the jet, BLR and the DT.</p>\n</li>\n</ul>',
'doi': '10.5281/zenodo.4687123', 'doi': '10.5281/zenodo.4687123',
'license': {'id': 'other-open'}, 'license': {'id': 'other-open'},
'publication_date': '2021-04-14', 'publication_date': '2021-04-14',
'related_identifiers': [{'identifier': 'https://github.com/cosimoNigro/agnpy/tree/v0.0.10', 'related_identifiers': [{'identifier': 'https://github.com/cosimoNigro/agnpy/tree/v0.0.10',
'relation': 'isSupplementTo', 'relation': 'isSupplementTo',
'scheme': 'url'}, 'scheme': 'url'},
{'identifier': '10.5281/zenodo.4055175', {'identifier': '10.5281/zenodo.4055175',
'relation': 'isVersionOf', 'relation': 'isVersionOf',
'scheme': 'doi'}], 'scheme': 'doi'}],
'relations': {'version': [{'count': 7, 'relations': {'version': [{'count': 7,
'index': 3, 'index': 3,
'is_last': False, 'is_last': False,
'last_child': {'pid_type': 'recid', 'pid_value': '5153369'}, 'last_child': {'pid_type': 'recid', 'pid_value': '5153369'},
'parent': {'pid_type': 'recid', 'pid_value': '4055175'}}]}, 'parent': {'pid_type': 'recid', 'pid_value': '4055175'}}]},
'resource_type': {'title': 'Software', 'type': 'software'}, 'resource_type': {'title': 'Software', 'type': 'software'},
'title': 'cosimoNigro/agnpy: v0.0.10: added EPWL for electrons and off-axis absorption calculation', 'title': 'cosimoNigro/agnpy: v0.0.10: added EPWL for electrons and off-axis absorption calculation',
'version': 'v0.0.10'} 'version': 'v0.0.10'}
%% Cell type:code id:1ee7197f tags: %% Cell type:code id:1ee7197f tags:
``` python ``` python
for file in agnpy['files']: for file in agnpy['files']:
print(file['links']['self']) print(file['links']['self'])
``` ```
%% Output %% Output
https://zenodo.org/api/files/a806b549-922e-4025-9453-a5f4c0913fdd/cosimoNigro/agnpy-v0.0.10.zip https://zenodo.org/api/files/a806b549-922e-4025-9453-a5f4c0913fdd/cosimoNigro/agnpy-v0.0.10.zip
%% Cell type:markdown id:bb63887b tags: %% Cell type:markdown id:bb63887b tags:
We could do a simple `wget` of the previous URL and recover the file updoaded to Zenodo. We could do a simple `wget` of the previous URL and recover the file updoaded to Zenodo.
Let's see and example with various files uploaded. Let's see and example with various files uploaded.
%% Cell type:code id:16db6ee0 tags: %% Cell type:code id:16db6ee0 tags:
``` python ``` python
ESCAPE_template = requests.get('https://zenodo.org/api/records/4790629', params=parameters).json() ESCAPE_template = requests.get('https://zenodo.org/api/records/4790629', params=parameters).json()
``` ```
%% Cell type:code id:9feca5e6 tags: %% Cell type:code id:9feca5e6 tags:
``` python ``` python
for file in ESCAPE_template['files']: for file in ESCAPE_template['files']:
print(file['links']['self']) print(file['links']['self'])
``` ```
%% Output %% Output
https://zenodo.org/api/files/923a2614-a0fa-4927-bb3b-704168f3c768/codemeta.json https://zenodo.org/api/files/923a2614-a0fa-4927-bb3b-704168f3c768/codemeta.json
https://zenodo.org/api/files/923a2614-a0fa-4927-bb3b-704168f3c768/Singularity https://zenodo.org/api/files/923a2614-a0fa-4927-bb3b-704168f3c768/Singularity
https://zenodo.org/api/files/923a2614-a0fa-4927-bb3b-704168f3c768/Singularity.simg https://zenodo.org/api/files/923a2614-a0fa-4927-bb3b-704168f3c768/Singularity.simg
https://zenodo.org/api/files/923a2614-a0fa-4927-bb3b-704168f3c768/template_project_escape-v2.1.zip https://zenodo.org/api/files/923a2614-a0fa-4927-bb3b-704168f3c768/template_project_escape-v2.1.zip
%% Cell type:markdown id:4070d988 tags: %% Cell type:markdown id:4070d988 tags:
## eossr ## eossr
The eossr library uses Zenodo REST API. The eossr library uses the Zenodo REST API.
See the [OSSR API notebook](ossr_search.ipynb) for an example on how to use it. See the OSSR API notebooks ([Explore the OSSR](ossr_api-Explore_the_OSSR.ipynb) and [How to upload records to the OSSR](ossr_api-Upload_records_OSSR.ipynb)) for examples on how to use it.
%% Cell type:code id:563902f1 tags: %% Cell type:code id:563902f1 tags:
``` python ``` python
``` ```
......
%% Cell type:markdown id:4a25feec tags: %% Cell type:markdown id:4a25feec tags:
# Find ESCAPE OSSR records # Find ESCAPE OSSR records
**Please note** that to fetch information from the OSSR, **token is needed**.
The EOSSR API will get the public information that is available in the repository.
%% Cell type:markdown id:5e008b43 tags: %% Cell type:markdown id:5e008b43 tags:
## Getting all the records ## Getting all the records
%% Cell type:code id:dbde9b19 tags: %% Cell type:code id:dbde9b19 tags:
``` python ``` python
from eossr.api import get_ossr_records from eossr.api import get_ossr_records
``` ```
%% Cell type:code id:2fe017bc tags: %% Cell type:code id:2fe017bc tags:
``` python ``` python
ossr_records = get_ossr_records() ossr_records = get_ossr_records()
``` ```
%% Cell type:code id:5eb34293 tags: %% Cell type:code id:5eb34293 tags:
``` python ``` python
len(ossr_records) len(ossr_records)
``` ```
%% Output %% Output
16 16
%% Cell type:markdown id:93b033a0 tags: %% Cell type:markdown id:93b033a0 tags:
Records are objects containing data and metadata sent by Zenodo API Records are objects containing data and metadata sent by Zenodo API
%% Cell type:code id:f88ebfd3 tags: %% Cell type:code id:f88ebfd3 tags:
``` python ``` python
record = ossr_records[0] record = ossr_records[0]
``` ```
%% Cell type:code id:988b95c7 tags: %% Cell type:code id:988b95c7 tags:
``` python ``` python
print(record) print(record)
``` ```
%% Output %% Output
Record #5524913 : eossr Record #5524913 : eossr
%% Cell type:code id:6bbe7db1 tags: %% Cell type:code id:6bbe7db1 tags:
``` python ``` python
record record
``` ```
%% Output %% Output
Record({'conceptdoi': '10.5281/zenodo.5524912', 'conceptrecid': '5524912', 'created': '2021-09-23T15:03:51.644210+00:00', 'doi': '10.5281/zenodo.5524913', 'files': [{'bucket': '165e5f9a-17bc-4792-bd04-b01cef8b9fc7', 'checksum': 'md5:20d7ce7abc06541bed2655f19edfb956', 'key': 'codemeta.json', 'links': {'self': 'https://zenodo.org/api/files/165e5f9a-17bc-4792-bd04-b01cef8b9fc7/codemeta.json'}, 'size': 3271, 'type': 'json'}, {'bucket': '165e5f9a-17bc-4792-bd04-b01cef8b9fc7', 'checksum': 'md5:33489eacd42433ffdb66da2972b3e900', 'key': 'Docker_v0.2.tar', 'links': {'self': 'https://zenodo.org/api/files/165e5f9a-17bc-4792-bd04-b01cef8b9fc7/Docker_v0.2.tar'}, 'size': 3085572608, 'type': 'tar'}, {'bucket': '165e5f9a-17bc-4792-bd04-b01cef8b9fc7', 'checksum': 'md5:ef70d30cd1d548e1ba8ebd71679cbbb8', 'key': 'eossr-v0.2.zip', 'links': {'self': 'https://zenodo.org/api/files/165e5f9a-17bc-4792-bd04-b01cef8b9fc7/eossr-v0.2.zip'}, 'size': 60988, 'type': 'zip'}], 'id': 5524913, 'links': {'badge': 'https://zenodo.org/badge/doi/10.5281/zenodo.5524913.svg', 'bucket': 'https://zenodo.org/api/files/165e5f9a-17bc-4792-bd04-b01cef8b9fc7', 'conceptbadge': 'https://zenodo.org/badge/doi/10.5281/zenodo.5524912.svg', 'conceptdoi': 'https://doi.org/10.5281/zenodo.5524912', 'doi': 'https://doi.org/10.5281/zenodo.5524913', 'html': 'https://zenodo.org/record/5524913', 'latest': 'https://zenodo.org/api/records/5524913', 'latest_html': 'https://zenodo.org/record/5524913', 'self': 'https://zenodo.org/api/records/5524913'}, 'metadata': {'access_right': 'open', 'access_right_category': 'success', 'communities': [{'id': 'escape2020'}], 'creators': [{'affiliation': 'LAPP, CNRS', 'name': 'Vuillaume, Thomas', 'orcid': '0000-0002-5686-2078'}, {'affiliation': 'LAPP, CNRS', 'name': 'Garcia, Enrique', 'orcid': '0000-0003-2224-4594'}, {'affiliation': 'GSI', 'name': 'Tacke, Christian', 'orcid': '0000-0002-5321-8404'}, {'affiliation': 'ECAP, FAU (Nuremberg, Germany)', 'name': 'Gál, Tamás', 'orcid': '0000-0001-7821-8673'}], 'description': '<p>ESCAPE OSSR library</p>\n\n<ul>\n\t<li>Code: <a href="https://gitlab.in2p3.fr/escape2020/wp3/eossr">https://gitlab.in2p3.fr/escape2020/wp3/eossr</a></li>\n\t<li>Documentation: <a href="https://escape2020.pages.in2p3.fr/wp3/eossr/">https://escape2020.pages.in2p3.fr/wp3/eossr/</a></li>\n</ul>', 'doi': '10.5281/zenodo.5524913', 'grants': [{'acronym': 'ESCAPE', 'code': '824064', 'funder': {'acronyms': [], 'doi': '10.13039/501100000780', 'links': {'self': 'https://zenodo.org/api/funders/10.13039/501100000780'}, 'name': 'European Commission'}, 'links': {'self': 'https://zenodo.org/api/grants/10.13039/501100000780::824064'}, 'program': 'H2020', 'title': 'European Science Cluster of Astronomy & Particle physics ESFRI research infrastructures'}], 'keywords': ['jupyter-notebook'], 'language': 'eng', 'license': {'id': 'MIT'}, 'notes': "Release Notes:\nThis major release of the eossr introduces 3 pillars that allow the user to interact easily with the ESCAPE OSSR:\n\n\n- **API** module: introduces an API to communicate with the OSSR built on Zenodo's API:\n - fetch OSSR records\n - get records metadata\n - upload a new record\n - update an existing record\n\n\n- **metadata** module:\n - implement the official metadata schema for the OSSR based on codemeta schema\n - method to translate codemeta metadata into zenodo metadata\n\n- **continuous integration**: collection of methods and snippets to allow users to use the gitlab CI to: \n - make a new record in the OSSR\n - update an existing record in the OSSR\n - build a Docker container / image\n - build a Singularity container / image\n - add containers to the gitlab registry\n - add images to your OSSR upload", 'publication_date': '2021-09-23', 'related_identifiers': [{'identifier': 'https://gitlab.in2p3.fr/escape2020/wp3/eossr', 'relation': 'isSupplementTo', 'resource_type': 'software', 'scheme': 'url'}, {'identifier': '10.5281/zenodo.5524912', 'relation': 'isVersionOf', 'scheme': 'doi'}], 'relations': {'version': [{'count': 1, 'index': 0, 'is_last': True, 'last_child': {'pid_type': 'recid', 'pid_value': '5524913'}, 'parent': {'pid_type': 'recid', 'pid_value': '5524912'}}]}, 'resource_type': {'title': 'Software', 'type': 'software'}, 'title': 'eossr', 'version': 'v0.2'}, 'owners': [37616], 'revision': 4, 'stats': {'downloads': 11.0, 'unique_downloads': 6.0, 'unique_views': 3.0, 'version_downloads': 11.0, 'version_unique_downloads': 6.0, 'version_unique_views': 3.0, 'version_views': 5.0, 'version_volume': 3085720752.0, 'views': 5.0, 'volume': 3085720752.0}, 'updated': '2021-09-24T13:48:31.042154+00:00'}) {
"conceptdoi": "10.5281/zenodo.5524912",
"conceptrecid": "5524912",
"created": "2021-09-23T15:03:51.644210+00:00",
"doi": "10.5281/zenodo.5524913",
"files": [
{
"bucket": "165e5f9a-17bc-4792-bd04-b01cef8b9fc7",
"checksum": "md5:20d7ce7abc06541bed2655f19edfb956",
"key": "codemeta.json",
"links": {
"self": "https://zenodo.org/api/files/165e5f9a-17bc-4792-bd04-b01cef8b9fc7/codemeta.json"
},
"size": 3271,
"type": "json"
},
{
"bucket": "165e5f9a-17bc-4792-bd04-b01cef8b9fc7",
"checksum": "md5:33489eacd42433ffdb66da2972b3e900",
"key": "Docker_v0.2.tar",
"links": {
"self": "https://zenodo.org/api/files/165e5f9a-17bc-4792-bd04-b01cef8b9fc7/Docker_v0.2.tar"
},
"size": 3085572608,
"type": "tar"
},
{
"bucket": "165e5f9a-17bc-4792-bd04-b01cef8b9fc7",
"checksum": "md5:ef70d30cd1d548e1ba8ebd71679cbbb8",
"key": "eossr-v0.2.zip",
"links": {
"self": "https://zenodo.org/api/files/165e5f9a-17bc-4792-bd04-b01cef8b9fc7/eossr-v0.2.zip"
},
"size": 60988,
"type": "zip"
}
],
"id": 5524913,
"links": {
"badge": "https://zenodo.org/badge/doi/10.5281/zenodo.5524913.svg",
"bucket": "https://zenodo.org/api/files/165e5f9a-17bc-4792-bd04-b01cef8b9fc7",
"conceptbadge": "https://zenodo.org/badge/doi/10.5281/zenodo.5524912.svg",
"conceptdoi": "https://doi.org/10.5281/zenodo.5524912",
"doi": "https://doi.org/10.5281/zenodo.5524913",
"html": "https://zenodo.org/record/5524913",
"latest": "https://zenodo.org/api/records/5524913",
"latest_html": "https://zenodo.org/record/5524913",
"self": "https://zenodo.org/api/records/5524913"
},
"metadata": {
"access_right": "open",
"access_right_category": "success",
"communities": [
{
"id": "escape2020"
}
],
"creators": [
{
"affiliation": "LAPP, CNRS",
"name": "Vuillaume, Thomas",
"orcid": "0000-0002-5686-2078"
},
{
"affiliation": "LAPP, CNRS",
"name": "Garcia, Enrique",
"orcid": "0000-0003-2224-4594"
},
{
"affiliation": "GSI",
"name": "Tacke, Christian",
"orcid": "0000-0002-5321-8404"
},
{
"affiliation": "ECAP, FAU (Nuremberg, Germany)",
"name": "G\u00e1l, Tam\u00e1s",
"orcid": "0000-0001-7821-8673"
}
],
"description": "<p>ESCAPE OSSR library</p>\n\n<ul>\n\t<li>Code: <a href=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr\">https://gitlab.in2p3.fr/escape2020/wp3/eossr</a></li>\n\t<li>Documentation: <a href=\"https://escape2020.pages.in2p3.fr/wp3/eossr/\">https://escape2020.pages.in2p3.fr/wp3/eossr/</a></li>\n</ul>",
"doi": "10.5281/zenodo.5524913",
"grants": [
{
"acronym": "ESCAPE",
"code": "824064",
"funder": {
"acronyms": [],
"doi": "10.13039/501100000780",
"links": {
"self": "https://zenodo.org/api/funders/10.13039/501100000780"
},
"name": "European Commission"
},
"links": {
"self": "https://zenodo.org/api/grants/10.13039/501100000780::824064"
},
"program": "H2020",
"title": "European Science Cluster of Astronomy & Particle physics ESFRI research infrastructures"
}
],
"keywords": [
"jupyter-notebook"
],
"language": "eng",
"license": {
"id": "MIT"
},
"notes": "Release Notes:\nThis major release of the eossr introduces 3 pillars that allow the user to interact easily with the ESCAPE OSSR:\n\n\n- **API** module: introduces an API to communicate with the OSSR built on Zenodo's API:\n - fetch OSSR records\n - get records metadata\n - upload a new record\n - update an existing record\n\n\n- **metadata** module:\n - implement the official metadata schema for the OSSR based on codemeta schema\n - method to translate codemeta metadata into zenodo metadata\n\n- **continuous integration**: collection of methods and snippets to allow users to use the gitlab CI to: \n - make a new record in the OSSR\n - update an existing record in the OSSR\n - build a Docker container / image\n - build a Singularity container / image\n - add containers to the gitlab registry\n - add images to your OSSR upload",
"publication_date": "2021-09-23",
"related_identifiers": [
{
"identifier": "https://gitlab.in2p3.fr/escape2020/wp3/eossr",
"relation": "isSupplementTo",
"resource_type": "software",
"scheme": "url"
},
{
"identifier": "10.5281/zenodo.5524912",
"relation": "isVersionOf",
"scheme": "doi"
}
],
"relations": {
"version": [
{
"count": 1,
"index": 0,
"is_last": true,
"last_child": {
"pid_type": "recid",
"pid_value": "5524913"
},
"parent": {
"pid_type": "recid",
"pid_value": "5524912"
}
}
]
},
"resource_type": {
"title": "Software",
"type": "software"
},
"title": "eossr",
"version": "v0.2"
},
"owners": [
37616
],
"revision": 4,
"stats": {
"downloads": 13.0,
"unique_downloads": 7.0,
"unique_views": 6.0,
"version_downloads": 13.0,
"version_unique_downloads": 7.0,
"version_unique_views": 6.0,
"version_views": 8.0,
"version_volume": 3085785011.0,
"views": 8.0,
"volume": 3085785011.0
},
"updated": "2021-09-24T13:48:31.042154+00:00"
}
%% Cell type:code id:3aad2e35 tags: %% Cell type:code id:3aad2e35 tags:
``` python ``` python
``` ```
%% Cell type:markdown id:cb5f905e tags: %% Cell type:markdown id:cb5f905e tags:
You can use `print_info` to display minimal information about a `Record`: You can use `print_info` to display minimal information about a `Record`:
%% Cell type:code id:a9ec3d38 tags: %% Cell type:code id:a9ec3d38 tags:
``` python ``` python
record.print_info() record.print_info()
``` ```
%% Output %% Output
=== Record #5524913 === === Record #5524913 ===
Title: eossr === Title: eossr ===
DOI: 10.5281/zenodo.5524913 DOI: 10.5281/zenodo.5524913
URL: https://zenodo.org/record/5524913 URL: https://zenodo.org/record/5524913
Description: Description:
<p>ESCAPE OSSR library</p> <p>ESCAPE OSSR library</p>
<ul> <ul>
<li>Code: <a href="https://gitlab.in2p3.fr/escape2020/wp3/eossr">https://gitlab.in2p3.fr/escape2020/wp3/eossr</a></li> <li>Code: <a href="https://gitlab.in2p3.fr/escape2020/wp3/eossr">https://gitlab.in2p3.fr/escape2020/wp3/eossr</a></li>
<li>Documentation: <a href="https://escape2020.pages.in2p3.fr/wp3/eossr/">https://escape2020.pages.in2p3.fr/wp3/eossr/</a></li> <li>Documentation: <a href="https://escape2020.pages.in2p3.fr/wp3/eossr/">https://escape2020.pages.in2p3.fr/wp3/eossr/</a></li>
</ul> </ul>
%% Cell type:code id:28ad4039 tags: %% Cell type:code id:28ad4039 tags:
``` python ``` python
``` ```
%% Cell type:markdown id:21384a7d tags: %% Cell type:markdown id:21384a7d tags:
## Specific search ## Specific search
%% Cell type:markdown id:7f1a9209 tags: %% Cell type:markdown id:7f1a9209 tags:
### Using strings ### Using strings
%% Cell type:code id:3a3dc135 tags: %% Cell type:code id:3a3dc135 tags:
``` python ``` python
escape_records = get_ossr_records('escape') escape_records = get_ossr_records('escape')
``` ```
%% Cell type:code id:0aa0deec tags: %% Cell type:code id:0aa0deec tags:
``` python ``` python
for r in escape_records: for r in escape_records:
print(r) print(r)
``` ```
%% Output %% Output
Record #3743489 : ESCAPE the maze Record #3743489 : ESCAPE the maze
Record #4923992 : ESCAPE template project Record #4923992 : ESCAPE template project
Record #5093909 : ESCAPE Data Science Summer School 2021 Record #5093909 : ESCAPE Data Science Summer School 2021
Record #5524913 : eossr Record #5524913 : eossr
Record #4044010 : EOSC - a tool for enabling Open Science in Europe Record #4044010 : EOSC - a tool for enabling Open Science in Europe
%% Cell type:markdown id:c4b08fde tags: %% Cell type:markdown id:c4b08fde tags:
### Using keywords ### Using keywords
%% Cell type:code id:f5cb8f77 tags: %% Cell type:code id:f5cb8f77 tags:
``` python ``` python
cta_records = get_ossr_records(keywords='CTA') cta_records = get_ossr_records(keywords='CTA')
len(cta_records) len(cta_records)
``` ```
%% Output %% Output
2 2
%% Cell type:code id:019f21eb tags: %% Cell type:code id:019f21eb tags:
``` python ``` python
for record in cta_records: for record in cta_records:
print(record) print(record)
``` ```
%% Output %% Output
Record #4419866 : IndexedConv/IndexedConv: v1.3 Record #4419866 : IndexedConv/IndexedConv: v1.3
Record #3659184 : ctapipe_io_mchdf5 Record #3659184 : ctapipe_io_mchdf5
%% Cell type:code id:5f304419 tags: %% Cell type:code id:5f304419 tags:
``` python ``` python
``` ```
%% Cell type:markdown id:da77c97b tags: %% Cell type:markdown id:da77c97b tags:
### Directly from its id ### Directly from its id
if you happen to know exactly the record you are looking for if you happen to know exactly the record you are looking for
%% Cell type:code id:eb048c8f tags: %% Cell type:code id:eb048c8f tags:
``` python ``` python
from eossr.api.zenodo import get_record from eossr.api.zenodo import get_record
``` ```
%% Cell type:code id:8a162ccb tags: %% Cell type:code id:8a162ccb tags:
``` python ``` python
record = get_record(4923992) record = get_record(4923992)
``` ```
%% Cell type:code id:81b76847 tags: %% Cell type:code id:81b76847 tags:
``` python ``` python
print(record) print(record)
``` ```
%% Output %% Output
Record #4923992 : ESCAPE template project Record #4923992 : ESCAPE template project
%% Cell type:code id:25ec9b5a tags: %% Cell type:code id:25ec9b5a tags:
``` python ``` python
``` ```
%% Cell type:markdown id:a85d8056 tags: %% Cell type:markdown id:a85d8056 tags:
# Records methods # Records methods
There are other useful methods to a Record class. There are other useful methods to a Record class.
%% Cell type:markdown id:9083a824 tags: %% Cell type:markdown id:9083a824 tags:
## Getting CodeMeta metadata ## Getting CodeMeta metadata
If a `codemeta.json` file has been added to the record, one can retrieve it directly: If a `codemeta.json` file has been added to the record, one can retrieve it directly:
%% Cell type:code id:1431eb41 tags: %% Cell type:code id:1431eb41 tags:
``` python ``` python
record.get_codemeta() record.get_codemeta()
``` ```
%% Output %% Output
{'@context': 'https://doi.org/10.5063/schema/codemeta-2.0', {'@context': 'https://doi.org/10.5063/schema/codemeta-2.0',
'@type': 'SoftwareSourceCode', '@type': 'SoftwareSourceCode',
'name': 'ESCAPE template project', 'name': 'ESCAPE template project',
'description': 'An example of software project template for the ESCAPE 2020 European project', 'description': 'An example of software project template for the ESCAPE 2020 European project',
'keywords': ['ESCAPE', 'jupyter-notebook'], 'keywords': ['ESCAPE', 'jupyter-notebook'],
'license': 'https://spdx.org/licenses/MIT', 'license': 'https://spdx.org/licenses/MIT',
'identifier': '10.5281/zenodo.3884963', 'identifier': '10.5281/zenodo.3884963',
'softwareVersion': 'v2.2', 'softwareVersion': 'v2.2',
'developmentStatus': 'active', 'developmentStatus': 'active',
'codeRepository': 'https://gitlab.in2p3.fr/escape2020/wp3/template_project_escape', 'codeRepository': 'https://gitlab.in2p3.fr/escape2020/wp3/template_project_escape',
'runtimePlatform': 'Python >3.6', 'runtimePlatform': 'Python >3.6',
'downloadUrl': 'https://gitlab.in2p3.fr/escape2020/wp3/template_project_escape/-/archive/v2.2/template_project_escape-v2.2.tar.gz', 'downloadUrl': 'https://gitlab.in2p3.fr/escape2020/wp3/template_project_escape/-/archive/v2.2/template_project_escape-v2.2.tar.gz',
'installUrl': 'https://gitlab.in2p3.fr/escape2020/wp3/template_project_escape/-/blob/master/setup.py', 'installUrl': 'https://gitlab.in2p3.fr/escape2020/wp3/template_project_escape/-/blob/master/setup.py',
'releaseNotes': 'Jupyter Notebooks example added. Example of how to automatise the upload of the docker image - whose container was built and published during the CI - to Zenodo.', 'releaseNotes': 'Jupyter Notebooks example added. Example of how to automatise the upload of the docker image - whose container was built and published during the CI - to Zenodo.',
'dateCreated': '2019-11-05', 'dateCreated': '2019-11-05',
'datePublished': '2021-06-10', 'datePublished': '2021-06-10',
'dateModified': '2021-05-25', 'dateModified': '2021-05-25',
'isAccessibleForFree': True, 'isAccessibleForFree': True,
'isPartOf': ['https://gitlab.in2p3.fr/escape2020', 'isPartOf': ['https://gitlab.in2p3.fr/escape2020',
'https://projectescape.eu/'], 'https://projectescape.eu/'],
'contIntegration': 'https://gitlab.in2p3.fr/escape2020/wp3/template_project_escape/-/pipelines', 'contIntegration': 'https://gitlab.in2p3.fr/escape2020/wp3/template_project_escape/-/pipelines',
'buildInstructions': 'https://gitlab.in2p3.fr/escape2020/wp3/template_project_escape/-/blob/master/README.md', 'buildInstructions': 'https://gitlab.in2p3.fr/escape2020/wp3/template_project_escape/-/blob/master/README.md',
'issueTracker': 'https://gitlab.in2p3.fr/escape2020/wp3/template_project_escape/-/issues', 'issueTracker': 'https://gitlab.in2p3.fr/escape2020/wp3/template_project_escape/-/issues',
'readme': 'https://gitlab.in2p3.fr/escape2020/wp3/template_project_escape/-/blob/master/README.md', 'readme': 'https://gitlab.in2p3.fr/escape2020/wp3/template_project_escape/-/blob/master/README.md',
'programmingLanguage': [{'@type': 'ComputerLanguage', 'programmingLanguage': [{'@type': 'ComputerLanguage',
'name': 'Python', 'name': 'Python',
'url': 'https://www.python.org/'}, 'url': 'https://www.python.org/'},
{'@type': 'ComputerLanguage', {'@type': 'ComputerLanguage',
'name': 'Bash', 'name': 'Bash',
'url': 'https://www.gnu.org/software/bash/'}], 'url': 'https://www.gnu.org/software/bash/'}],
'softwareRequirements': [{'@type': 'SoftwareApplication', 'softwareRequirements': [{'@type': 'SoftwareApplication',
'identifier': 'numpy', 'identifier': 'numpy',
'name': 'numpy', 'name': 'numpy',
'softwareVersion': '1.18.1'}, 'softwareVersion': '1.18.1'},
{'@type': 'SoftwareApplication', {'@type': 'SoftwareApplication',
'identifier': 'requests', 'identifier': 'requests',
'name': 'requests', 'name': 'requests',
'softwareVersion': '>=3.6'}, 'softwareVersion': '>=3.6'},
{'@type': 'SoftwareApplication', {'@type': 'SoftwareApplication',
'identifier': 'pytest', 'identifier': 'pytest',
'name': 'pytest', 'name': 'pytest',
'softwareVersion': '>=5.4.2'}, 'softwareVersion': '>=5.4.2'},
{'@type': 'SoftwareApplication', {'@type': 'SoftwareApplication',
'identifier': 'pyyaml', 'identifier': 'pyyaml',
'name': 'pyyaml', 'name': 'pyyaml',
'softwareVersion': '>=5.3.1'}], 'softwareVersion': '>=5.3.1'}],
'maintainer': {'@type': 'Person', 'maintainer': {'@type': 'Person',
'@id': 'https://orcid.org/0000-0003-2224-4594', '@id': 'https://orcid.org/0000-0003-2224-4594',
'givenName': 'Enrique', 'givenName': 'Enrique',
'familyName': 'Garcia', 'familyName': 'Garcia',
'email': 'garcia@lapp.in2p3.fr', 'email': 'garcia@lapp.in2p3.fr',
'affiliation': {'@type': 'Organization', 'name': 'LAPP, CNRS'}}, 'affiliation': {'@type': 'Organization', 'name': 'LAPP, CNRS'}},
'author': [{'@type': 'Person', 'author': [{'@type': 'Person',
'@id': 'https://orcid.org/0000-0003-2224-4594', '@id': 'https://orcid.org/0000-0003-2224-4594',
'givenName': 'Enrique', 'givenName': 'Enrique',
'familyName': 'Garcia', 'familyName': 'Garcia',
'email': 'garcia@lapp.in2p3.fr', 'email': 'garcia@lapp.in2p3.fr',
'affiliation': {'@type': 'Organization', 'name': 'LAPP, CNRS'}}], 'affiliation': {'@type': 'Organization', 'name': 'LAPP, CNRS'}}],
'contributor': [{'@type': 'Person', 'contributor': [{'@type': 'Person',
'@id': 'https://orcid.org/0000-0002-5686-2078', '@id': 'https://orcid.org/0000-0002-5686-2078',
'givenName': 'Thomas', 'givenName': 'Thomas',
'familyName': 'Vuillaume', 'familyName': 'Vuillaume',
'email': 'vuillaume@lapp.in2p3.fr', 'email': 'vuillaume@lapp.in2p3.fr',
'affiliation': {'@type': 'Organization', 'name': 'LAPP, CNRS'}}], 'affiliation': {'@type': 'Organization', 'name': 'LAPP, CNRS'}}],
'funder': [{'@type': 'Organization', 'funder': [{'@type': 'Organization',
'name': 'ESCAPE: European Science Cluster of Astronomy & Particle physics ESFRI research infrastructures', 'name': 'ESCAPE: European Science Cluster of Astronomy & Particle physics ESFRI research infrastructures',
'funder': {'@type': 'Organization', 'funder': {'@type': 'Organization',
'@id': 'https://doi.org/10.13039/501100000780', '@id': 'https://doi.org/10.13039/501100000780',
'name': 'European Commission'}}], 'name': 'European Commission'}}],
'funding': '824064'} 'funding': '824064'}
%% Cell type:code id:7a1d0f77 tags: %% Cell type:code id:7a1d0f77 tags:
``` python ``` python
``` ```
%% Cell type:markdown id:64c43dd6 tags: %% Cell type:markdown id:64c43dd6 tags:
## MyBinder integration ## MyBinder integration
You can get a mybinder URL directly from a record: You can get a mybinder URL directly from a record:
%% Cell type:code id:7cf9bcdb tags: %% Cell type:code id:7cf9bcdb tags:
``` python ``` python
record.get_mybinder_url() record.get_mybinder_url()
``` ```
%% Output %% Output
'https://mybinder.org/v2/zenodo/10.5281/zenodo.3572654' 'https://mybinder.org/v2/zenodo/10.5281/zenodo.3572654'
%% Cell type:code id:622e44d9 tags: %% Cell type:code id:622e44d9 tags:
``` python ``` python
``` ```
%% Cell type:markdown id:d5e9bc28 tags:
# Upload records on the OSSR
%% Cell type:markdown id:a4123841 tags:
To upload records on the OSSR, you may use the [Zenodo client](https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/blob/master/eossr/api/zenodo.py).
This is also used by the continuous integration to automatise project's uploads from GitLab to Zenodo.
To do so, you will need to use your Zenodo token ([create one](https://zenodo.org/account/settings/applications/tokens/new/)).
%% Cell type:code id:69c6f758 tags:
``` python
from eossr.api.zenodo import ZenodoAPI
token = ''
z = ZenodoAPI(access_token=token, sandbox=False)
```
%% Cell type:code id:83075f0b tags:
``` python
```
......
%% Cell type:markdown id:d5e9bc28 tags:
# Upload records on the OSSR
%% Cell type:markdown id:a4123841 tags:
To upload records on the OSSR, you may use the [Zenodo client](https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/blob/master/eossr/api/zenodo.py).
The client is also used by the continuous integration to automatise project's uploads from GitLab to Zenodo [check the EOSSR scripts here](https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/tree/master/eossr/scripts).
**However**, to upload records to the OSSR, you **will need** to use your Zenodo token ([create one](https://zenodo.org/account/settings/applications/tokens/new/)).
%% Cell type:code id:52aedbb2 tags:
``` python
token = ''
```
%% Cell type:code id:6fcd7ef2 tags:
``` python
import json
from eossr.api.zenodo import ZenodoAPI
# Please note that for this demo we are using Zenodo Sandbox.
z = ZenodoAPI(access_token=token, sandbox=True)
```
%% Cell type:code id:24eecce0 tags:
``` python
```
%% Cell type:markdown id:c13a5232 tags:
## Create a new entry
First we would need to create a new entry
%% Cell type:code id:83075f0b tags:
``` python
new_entry = z.create_new_entry()
```
%% Cell type:code id:84173c5d tags:
``` python
```
%% Cell type:markdown id:fcd8e90c tags:
### Zenodo API answer handler
We have also developped a REST API response client to manage the answers from the Zenodo API.
%% Cell type:code id:22f8e2b2 tags:
``` python
from eossr.api.zenodo.http_status import ZenodoHTTPStatus
```
%% Cell type:code id:07fd3360 tags:
``` python
status_new_entry = ZenodoHTTPStatus(new_entry.status_code, new_entry.json())
print(status_new_entry)
```
%% Output
HTTP Status Code: 201 - Created.
Request succeeded. Response included. Usually sent for POST requests.
%% Cell type:markdown id:b8761071 tags:
## Add files to the entry
Then we upload to the new entry a file (let's say a `codemeta.json` metadata file)
%% Cell type:code id:74351af6 tags:
``` python
deposit_id = new_entry.json()['id']
upload_file = z.upload_file_entry(deposit_id,
name_file='codemeta.json',
path_file='../../codemeta.json')
```
%% Cell type:code id:a836e493 tags:
``` python
status_upload = ZenodoHTTPStatus(upload_file.status_code, upload_file.json())
print(status_upload)
```
%% Output
HTTP Status Code: 200 - OK.
Request succeeded. Response included. Usually sent for GET/PUT/PATCH requests.
%% Cell type:code id:7809adba tags:
``` python
```
%% Cell type:markdown id:aadbd21e tags:
## Add metadata to the entry
We add metadata to the Zenodo entry using the EOSSR codemeta2zenodo conversor
%% Cell type:code id:c622d5c9 tags:
``` python
from eossr.metadata.codemeta2zenodo import parse_codemeta_and_write_zenodo_metadata_file
```
%% Cell type:code id:d0b1af6d tags:
``` python
parse_codemeta_and_write_zenodo_metadata_file(codemeta_filename='../../codemeta.json',
zenodo_outname='.zenodo.json')
```
%% Cell type:code id:9f3cfedc tags:
``` python
# Let's have a look to the output to the .zenodo.json file
! cat .zenodo.json
```
%% Output
{
"access_right": "open",
"communities": [
{
"identifier": "escape2020"
}
],
"creators": [
{
"affiliation": "LAPP, CNRS",
"name": "Vuillaume, Thomas",
"orcid": "0000-0002-5686-2078"
},
{
"affiliation": "LAPP, CNRS",
"name": "Garcia, Enrique",
"orcid": "0000-0003-2224-4594"
},
{
"affiliation": "GSI",
"name": "Tacke, Christian",
"orcid": "0000-0002-5321-8404"
},
{
"affiliation": "ECAP, FAU (Nuremberg, Germany)",
"name": "G\u00e1l, Tam\u00e1s",
"orcid": "0000-0001-7821-8673"
}
],
"description": "ESCAPE OSSR library",
"grants": [
{
"id": "10.13039/501100000780::824064"
}
],
"keywords": [
"jupyter-notebook"
],
"language": "eng",
"license": "MIT",
"notes": "Release Notes: ",
"publication_date": "2021-09-23",
"title": "eossr",
"upload_type": "software",
"version": "v0.2"
}
%% Cell type:code id:7c37dc70 tags:
``` python
with open('.zenodo.json') as f:
zenodo_metadata = json.load(f)
update_metadata_info = z.update_metadata_entry(deposit_id, json_metadata=zenodo_metadata)
```
%% Cell type:code id:ae6554d9 tags:
``` python
status_metadata = ZenodoHTTPStatus(update_metadata_info.status_code, update_metadata_info.json())
print(status_metadata)
```
%% Output
HTTP Status Code: 200 - OK.
Request succeeded. Response included. Usually sent for GET/PUT/PATCH requests.
%% Cell type:code id:1f67832d tags:
``` python
```
%% Cell type:markdown id:c6a4df85 tags:
### Check the content of the new entry
The `request` answers contain all the information of the current upload
%% Cell type:code id:4389a073 tags:
``` python
update_metadata_info.json()
```
%% Output
{'conceptrecid': '925643',
'created': '2021-09-28T08:24:19.636324+00:00',
'doi': '',
'doi_url': 'https://doi.org/',
'files': [{'checksum': '20d7ce7abc06541bed2655f19edfb956',
'filename': 'codemeta.json',
'filesize': 3271,
'id': '635a061a-dbad-42dc-af7e-4815597e4570',
'links': {'download': 'https://sandbox.zenodo.org/api/files/5c5ca785-e9a0-4b29-8c84-9b75f37ac963/codemeta.json',
'self': 'https://sandbox.zenodo.org/api/deposit/depositions/925644/files/635a061a-dbad-42dc-af7e-4815597e4570'}}],
'id': 925644,
'links': {'bucket': 'https://sandbox.zenodo.org/api/files/5c5ca785-e9a0-4b29-8c84-9b75f37ac963',
'discard': 'https://sandbox.zenodo.org/api/deposit/depositions/925644/actions/discard',
'edit': 'https://sandbox.zenodo.org/api/deposit/depositions/925644/actions/edit',
'files': 'https://sandbox.zenodo.org/api/deposit/depositions/925644/files',
'html': 'https://sandbox.zenodo.org/deposit/925644',
'latest_draft': 'https://sandbox.zenodo.org/api/deposit/depositions/925644',
'latest_draft_html': 'https://sandbox.zenodo.org/deposit/925644',
'newversion': 'https://sandbox.zenodo.org/api/deposit/depositions/925644/actions/newversion',
'publish': 'https://sandbox.zenodo.org/api/deposit/depositions/925644/actions/publish',
'registerconceptdoi': 'https://sandbox.zenodo.org/api/deposit/depositions/925644/actions/registerconceptdoi',
'self': 'https://sandbox.zenodo.org/api/deposit/depositions/925644'},
'metadata': {'access_right': 'open',
'communities': [{'identifier': 'escape2020'}],
'creators': [{'affiliation': 'LAPP, CNRS',
'name': 'Vuillaume, Thomas',
'orcid': '0000-0002-5686-2078'},
{'affiliation': 'LAPP, CNRS',
'name': 'Garcia, Enrique',
'orcid': '0000-0003-2224-4594'},
{'affiliation': 'GSI',
'name': 'Tacke, Christian',
'orcid': '0000-0002-5321-8404'},
{'affiliation': 'ECAP, FAU (Nuremberg, Germany)',
'name': 'Gál, Tamás',
'orcid': '0000-0001-7821-8673'}],
'description': 'ESCAPE OSSR library',
'doi': '',
'grants': [{'id': '10.13039/501100000780::824064'}],
'keywords': ['jupyter-notebook'],
'language': 'eng',
'license': 'MIT',
'notes': 'Release Notes:',
'prereserve_doi': {'doi': '10.5072/zenodo.925644', 'recid': 925644},
'publication_date': '2021-09-23',
'title': 'eossr',
'upload_type': 'software',
'version': 'v0.2'},
'modified': '2021-09-28T08:24:20.541025+00:00',
'owner': 34397,
'record_id': 925644,
'state': 'unsubmitted',
'submitted': False,
'title': 'eossr'}
%% Cell type:markdown id:a62874c5 tags:
We can check the files that we have already uploaded
%% Cell type:code id:f0328d01 tags:
``` python
update_metadata_info.json()['files']
```
%% Output
[{'checksum': '20d7ce7abc06541bed2655f19edfb956',
'filename': 'codemeta.json',
'filesize': 3271,
'id': '635a061a-dbad-42dc-af7e-4815597e4570',
'links': {'download': 'https://sandbox.zenodo.org/api/files/5c5ca785-e9a0-4b29-8c84-9b75f37ac963/codemeta.json',
'self': 'https://sandbox.zenodo.org/api/deposit/depositions/925644/files/635a061a-dbad-42dc-af7e-4815597e4570'}}]
%% Cell type:markdown id:ae3ccdb8 tags:
Or the metadata updated
%% Cell type:code id:7111b368 tags:
``` python
update_metadata_info.json()['metadata']
```
%% Output
{'access_right': 'open',
'communities': [{'identifier': 'escape2020'}],
'creators': [{'affiliation': 'LAPP, CNRS',
'name': 'Vuillaume, Thomas',
'orcid': '0000-0002-5686-2078'},
{'affiliation': 'LAPP, CNRS',
'name': 'Garcia, Enrique',
'orcid': '0000-0003-2224-4594'},
{'affiliation': 'GSI',
'name': 'Tacke, Christian',
'orcid': '0000-0002-5321-8404'},
{'affiliation': 'ECAP, FAU (Nuremberg, Germany)',
'name': 'Gál, Tamás',
'orcid': '0000-0001-7821-8673'}],
'description': 'ESCAPE OSSR library',
'doi': '',
'grants': [{'id': '10.13039/501100000780::824064'}],
'keywords': ['jupyter-notebook'],
'language': 'eng',
'license': 'MIT',
'notes': 'Release Notes:',
'prereserve_doi': {'doi': '10.5072/zenodo.925644', 'recid': 925644},
'publication_date': '2021-09-23',
'title': 'eossr',
'upload_type': 'software',
'version': 'v0.2'}
%% Cell type:code id:30337677 tags:
``` python
```
%% Cell type:markdown id:fa18756a tags:
## Publish the entry
Finally we can publish the new entry.
However in this case, because this is just a demo, we will just erase the entry.
%% Cell type:code id:6a9f1f09 tags:
``` python
# In case you would like to publish the entry, just uncomment the following lines.
# # publish = z.publish_entry(deposit_id)
# # status = ZenodoHTTPStatus(publish.status_code, publish.json())
```
%% Cell type:code id:ec4570b6 tags:
``` python
erase_entry = z.erase_entry(deposit_id)
```
%% Cell type:code id:3691016e tags:
``` python
ZenodoHTTPStatus(erase_entry.status_code).description
```
%% Output
'Request succeeded. No response included. Usually sent for DELETE requests'
%% Cell type:code id:406541ef tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment