7-1-7 register

Keep the detection and notification dates of each alert in a DHIS2 event program for the 7-1-7 targets.

This page concludes the Outbreak alerts series. The 7-1-7 targets measure each outbreak against three intervals - seven days from emergence to detection, one day from detection to notification, and seven days from notification to the completion of the early response actions.

The register

The register is a DHIS2 event program with one event per alert and one date data element per milestone. Two of the dates are known at the moment an alert is raised - the date it was detected and the date the district was notified - and the service below writes them. The date of emergence, the date the early response was completed and the account of any delay are entered by the people who investigate the outbreak, into the same event.

Program indicators in DHIS2 compute each interval with d2:daysBetween over two of the dates, and a chart of the indicators shows how many outbreaks met each target.

The event

The event is left active so that the remaining dates can be added to it:

# -*- coding: utf-8 -*-

# Zato
from zato.server.service import Service

class UpdateRegister(Service):
    name = 'dhis2.alerts.update-register'

    def build_event(self, alert:'dict') -> 'dict':

        register = self.config.alert_programs.register

        # The dates known when the alert is raised ..
        data_values = [
            {'dataElement': register.element_disease, 'value': alert['disease']},
            {'dataElement': register.element_detected, 'value': alert['detected']},
            {'dataElement': register.element_notified, 'value': alert['notified']},
        ]

        # .. go into a new event of the register, one per alert.
        event = {
            'program': register.id,
            'programStage': register.stage,
            'orgUnit': alert['district'],
            'occurredAt': alert['detected'],
            'status': 'ACTIVE',
            'dataValues': data_values,
        }

        return event

The register is written through the same tracker importer as the alert program:

    def handle(self) -> 'None':

        alert = self.request.payload
        event = self.build_event(alert)

        payload = {'events': [event]}
        params = {'async': 'false'}

        conn = self.rest['DHIS2 Tracker']
        conn.post(payload, params)

The detection date is the date the threshold was crossed in Zato, and the notification date is the date dhis2.alerts.notify-district sent the email and the SMS, so neither depends on anyone copying dates from one system to another.

See also

FeatureWhat it does
ThresholdsWhere the detection date comes from
District notificationsWhere the notification date comes from

Learn more