Skip to content

Commit

Permalink
fixed a bug where heredicare annotation yielded an error
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinDo committed Nov 20, 2023
1 parent bca30cb commit 6d06f98
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
39 changes: 21 additions & 18 deletions src/annotation_service/annotation_jobs/heredicare_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,26 @@ def save_to_db(self, info, variant_id, conn):
if tries > 0:
time.sleep(30 * tries)
if status == "error":
raise Exception("There was an error during variant retrieval from heredicare: " + str(message))

n_fam = heredicare_variant["N_FAM"]
n_pat = heredicare_variant["N_PAT"]
consensus_class = heredicare_variant["PATH_TF"] if heredicare_variant["PATH_TF"] != "-1" else None
comment = heredicare_variant["VUSTF_15"] if heredicare_variant["VUSTF_15"] is not None else ''
comment = comment.strip()
comment = comment if comment != '' else None
classification_date = heredicare_variant["VUSTF_DATUM"] if heredicare_variant["VUSTF_DATUM"] != '' else None
if classification_date is not None:
try:
classification_date = datetime.strptime(classification_date, "%d.%m.%Y")
except:
raise Exception("The date could not be saved in the database. Format should be dd.mm.yyyy, but was: " + str(classification_date))

conn.insert_heredicare_annotation(variant_id, vid, n_fam, n_pat, consensus_class, classification_date, comment)

return status_code, err_msg
err_msg += "There was an error during variant retrieval from heredicare: " + str(message)
status_code = 1
else:
n_fam = heredicare_variant["N_FAM"]
n_pat = heredicare_variant["N_PAT"]
consensus_class = heredicare_variant["PATH_TF"] if heredicare_variant["PATH_TF"] != "-1" else None
comment = heredicare_variant["VUSTF_15"] if heredicare_variant["VUSTF_15"] is not None else ''
comment = comment.strip()
comment = comment if comment != '' else None
classification_date = heredicare_variant["VUSTF_DATUM"] if heredicare_variant["VUSTF_DATUM"] != '' else None
if classification_date is not None:
try:
classification_date = datetime.strptime(classification_date, "%d.%m.%Y")
except:
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

if status_code == 0:
conn.insert_heredicare_annotation(variant_id, vid, n_fam, n_pat, consensus_class, classification_date, comment)

return status_code, err_msg


1 change: 1 addition & 0 deletions src/annotation_service/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def process_one_request(annotation_queue_id, job_config = get_default_job_config

info = line.split('\t')[7]
for job in all_jobs:
print(job.job_name)
status_code, err_msg = job.save_to_db(info, variant_id, conn=conn)
if status_code > 0:
status = "error"
Expand Down

0 comments on commit 6d06f98

Please sign in to comment.