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

syntax typos in notebooks

parent f0b02cc8
No related branches found
No related tags found
1 merge request!47syntax typos in notebooks
Pipeline #137861 passed
%% Cell type:markdown id:4a25feec tags:
# Find ESCAPE OSSR records
**Please note** that to fetch information from the OSSR, **token is needed**.
**Please note**; to fetch information from the OSSR using the EOSSR API, **NO Zenodo token is needed**.
The EOSSR API will get the public information that is available in the repository.
%% Cell type:markdown id:5e008b43 tags:
## Getting all the records
%% Cell type:code id:dbde9b19 tags:
``` python
from eossr.api import get_ossr_records
```
%% Cell type:code id:2fe017bc tags:
``` python
ossr_records = get_ossr_records()
```
%% Cell type:code id:5eb34293 tags:
``` python
len(ossr_records)
```
%% Output
16
%% Cell type:markdown id:93b033a0 tags:
Records are objects containing data and metadata sent by Zenodo API
%% Cell type:code id:f88ebfd3 tags:
``` python
record = ossr_records[0]
```
%% Cell type:code id:988b95c7 tags:
``` python
print(record)
```
%% Output
Record #5524913 : eossr
%% Cell type:code id:6bbe7db1 tags:
``` python
record
```
%% Output
{
"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:
``` python
```
%% Cell type:markdown id:cb5f905e tags:
You can use `print_info` to display minimal information about a `Record`:
%% Cell type:code id:a9ec3d38 tags:
``` python
record.print_info()
```
%% Output
=== Record #5524913 ===
Title: eossr ===
DOI: 10.5281/zenodo.5524913
URL: https://zenodo.org/record/5524913
Description:
<p>ESCAPE OSSR library</p>
<ul>
<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>
</ul>
%% Cell type:code id:28ad4039 tags:
``` python
```
%% Cell type:markdown id:21384a7d tags:
## Specific search
%% Cell type:markdown id:7f1a9209 tags:
### Using strings
%% Cell type:code id:3a3dc135 tags:
``` python
escape_records = get_ossr_records('escape')
```
%% Cell type:code id:0aa0deec tags:
``` python
for r in escape_records:
print(r)
```
%% Output
Record #3743489 : ESCAPE the maze
Record #4923992 : ESCAPE template project
Record #5093909 : ESCAPE Data Science Summer School 2021
Record #5524913 : eossr
Record #4044010 : EOSC - a tool for enabling Open Science in Europe
%% Cell type:markdown id:c4b08fde tags:
### Using keywords
%% Cell type:code id:f5cb8f77 tags:
``` python
cta_records = get_ossr_records(keywords='CTA')
len(cta_records)
```
%% Output
2
%% Cell type:code id:019f21eb tags:
``` python
for record in cta_records:
print(record)
```
%% Output
Record #4419866 : IndexedConv/IndexedConv: v1.3
Record #3659184 : ctapipe_io_mchdf5
%% Cell type:code id:5f304419 tags:
``` python
```
%% Cell type:markdown id:da77c97b tags:
### Directly from its id
if you happen to know exactly the record you are looking for
%% Cell type:code id:eb048c8f tags:
``` python
from eossr.api.zenodo import get_record
```
%% Cell type:code id:8a162ccb tags:
``` python
record = get_record(4923992)
```
%% Cell type:code id:81b76847 tags:
``` python
print(record)
```
%% Output
Record #4923992 : ESCAPE template project
%% Cell type:code id:25ec9b5a tags:
``` python
```
%% Cell type:markdown id:a85d8056 tags:
# Records methods
## `Record` methods
There are other useful methods to a Record class.
%% Cell type:markdown id:9083a824 tags:
## Getting CodeMeta metadata
If a `codemeta.json` file has been added to the record, one can retrieve it directly:
%% Cell type:code id:1431eb41 tags:
``` python
record.get_codemeta()
```
%% Output
{'@context': 'https://doi.org/10.5063/schema/codemeta-2.0',
'@type': 'SoftwareSourceCode',
'name': 'ESCAPE template project',
'description': 'An example of software project template for the ESCAPE 2020 European project',
'keywords': ['ESCAPE', 'jupyter-notebook'],
'license': 'https://spdx.org/licenses/MIT',
'identifier': '10.5281/zenodo.3884963',
'softwareVersion': 'v2.2',
'developmentStatus': 'active',
'codeRepository': 'https://gitlab.in2p3.fr/escape2020/wp3/template_project_escape',
'runtimePlatform': 'Python >3.6',
'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',
'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',
'datePublished': '2021-06-10',
'dateModified': '2021-05-25',
'isAccessibleForFree': True,
'isPartOf': ['https://gitlab.in2p3.fr/escape2020',
'https://projectescape.eu/'],
'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',
'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',
'programmingLanguage': [{'@type': 'ComputerLanguage',
'name': 'Python',
'url': 'https://www.python.org/'},
{'@type': 'ComputerLanguage',
'name': 'Bash',
'url': 'https://www.gnu.org/software/bash/'}],
'softwareRequirements': [{'@type': 'SoftwareApplication',
'identifier': 'numpy',
'name': 'numpy',
'softwareVersion': '1.18.1'},
{'@type': 'SoftwareApplication',
'identifier': 'requests',
'name': 'requests',
'softwareVersion': '>=3.6'},
{'@type': 'SoftwareApplication',
'identifier': 'pytest',
'name': 'pytest',
'softwareVersion': '>=5.4.2'},
{'@type': 'SoftwareApplication',
'identifier': 'pyyaml',
'name': 'pyyaml',
'softwareVersion': '>=5.3.1'}],
'maintainer': {'@type': 'Person',
'@id': 'https://orcid.org/0000-0003-2224-4594',
'givenName': 'Enrique',
'familyName': 'Garcia',
'email': 'garcia@lapp.in2p3.fr',
'affiliation': {'@type': 'Organization', 'name': 'LAPP, CNRS'}},
'author': [{'@type': 'Person',
'@id': 'https://orcid.org/0000-0003-2224-4594',
'givenName': 'Enrique',
'familyName': 'Garcia',
'email': 'garcia@lapp.in2p3.fr',
'affiliation': {'@type': 'Organization', 'name': 'LAPP, CNRS'}}],
'contributor': [{'@type': 'Person',
'@id': 'https://orcid.org/0000-0002-5686-2078',
'givenName': 'Thomas',
'familyName': 'Vuillaume',
'email': 'vuillaume@lapp.in2p3.fr',
'affiliation': {'@type': 'Organization', 'name': 'LAPP, CNRS'}}],
'funder': [{'@type': 'Organization',
'name': 'ESCAPE: European Science Cluster of Astronomy & Particle physics ESFRI research infrastructures',
'funder': {'@type': 'Organization',
'@id': 'https://doi.org/10.13039/501100000780',
'name': 'European Commission'}}],
'funding': '824064'}
%% Cell type:code id:7a1d0f77 tags:
``` python
```
%% Cell type:markdown id:64c43dd6 tags:
## MyBinder integration
You can get a mybinder URL directly from a record:
%% Cell type:code id:7cf9bcdb tags:
``` python
record.get_mybinder_url()
```
%% Output
'https://mybinder.org/v2/zenodo/10.5281/zenodo.3572654'
%% Cell type:code id:622e44d9 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