Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AA storm - email alert logic #1420

Open
wants to merge 73 commits into
base: feature/add-new-AA-storm
Choose a base branch
from

Conversation

Max-Z80
Copy link
Collaborator

@Max-Z80 Max-Z80 commented Jan 28, 2025

Description

This is the logic for deciding whether to send an email or not.

the cron run hourly
latest reports for each storm are persisted in DB
when a new report is published and has not been processed yet by the alert system then an email payload might be built depending of the report status for example

  • When a readiness trigger or
  • when an activation trigger is detected

The email payloads will then be used to create the emails and send it at the end of the process.

Setup - anticipatory action storm alerts

  • Alerts are triggered by a cron job running hourly within the alerting-node process.
  • Run docker-compose up to launch the alerting-node and alerting-db processes.
  • The system checks database entries to determine which country needs to be triggered.
  • Currently, only Mozambique is supported. To add it, connect to the psql console of alerting-db and run the following command:
INSERT INTO anticipatory_action_alerts (country, emails, prism_url)
VALUES ('Mozambique', ARRAY['email1@example.com'], 'https://prism.wfp.org');
  • country: The target country for the alert.
  • emails: A list of email addresses that will receive the alert notification.
  • prism_url: The base URL of the PRISM platform for redirection link and screenshot capture.

Notes

  • Mozambique supported only for storm alerts

How to test the feature:

  • [ ]
  • [ ]

Checklist - did you ...

Test your changes with

  • REACT_APP_COUNTRY=rbd yarn start
  • REACT_APP_COUNTRY=cambodia yarn start
  • REACT_APP_COUNTRY=mozambique yarn start
  • Add / update necessary tests?
  • Add / update outdated documentation?

Screenshot/video of feature:

image

Copy link

github-actions bot commented Jan 28, 2025

Build succeeded and deployed at https://prism-1420.surge.sh
(hash f63359c deployed at 2025-02-27T20:56:49)

@ericboucher
Copy link
Collaborator

@Max-Z80 please describe a bit more what this PR does in the PR body and adapt the name to what it is actually doing. There is no real "logic" here, it is simply initializing the new alert worker. No?

@Max-Z80
Copy link
Collaborator Author

Max-Z80 commented Jan 29, 2025

@Max-Z80 please describe a bit more what this PR does in the PR body and adapt the name to what it is actually doing. There is no real "logic" here, it is simply initializing the new alert worker. No?

THere is a logic in the aa-strom-alert-worker.js. I will describe deeper this logic in the PR body

@Max-Z80 Max-Z80 marked this pull request as draft January 29, 2025 12:44
@Max-Z80 Max-Z80 force-pushed the aa-storm-feature/email-logic branch from 3b4c109 to ddd4a08 Compare January 31, 2025 13:41
@Max-Z80 Max-Z80 force-pushed the aa-storm-feature/email-logic branch from 852ba3e to 4f586c6 Compare February 3, 2025 21:23
@Max-Z80 Max-Z80 force-pushed the aa-storm-feature/email-logic branch from 4f586c6 to 4773e5b Compare February 3, 2025 21:25
ericboucher and others added 7 commits February 13, 2025 16:27
* Update design, add mailto link, update wind types, filter activated district

* fix type

* add body message

* fix type

* fix lint

* fix lint

* add bcc option to email

* fix naming
Co-authored-by: donia benharara <donia.benharara@pathtech.fr>
@ericboucher ericboucher marked this pull request as ready for review February 20, 2025 10:01
@ericboucher ericboucher changed the title aa storm feature / alert logic AA storm - email alert logic Feb 20, 2025
Copy link
Collaborator

@ericboucher ericboucher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

One small thing we should address before merging, momentjs is deprecated and we removed it from the app a few months ago. So let's remove the few re-appearances from this PR for consistency :)

@wadhwamatic
Copy link
Member

Hi @Max-Z80. Two more small inputs from Gabriela:

  1. Let's replace "Projected wind speeds affecting districts in the next 72 hours:" with "Projected wind speeds affecting pilot districts:"
  2. Between the table and ACCESS DASHBOARD link, add this text: "For more information about landfall and trajectory, please access the dashboard using the link below:"

cc @ericboucher

const latestAvailableReports = await getLatestAvailableReports();

// get the last alert which has been processed for email alert system
const alert = await alertRepository.findOne({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Max-Z80 @Doniaab let's make sure we support multiple alerts here. This would allow us to handle different user groups more easily

Co-authored-by: Maxime Chaillet <maxime.chaillet@pathtech.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants