orcasound / aifororcas-livesystem

Real-time AI-assisted killer whale notification system (model and moderator portal) :star:
http://orcahello.ai4orcas.net/
MIT License
37 stars 25 forks source link

Add notification logic for OrcaHello subscribers #188

Open scottveirs opened 2 months ago

scottveirs commented 2 months ago

For OrcaHello subscribers who want to take "protection opportunities" we would like customized emails to be sent.

Problem statement

Previously, an email was sent via SendGrid every time a candidate was approved by a moderator. This can result in the subscribers getting an email as frequently as every minute or so -- which for some may be annoying.

A proposed improvement would use the less expensive AWS SES service discovered by @skanderm and used for notifying moderators of human detections and the ~4,000 member list of Concerned Community Scientists and meet the following requirement for subscriber notifications:

Proposed solution:

Implement this logic within the OrcaHello Notification system code:

  1. Upon moderation of a candidate that confirms the OrcaHello model successfully detected SRKW calls, send an email to the subscriber list
  2. Note the detection time of the moderated candidate that trigged the notification.
  3. Using the value from step 2, monitor the queue of new candidates, computing the age of each (i.e. subtract new-confirmed-candidate-datetime from the `most-recent-co
  4. If the age of a new true postitive (confirmed candidate) is greater than 15 minutes (AND the age is not negative) then send a new email to the subscriber list. Negative times would indicate a moderator has processed part of the back-log (often many days or months old), in which case no notifications should be sent.

Be sure to throttle the send rate to stay below ~14 emails/sec.

Final steps:

scottveirs commented 2 months ago

@dbainj1 and @veirs -- would welcome your input on the proposed solution and its logic...