From de3eefb2125c22661950ce21c2524b83e0688ea8 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 25 Jun 2018 10:46:21 -0700 Subject: stats page --- python/fatcat/routes.py | 5 ++ python/fatcat/templates/stats.html | 104 +++++++++++++++++++++++++++++++++++++ python/tests/routes.py | 3 ++ 3 files changed, 112 insertions(+) create mode 100644 python/fatcat/templates/stats.html (limited to 'python') diff --git a/python/fatcat/routes.py b/python/fatcat/routes.py index 8fe74a2d..77aecff3 100644 --- a/python/fatcat/routes.py +++ b/python/fatcat/routes.py @@ -156,6 +156,11 @@ def editor_changelog(username): return render_template('editor_changelog.html', editor=editor, changelog_entries=changelog_entries) +@app.route('/stats', methods=['GET']) +def stats_view(): + stats = api.get_stats() + return render_template('stats.html', stats=stats.extra) + ### Search ################################################################## @app.route('/release/search', methods=['GET', 'POST']) diff --git a/python/fatcat/templates/stats.html b/python/fatcat/templates/stats.html new file mode 100644 index 00000000..6a37dcee --- /dev/null +++ b/python/fatcat/templates/stats.html @@ -0,0 +1,104 @@ +{% extends "base.html" %} +{% block body %} + +

Entity Statistics

+ +
+
+ {{ stats.entity_counts.work }} +
+
+ Works +
+
+ +
+ +
+
+ {{ stats.entity_counts.release }} +
+
+ Releases +
+
+ +
+
+ {{ stats.releases_with_dois }} +
+
+ ... with DOIs +
+
+ +
+
+ {{ stats.releases_with_dois }} +
+
+ ... with a File +
+
+ +
+ +
+
+ {{ stats.entity_counts.container }} +
+
+ Containers +
+
+ +
+
+ {{ stats.containers_with_issnls }} +
+
+ ... with an ISSN-L +
+
+ +
+ +
+
+ {{ stats.entity_counts.creator }} +
+
+ Creators +
+
+ +
+
+ {{ stats.creators_with_orcids }} +
+
+ ... with an ORCID +
+
+ +
+ +
+
+ {{ stats.entity_counts.file }} +
+
+ Files +
+
+ +
+
+ {{ stats.files_with_releases }} +
+
+ ... with a Release +
+
+ +{% endblock %} diff --git a/python/tests/routes.py b/python/tests/routes.py index f92df54c..ec4eaf12 100644 --- a/python/tests/routes.py +++ b/python/tests/routes.py @@ -88,3 +88,6 @@ def test_all_views(app): rv = app.get('/editor/admin/changelog') assert rv.status_code == 200 + + rv = app.get('/stats') + assert rv.status_code == 200 -- cgit v1.2.3