diff --git a/examples/notebooks/ossr_statistics.ipynb b/examples/notebooks/ossr_statistics.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..97ac51cbf26108d6e1bc82053d96856baa09e882 --- /dev/null +++ b/examples/notebooks/ossr_statistics.ipynb @@ -0,0 +1,91 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "457f7641", + "metadata": {}, + "outputs": [], + "source": [ + "from eossr.api import get_ossr_records\n", + "from IPython.display import Markdown as md\n", + "from datetime import date" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b9668e64", + "metadata": {}, + "outputs": [], + "source": [ + "title = f\"# OSSR statistics on the {date.today()}\"\n", + "\n", + "ossr_records = get_ossr_records()\n", + "stats_names = ['downloads', 'unique_downloads', 'views', 'unique_views', ]\n", + "sum_stats = {key: sum([int(rec.data['stats'][key]) for rec in ossr_records]) for key in stats_names}\n", + "\n", + "text = f\"## There are {len(ossr_records)} records in the OSSR.\\n\"\n", + "for key, value in sum_stats.items():\n", + " text+=f\"{key.replace('_', ' ')}: {value}\\n\\n\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2f5effcb", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fe656e0b", + "metadata": {}, + "outputs": [], + "source": [ + "md(title)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "df351e32", + "metadata": {}, + "outputs": [], + "source": [ + "md(text)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d0e84058", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.2" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}