The BA project requires the ability to generate referrals in the CHW application and have those synchronized to the health facility application.

Assumptions

Outstanding Questions on this Scoping Document

Definitions

High Level Workflow

This section defines the high level workflow for generating referrals in the CHW application, syncing and to the server, viewing the task in the Facility application and closing the loop.Additional details and mock-ups have been created by the BA team.

Constraints

Steps:

Task, Event, Location and Entity Relationships

The core of this innovation is a relationship between events, tasks and entities in the Android client. These relationships are important in both the Android client and OpenSRP server. Note that Reveal includes a location component that's not critical in this case, so the implementation may be slightly different. (Reference the definitions above for more information) This section defines the relationship and impact of each component of the data model.

Task State Machine

The Reveal team implemented a task state machine in the Android client. We need to implement the same in OpenSRP for the BA project. Below is a representation of that state machine, which is a number of processes that update the state of tasks. We don't need to implement all states in the Android client for this project.

Task Statuses

Task Business Statuses

Task Template and Data Dictionary

{
  "identifier": "UUID()",
  "planIdentifier": "",
  "groupIdentifier": "healthFacilityLocation",
  "status": "Ready",
  "businessStatus": "Not Visited",
  "priority": 3,
  "code": "referralType",
  "description": "referralDescription",
  "focus": "",
  "for": "patientBaseEntityId",
  "executionStartDate": "now()",
  "executionEndDate": "now() + 7 days",
  "reasonReference": "referralFormEventId",
  "owner": "username",
  "note": null,
  "serverVersion": 0
}


NameDescriptionTypeChoicesCalculationConstraint(s)RequiredEditable?
identifierThis is a globally unique id (GUID) of the taskString

HiddenYesNo
planIdentifierThis is the GUID of the plan related to this task (We will not use this for BA)String

HiddenNoNo
groupIdentifierThis is the location id of the facility where the task is assignedString

HiddenYesNo
statusThis is the status of the taskselect_one
"Draft", "Ready", "Cancelled", "In Progress", "Completed", "Failed"

Default Value = "Ready"YesYes
businessStatusThis is the business status of the task that's displayed in the UIString"Referred", "In-Progress", "Complete", "Expired"
Default Value = "Referred"YesYes
priorityThis is the priority of the task (1 being low priority, 5 being high priority)select_one"1","2","3","4","5"
Default value = "3"YesYes
codeThis is the type of task and is dependent on the interventionselect_one
"Referral"

Default value = "Referral"YesYes
descriptionThis is a human readable description of the taskstring

Default value = "Review and perform the referral for the client"NoYes
focusThis is the type of referral that needs to be doneselect_one
"Sick Child", "Suspected Malaria", "Pregnancy Test or Confirmation", "ANC Danger Signs","PNC Danger Signs","FP initiation","Home Birth","Woman in Labour"


YesYes
forThis is the target entity that benefits from the task. (i.e. patient baseEntityId)String


YesYes
executionStartDateStart dateTime for the executionPerioddateTime


NoYes
executionEndDateEnd dateTime for the executionPerioddateTime


NoYes
reasonReferenceThis is the id of the form that was submitted that kicked off this task. This is used to link to the referral that was generatedUUID


NoNo
authoredOnThis is the dateTime that the task was createddateTime


YesNo
lastModifiedThis is a dateTime that the task was last modifieddateTime


YesNo
ownerThis is the Username of the person who generated this taskstring


YesYes
noteThis is a repeating group that allows users to keep notes on the status of a task over time.Repeating Group


NoYes
note.authorStringThis is the username of the user who authored the noteString

HiddenYesNo
note.timeThis is the dateTime the note was addeddateTime

HiddenYesNo
note.textThis is the text content of the note
String (may include paragraphs)



YesYes

Plan Definition

We need to create a plan in the system to be able to link tasks to particular actions within the plan.

