The sections below walk through how to manage data from Organizations.
Viewing Data Assigned to Locations
You can use the Case List report to view cases that are assigned to each location. In the case list report, you can choose a specific location to view data for - this will show data for all cases assigned to that location and any child locations. You can type and search using the Location name to find a location. Please note that only some of the native reporting supports organizations.
Reassign Cases to a Location
Similar to assigning cases between mobile workers, you can use the Reassign Cases report to assign a case to a location. To go to the Reassign Cases report, choose the Data tab, then choose View All, then choose the Reassign Cases link on the left side.
Use the reassign cases report to search and filter for the cases you care about - then check the cases you want to reassign and choose "Group" and the location you want to reassign the cases to.
Assigning Cases to Locations When Using the Excel Importer
Importing Cases from Excel
For more details on importing cases from Excel please see https://dimagi.atlassian.net/wiki/x/TAjKfw.
Using the Owner Name
When importing cases using the bulk uploader, you can assign them to a location using an owner_name column. In the owner_name column, you can list the name of the location or the site code for the location. The importer will first check for mobile worker names and groups for matches before trying to match to locations.
If you have location names that conflict in your project, you can also use the site code to ensure the cases are assigned to the correct owner.
Using Owner ID
You can also directly use the ID of the location when importing cases to assign cases to that location. You can put the ID in a column called owner_id in your Excel sheet. To find the ID of a location, navigate to the locations page: https://www.commcarehq.org/a/<domain>/settings/locations/import/ and click on "Download Organization Structure". When you download your locations, there will be a "location_id" column, which will contain the location ID against each location.
You can also find the location ID of your location by clicking on "Edit" and looking at the URL in your browser. The last portion of the URL is the location ID. For example: https://www.commcarehq.org/a/[your_domain]/settings/locations/ddc5de8aedb66637cc96ab25d6fb9e2c/. In this URL, the last part: ddc5de8aedb66637cc96ab25d6fb9e2c is the location ID.
Assigning Cases to One of Multiple Locations
For mobile workers assigned to locations that can "View Child Data", they can sometimes be in more than one case sharing group. The user will be required to choose which location the case gets assigned to. For example, a clinic may be required to register clients and assign them to one of their CHWs.
This will add a multiple choice question in your application that allows you to choose which location a case will be assigned to.
Step 1: Turn on the Add-On
When a mobile worker 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 location. To do this, you need to turn on an Add-On 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
Choose the Application Settings (the gear icon next to your application's name near the top left of the screen)
Navigate to the Add-Ons tab
Turn on the "Custom Single and Multiple Answer Questions" add-on under "Calculations" and hit Save
Step 2: 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.
Go to your form that is used to register a new case. Choose the Choice dropdown and add a new Multiple Choice Lookup Table question.
Set the question ID to owner_id (or whatever makes sense) and the label "What location do you want to assign the user to? (or whatever makes sense)".
Choose the "Lookup Table Data" item in the left tree, and then choose the "..." button to configure the list of choices.
Set the Query Expression to instance('locations')/locations/location[@type = 'TYPE OF LOCATION'] (note: be sure to change "TYPE OF LOCATION" to the specific type of location in your application. This will display the list of locations that are available to own the case. Set the Instance ID to locations and the Instance URI to jr://fixture/locations. Then click on the Save button.
Back on the Lookup Table Data page, set the Value field to @id and the Display Text field to name. Note that the Lookup Table dropdown should say "Lookup table not found in project".
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, which is a special property used to define the owner of the case.
Search for Locations
When searching for locations, you can use special symbols to make your search more precise.
You can initiate an exact search by including quotation marks around the name of the location, as pictured above. CommCare will provide the user suggestions matching the exact text, so for instance, "Cambridgeport" wouldn't appear.
You can use slashes to specify multiple location levels, narrowing your search. For example, typing "mass" will show you "Massachusetts":
Adding a slash afterward will start a new search among the results.
You may then type to search in those results.
This can be done multiple times.
These two techniques can also be combined for maximal precision.
Assigning Lookup Table Rows to a Location
Lookup Table Documentation
For more details on using Lookup tables, view https://dimagi.atlassian.net/wiki/x/gijKfw.
Lookup table rows can be assigned to a location by editing the excel upload. This will allow all mobile workers assigned to that location and mobile workers at any child locations to view that lookup table data. This makes it easier to assign specific data to a region or group of mobile workers.
To assign a lookup table row to a location, add a column titled location 1 (or location 2, location 3, etc. if you want to assign multiple locations to a row). This column must be added on the Table ID tab of the upload. Likely, the Table ID tab will be second on the spreadsheet if it was originally created using the Download Lookup Tables feature.
Next, enter the name of the location or the site code. Since location names can sometimes conflict, the site code will ensure that the lookup table row is correctly assigned. If you use a location name that results in duplicates, you will get a warning after importing the lookup table.
Show Orphan Case Alerts on Mobile Worker Edit Page
Locations that owns cases and have a single assigned mobile worker require careful consideration. This is because unassigning that mobile worker from the location would render the cases inaccessible to all mobile workers. On the other hand, unassigning mobile workers from locations with no cases presents no issue, as no new cases can be created in such locations.
While some workflows capitalize on this behavior, other workflows might be impacted differently. Depending on your project's specific worflow, you might want the system to display a warning when this situation is detected.
The warning banner
The display of a warning banner is controlled by a project setting named Show Orphan Case Alerts on Mobile Worker Edit Page.
When editing a mobile worker, the warning banner will be displayed on the "Locations" tab if any of the worker's assigned locations fall into the category described above. The banner presents a list of locations where the mobile worker is the sole assigned user, along with the number of cases present in each location. This enables you to quickly identify situations that require attention.