aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-02-09 17:27:14 +0300
committerFrederick Muriuki Muriithi2024-02-12 18:17:40 +0300
commita0d3ac85dab5bfba9107f63b3219902ebe32cdd9 (patch)
tree83a3a7e8e6d8d4b2ea2d5481cb07aa5e32f71ff7
parentb7eb549bb02eaba22ba06b0ddf5d04c9b4fe0f66 (diff)
downloadgn-uploader-a0d3ac85dab5bfba9107f63b3219902ebe32cdd9.tar.gz
UI: Provide QC successful results page
-rw-r--r--qc_app/templates/rqtl2/rqtl2-qc-job-results.html62
-rw-r--r--qc_app/upload/rqtl2.py18
2 files changed, 75 insertions, 5 deletions
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%}
+<h1 class="heading">R/qtl2 bundle: QC job results</h1>
+
+<div class="explainer">
+ <p>The R/qtl2 bundle you uploaded has passed all automated quality-control
+ checks successfully.</p>
+ <p>You may now continue to load the data into GeneNetwork for the bundle, with
+ the following details:</p>
+</div>
+
+<form id="form-qc-job-results" action="#implement-this" method="POST">
+ <fieldset>
+ <legend>Species</legend>
+ <input type="hidden" name="speciesid" value="{{species.SpeciesId}}" />
+
+ <span class="form-col-1">Name</span>
+ <span class="form-col-2">{{species.Name | capitalize}}</span>
+
+ <span class="form-col-1">Scientific</span>
+ <span class="form-col-2">{{species.FullName | capitalize}}</span>
+ </fieldset>
+
+ <fieldset>
+ <legend>population</legend>
+ <input type="hidden" name="populationid" value="{{populationid}}" />
+
+ <span class="form-col-1">Name</span>
+ <span class="form-col-2">{{population.InbredSetName}}</span>
+
+ <span class="form-col-1">Full Name</span>
+ <span class="form-col-2">{{population.FullName}}</span>
+
+ <span class="form-col-1">Genetic Type</span>
+ <span class="form-col-2">{{population.GeneticType}}</span>
+
+ <span class="form-col-1">Description</span>
+ <span class="form-col-2">{{population.Description or "-"}}</span>
+ </fieldset>
+
+ <fieldset>
+ <legend>R/qtl2 Bundle File</legend>
+ <input type="hidden" name="rqtl2-bundle-file" value="{{rqtl2bundle}}" />
+ <input type="hidden" name="original-filename" value="{{rqtl2bundleorig}}" />
+
+ <span class="form-col-1">Original Name</span>
+ <span class="form-col-2">{{rqtl2bundleorig}}</span>
+
+ <span class="form-col-1">Internal Name</span>
+ <span class="form-col-2">{{rqtl2bundle.name[0:25]}}&hellip;</span>
+ </fieldset>
+
+ <fieldset>
+ <input type="submit" value="continue" class="btn btn-main form-col-2" />
+ </fieldset>
+</form>
+
+{%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,