aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-06-09 14:51:41 -0500
committerFrederick Muriuki Muriithi2025-06-09 14:51:41 -0500
commit70e690e46642bd6e6a46eb2f806db45dfbed5541 (patch)
tree6b2cf3dbd10839032ff5932b211a0845bcba73e6 /scripts
parent0cbf07162e4669f43301f3b35b6f062a00d2ad29 (diff)
downloadgn-uploader-70e690e46642bd6e6a46eb2f806db45dfbed5541.tar.gz
Run the authorisation update requests.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/load_phenotypes_to_db.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/scripts/load_phenotypes_to_db.py b/scripts/load_phenotypes_to_db.py
index 223a435..dc083cd 100644
--- a/scripts/load_phenotypes_to_db.py
+++ b/scripts/load_phenotypes_to_db.py
@@ -318,7 +318,26 @@ def update_auth(authserver, token, species, population, dataset, xrefdata):
"data_link_ids": [
item["data_link_id"] for item in linkeddata["traits"]]
}).then(lambda attc: (user, linkeddata, resource, attc))
- raise NotImplementedError("Please implement this!")
+
+ def __handle_error__(resp):
+ logger.error("ERROR: Updating the authorisation for the data failed.")
+ logger.debug(
+ "ERROR: The response from the authorisation server was:\n\t%s",
+ resp.json())
+ return 1
+
+ def __handle_success__(val):
+ logger.info(
+ "The authorisation for the data has been updated successfully.")
+ return 0
+
+ return __fetch_user_details__().then(__link_data__).then(
+ lambda result: __fetch_phenotype_category_details__(*result)
+ ).then(
+ lambda result: __create_resource__(*result)
+ ).then(
+ lambda result: __attach_data_to_resource__(*result)
+ ).either(__handle_error__, __handle_success__)
def load_data(conn: mysqldb.Connection, job: dict) -> int: