Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This scoping document defines the narrative and technical requirements for dynamic task generation and entity persistence for the Reveal platform. The contents of this document relates to dynamic form configuration, but is not wholly dependent on that feature set. In essence dynamic task generation and entity persistence can take place independently of which form is opened when a task is assigned.

...

  1. Plans will be updated to include action criteria that supports defining templated logic that should be evaluated when generating tasks in the server and client. This will be used at multiple steps across the system.

  2. We will move bulk task generation from Nifi into the OpenSRP server, adding a business layer and queue that supports the evaluation of plans and generation of tasks. This process will walk the relationship tree for all affected entities that are affected in the jurisdiction, evaluating the logic defined in the plan action at each step.

    1. (CRAIG CHECK THIS AGAIN AFTER YOU FINISH THIS DOC) We will not implement a state machine in the OpenSRP Server.

  3. Configurable forms will be able to define the task’s business status as a hidden value in the bottom of the form labeled business_status.

    1. This allows for configuration of the business logic, color coding, and task processing

  4. We will implement a task state machine in the Android client that is able to execute logic on task state changes.

    1. This allows us to respond to changes in task state independent of form submissions. A post save action on a form may or may not change the state of an assigned task. This allows us to chain actions in the event we need to execute multiple, independent, actions based on task state changes.

  5. Plans will be evaluated in the Android client after a task state has changed to identify if follow-on actions should be taken. Each action will include evaluation criteria that determines the action.

  6. The Android client will be able to display multiple tasks assigned to a structure in the map view. This will allow implementers to assign multiple action items and independent forms at the structure level.

  7. (I’m not sure if we want to do this or solve it another way) We will provide access to view and edit locations, families and family members in the Android client even if a task is not assigned to that entity.

    1. The location is the primary unit of navigation from the map view. A user can not access the information at a location if a task is not assigned. We will lift that constraint and allow users to view the underlying entity.

...

  • Forms (Upload Web UI)

    • System administrators will be able to add, edit, and update fields for forms that are available in the system. This includes changing the business status that impacts task generation

  • Plan Templates (No Web UI)

    • This is a new item that will allow system administrators to define plan templates for certain workflows. We currently hard code this into the OpenSRP Web UI for IRS and Focus Investigation. These templates allow a user to select from a drop down menu and control the actions that show up. Ultimately, the template creator has the capacity to create any action they wish.

    • Creating, updating, and archiving Plan Templates will not be accessible through the web UI.

  • Plans (Web UI)

    • Users are currently able to create plans in the Web UI. We will expand this to support adding criteria to action.

  • Task State Change Logic (No Web UI)

    • This will allow us to define logic that executes when the task state changes

  • (Placeholder: I’m not sure if we need to do this) Post form save logic (No Web UI)

    • We want to standardize the post form save logic so that it can be templated and eventually defined server side. This would allow us to define what happens after a form is saved.

  • (I’m not sure if we want to do this, or if MapBox provides this for us) Map View Styles (No Web UI)

    • System administrators will be able to define color coding for business status combinations available in the Android client and Web UI’s map views. This will allow system administrators to define color coding combinations on state

...

  • User creates a plan in the Web UI

    • They select from a drop down of plan templates, choosing (IRS Zambia 2020 plan template)

    • They complete the online form, confirm the default dates are correct and click Save

  • (optional) The user walks through the map based planning UI

  • The plan’s status is changed to “active” which triggers an action that generates all tasks for the plan in the OpenSRP Server

  • The user assigns a team to the plan if it wasn’t done in the map based planning UI

  • The spray operator logs into the Android client and the data syncs to their device

  • The user drops a point to add a location

    • The form is saved

    • The post form save action generates a task with status=”complete” and business_status defined by the form.

    • The task state change triggers an evaluation of the actions in the plan

    • The spray action evaluates to true because the location is marked as a residential structure.

    • The task state machine generates a “spray” task based on the spray task template that was configured with status “Ready”

    • The color coding is reflected as it was defined for this type of task in the Map View Styles configuration

    • The user taps the structure

      • If multiple tasks were assigned, they would be presented with a list of those tasks so they could choose which one to complete. The user should also be able to archive a task if it’s not relevant.

    • The form opens, they complete the form, and save it.

    • The post save action executes, updating the business status of the task

    • The task state change in status and business_status triggers an evaluation of the actions of the plan

    • All criteria evaluates to false for each action, so nothing is changed in the system

    • The user is returned to the map view. The color coding is reflected as it was defined for this type of task in the Map View Styles configuration.

