In Version 2.0, OpenSRP server app will be using events/clients data to generate enroll clients into various schedules. The diagram below highlights the hierarchical order of the classes involved in implementing the logic for enrolling, fulfilling, unenrolling clients into/from different milestones based on the events generated from the form submissions.
Schedule Config Files
Since it's events that lead to clients joining schedules, some JSON config files are required to serve as a guide to the EventsRouter class when determining which event leads to a client joining a given schedule and forwarding this event to the respective ScheduleHandler for processing. Authoring a schedule config file mainly involves specifying events, action,reference_date_fields and enrollment/unenrolment/fulfillment_fields that the scheduling logic should look out for in an event to automatically determine which schedule a client quailifies to join, fulfill or unenroll. These fields are questions and answers from the form submissions most of the times in form of OpenMRS concepts. In particular in the events object:
- types are the event types to look out for
- enrollment_fields are the conditions that must be satisfied to enroll a client to a schedule. Concept key in this object is the question that must be satisfied with answer specified in the value key. NOT_EMPTY in the value key means that value can be anything except and empty string. When not using a concept as the question, specify any other key as filed: {field_name} as shown in the fulfillment_date_fields
- reference_date_field is the field that has the date to be used as the schedule reference date,
- action specifies what should happen when a condition is satisfied i.e either to enroll/unenroll or fulfill a milestone
- pass_logic is either AND/OR, when AND all the conditions in the enrollment_field must be satisfied
- milestone is the the milestone affected by the specified condition
{ "name": "Ante Natal Care - Normal", "handler": "ANCScheduleHandler", "events": [ { "types": ["Pregnancy Surveillance and Registration"], "pass_logic": "AND", "enrollment_fields": [ { "concept": "162942AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "value":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" } ], "milestone": "ANC 1", "reference_date_fields": [ { "concept": "1427AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "value": "NOT_EMPTY" } ], "action": "enroll" }, { "types": ["ANC Reminder Visit 1"], "pass_logic": "AND", "fulfillment_date_fields": [ { "field": "eventDate", "value": "NOT_EMPTY" } ], "milestone": "ANC 1", "action": "fulfill" } ] }
Class | Module | Notes |
---|---|---|
ApplicationStartupListener | opensrp-web | |
EventsListener | opensrp-core | |
EventsRouter | opensrp-core | |
ScheduleHandlers | opensrp-register | |
HealthSchedulerService | opensrp-core | |
ScheduleService | opensrp-core | |
AlertRouter | opensrp-core | |
ECAlertCreationAction | opensrp-core | |
ActionService | opensrp-core |
0 Comments