.patient_reports

Patient Reports: Defining SMS workflows with schedules, registration, and patient reports.

The patient_reports key contains the actions to take when reports about people are received.

app_settings.json .patient_reports[]

propertydescriptionrequired
formForm ID of the patient form.yes
nameDescriptive name of the form. This is not currently used in the app, but can be a helpful annotation.no
formatGuide of how the form can be used. This is not currently used in the app, but can be a helpful annotation.no
silence_typeA comma separated list of schedules to mute.no
silence_forDuration from when the report was submitted for which messages should be muted. It is structured as a string with an integer value followed by a space and the time unit. For instance 8 weeks or 2 days. The units available are seconds, minutes, hours, days, weeks, months, years, and their singular forms as well. When a message is muted all messages belonging to the same group will be muted, even if it falls outside of this time period. See messages[].group in Schedules for related info.no
fieldsDescriptive list of form fields. This is not currently used in the app, but can be a helpful annotation.no
validationsA set of validations to perform on incoming reports. More information about validation rules can be found here.no
validations.join_responsesA boolean specifying whether validation messages should be combined into one message.no
validations.list[]An array of validation rules a report should pass to be considered valid.no
validations.list[].propertyReport field for which this validation rule will be applied.no
validations.list[].ruleValidation condition to be applied to the property field. More information about rules can be found here.no
validations.list[].translation_keyTranslation key for the message reply to be sent if a report fails this rule.no
messagesAn array of automated responses to incoming reports.no
messages[].translation_keyTranslation key for the message text associated with this eventno
messages[].event_typeAn event that will trigger sending of this message. Typical values are: report_accepted when the report has been successfully validated, registration_not_found when the patient ID supplied in the report doesn’t match any patient ID issued by Medic. on_mute and on_unmute are used in the context of muting as described hereno
messages[].recipientWho the message should be sent to. Use reporting_unit for the sender of the report, clinic for clinic contact, and parent for the parent contact.no

Code sample

This sample shows a V report clearing schedules that have messages within 8 days of the report being received. The sample also defines the response messages if the report is accepted or if the patient is not found.

  "patient_reports": [
    {
      "form": "V",
      "name": "Visit (SMS)",
      "format": "V <patientid>",
      "silence_type": "ANC Reminders, ANC Reminders LMP, ANC Reminders LMP from App",
      "silence_for": "8 days",
      "fields": [
        {
          "field_name": "",
          "title": ""
        }
      ],
      "validations": {
        "join_responses": true,
        "list": [
          {
            "property": "patient_id",
            "rule": "regex('^[0-9]{5,13}$')",
            "translation_key": "messages.generic.validation.patient_id"
          }
        ]
      },
      "messages": [
        {
          "translation_key": "messages.v.report_accepted",
          "event_type": "report_accepted",
          "recipient": "reporting_unit"
        },
        {
          "translation_key": "messages.generic.registration_not_found",
          "event_type": "registration_not_found",
          "recipient": "reporting_unit"
        }
      ]
    }
  ]