Skip to content

Instantly share code, notes, and snippets.

@mks-d
Last active December 17, 2018 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mks-d/07d342828d28ee5cb152e35ea28a0138 to your computer and use it in GitHub Desktop.
Save mks-d/07d342828d28ee5cb152e35ea28a0138 to your computer and use it in GitHub Desktop.
OpenMRS Initializer provides the 'locations' domain - Example use

Strangely we could do for so long without a dedicated OpenMRS Initializer domain for locations. Until now we were simply bringing in locations metadata through OpenMRS MDS packages. MDS packages are always a convenient fallback mechanism when the desired OpenMRS Initializer domain is not (yet) available.

It was on our to do list for some time to finally address the case of locations. It is now done, please check the README about it here.

Let us look at a sample use on a Bahmni distribution of one of our clients that supports a small community health clinic in Haiti. Starting from an existing default Bahmni setup we want to end up with just two locations:

  • Clinic
  • Community

'Clinic' is the login location for providers at the clinic itself, whereas 'Community' is an ad-hoc location for providers performing community surveys while offline using Bahmni Connect. We had to deal with the additional constraint that Bahmni default's OPD-1 location had been used to record data at the clinic already, so that one would have to become 'Clinic'.

This simple CSV configuration (committed here)

  1. Retires a set of default Bahmni locations that we don't intend to use and
  2. Renames two of the default Bahmni locations.

Imgur

Let us go through this CSV config line by line and interpret the Initializer actions on each object. For those that are edited we have stated their name as it comes in the default state of the Bahmni database:

CSV line Bahmni default name OpenMRS Initializer actions
2 OPD-1 Renamed into 'Clinic', set as child of 'Jerusalem Clinic', tagged as 'Login Location'
3 Created, set as child of 'Jerusalem Clinic', tagged as 'Login Location' and 'Visit Location'
4 Subcenter 1 (BAM) Retired
5 Subcenter 2 (SEM) Retired
6 Subcenter 3 (SIV) Retired
7 Unknown Location Retired
8 Ganiyari Renamed as 'Jerusalem Clinic', tagged as 'Login Location'

Here again OpenMRS Initializer provides a simple way to process some key metadata in a friendly and readable format, that is very much in line with all other domains that had been covered until now: concepts, drugs, person attribute types... etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment