aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-08-29 10:15:44 +0300
committerFrederick Muriuki Muriithi2023-10-10 11:12:47 +0300
commit9773e7642972f958ed7b1f9a9c47a04f9eb7d593 (patch)
tree970c8c08ac7351f949de73be64611ef8e2f837ad
parent413a9d52984850d232d97138485c73d857f7b8c8 (diff)
downloadgenenetwork3-9773e7642972f958ed7b1f9a9c47a04f9eb7d593.tar.gz
Retrieve InbredSet group details.
-rw-r--r--gn3/case_attributes.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/gn3/case_attributes.py b/gn3/case_attributes.py
index 3f5649a..f79612d 100644
--- a/gn3/case_attributes.py
+++ b/gn3/case_attributes.py
@@ -18,6 +18,14 @@ from gn3.auth.authorisation.errors import AuthorisationError
caseattr = Blueprint("case-attribute", __name__)
+def __inbredset_group__(conn, inbredset_id):
+ """Return InbredSet group's top-level details."""
+ with conn.cursor(cursorclass=DictCursor) as cursor:
+ cursor.execute(
+ "SELECT * FROM InbredSet WHERE InbredSetId=%(inbredset_id)s",
+ {"inbredset_id": inbredset_id})
+ return dict(cursor.fetchone())
+
def __case_attribute_labels_by_inbred_set__(conn, inbredset_id):
"""Return the case-attribute labels/names for the given InbredSet group."""
with conn.cursor(cursorclass=DictCursor) as cursor:
@@ -26,6 +34,12 @@ def __case_attribute_labels_by_inbred_set__(conn, inbredset_id):
{"inbredset_id": inbredset_id})
return tuple(dict(row) for row in cursor.fetchall())
+@caseattr.route("/<int:inbredset_id>", methods=["GET"])
+def inbredset_group(inbredset_id: int) -> Response:
+ """Retrieve InbredSet group's details."""
+ with database_connection(current_app.config["SQL_URI"]) as conn:
+ return jsonify(__inbredset_group__(conn, inbredset_id))
+
@caseattr.route("/<int:inbredset_id>/names", methods=["GET"])
def inbredset_case_attribute_names(inbredset_id: int) -> Response:
"""Retrieve ALL case-attributes for a specific InbredSet group."""