Location Hierarchy
In OpenSRP locations are managed in OpenMRS that allows you to maintain locations of any type and any level of hierarchy.
On server:
- Carefully identify the types and level of administrative locations in your country or program, e.g. Country > Province > District > Town > Union Council. These types are registered as 'Tags' in OpenMRS. The system allows you to maintain multiple tags for locations but ideally and for better program management and reporting, there should be only one Tag associated with any location.
- The identified types in location hierarchy should be registered as Tags in OpenMRS from section 'Manage Location Tags' (e.g. http://46.101.51.199:8080/openmrs/admin/locations/locationTag.list)
- Now register all locations in your administrative hierarchy. The locations are registered from 'Manage Locations' section of OpenMRS (e.g. http://46.101.51.199:8080/openmrs/admin/locations/location.list). Note that while registering you must assign the Tag of the registered locations and also select the parent location. If parent location doesnot exist, it should be created first. Therefore, start creating locations from topmost level in hierarchy and gradually dig down to the lowest one (see image below)
- Once you are done with locations check if location hierarchy is correct from 'Location Hierarchy' section in OpenMRS (e.g. http://46.101.51.199:8080/openmrs/admin/locations/hierarchy.list)
On client:
- The location hierarchy inside OpenMRS could be accessed on OpenSRP client with complete hierarchy and level information in JSON format.
- To get tree for all locations starting from the top most root send a http request to http://yourserver/location/location-tree. For demo server access the link http://46.101.51.199:8080/oweb/location/location-tree
- The response returned would be a json document mappable to org.opensrp.api.util.LocationTree.
- To get subtree starting from a particular location add location id i.e. uuid in OpenMRS to the request as http://yourserver/location/location-tree/uuid as path variable. The returned tree would be a JSON document mappable to org.opensrp.api.util.LocationTree where root location would be the one specified in filter.
This site is no longer maintained. Please visit docs.opensrp.io for current documentation.