From 2048c16ffaf3767f286cd1808044ed25ab5b8842 Mon Sep 17 00:00:00 2001 From: MarvinDo Date: Fri, 26 Jul 2024 09:42:23 +0200 Subject: [PATCH] added specific variants reannotate & improved heredicare job --- .../annotation_jobs/heredicare_job.py | 23 +++++++++---------- .../templates/user/admin_dashboard.html | 7 ++++++ .../user/variant_import_summary.html | 2 +- .../webapp/user/user_routes.py | 9 +++++--- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/annotation_service/annotation_jobs/heredicare_job.py b/src/annotation_service/annotation_jobs/heredicare_job.py index 5a81f468..2b91aa4a 100644 --- a/src/annotation_service/annotation_jobs/heredicare_job.py +++ b/src/annotation_service/annotation_jobs/heredicare_job.py @@ -98,21 +98,20 @@ def annotate_heredicare(self, variant_id, conn): err_msg += "The date could not be saved in the database. Format should be dd.mm.yyyy, but was: " + str(classification_date) status_code = 1 - heredicare_annotation_id = None if status_code == 0: heredicare_annotation_id = conn.insert_update_heredicare_annotation(variant_id, vid, n_fam, n_pat, consensus_class, classification_date, comment, lr_cooc, lr_coseg, lr_family) - for key in heredicare_variant: - if key.startswith("PATH_Z"): - zid = int(key[6:]) - heredicare_center_classification_raw = heredicare_variant[key] - if heredicare_center_classification_raw is not None and heredicare_variant[key] == "-1": - heredicare_center_classification_raw = None - classification, comment = self.preprocess_heredicare_center_classification(heredicare_center_classification_raw) - if classification is not None: - conn.insert_update_heredicare_center_classification(heredicare_annotation_id, zid, classification, comment) - else: - conn.delete_heredicare_center_classification(heredicare_annotation_id, zid) + for key in heredicare_variant: + if key.startswith("PATH_Z"): + zid = int(key[6:]) + heredicare_center_classification_raw = heredicare_variant[key] + if heredicare_center_classification_raw is not None and heredicare_variant[key] == "-1": + heredicare_center_classification_raw = None + classification, comment = self.preprocess_heredicare_center_classification(heredicare_center_classification_raw) + if classification is not None: + conn.insert_update_heredicare_center_classification(heredicare_annotation_id, zid, classification, comment) + else: + conn.delete_heredicare_center_classification(heredicare_annotation_id, zid) return status_code, err_msg diff --git a/src/frontend_celery/webapp/templates/user/admin_dashboard.html b/src/frontend_celery/webapp/templates/user/admin_dashboard.html index d3d9d324..1708baaf 100644 --- a/src/frontend_celery/webapp/templates/user/admin_dashboard.html +++ b/src/frontend_celery/webapp/templates/user/admin_dashboard.html @@ -150,6 +150,13 @@

Warnings

+
+ + + + +
+ diff --git a/src/frontend_celery/webapp/templates/user/variant_import_summary.html b/src/frontend_celery/webapp/templates/user/variant_import_summary.html index a1a2d36d..512559a2 100644 --- a/src/frontend_celery/webapp/templates/user/variant_import_summary.html +++ b/src/frontend_celery/webapp/templates/user/variant_import_summary.html @@ -96,7 +96,7 @@

Status details

- +

Refresh page so see changes
diff --git a/src/frontend_celery/webapp/user/user_routes.py b/src/frontend_celery/webapp/user/user_routes.py index f21caeaf..6e9b4a88 100644 --- a/src/frontend_celery/webapp/user/user_routes.py +++ b/src/frontend_celery/webapp/user/user_routes.py @@ -257,6 +257,9 @@ def admin_dashboard(): variant_ids = annotation_stati['aborted'] elif reannotate_which == 'unannotated': variant_ids = annotation_stati['unannotated'] + elif reannotate_which == 'specific': + raw = request.form.get('specific_variants', '') + variant_ids = search_utils.preprocess_query(raw, pattern = "\d+") tasks.annotate_all_variants.apply_async(args=[variant_ids, selected_job_config, session['user']['user_id'], session['user']['roles']]) current_app.logger.info(session['user']['preferred_username'] + " issued a reannotation of " + reannotate_which + " variants") @@ -411,21 +414,21 @@ def extract_stati_vis(request_args, allowed_stati): raw = request_args.getlist('status')# raw = ';'.join(raw) regex_inner = '|'.join(allowed_stati) - processed = preprocess_query(raw, r'(' + regex_inner + r')?') + processed = search_utils.preprocess_query(raw, r'(' + regex_inner + r')?') if processed is None: flash("You have an error in your status queries. Results are not filtered by stati.", "alert-danger") return processed def extract_comments_vis(request_args): raw = request_args.get('comment', '') - processed = preprocess_query(raw, pattern=r".*", seps = "[;]", remove_whitespace = False) + processed = search_utils.preprocess_query(raw, pattern=r".*", seps = "[;]", remove_whitespace = False) if processed is None: flash("You have an error in your comment query(s). Results are not filtered by comment.", "alert-danger") return processed def extract_vids_vids(request_args): raw = request_args.get('vid', '') - processed = preprocess_query(raw, pattern=r"\d+") + processed = search_utils.preprocess_query(raw, pattern=r"\d+") if processed is None: flash("You have an error in your VID query(s). Results are not filtered by VIDs.", "alert-danger") return processed