Skip to content

Commit

Permalink
many fixes in the dashboard (stats, etc.)
Browse files Browse the repository at this point in the history
  • Loading branch information
albangaignard committed Jan 29, 2024
1 parent c07a0be commit a9068a8
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 18 deletions.
34 changes: 24 additions & 10 deletions src/webapp/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand All @@ -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 = """
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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 .
Expand All @@ -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"]})
Expand Down
63 changes: 62 additions & 1 deletion src/webapp/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,68 @@

{% block body %}

<h1 class="title">EDAM ontology development dashboard</h1>
<h1 class="title">Welcome to the EDAM ontology dashboard</h1>

<section class="section">
<h2 class="subtitle">EDAM concepts</h2>

<nav class="level is-mobile">
<div class="level-item has-text-centered">
<div>
<p class="heading">Topics</p>
<p class="title">{{ topics }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Operations</p>
<p class="title">{{ operations }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Data</p>
<p class="title">{{ data }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Format</p>
<p class="title">{{ formats }}</p>
</div>
</div>
</nav>
</section>

<section class="section">
<h2 class="subtitle">From the last stable release</h2>

<nav class="level is-mobile">
<div class="level-item has-text-centered">
<div>
<p class="heading">New topics</p>
<p class="title">{{ new_topics }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">New operations</p>
<p class="title">{{ new_operations }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">New data</p>
<p class="title">{{ new_data }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">New format</p>
<p class="title">{{ new_formats }}</p>
</div>
</div>
</nav>
</section>

{% endblock %}
3 changes: 3 additions & 0 deletions src/webapp/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/bulma.min.css') }}" />
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/app.css')}}">
<script type="application/ld+json">
{"@context": {"sc": "https://schema.org/", "dct": "http://purl.org/dc/terms/", "prov": "http://www.w3.org/ns/prov#"}, "@type": ["sc:SoftwareApplication", "prov:Entity"], "@id": "https://github.com/IFB-ElixirFr/EDAM-dashboard", "dct:conformsTo": "https://bioschemas.org/profiles/ComputationalTool/1.0-RELEASE", "sc:name": "EDAM-dashboard", "sc:applicationCategory": "Bioinformatics", "sc:applicationSubCategory": "Ontology development"}
</script>
</head>

<body>
Expand Down
9 changes: 5 additions & 4 deletions src/webapp/templates/nav.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<aside class="menu">
<ul class="menu-list">
<li><a href="{{ url_for('index') }}">Home</a></li>
<li><a href="{{ url_for('index') }}">Visualizations</a></li>
</ul>
<p class="menu-label">Contributors</p>
<p class="menu-label">I'm a contributor</p>
<ul class="menu-list">
<li><a href="{{ url_for('quick_curation') }}">Quick curation</a></li>
<li><a href="{{ url_for('expert_curation') }}">In my field</a></li>
</ul>
<p class="menu-label">Developers</p>
<p class="menu-label">I'm a developers</p>
<ul class="menu-list">
<li><a href="{{ url_for('edam_stats') }}">Statistics</a></li>
<li><a href="{{ url_for('edam_validation') }}">Online validation</a></li>
<!-- <li><a href="{{ url_for('edam_stats') }}">Statistics</a></li>-->
<!-- <li><a href="{{ url_for('edam_validation') }}">Online validation</a></li>-->
<li><a href="{{ url_for('edam_last_report') }}">Last validation report</a></li>
</ul>
</aside>
4 changes: 2 additions & 2 deletions src/webapp/templates/quick_curation.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ <h1 class="title">Finding top priority curation needs</h1>
<p>In this demo, we randomly pick 5 classes from the EDAM ontology that need to be curated.</p>

<section class="section">
<h2 class="subtitle"> <span class="tag is-light">{{ count_no_wikipedia }} </span> EDAM topics with missing wikipedia
<h2 class="subtitle"> <span class="tag is-black">{{ count_no_wikipedia }} </span> EDAM topics with missing wikipedia
links. </h2>
<div class="buttons">
{% for item in missing_wikipedia %}
<a href="{{ item.class }}" class="button is-danger is-rounded">{{ item.term }}</a>
<a href="{{ item.class }}" class="button is-danger is-rounded" target="_blank" >{{ item.term }}</a>
{% endfor %}
</div>
</section>
Expand Down
2 changes: 1 addition & 1 deletion src/webapp/templates/stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ <h2 class="subtitle">EDAM concepts</h2>
<div class="level-item has-text-centered">
<div>
<p class="heading">Format</p>
<p class="title">{{ format }}</p>
<p class="title">{{ formats }}</p>
</div>
</div>
</nav>
Expand Down

0 comments on commit a9068a8

Please sign in to comment.