Skip to content
Snippets Groups Projects
Commit 80e3e05f authored by Vuillaume's avatar Vuillaume
Browse files

Merge branch 'ossr_stats' into 'master'

move ossr stats in docs only and hide cellss

See merge request !65
parents 4233f188 92edc777
No related branches found
No related tags found
1 merge request!65move ossr stats in docs only and hide cellss
Pipeline #139667 passed
...@@ -14,6 +14,7 @@ Welcome to eOSSR's documentation! ...@@ -14,6 +14,7 @@ Welcome to eOSSR's documentation!
license license
docstring docstring
metadata metadata
notebooks/ossr_statistics.ipynb
examples examples
snippets snippets
......
%% Cell type:code id:457f7641 tags: %% Cell type:markdown id:6f9a9077 tags:
# OSSR Statistics
%% Cell type:code id:dbb762f7 tags:
``` python ``` python
from eossr.api import get_ossr_records from eossr.api import get_ossr_records, get_zenodo_records
from IPython.display import Markdown as md from IPython.display import Markdown as md
from datetime import date from datetime import date
``` ```
%% Cell type:code id:b9668e64 tags: %% Cell type:code id:b9668e64 tags:
``` python ``` python
title = f"# OSSR statistics on the {date.today()}" title = f"## OSSR statistics generated the {date.today()}"
ossr_records = get_ossr_records() ossr_records = get_ossr_records()
stats_names = ['downloads', 'unique_downloads', 'views', 'unique_views', ] stats_names = ['downloads', 'unique_downloads', 'views', 'unique_views', ]
sum_stats = {key: sum([int(rec.data['stats'][key]) for rec in ossr_records]) for key in stats_names} sum_stats = {key: sum([int(rec.data['stats'][key]) for rec in ossr_records]) for key in stats_names}
text = f"## There are {len(ossr_records)} records in the OSSR.\n" text = f"## There are {len(ossr_records)} records in the OSSR.\n"
for key, value in sum_stats.items(): for key, value in sum_stats.items():
text+=f"{key.replace('_', ' ')}: {value}\n\n" text+=f"{key.replace('_', ' ')}: {value}\n\n"
```
%% Cell type:code id:2f5effcb tags:
``` python
``` ```
%% Cell type:code id:fe656e0b tags: %% Cell type:code id:fe656e0b tags:
``` python ``` python
md(title) md(title)
``` ```
%% Cell type:code id:df351e32 tags: %% Cell type:code id:df351e32 tags:
``` python ``` python
md(text) md(text)
``` ```
%% Cell type:code id:d0e84058 tags: %% Cell type:code id:d0e84058 tags:
``` python ``` python
escape2020_community_records = get_zenodo_records(communities='escape2020')
url_escape2020_not_ossr = 'https://zenodo.org/communities/escape2020/search?page=1&size=20&q=&type=publication&type=lesson&type=poster'
text = f"**Note that there are also {len(escape2020_community_records) - len(ossr_records)} records in the `escape2020` community that are not software or datasets.**\n\n"
text += f"You may find them [directly on Zenodo]({url_escape2020_not_ossr})"
```
%% Cell type:code id:696416cf tags:
``` python
md(text)
```
%% Cell type:code id:ae5204cf 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