In this talk post and in the squad call last week, we discussed multi-facilities server instances, ex: one OpenMRS server used by multiple hospitals that are operationally independent from each other. The way we model the the location hierarchy might look like this (Location tags are in parentheses):
Hospital A (Visit Location)
|- Inpatient Department A (Queue Location)
|- Ward A1 (Login Location)
|- Ward A2 (Login Location)
|- Outpatient Department A (Queue Location)
|- Triage A (Login Location)
|- Pharmacy A (Login Location)
Hospital B (Visit Location)
|- Inpatient Department B (Queue Location)
|- Ward B1 (Login Location)
|- Ward B2 (Login Location)
|- Outpatient Department B (Queue Location)
|- Triage B (Login Location)
|- Pharmacy B (Login Location)
Some distributions, like the Refapp (populated with the default data in dev3 / test3) and PIH, use the Visit Location tag to denote such “top-level” locations. When a user logs into a Login Location under Hospital A (ex: Triage A), they should only see data (for patients, visits, prescriptions, queues, appointments, etc…) that are created within Hospital A (i.e. either Hospital A or its sub-locations). Currently, this is done / considered in an ad-hoc, non-standard manner in some apps:
- In the dispensing app, we have a search bar for prescriptions. In a multi-facilities server, we can configure
locationBehavior.restrictToVisitLocationDescendantsto true, do make the search bar only return prescriptions made in a sub-location of the login session location’s closet ancestor location tagged asVisit Location. For example, if the user is logged into Triage A, the closest ancestor location that is tagged asVisit Locationis Hospital A, and the user can search for prescriptions made in all locations under Hospital A. - In the Service Queues app, a similar pattern is being proposed (also enabled via config) . When the user is logged into a
Login Locationunder Hospital A, the app’s Location dropdown filter should only showQueue Locationsunder Hospital A, and should only see queue entries that are made under Hospital A.
Some open questions for the community:
- Should we standardize on having a top-level location tag, so that when a user logs in to a location under a top-level location, they can only see data under that top-level Location?
- Should we standardize on calling this top-level location tag
Visit Location? If not, we can allow this tag to be configurable.
- Should we standardize on calling this top-level location tag
- Are there any other solutions the community has come up with that solves the multi-facilities pattern differently?
- If we do standardize on having a top-level location tag, should we standardize this “only see data within a top-level location” behavior across all apps as default, and eliminate configurations like
locationBehavior.restrictToVisitLocationDescendantswithin the dispensing app?
cc @PIH, @METS, @ibacher , @dennis , @slubwama, @ujjawalprabhat, (feel free to cc additional people)