diff options
author | Munyoki Kilyungi | 2022-12-01 15:49:27 +0300 |
---|---|---|
committer | BonfaceKilz | 2022-12-06 11:35:09 +0300 |
commit | 8b8397fb5ddf66492d5fb6c085860374d2c3625d (patch) | |
tree | 89f5ba69e30364934661e0f9d4f0a8e3e50b4c75 /wqflask | |
parent | ffbac2d448792d5331f6e7d66c0ab6fa867a70cb (diff) | |
download | genenetwork2-8b8397fb5ddf66492d5fb6c085860374d2c3625d.tar.gz |
Use a dataset's name to fetch it's metadata
* wqflask/wqflask/views.py (show_trait_page): Use a dataset's name -
from the query parameters - to fetch metadata.
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/views.py | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 028512dd..2477b2c0 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -490,23 +490,21 @@ def show_trait_page(): template_vars.js_data = json.dumps(template_vars.js_data, default=json_default_handler, indent=" ") - + # Should there be any mis-configurations, things will still + # work. + metadata = {} try: - metadata = ( - template_vars.dataset.accession_id - .bind( - lambda idx: requests.get( - urljoin( - GN3_LOCAL_URL, - f"/api/metadata/dataset/GN{idx}") - ) - ) + metadata = requests.get( + urljoin( + GN3_LOCAL_URL, + f"/api/metadata/dataset/{request.args.get('dataset')}") ).json() except: metadata = {} - - return render_template("show_trait.html", - metadata=metadata, **template_vars.__dict__) + return render_template( + "show_trait.html", + metadata=metadata, + **template_vars.__dict__) @app.route("/heatmap", methods=('POST',)) |