diff options
-rw-r--r-- | wqflask/wqflask/templates/phenotype.html | 98 | ||||
-rw-r--r-- | wqflask/wqflask/views.py | 13 |
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, + ) |