...

  • User creates a plan in the Web UI

    • They select from a drop down of plan templates, choosing (Thailand Routine FI 2020 plan template)

    • They complete the online form, confirm the default dates are correct.

    • They make sure to check the plan as active

  • The plan’s status is changed to “active” which triggers an action that generates all tasks for the plan in the OpenSRP Server

  • The user assigns a team to the plan

  • The frontline worker logs into the Android client and the data syncs to their device

  • The user drops a point to add a location

    • The form is saved

    • The post form save action generates a task with status=”complete” and business_status defined by the form.

    • The task state change triggers an evaluation of the actions in the plan

    • The spray action evaluates to true because the location is marked as a residential structure.

    • The task state machine generates a “register family” task based on the register family task template that was configured with status “Ready”

    • The color coding is reflected as it was defined for this type of task in the Map View Styles configuration

    • The user taps the structure

      • If multiple tasks were assigned, they would be presented with a list of those tasks so they could choose which one to complete. The user should also be able to archive a task if it’s not relevant.

    • The form opens, they complete the form, and save it.

    • The post save action executes, updating the business status of the task.

    • The task state change in status and business_status triggers an evaluation of the actions of the plan

      • The criteria for the “Bednet Distribution” action evaluates to true so a bednet distribution task is created

      • The criteria for the “Blood Screening” action evaluates to true so a blood screening task is created for the head of household.

      • The criteria for all other actions evaluate to false.

    • The user is forwarded to the household view

    • The user registers the spouse of the head of household and saves the form.

    • The post save action executes, creating a task with status=”complete” and business_status based on the register family member form. (This allows us to count that work, even though it wasn’t initially assigned)

    • The task state change in status and business_status triggers an evaluation of the actions of the plan

      • The criteria for the “Blood Screening” action evaluates to true so a blood screening task is created for the recently added family member.

      • The criteria for all other actions evaluate to false.

    • The user returns to the household view.

    • The user completes the blood screening form for the head of household.

    • The post save action executes, updating the business status of the task.

    • The task state change in status and business_status triggers an evaluation of the actions of the plan

      • The criteria for all actions evaluate to false.

    • The user returns to the household view.

    • The user edits the blood screening form for the head of household.

    • The post save action executes, updating the business status of the task.

    • The task state change in business_status triggers an evaluation of the actions of the plan

      • The criteria for all actions evaluate to false.

    • The user returns to the household view.

    • The user navigates back to the map view and the color of that structure changes to the color defined in the configurable Map View Style

...

This section outlines the software packages that need to be developed in order to deliver these features. The target is to break out these items into tangible chunks of work that can be scheduled and delivered within two weeks.

(This section is still a work in progress)

1. Develop Plan Evaluator Java Library

