Regions
Regions are tiered geographic groupings that contain a list of health facilities. The Cold Chain application is intended to scale to national deployments, and support for regions allows the large data set to be subdivided into manageable pieces. Furthermore, users in different regions are restricted to viewing and modifying data in their region. This has the dual advantage of clearing up the extra clutter that is not relevant to the user, and preventing them from making changes to data they should not have access to.
Regions affect health facility, refrigerator, and maintenance data. Every row in these three tables will be tied to a particular region. The refrigerator type data is not tied to particular regions.
Regions have multiple tiers. For example, the Balaka region is contained inside the South East Region, which is contained in the larger South region. This example has three tiers, but this is not required. The Chitipa region is contained in the North region (there is no East/West subdivision).
Selecting a Region
Function
The Region Selection screen is the first screen you will encounter after being authenticated and granted access. This will differ based on the authenticated user's particular group. For example, the user authenticated in the image to the left above has a default group of REGION_SOUTH_EAST and the user in the image to the right above has a default group of REGION_NORTH. This is the same first screen shown to each user, it is populated to fit their location.
Each button in the list signifies a smaller region contained in the lager region, and the list is generated dynamically based on the region shown. The number of tiers needed to get to the smallest region level will depend on the default group of the authenticated user and the number of tiers it contains.
Implementation
This screen is shown when assets/index.html
and assets/menu.js
execute the authentication code and find a user with a valid region. This will trigger the function showSubregionButtonsAndTitle(...)
in menu.js
, which handles the tiered subregions and creates a list of buttons based on the regions one tier below the authenticated users default group region. The default group region is parsed by the util.getMenuOptions(...)
function in assets/util.js
. This default group string might, itself, contain its subgroups if the group is a higher tier. If that is the case those subregions will be listed as the buttons, and when pressed they will relaunch this screen with a URL parameter indicating the subregion as the new focus region. See addMenuButton(...)
in menu.js
to see how index.html
is relaunched with a new parameter.
If the sub regions are not found by the above method, then the database is queried for the sub regions: util.getDistrictsByAdminLevel2(...)
calls odkData.arbitraryQuery(...)
and queries the health_facility table.
When leaf regions or regions at the child tier that contain Health Facilities are reached, the region buttons will launch the Region Menu screen.
Files
assets/index.html
assets/js/menu.js
assets/js/util.js
Forms
None
Database Tables
Health Facility