diff options
author | Frederick Muriuki Muriithi | 2022-07-13 02:37:52 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2022-07-19 04:59:59 +0300 |
commit | 68cf0750ee29d91abf8fe8d0a81426e324b41b12 (patch) | |
tree | ed1b752cb63937ebe5d1c5cca812cbd0f7bd65a6 /qc_app/dbinsert.py | |
parent | 27032e1876373f9b519275bffbca117f2c96ca1f (diff) | |
download | gn-uploader-68cf0750ee29d91abf8fe8d0a81426e324b41b12.tar.gz |
Implement dataset selection
- Implement UI enabling selection from existing datasets
- Start implementation of UI that enables creation of new dataset
Diffstat (limited to 'qc_app/dbinsert.py')
-rw-r--r-- | qc_app/dbinsert.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/qc_app/dbinsert.py b/qc_app/dbinsert.py index 4fbd0d3..523152d 100644 --- a/qc_app/dbinsert.py +++ b/qc_app/dbinsert.py @@ -177,6 +177,17 @@ def create_study(): flash(f"Missing data: {aserr.args[0]}", "alert-error") return redirect(url_for("dbinsert.select_study"), code=307) +def datasets_by_study(studyid:int) -> tuple: + "Retrieve datasets associated with a study with the ID `studyid`." + with database_connection() as conn: + with conn.cursor(cursorclass=DictCursor) as cursor: + query = "SELECT * FROM ProbeSetFreeze WHERE ProbeFreezeId=%s" + print(f"QUERY: {query}\n\tPARAMS: ({studyid},)") + cursor.execute(query, (studyid,)) + return tuple(cursor.fetchall()) + + return tuple() + @dbinsertbp.route("/dataset", methods=["POST"]) def select_dataset(): "Select the dataset to add the file contents against" @@ -186,15 +197,14 @@ def select_dataset(): assert form.get("filetype"), "filetype" assert form.get("species"), "species" assert form.get("genechipid"), "platform" - assert (form.get("studyid") or form.get(studyname)), "" - assert form.get(""), "" - assert form.get(""), "" - assert form.get(""), "" - assert form.get(""), "" + assert (form.get("studyid") or request.args.get("studyid")), "study" + studyid=(form.get("studyid") or request.args.get("studyid")) + datasets = datasets_by_study(studyid) return render_template( "select_dataset.html", filename=form["filename"], - filetype=form["filetype"], species=speciesid, genechipid=genechipid) + filetype=form["filetype"], species=form["species"], + genechipid=form["genechipid"], studyid=studyid, datasets=datasets) except AssertionError as aserr: return render_error(f"Missing data: {aserr.args[0]}") |