Setup
The connections and the configuration files the outbreak alert services use.
This page is the first of the Outbreak alerts series. It covers what is configured once, before any service is written.
The DHIS2 connections
The services reach DHIS2 through two REST outgoing connections. Both use the DHIS2 security definition from DHIS2 security and JSON as the data format:
| Name | URL path | Used by |
|---|---|---|
DHIS2 Analytics | /api/analytics | Reading the weekly counts per district |
DHIS2 Tracker | /api/tracker | Writing alerts and 7-1-7 register events |
The notification channels
Districts are notified by email and by SMS:
- Email. An SMTP connection named
District Alerts, created under Connections ▹ Outgoing ▹ E-mail ▹ SMTP. - SMS. A REST outgoing connection named
SMS Gateway, pointing to the endpoint of the SMS provider's API that sends a message, with the security definition the provider's credentials call for.
The EMS connection
When alerts are managed in an emergency management system built on Odoo, the services reach it through an Odoo connection named EMS, created under Connections ▹ Outgoing ▹ Odoo with the address, database and user of the EMS.
The configuration files
alerts.ini holds the level of the organisation unit hierarchy that districts are on, the service that records alerts, the sender of the emails, and one section per disease with the data element its counts are reported under and the rule it is checked with:
# config/user-conf/alerts.ini
[analytics]
district_level = 2
[record]
service = dhis2.alerts.record-alert
[email]
sender = surveillance@example.com
[diseases]
[[cholera]]
data_element = UsSUX0cpKsH
rule = single_case
[[malaria]]
data_element = vq2qO3eTrNi
rule = baseline
baseline_weeks = 8
deviations = 2
minimum = 5
districts.ini has one section per district, named after the district's UID, with the name used in messages and the addresses the district is notified at. Phone numbers are quoted so they are read as text:
# config/user-conf/districts.ini
[O6uvpzGd5pu]
name = North
email = surveillance.north@example.com
phone = '+15555550104'
[fdc6uOvgoji]
name = East
email = surveillance.east@example.com
phone = '+15555550107'
alert_programs.ini holds the identifiers of the alert program and the 7-1-7 register:
# config/user-conf/alert_programs.ini
[alert]
id = Xb4mT0vQd8L
tracked_entity_type = Gq2LpZ7cW1n
stage_signal = Rk8vN3sYd5H
element_disease = Ua6tP9wKe2J
element_week = Hc1zS4oBm7Q
element_cases = Wd3rF8jLn0T
[register]
id = Jm5yC2gXa9V
stage = Pe7kD1uRt4Z
element_disease = Tn9bV6hQs3M
element_detected = Lf2wE8cYp6K
element_notified = Zs4qA7nJv1D
ems.ini is described on Alerts in an EMS.
Next
Weekly data reads twelve weeks of counts per district from DHIS2 analytics.
See also
see-also-table
columns: [Feature, What it does]
rows:
- page: docs/dev/examples/smtp
text: SMTP
note: Sending email from services
- page: docs/dev/odoo/index
text: Odoo
note: Connections to Odoo and its models
- page: docs/dev/examples/config
text: Config files
note: Nested sections and values read through self.config