aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-06-07 09:43:52 +0300
committerBonfaceKilz2023-06-07 09:45:11 +0300
commit0cd4b09cc56c5dda7bda4ed989ab0ba72c43ac31 (patch)
tree7aab977987d4d404da0f8c8d907a5ff4a5249bc4
parent1b709fd550c2abf53cc4fae84eab1b179e94b63d (diff)
downloadgenenetwork2-0cd4b09cc56c5dda7bda4ed989ab0ba72c43ac31.tar.gz
Add publication page
* wqflask/wqflask/templates/publication.html: New page. * wqflask/wqflask/views.py (get_dataset): New function. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rw-r--r--wqflask/wqflask/templates/publication.html82
-rw-r--r--wqflask/wqflask/views.py13
2 files changed, 95 insertions, 0 deletions
diff --git a/wqflask/wqflask/templates/publication.html b/wqflask/wqflask/templates/publication.html
new file mode 100644
index 00000000..d0f6633e
--- /dev/null
+++ b/wqflask/wqflask/templates/publication.html
@@ -0,0 +1,82 @@
+{% extends "base.html" %}
+
+{% block css %}
+<style type="text/css">
+ .page-header {
+ text-underline-offset: 0.5rem;
+ padding: 1em;
+ }
+
+ .panel-metadata {
+ display: inline-block;
+ width: fit-content;
+ height: fit-content;
+ padding: 0;
+ }
+
+ .panel-metadata dt {
+ color: green;
+ }
+
+ .panel-metadata dt::after {
+ content: ":";
+ }
+
+</style>
+{% endblock %}
+
+{% block title %}Dataset: {{ name }}{% endblock %}
+
+{% block content %}
+
+<header class="page-header text-justify">
+ <h1>
+ {% if metadata.title %}
+ <u>{{ metadata.title}}</u>
+ {% else %}
+ {{ name }}
+ {% endif %}
+ </h1>
+</header>
+
+<div class="container">
+ {% if metadata == {} %}
+ <p class="lead">We appreciate your interest, but unfortunately, we don't have any additional information available for: <strong>{{ name }}</strong>. If you have any other questions or need assistance with something else, please feel free to reach out to us.</p>
+ {% else %}
+ <div class="panel-about panel panel-info panel-metadata text-muted{{ float_p }}">
+ <div class="panel-heading"><strong><span class="glyphicon glyphicon-info-sign aria-hidden=true"></span> Details</strong> </div>
+ <div class="panel-body">
+ <dl class="dl-horizontal">
+ {% if metadata.pubMedId %}
+ <dt>PUBMED</dt>
+ <dd>
+ <a href="{{ metadata.pubMedId }}" target="_blank">{{ metadata.pubMedId.split("/")[-1] }}</a>
+ </dd>
+ {% endif %}
+ {% if metadata.abstract %} <dt>Abstract</dt> <dd>{{ metadata.abstract}}</dd> {% endif %}
+ {% if metadata.month %} <dt>Month</dt> <dd>{{ metadata.month }}</dd> {% endif %}
+ {% if metadata.pages %} <dt>Pages</dt> <dd>{{ metadata.pages }}</dd> {% endif %}
+ {% if metadata.volume %} <dt>Volume</dt> <dd>{{ metadata.volume }}</dd> {% endif %}
+ </dl>
+ </div>
+ </div>
+ {% if metadata.phenotypeOfPublication %}
+ <div class="container">
+ <h2>Related Phenotypes:</h2>
+ <table class="table">
+ {% for link in metadata.phenotypeOfPublication %}
+ <tr>
+ <td>
+ <a href="{{ link }}" target="_blank">{{ link }}</a>
+ </td>
+ </tr>
+ {% endfor %}
+ </table>
+
+ </div>
+ {% endif %}
+ {% endif %}
+
+</div>
+
+{% endblock %}
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 895ad0cb..d980e5e3 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -1118,3 +1118,16 @@ def get_dataset(name):
metadata=metadata,
float_p=float_p
)
+
+
+@app.route("/publication/<name>", methods=('GET',))
+def get_publication(name):
+ metadata = requests.get(
+ urljoin(
+ GN3_LOCAL_URL,
+ f"/api/metadata/publication/{name}")
+ ).json()
+ return render_template(
+ "publication.html",
+ metadata=metadata,
+ )