...

  1. A “register family” task has been created against a location in the server, but the Android client already has a family registered against that location when the new plan is activated

    1. User is operating on FI Plan1 offline

    2. User has a task for Plan1 to register family for Structure A

    3. User registers this family

    4. Plan2 is created on the server

    5. StructureA has a new task generated against Plan2

    6. User goes online

    7. Conflict:

      1. The structure has two tasks associated with the same entity (family) against different plans

      2. the task for the new plan should not have been generated (if the device had been online and the family registration had synced before the new plan was created)

    8. Solution Options:

      1. The task that was first marked as Done first wins, the other task is archived?

      2. Archive needs We could add logic server side when new clients are synced, we could analyze any tasks that exist against the family registration when the client hits the OpenSRP server and changes “status”: “Cancelled” for the task that was created.

        1. We have an issue with follow-on task generation. So if you registered a family, you need to run through the plan again and generate the appropriate tasks.

        2. Business Logic: Evaluate against a single entity server side.

          1. We sync an event

            1. For this specific event type, we evaluate it against all known plans that were active when the event was created

            2. Identify if there are any tasks linked to it with a status “Ready” for any plan that is active (this includes doing a structure look-up)

            3. We cancel the associated task based on the task.code and then immediately trigger plan evaluation for plans that are affected

          2. Note:

            1. It’s possible that users have done double family registrations.

            2. It would be valuable to configure this in the plan, including adding a look-up for other tasks that exist

            3. Events are synced by jurisdiction, so that means other devices have a copy of all events against that jurisdiction over time

          3. We need to do this for the following eventTypes

            1. Family Registration

            2. Family Member Registration

            3. Register_Structure

          4. Feature:

            1. Evaluate the family member event in the OpenSRP server

            2. Evaluate the action against

      3. The task that was first marked as Done first wins, the other task is archived?

      4. Archive needs to cascade down to all devices

  2. A point is added locally and it hasn’t been synced

    1. Is this an issue?

      1. Point in added locally

      2. Task is created locally

      3. Family is registered

      4. Device syncs location, task and event to server

      5. location is synced down to other devices

    2. Problem: A new plan is generated and this point isn’t evaluated

  3. We don’t provide access to perform lifecycle life cycle events on locations (update, archive)

  4. We don’t provide access to underlying families if we don’t have a register family task

    1. Note

      1. We need to consider the color coding for families that are registered but don’t have a task

  5. We don’t have a clear process for handling duplicate registrations and tasks that are generated on multiple offline devices

    1. The current strategy is latest wins. That should be fine, but we need a clear audit path to show what happened. If possible, see if we can reverse it.

  6. Users change an entity in one plan and expects that to persist across other plans in the operational area when offline. For example, if a user has two plans in the same operational area and they register a family at structure A, they expect that family to show up in structure A in both plans.

    1. if this is happening locally when offline, this should be catered for by removing the restriction on accessing entities without tasks. The location is associated to the jurisdiction, the entity (family) is associated to the location.

    2. A user removes a family member in one plan and expects it to persist across plans

      1. Ditto above

...

  • Issue: We don’t evaluate the difference in state between the OpenSRP server and the Android client upon sync. There’s an underlying Issue where we evaluate plans only once when they are made active based on the state in the server at that time. (PD: does ‘evaluate’ equate to ‘generate tasks for’?)

  • PD: What currently happens if there is a task of the same type for the same location, one generated server side and one generated on the client? Is this even possible? - should tasks be marked as 'generated server side or generated android? seems useful))

    • Option 1:

      • Evaluate the entity state of certain task types before they are opened. For example, if you have a register family task type, you could evaluate it and see that there’s already a relationship available for that structure. If so, run through the plan locally and generate the appropriate tasks.

    • Option 2:

      • Evaluate all tasks of a certain type when they are received by the Android client and update the state as part of the sync process

  • We don’t address state of entities across plans. In other words, the completion of certain types of events could trigger changes in other plans.

    • We aren’t sure if it should. I need help with this

    • e.g there a dynamic ‘ante-natal visit’ task created for pregnant women when a family member who is pregnant is registered….

    • If we stick to the set of entities that are persistent (locations, families, family members) then this is is not an issue - events are plan specific.

    • Ideally, an entity (specifically clients in this case UPDATE: I had originally thought that ‘Clients’ referred to families and family members only, but this seems to be incorrect as for IRS implementations the ‘sprayed_structure’ is a client, I don’t think spray information should be persisted) can be recreated by replaying all of the events that have that entity as the baseEntity (this is not currently the case as some client information does not get captured as part of the event)

    • Structures and Jurisdictions are also not generated through a task, ever. Register structure tasks are ‘after the fact’ events that are generated when a user drops a pin (Craig Appl is this true?)

    • It feel like there should be some events which are able to modify baseEntitiy attributes, and some that aren’t … does this fit into the DHIS2 paradigm of tracked entities with attribute values, who have events with data elements ? in that case, events CANNOT modify tracked entity attributes - it is a different process to set the attributes

  • Issue: We don’t provide generic access to the underlying family or family member registered at a location regardless of task assignment for that particular plan

    • Logic:

      • Any user should be able to tap on any location to open a view of the family regardless of task assignment.

        • We need to determine the impact of this across plans and in the reporting system

  • We don’t have a clear process for handling duplicate registrations and tasks that are generated on multiple offline devices

    • Logic:

  • We don’t allow users to archive locations or change the state of a location

    • Logic:

      • Any user should be able to tap a location regardless of task status, view and edit information about the location.

        • We need to determine the impact of this across plans and in the reporting system

...