From a9068a80201a743595eeb94b08de2dfd8e1c2138 Mon Sep 17 00:00:00 2001 From: Alban Gaignard Date: Mon, 29 Jan 2024 16:51:00 +0100 Subject: [PATCH] many fixes in the dashboard (stats, etc.) --- src/webapp/app.py | 34 +++++++++---- src/webapp/templates/index.html | 63 +++++++++++++++++++++++- src/webapp/templates/layout.html | 3 ++ src/webapp/templates/nav.html | 9 ++-- src/webapp/templates/quick_curation.html | 4 +- src/webapp/templates/stats.html | 2 +- 6 files changed, 97 insertions(+), 18 deletions(-) diff --git a/src/webapp/app.py b/src/webapp/app.py index e256d39..c4f82ad 100644 --- a/src/webapp/app.py +++ b/src/webapp/app.py @@ -13,12 +13,12 @@ } g = ConjunctiveGraph() -g.load('https://raw.githubusercontent.com/edamontology/edamontology/master/EDAM_dev.owl', format='xml') +g.parse('https://raw.githubusercontent.com/edamontology/edamontology/master/EDAM_dev.owl', format='xml') g.bind('edam', Namespace('http://edamontology.org/')) print(str(len(g)) + ' triples in the EDAM triple store') g_last_stable = ConjunctiveGraph() -g_last_stable.load('http://edamontology.org/EDAM.owl', format='xml') +g_last_stable.parse('http://edamontology.org/EDAM.owl', format='xml') ## Build an index to retrieve term labels idx_label = {} @@ -37,11 +37,25 @@ @app.route('/') def index(): - return render_template('index.html') + res = get_edam_numbers(g) + res_last = get_edam_numbers(g_last_stable) + + return render_template('index.html', + topics=res['nb_topics'], + operations=res['nb_operations'], + data=res['nb_data'], + formats=res['nb_formats'], + new_topics=res['nb_topics'] - res_last['nb_topics'], + new_operations=res['nb_operations'] - res_last['nb_operations'], + new_data=res['nb_data'] - res_last['nb_data'], + new_formats=res['nb_formats'] - res_last['nb_formats'] + ) @app.route('/expert_curation') def expert_curation(): - return render_template('index.html') + # 1. select a topic + # 2. select topic-specific curation actions (subclasses of the identified topic) + return render_template('expert_curation.html') def get_edam_numbers(g): query_op = """ @@ -90,13 +104,13 @@ def edam_stats(): return render_template('stats.html', topics = res['nb_topics'], - operations = res['nb_topics'], - data = res['nb_topics'], - format = res['nb_topics'], + operations = res['nb_operations'], + data = res['nb_data'], + formats = res['nb_formats'], new_topics = res['nb_topics'] - res_last['nb_topics'], new_operations = res['nb_operations'] - res_last['nb_operations'], new_data = res['nb_data'] - res_last['nb_data'], - new_formats = res['nb_formats'] - res_last['nb_formats'], + new_formats = res['nb_formats'] - res_last['nb_formats'] ) @app.route('/edam_validation') @@ -147,7 +161,7 @@ def quick_curation(): count_no_wikipedia = str(r["nb_no_wikipedia"]) ######### - q_no_publication_entries = """ + q_no_wikipedia_all = """ SELECT ?c ?term WHERE { ?c rdfs:subClassOf+ edam:topic_0003 ; rdfs:label ?term . @@ -158,7 +172,7 @@ def quick_curation(): } . } """ - results = g.query(q_no_publication_entries, initNs=ns) + results = g.query(q_no_wikipedia_all, initNs=ns) no_wikipedia = [] for r in results: no_wikipedia.append({"term": r["term"], "class": r["c"]}) diff --git a/src/webapp/templates/index.html b/src/webapp/templates/index.html index 133287a..4d67451 100644 --- a/src/webapp/templates/index.html +++ b/src/webapp/templates/index.html @@ -6,7 +6,68 @@ {% block body %} -

EDAM ontology development dashboard

+

Welcome to the EDAM ontology dashboard

+
+

EDAM concepts

+ + +
+ +
+

From the last stable release

+ + +
{% endblock %} \ No newline at end of file diff --git a/src/webapp/templates/layout.html b/src/webapp/templates/layout.html index 227ac67..009e389 100644 --- a/src/webapp/templates/layout.html +++ b/src/webapp/templates/layout.html @@ -6,6 +6,9 @@ + diff --git a/src/webapp/templates/nav.html b/src/webapp/templates/nav.html index 0e9cc88..e585ed7 100644 --- a/src/webapp/templates/nav.html +++ b/src/webapp/templates/nav.html @@ -1,16 +1,17 @@ \ No newline at end of file diff --git a/src/webapp/templates/quick_curation.html b/src/webapp/templates/quick_curation.html index 5ca50fd..5ed8c91 100644 --- a/src/webapp/templates/quick_curation.html +++ b/src/webapp/templates/quick_curation.html @@ -10,11 +10,11 @@

Finding top priority curation needs

In this demo, we randomly pick 5 classes from the EDAM ontology that need to be curated.

-

{{ count_no_wikipedia }} EDAM topics with missing wikipedia +

{{ count_no_wikipedia }} EDAM topics with missing wikipedia links.

{% for item in missing_wikipedia %} - {{ item.term }} + {{ item.term }} {% endfor %}
diff --git a/src/webapp/templates/stats.html b/src/webapp/templates/stats.html index f5dd693..c8ac48e 100644 --- a/src/webapp/templates/stats.html +++ b/src/webapp/templates/stats.html @@ -34,7 +34,7 @@

EDAM concepts

Format

-

{{ format }}

+

{{ formats }}