From d3122c73497650d7165afb8fc6c75f2650ef956c Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 26 Sep 2024 16:02:12 -0500 Subject: List the phenotype datasets. --- uploader/phenotypes/views.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'uploader/phenotypes/views.py') diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py index 9185f4c..7ad32ad 100644 --- a/uploader/phenotypes/views.py +++ b/uploader/phenotypes/views.py @@ -14,6 +14,8 @@ from uploader.request_checks import with_species, with_population from uploader.population.models import (populations_by_species, population_by_species_and_id) +from .models import datasets_by_population + phenotypesbp = Blueprint("phenotypes", __name__) @phenotypesbp.route("/phenotypes", methods=["GET"]) @@ -61,3 +63,23 @@ def select_population(species: dict, **kwargs): return redirect(url_for("species.populations.phenotypes.list_datasets", species_id=species["SpeciesId"], population_id=population["Id"])) + + + +@phenotypesbp.route( + "/populations//phenotypes/datasets", + methods=["GET"]) +@require_login +@with_population(species_redirect_uri="species.populations.phenotypes.index", + redirect_uri="species.populations.phenotypes.select_population") +def list_datasets(species: int, population: int, **kwargs): + """List available phenotype datasets.""" + with database_connection(app.config["SQL_URI"]) as conn: + return render_template("phenotypes/list-datasets.html", + species=species, + population=population, + datasets=datasets_by_population( + conn, + species["SpeciesId"], + population["Id"]), + activelink="list-datasets") -- cgit v1.2.3