From a0d3ac85dab5bfba9107f63b3219902ebe32cdd9 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 9 Feb 2024 17:27:14 +0300 Subject: UI: Provide QC successful results page --- qc_app/templates/rqtl2/rqtl2-qc-job-results.html | 62 ++++++++++++++++++++++++ qc_app/upload/rqtl2.py | 18 +++++-- 2 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 qc_app/templates/rqtl2/rqtl2-qc-job-results.html (limited to 'qc_app') diff --git a/qc_app/templates/rqtl2/rqtl2-qc-job-results.html b/qc_app/templates/rqtl2/rqtl2-qc-job-results.html new file mode 100644 index 0000000..46a168f --- /dev/null +++ b/qc_app/templates/rqtl2/rqtl2-qc-job-results.html @@ -0,0 +1,62 @@ +{%extends "base.html"%} +{%from "cli-output.html" import cli_output%} + +{%block title%}R/qtl2 bundle: QC job results{%endblock%} + +{%block contents%} +

R/qtl2 bundle: QC job results

+ +
+

The R/qtl2 bundle you uploaded has passed all automated quality-control + checks successfully.

+

You may now continue to load the data into GeneNetwork for the bundle, with + the following details:

+
+ +
+
+ Species + + + Name + {{species.Name | capitalize}} + + Scientific + {{species.FullName | capitalize}} +
+ +
+ population + + + Name + {{population.InbredSetName}} + + Full Name + {{population.FullName}} + + Genetic Type + {{population.GeneticType}} + + Description + {{population.Description or "-"}} +
+ +
+ R/qtl2 Bundle File + + + + Original Name + {{rqtl2bundleorig}} + + Internal Name + {{rqtl2bundle.name[0:25]}}… +
+ +
+ +
+
+ +{%endblock%} diff --git a/qc_app/upload/rqtl2.py b/qc_app/upload/rqtl2.py index c20bd8f..4b00891 100644 --- a/qc_app/upload/rqtl2.py +++ b/qc_app/upload/rqtl2.py @@ -183,7 +183,8 @@ def upload_rqtl2_bundle(species_id: int, population_id: int): {"job-metadata": json.dumps({ "speciesid": species_id, "populationid": population_id, - "rqtl2-bundle-file": str(the_file.absolute())})}), + "rqtl2-bundle-file": str(the_file.absolute()), + "original-filename": request.files["rqtl2_bundle_file"].filename})}), redisuri, f"{app.config['UPLOAD_FOLDER']}/job_errors") return redirect(url_for( @@ -193,7 +194,8 @@ def upload_rqtl2_bundle(species_id: int, population_id: int): methods=["GET", "POST"]) def rqtl2_bundle_qc_status(jobid: UUID): """Check the status of the QC jobs.""" - with Redis.from_url(app.config["REDIS_URL"], decode_responses=True) as rconn: + with (Redis.from_url(app.config["REDIS_URL"], decode_responses=True) as rconn, + database_connection(app.config["SQL_URI"]) as dbconn): try: thejob = jobs.job(rconn, jobs.jobsnamespace(), jobid) messagelistname = thejob.get("log-messagelist") @@ -207,9 +209,15 @@ def rqtl2_bundle_qc_status(jobid: UUID): thejob.get("errors-generic", "[]")), messages=logmessages) if jobstatus == "success": - return render_template("rqtl2/rqtl2-qc-job-results.html", - job=thejob, - messages=logmessages) + jobmeta = json.loads(thejob["job-metadata"]) + species = species_by_id(dbconn, jobmeta["speciesid"]) + return render_template( + "rqtl2/rqtl2-qc-job-results.html", + species=species, + population=population_by_species_and_id( + dbconn, species["SpeciesId"], jobmeta["populationid"]), + rqtl2bundle=Path(jobmeta["rqtl2-bundle-file"]), + rqtl2bundleorig=jobmeta["original-filename"]) return render_template("rqtl2/rqtl2-qc-job-status.html", job=thejob, -- cgit v1.2.3