aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-06-12 15:24:32 +0300
committerBonfaceKilz2023-06-12 15:35:53 +0300
commit81ed7cd35da435d96a735d292462f700f83c8eb0 (patch)
treeb986ee0ef64775e49bf28faa71dabb5cfc79a3ba /wqflask
parent2e74479a895d10994671b719274f1e4203199d22 (diff)
downloadgenenetwork2-81ed7cd35da435d96a735d292462f700f83c8eb0.tar.gz
Add phenotype page
* wqflask/wqflask/templates/phenotype.html: New template. * wqflask/wqflask/views.py (get_phenotype): New endpoint. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/templates/phenotype.html98
-rw-r--r--wqflask/wqflask/views.py13
2 files changed, 111 insertions, 0 deletions
diff --git a/wqflask/wqflask/templates/phenotype.html b/wqflask/wqflask/templates/phenotype.html
new file mode 100644
index 00000000..e3f588c7
--- /dev/null
+++ b/wqflask/wqflask/templates/phenotype.html
@@ -0,0 +1,98 @@
+{% extends "base.html" %}
+
+{% block css %}
+<style type="text/css">
+ .page-header {
+ text-underline-offset: 0.5rem;
+ padding: 1em;
+ }
+</style>
+{% endblock %}
+
+{% block title %}Phenotype: {{ name }}{% endblock %}
+
+{% block content %}
+
+<h1 class="page-header">
+ {% if metadata.name %}
+ <u>Phenotype: {{ metadata.name }}</u>
+ {% else %}
+ {{ name }}
+ {% endif %}
+</h1>
+
+<div class="container">
+ <table class="table">
+ {% if metadata.inbredSetName %}
+ <tr>
+ <td><b>Group</b></td>
+ <td>{{ metadata.inbredSetName }}</td>
+ </tr>
+ {% endif %}
+
+ {% if metadata.speciesName %}
+ <tr>
+ <td><b>Species</b></td>
+ <td>{{ metadata.speciesName }}</td>
+ </tr>
+ {% endif %}
+
+ {% if metadata.publicationDescription %}
+ <tr>
+ <td><b>Phenotype</b></td>
+ <td>{{ metadata.publicationDescription }}</td>
+ </tr>
+ {% endif %}
+
+ {% if metadata.author %}
+ <tr>
+ <td><b>Authors</b></td>
+ <td>
+ {% if metadata.author is iterable %}
+ {{ metadata.author |join(", ") }}
+ {% for author in metadata.author %}
+ {{ author }}
+ {% endfor %}
+ {% else %}
+ metadata.author
+ {% endif %}
+ {% endif %}
+ </td>
+ </tr>
+
+ {% if metadata.title %}
+ <tr>
+ <td><b>Title</b></td>
+ <td>{{ metadata.title }}</td>
+ </tr>
+ {% endif %}
+
+ {% if metadata.title %}
+ <tr>
+ <td><b>Title</b></td>
+ <td>{{ metadata.title }}</td>
+ </tr>
+ {% endif %}
+
+ {% if metadata.journal %}
+ <tr>
+ <td><b>Journal</b></td>
+ <td>
+ {{ metadata.journal }}
+ {% if metadata.year %}
+ (
+ <a href="{{ metadata.pubMedId if metadata.pubMedId else '#' }}" target="_blank">
+ {{ metadata.year }}
+ </a>
+ )
+ {% endif %}
+ </td>
+ </tr>
+
+
+ {% endif %}
+ </table>
+</div>
+
+
+{% endblock %}
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index d980e5e3..86457c4e 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -1131,3 +1131,16 @@ def get_publication(name):
"publication.html",
metadata=metadata,
)
+
+
+@app.route("/phenotype/<name>", methods=('GET',))
+def get_phenotype(name):
+ metadata = requests.get(
+ urljoin(
+ GN3_LOCAL_URL,
+ f"/api/metadata/phenotype/{name}")
+ ).json()
+ return render_template(
+ "phenotype.html",
+ metadata=metadata,
+ )