Skip to content

Commit

Permalink
Feat : error messages for detections rejections #138 (#190)
Browse files Browse the repository at this point in the history
* Error messages for detections rejections

#138

* Update server.py

* Use log.warning
  • Loading branch information
alexbelgium authored Sep 30, 2024
1 parent 3d99530 commit a264eb9
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions scripts/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,14 @@ def run_analysis(file):
for time_slot, entries in raw_detections.items():
log.info('%s-%s', time_slot, entries[0])
for entry in entries:
if entry[1] >= conf.getfloat('CONFIDENCE') and ((entry[0] in INCLUDE_LIST or len(INCLUDE_LIST) == 0)
and (entry[0] not in EXCLUDE_LIST or len(EXCLUDE_LIST) == 0)
and (entry[0] in PREDICTED_SPECIES_LIST
or len(PREDICTED_SPECIES_LIST) == 0)):
d = Detection(time_slot.split(';')[0], time_slot.split(';')[1], entry[0], entry[1])
confident_detections.append(d)
if entry[1] >= conf.getfloat('CONFIDENCE'):
if entry[0] not in INCLUDE_LIST and len(INCLUDE_LIST) != 0:
log.warning("Excluded as INCLUDE_LIST is active but this species is not in it: %s", entry[0])
elif entry[0] in EXCLUDE_LIST and len(EXCLUDE_LIST) != 0:
log.warning("Excluded as species in EXCLUDE_LIST: %s", entry[0])
elif entry[0] not in PREDICTED_SPECIES_LIST and len(PREDICTED_SPECIES_LIST) != 0:
log.warning("Excluded as below Species Occurrence Frequency Threshold: %s", entry[0])
else:
d = Detection(time_slot.split(';')[0], time_slot.split(';')[1], entry[0], entry[1])
confident_detections.append(d)
return confident_detections

0 comments on commit a264eb9

Please sign in to comment.