{
    "identifier": "${UUID()}",
    "version": "1",
    "name": "baCatchAllReferral Plan",
    "title": "BA Catch All Referral Plan",
    "status": "active",
    "date": "2019-08-06",
    "effectivePeriod": {
      "start": "2019-08-07",
      "end": "2020-08-06"
    },
    "jurisdiction": [
      {
        "code": "UUID_OF_FACILITY_1"
      },
      {
        "code": "UUID_OF_FACILITY_2"
      },
      {
        "code": "UUID_OF_FACILITY_3"
      },
      {
        "code": "UUID_OF_FACILITY_4"
      },
      {
        "code": "UUID_OF_FACILITY_5"
      }
    ],
    "serverVersion": 0,
    "goal": [
      {
        "id": "sickChildReferralGoal",
        "description": "Sick Child Referral Goal",
        "priority": "medium-priority",
        "target": [
          {
            "measure": "Percent of referrals closed",
            "detail": {
              "detailQuantity": {
                "value": 80,
                "comparator": ">=",
                "unit": "Percent"
              }
            },
            "due": "2020-08-06"
          }
        ]
      },
	  {
        "id": "suspectedMalariaReferralGoal",
        "description": "Suspected Malaria Referral Goal",
        "priority": "medium-priority",
        "target": [
          {
            "measure": "Percent of referrals closed",
            "detail": {
              "detailQuantity": {
                "value": 80,
                "comparator": ">=",
                "unit": "Percent"
              }
            },
            "due": "2020-08-06"
          }
        ]
      },
	  {
        "id": "pregnancyTestReferralGoal",
        "description": "Pregnancy Test Referral Goal",
        "priority": "medium-priority",
        "target": [
          {
            "measure": "Percent of referrals closed",
            "detail": {
              "detailQuantity": {
                "value": 80,
                "comparator": ">=",
                "unit": "Percent"
              }
            },
            "due": "2020-08-06"
          }
        ]
      },
	  {
        "id": "ancDangerSignsReferralGoal",
        "description": "ANC Danger Signs Referral Goal",
        "priority": "medium-priority",
        "target": [
          {
            "measure": "Percent of referrals closed",
            "detail": {
              "detailQuantity": {
                "value": 80,
                "comparator": ">=",
                "unit": "Percent"
              }
            },
            "due": "2020-08-06"
          }
        ]
      },
	  {
        "id": "pncDangerSignsReferralGoal",
        "description": "PNC Danger Signs Referral Goal",
        "priority": "medium-priority",
        "target": [
          {
            "measure": "Percent of referrals closed",
            "detail": {
              "detailQuantity": {
                "value": 80,
                "comparator": ">=",
                "unit": "Percent"
              }
            },
            "due": "2020-08-06"
          }
        ]
      },
	  {
        "id": "fpInitiationReferralGoal",
        "description": "Family Planning Referral Goal",
        "priority": "medium-priority",
        "target": [
          {
            "measure": "Percent of referrals closed",
            "detail": {
              "detailQuantity": {
                "value": 80,
                "comparator": ">=",
                "unit": "Percent"
              }
            },
            "due": "2020-08-06"
          }
        ]
      }
    ],
    "action": [
      {
        "identifier": "${UUID()}",
        "prefix": 1,
        "title": "Sick Child Referral",
        "description": "Receive referral, perform patient action and close it",
        "code": "Referral",
        "timingPeriod": {
          "start": "2019-08-07",
          "end": "2020-08-06"
        },
        "reason": "Sick Child",
        "goalId": "sickChildReferralGoal",
        "subjectCodableConcept": {
          "text": "Referral"
        },
        "taskTemplate": "Referral"
      },
	  {
        "identifier": "${UUID()}",
        "prefix": 2,
        "title": "Suspected Malaria Referral",
        "description": "Receive referral, perform patient action and close it",
        "code": "Referral",
        "timingPeriod": {
          "start": "2019-08-07",
          "end": "2020-08-06"
        },
        "reason": "Suspected Malaria",
        "goalId": "suspectedMalariaReferralGoal",
        "subjectCodableConcept": {
          "text": "Referral"
        },
        "taskTemplate": "Referral"
      },
	  {
        "identifier": "${UUID()}",
        "prefix": 3,
        "title": "Pregnancy Test or Confirmation Referral",
        "description": "Receive referral, perform patient action and close it",
        "code": "Referral",
        "timingPeriod": {
          "start": "2019-08-07",
          "end": "2020-08-06"
        },
        "reason": "Pregnancy Test",
        "goalId": "pregnancyTestReferralGoal",
        "subjectCodableConcept": {
          "text": "Referral"
        },
        "taskTemplate": "Referral"
      },
	  {
        "identifier": "${UUID()}",
        "prefix": 4,
        "title": "ANC Danger Signs Referral",
        "description": "Receive referral, perform patient action and close it",
        "code": "Referral",
        "timingPeriod": {
          "start": "2019-08-07",
          "end": "2020-08-06"
        },
        "reason": "ANC Danger Signs",
        "goalId": "ancDangerSignsReferralGoal",
        "subjectCodableConcept": {
          "text": "Referral"
        },
        "taskTemplate": "Referral"
      },
	  {
        "identifier": "${UUID()}",
        "prefix": 5,
        "title": "PNC Danger Signs Referral",
        "description": "Receive referral, perform patient action and close it",
        "code": "Referral",
        "timingPeriod": {
          "start": "2019-08-07",
          "end": "2020-08-06"
        },
        "reason": "PNC Danger Signs",
        "goalId": "pncDangerSignsReferralGoal",
        "subjectCodableConcept": {
          "text": "Referral"
        },
        "taskTemplate": "Referral"
      },
	  {
        "identifier": "${UUID()}",
        "prefix": 6,
        "title": "Family Planning Initiation Referral",
        "description": "Receive referral, perform patient action and close it",
        "code": "Referral",
        "timingPeriod": {
          "start": "2019-08-07",
          "end": "2020-08-06"
        },
        "reason": "Family Planning Initiation",
        "goalId": "fpInitiationReferralGoal",
        "subjectCodableConcept": {
          "text": "Referral"
        },
        "taskTemplate": "Referral"
      }
    ]
  }


Software Development Required

This section defines the software that needs to be developed to realize this feature. I have broken this down into a set of features that need to be implemented in the CHW app, the health facility app and the OpenSRP server. This section does not include reporting.

Out of Scope for the MVP

Decisions

Core

We need to develop the following core features.

CHW App

Health Facility App

Both Apps

View Descriptions

This section defines the views that are impacted and the core data elements that define these views.

Card Structure

Row 1: (Given Name) (Family Name), (Age) (DateTime)
Row 2: (Referral Reason)
Row 3: Referred by CHW (CHW Username)

FieldSourceLogicExample
Given Namepatient.givenNameThe task.for value has the baseEntityId of the person impacted. query the client table and find these person attributesCharity
Family Namepatient.familyNameThe task.for value has the baseEntityId of the person impacted. query the client table and find these person attributesMikulo
Agepatient.ageThe task.for value has the baseEntityId of the person impacted. query the client table and find these person attributes22
Referral Reasontask.focus
FP Initiation
CHW Usernametask.owner
jmajufuli
DateTimetask.executionStartDateWe need to calculate this field based on the time since the executionStartDate with dynamic values set within the last 24 hours, "Yesterday" or date (This is similar to how we display sync time in multiple OpenSRP apps1h ago