aboutsummaryrefslogtreecommitdiff
path: root/qc_app/db
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-01-17 05:38:29 +0300
committerFrederick Muriuki Muriithi2024-01-17 05:39:10 +0300
commitbf1c2ec1b16b50f419a349a54031baf85fcd4abd (patch)
tree3cd3bfdce0430f657457986becce7483a7172c16 /qc_app/db
parent4e3f6e51b92d9c56f77452bd4b723323a526bc52 (diff)
downloadgn-uploader-bf1c2ec1b16b50f419a349a54031baf85fcd4abd.tar.gz
UI: Initialise summary page.
Diffstat (limited to 'qc_app/db')
-rw-r--r--qc_app/db/datasets.py7
-rw-r--r--qc_app/db/species.py10
2 files changed, 11 insertions, 6 deletions
diff --git a/qc_app/db/datasets.py b/qc_app/db/datasets.py
index 3a27706..8122cfa 100644
--- a/qc_app/db/datasets.py
+++ b/qc_app/db/datasets.py
@@ -14,3 +14,10 @@ def geno_dataset_by_species_and_population(
"WHERE iset.SpeciesId=%(sid)s AND iset.InbredSetId=%(pid)s",
{"sid": speciesid, "pid": populationid})
return tuple(dict(row) for row in cursor.fetchall())
+
+def geno_dataset_by_id(conn: mdb.Connection, dataset_id: int) -> dict:
+ """Retrieve genotype dataset by ID"""
+ with conn.cursor(cursorclass=DictCursor) as cursor:
+ cursor.execute("SELECT * FROM GenoFreeze WHERE Id=%s",
+ (dataset_id,))
+ return dict(cursor.fetchone())
diff --git a/qc_app/db/species.py b/qc_app/db/species.py
index 7006d15..653e59b 100644
--- a/qc_app/db/species.py
+++ b/qc_app/db/species.py
@@ -6,8 +6,8 @@ def species(conn: mdb.Connection) -> tuple:
"Retrieve the species from the database."
with conn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute(
- "SELECT SpeciesId, SpeciesName, LOWER(Name) AS Name, MenuName "
- "FROM Species")
+ "SELECT SpeciesId, SpeciesName, LOWER(Name) AS Name, MenuName, "
+ "FullName FROM Species")
return tuple(cursor.fetchall())
return tuple()
@@ -16,9 +16,7 @@ def species_by_id(conn: mdb.Connection, speciesid) -> dict:
"Retrieve the species from the database by id."
with conn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute(
- (
- "SELECT "
- "SpeciesId, SpeciesName, LOWER(Name) AS Name, MenuName "
- "FROM Species WHERE SpeciesId=%s"),
+ "SELECT SpeciesId, SpeciesName, LOWER(Name) AS Name, MenuName, "
+ "FullName FROM Species WHERE SpeciesId=%s",
(speciesid,))
return cursor.fetchone()