Assigning Cases to one of Multiple Groups

Assigning cases to one of multiple groups

Let's suppose that you have nurses who see patients at health centres, and each health centre draws patients from several surrounding villages. Each village then has a worker who performs checkups in the village at the patients' houses. 

Alternative Option

This page describes manually configuring case sharing groups. You can also use the Organizations feature to more easily configure this setup.

What needs to exist for the above to happen (without having all the workers see all the other workers' cases) is one case-sharing group per village containing the worker and each nurse that could potentially assign a case to that worker. If the worker registers a new case, the case will be shared in the village's case-sharing group which includes the nurse. When the nurse registers a case, they will have to select which village's case sharing group will own the new case. This means that the nurses will be in several different case sharing groups.

 

Step 1: Setup the Case Sharing Groups

You need to setup one Case Sharing group for each set of cases you want shared.  In the example above, the project needs one group for Village 1 Worker, one group for Village 2 worker, one group for Village 3 worker.  You would then assign the nurse to all three groups, and the worker to their own groups.

To setup the Case Sharing groups, go to Users -> Groups.  Then create the case sharing groups required, and make sure you turn on "Case Sharing" for each group. To do so, select the group you want to enable case sharing for to proceed to the edit groups page. On this page, select Edit Settings to open a pop out window where you can turn case sharing on. 

Step 2: Turn on the Feature Preview

When a nurse is registering a patient, you want to display a list of the case sharing groups so that they can assign the case to the appropriate village worker.  To do this, you need to turn on a Feature Preview called "Custom Single and Multiple Answer Questions".  This allows you to display custom choice lists in forms (i.e. a list of case sharing groups) instead of just items from a Lookup Table.

1. Proceed to the Application Settings by selecting the Gear in the top left hand corner. Then select the 'Add-ons' tab:

2. Select the button with three lines on on the right hand side of the screen. Select 'Calculations' from this drop-down.

3. Turn on the "Custom Single and Multiple Answer Questions" feature preview and then click 'Save'.

Step 3: Configure Your Application

In the application, you need to setup your Registration form so that it displays the list of case sharing groups in a single or multiple select question.  

1. Go to your form that is used to register a new case.  Add a new Checkbox Lookup table question to the form:

2. Set the question ID to village (or whatever makes sense) and the display text to "What village do you come from?"

3. Choose the "Lookup Table Data" item in the left tree, and then choose the "..." button to configure the list of choices.

4. Set the Query Expression to instance('group')/groups/group . This will display the list of case sharing groups.   Set the Instance ID to group and the Instance URI to jr://fixture/user-groups .  Then click on the Save button. 

5. Back on the Lookup Table Data page, set the Value field to @id and the Label field to name.  Note that the Lookup Table dropdown should say "Lookup table not found in project"

6. Save your form, and then go to the Case Management section of the form and save the question to the case property called owner_id.

Separate worker and nurse apps

If the workers and the nurses use the same app, the workers will see the question 'what village do you come from?' with only one possible answer corresponding to the one village which they work in. To avoid this, you can have the workers use a separate app to register cases. Make sure the worker app has case sharing Enabled so that the nurses can see the cases they register. Remember that only forms with the above code can be accessed by users in more than one group.

Multiple workers in the same village

If each village has more than one worker, make sure that they are all the workers are in the village's group, that the group has case sharing enabled, and that the workers' app also has case sharing enabled (see above).