Skip to content

Commit

Permalink
CU-2e77aae: Add some logger debug statements, don't need to check Met…
Browse files Browse the repository at this point in the history
…aAnnos don't exist, speeds up processing of annotations
  • Loading branch information
tomolopolis committed Sep 3, 2024
1 parent c3dc40d commit 3c7fc5a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions webapp/api/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def check_ents(ent):

logger.debug('Found %s annotations to store', len(ents))
for ent in ents:
logger.debug('Processing annotation ent %s of %s', ents.index(ent), len(ents))
label = ent._.cui

if not Entity.objects.filter(label=label).exists():
Expand Down Expand Up @@ -104,13 +105,10 @@ def check_ents(ent):

ann_ent.save()

logger.debug('Found % annotations to store', len(ents))
# check the ent._.meta_anns if it exists
if hasattr(ent._, 'meta_anns') and len(metatask2obj) > 0 and len(metataskvals2obj) > 0:
for meta_ann_task, pred in ent._.meta_anns.items():
meta_anno_obj = MetaAnnotation.objects.filter(annotated_entity=ann_ent,
meta_task=metatask2obj[meta_ann_task]).first()
if meta_anno_obj is None or not meta_anno_obj.validated:
# check the ent._.meta_anns if it exists
if hasattr(ent._, 'meta_anns') and len(metatask2obj) > 0 and len(metataskvals2obj) > 0:
logger.debug('Found %s meta annos on ent', len(ent._.meta_anns.items()))
for meta_ann_task, pred in ent._.meta_anns.items():
meta_anno_obj = MetaAnnotation()
meta_anno_obj.predicted_meta_task_value = metataskvals2obj[meta_ann_task][pred['value']]
meta_anno_obj.meta_task = metatask2obj[meta_ann_task]
Expand Down

0 comments on commit 3c7fc5a

Please sign in to comment.