Skip to content

Commit

Permalink
Merge pull request #523 from NCATSTranslator/NoneType_Error
Browse files Browse the repository at this point in the history
adding extra logging info
  • Loading branch information
ShervinAbd92 authored Nov 8, 2023
2 parents caa0115 + 5f16339 commit db52552
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tr_sys/tr_ars/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,20 @@ def mergeMessagesRecursive(mergedMessage,messageList,pk):
if len(messageList)==0:
try:
results = mergedMessage.getResults()
logging.info('the type of results for mergedMessage.getResults class %s' % (type(results)))
if results is not None:
logging.info(f'Averaing normalized scores for {pk}')
try:
results = results.getRaw()
logging.info('the type of results for results.getRaw class %s' % (type(results)))
for result in results:
logging.info('result.keys are: %s' % (result.keys()))
if "normalized_score" in result.keys():
ns = result["normalized_score"]
if isinstance(ns,list) and len(ns)>0:
result["normalized_score"]= sum(ns) / len(ns)
else:
logging.info('there is no normalized_score in result.keys()')
except Exception as e:
logging.debug(e.__traceback__)
except Exception as e:
Expand Down

0 comments on commit db52552

Please sign in to comment.