about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjgart2022-01-25 13:29:38 -0500
committerjgart2022-01-25 13:29:38 -0500
commitd91e74cc73d25342f10f7ed93a9d684cda443a12 (patch)
treeb42768dba74d19c6483e9e6d05ace3937a83dea7
parent885b5fb52fd123832fa829484de949d4afaa38d6 (diff)
downloadgenenetwork2-d91e74cc73d25342f10f7ed93a9d684cda443a12.tar.gz
use binderlite api to get jupyter notebooks dynamically notebooks_api
-rw-r--r--wqflask/wqflask/jupyter_notebooks.py26
-rw-r--r--wqflask/wqflask/templates/jupyter_notebooks.html12
2 files changed, 9 insertions, 29 deletions
diff --git a/wqflask/wqflask/jupyter_notebooks.py b/wqflask/wqflask/jupyter_notebooks.py
index fc3a0af3..08d9123d 100644
--- a/wqflask/wqflask/jupyter_notebooks.py
+++ b/wqflask/wqflask/jupyter_notebooks.py
@@ -5,27 +5,5 @@ jupyter_notebooks = Blueprint("jupyter_notebooks", __name__)
 
 @jupyter_notebooks.route("/launcher", methods=("GET",))
 def launcher():
-    links = (
-        {
-            "main_url": "http://notebook.genenetwork.org/59373/notebooks/BXD%20Analysis.ipynb",
-            "notebook_name": "This shows how to model BXD mouse weight data using an AR(1) process",
-            "src_link_url": "https://github.com/BonfaceKilz/tsaf-analysis-of-bxd-mouse-colonies",
-        },
-        {
-            "main_url": "http://notebook.genenetwork.org/53457/notebooks/2020-05-08/solberg-rat-analysis.ipynb",
-            "notebook_name": "Quantitative Genetics Tools for Mapping Trait Variation to Mechanisms, Therapeutics, and Interventions - Webinar Series",
-            "src_link_url": "https://github.com/senresearch/quant-genetics-webinars",
-        },
-        {
-            "main_url": "http://notebook.genenetwork.org/34447/notebooks/genenetwork.ipynb",
-            "notebook_name": "Querying the GeneNetwork API declaratively with python.",
-            "src_link_url": "https://github.com/jgarte/genenetwork-jupyter-notebook-example",
-        },
-        {
-            "main_url": "http://notebook.genenetwork.org/53923/notebooks/genenetwork-api-using-r.ipynb",
-            "notebook_name": "R notebook showing how to query the GeneNetwork API.",
-            "src_link_url": "https://github.com/jgarte/genenetwork-api-r-jupyter-notebook",
-        },
-    )
-
-    return render_template("jupyter_notebooks.html", links=links)
+    links = requests.get("http://notebook.genenetwork.org/api")
+    return render_template("jupyter_notebooks.html", links=links.json())
diff --git a/wqflask/wqflask/templates/jupyter_notebooks.html b/wqflask/wqflask/templates/jupyter_notebooks.html
index afc95a15..e3a01fe5 100644
--- a/wqflask/wqflask/templates/jupyter_notebooks.html
+++ b/wqflask/wqflask/templates/jupyter_notebooks.html
@@ -1,10 +1,12 @@
 {%extends "base.html"%}
 
+
 {%block title%}
 Jupyter Notebooks
 {%endblock%}
 
 {%block css%}
+<meta http-equiv="refresh" content="5"> 
 <link rel="stylesheet" type="text/css" href="/static/new/css/jupyter_notebooks.css" />
 {%endblock%}
 
@@ -15,11 +17,11 @@ Jupyter Notebooks
 
   {%for item in links:%}
   <div class="jupyter-links">
-    <a href="{{item.get('main_url')}}"
-       title="Access running notebook for '{{item.get('notebook_name')}}' on GeneNetwork"
-       class="main-link">{{item.get("notebook_name")}}</a>
-    <a href="{{item.get('src_link_url')}}"
-       title="Link to the notebook repository for {{item.get('notebook_name', '_')}}"
+    <a href="{{item.get('launch_link')}}"
+       title="Access running notebook for '{{item.get('repository')}}' on GeneNetwork"
+       class="main-link">{{item.get("repository")}}</a>
+    <a href="{{item.get('home_page')}}"
+       title="Link to the notebook repository for {{item.get('repository', '_')}}"
        class="src-link">View Source</a>
   </div>
   {%endfor%}