From 81ed7cd35da435d96a735d292462f700f83c8eb0 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Mon, 12 Jun 2023 15:24:32 +0300 Subject: Add phenotype page * wqflask/wqflask/templates/phenotype.html: New template. * wqflask/wqflask/views.py (get_phenotype): New endpoint. Signed-off-by: Munyoki Kilyungi --- wqflask/wqflask/templates/phenotype.html | 98 ++++++++++++++++++++++++++++++++ wqflask/wqflask/views.py | 13 +++++ 2 files changed, 111 insertions(+) create mode 100644 wqflask/wqflask/templates/phenotype.html (limited to 'wqflask') 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 %} + +{% endblock %} + +{% block title %}Phenotype: {{ name }}{% endblock %} + +{% block content %} + +

+ {% if metadata.name %} + Phenotype: {{ metadata.name }} + {% else %} + {{ name }} + {% endif %} +

+ +
+ + {% if metadata.inbredSetName %} + + + + + {% endif %} + + {% if metadata.speciesName %} + + + + + {% endif %} + + {% if metadata.publicationDescription %} + + + + + {% endif %} + + {% if metadata.author %} + + + + + + {% if metadata.title %} + + + + + {% endif %} + + {% if metadata.title %} + + + + + {% endif %} + + {% if metadata.journal %} + + + + + + + {% endif %} +
Group{{ metadata.inbredSetName }}
Species{{ metadata.speciesName }}
Phenotype{{ metadata.publicationDescription }}
Authors + {% if metadata.author is iterable %} + {{ metadata.author |join(", ") }} + {% for author in metadata.author %} + {{ author }} + {% endfor %} + {% else %} + metadata.author + {% endif %} + {% endif %} +
Title{{ metadata.title }}
Title{{ metadata.title }}
Journal + {{ metadata.journal }} + {% if metadata.year %} + ( + + {{ metadata.year }} + + ) + {% endif %} +
+
+ + +{% 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/", 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, + ) -- cgit v1.2.3