From 8845894b130c10deac00aac2ec154315dbcb2f81 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Mon, 25 Apr 2022 17:39:40 +0200 Subject: [PATCH 1/4] Add form to matches page --- gilda/app/app.py | 11 ++- gilda/app/templates/base.html | 113 +++++++++++++++++++++++++++++-- gilda/app/templates/home.html | 91 +------------------------ gilda/app/templates/matches.html | 89 +++++++++++------------- 4 files changed, 160 insertions(+), 144 deletions(-) diff --git a/gilda/app/app.py b/gilda/app/app.py index 7574dd2b..c9b657bc 100644 --- a/gilda/app/app.py +++ b/gilda/app/app.py @@ -71,8 +71,15 @@ def home(): form = GroundForm() if form.validate_on_submit(): matches = form.get_matches() - return render_template('matches.html', matches=matches, version=version, - text=form.text.data, context=form.context.data) + return render_template( + 'matches.html', + matches=matches, + version=version, + text=form.text.data, + context=form.context.data, + # Add a new form that doesn't auto-populate + form=GroundForm(formdata=None), + ) return render_template('home.html', form=form, version=version) diff --git a/gilda/app/templates/base.html b/gilda/app/templates/base.html index d3b8d682..8a6d0e73 100644 --- a/gilda/app/templates/base.html +++ b/gilda/app/templates/base.html @@ -7,10 +7,15 @@ {% block head %} {{ super() }} + + {% endblock %} {% block content %} -
@@ -27,9 +32,7 @@

Gilda Grounding Service

-
- {% block gcontent %}{% endblock %} -
+ {% block gcontent %}{% endblock %}

Gilda is developed by INDRA labs which is part of the Gilda Grounding Service

{% endblock %} + +{% block scripts %} + {{ super() }} + + + + +{% endblock %} + +{% macro render_form(form) %} +
+
+

Gilda grounding input

+
+
+
+ {{ wtf.form_field(form.text) }} + {{ wtf.form_field(form.context) }} + {{ wtf.form_field(form.organisms, class_="form-control") }} + {{ wtf.form_field(form.submit, class="btn btn-primary") }} +
+
+ + + + + + +
+{% endmacro %} diff --git a/gilda/app/templates/home.html b/gilda/app/templates/home.html index b06db36e..03bbde6a 100644 --- a/gilda/app/templates/home.html +++ b/gilda/app/templates/home.html @@ -1,93 +1,6 @@ {% extends "base.html" %} -{% block head %} - {{ super() }} - - -{% endblock %} - {% block gcontent %} - - - - - -
-

Gilda grounding input

-
-
-
- {{ wtf.form_field(form.text) }} - {{ wtf.form_field(form.context) }} - {{ wtf.form_field(form.organisms, class_="form-control") }} - {{ wtf.form_field(form.submit, class="btn btn-primary")}} -
-
- - - - - - + {{ render_form(form) }} {% endblock %} + diff --git a/gilda/app/templates/matches.html b/gilda/app/templates/matches.html index 5065e4dd..a09434e3 100644 --- a/gilda/app/templates/matches.html +++ b/gilda/app/templates/matches.html @@ -1,54 +1,45 @@ {% extends "base.html" %} {% block gcontent %} -
-

Gilda grounding results

-
-
-

- Results for {{ text }} - {% if context %} with context - {{ context }}{% endif %}. -

-

- The table below contains the retrieved Groundings ordered by descreasing - score. The standard name for the entry is given in the Name column. - Additional groundings are provided for some entries where a match was - found to an equivalent term in a namespace different from the primary - grounding's. -

-
- - - - - - - - - - - {% for match in matches %} - - {% set match_curie = match.term.get_curie() %} - - - - +
GroundingNameScoreAdditional Groundings
- - {{ match_curie }} - - {{ match['term']['entry_name'] }}{{ match['score'] | round(4)}} - {% for xref_curie, xref_url in match.get_grounding_dict().items() %} - {% if xref_curie != match_curie %} - - {{ xref_curie }} - - {% endif %} + {{ render_form(form) }} + +
+
+

Gilda grounding results

+
+
+

+ Results for {{ text }} + {% if context %} with context + {{ context }}{% endif %} +

+

+ The table below contains the retrieved Groundings ordered by + descreasing score. The standard name for the entry is given in + the Name column. Additional groundings are provided for some + entries where a match was found to an equivalent term in a + namespace different from the primary grounding's. +

+
+ + + + + + + + + + + {% for match in matches %} + + + + + + {% endfor %} - - - {% endfor %} - -
DatabaseIdentifierNameScore
{{ match['term']['db'] }}{{ match['term']['id'] }}{{ match['term']['entry_name'] }}{{ match['score'] | round(4) }}
+
+ {% endblock %} From 2d6c3be56a6d76f044f221b7f1e7d6f446e46bc5 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 26 Apr 2022 11:00:01 +0200 Subject: [PATCH 2/4] Add form to matches page --- gilda/app/templates/base.html | 50 ++++++++++---------------------- gilda/app/templates/matches.html | 38 ++++++++++++++++-------- 2 files changed, 41 insertions(+), 47 deletions(-) diff --git a/gilda/app/templates/base.html b/gilda/app/templates/base.html index 8a6d0e73..c47dd51b 100644 --- a/gilda/app/templates/base.html +++ b/gilda/app/templates/base.html @@ -76,25 +76,6 @@

Gilda grounding input

- -
diff --git a/gilda/app/templates/matches.html b/gilda/app/templates/matches.html index a09434e3..7bdb8f6b 100644 --- a/gilda/app/templates/matches.html +++ b/gilda/app/templates/matches.html @@ -1,7 +1,9 @@ {% extends "base.html" %} {% block gcontent %} - {{ render_form(form) }} + {% if form is defined %} + {{ render_form(form) }} + {% endif %}
@@ -10,33 +12,45 @@

Gilda grounding results

Results for {{ text }} - {% if context %} with context - {{ context }}{% endif %} + {% if context %} with context {{ context }}{% endif %}.

- The table below contains the retrieved Groundings ordered by - descreasing score. The standard name for the entry is given in - the Name column. Additional groundings are provided for some - entries where a match was found to an equivalent term in a - namespace different from the primary grounding's. + The table below contains the retrieved Groundings ordered by decreasing + score. The standard name for the entry is given in the Name column. + Additional groundings are provided for some entries where a match was + found to an equivalent term in a namespace different from the primary + grounding's.

- - + + {% for match in matches %} - - + {% set match_curie = match.term.get_curie() %} + + {% endfor %} From 19713ce0760db8c04f5fe6f3b19a4f97b92a54ba Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 26 Apr 2022 11:15:50 +0200 Subject: [PATCH 3/4] Update style of modals --- gilda/app/templates/base.html | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/gilda/app/templates/base.html b/gilda/app/templates/base.html index c47dd51b..dfc9e552 100644 --- a/gilda/app/templates/base.html +++ b/gilda/app/templates/base.html @@ -65,7 +65,7 @@

Gilda Grounding Service

{% macro render_form(form) %}
-

Gilda grounding input

+

Gilda Grounding Input

@@ -81,10 +81,8 @@

Gilda grounding input

DatabaseIdentifierGrounding Name ScoreAdditional Groundings
{{ match['term']['db'] }}{{ match['term']['id'] }} + + {{ match_curie }} + + {{ match['term']['entry_name'] }} {{ match['score'] | round(4) }} + {% for xref_curie, xref_url in match.get_grounding_dict().items() %} + {% if xref_curie != match_curie %} + + {{ xref_curie }} + + {% endif %} + {% endfor %} +