Patient list displayed based on the facility location

Hello!

Seeking ideas/suggestions/thoughts/experiences!

The requirement: - Patient list in OHRI should be filtered based on the sessionLocation at the time the patient is registered.

Use case: - One OpenMRS instance is deployed for use by facilities countrywide. Users log in from their facilities (choose login location) and would like to view only patients registered in that facility. Change in sessionLocation should reload the patient list with patients registered in the “changed-to” facility.

Have you implemented this or a similar functionality? How did you go about it?

One suggested solution is to record the sessionLocation as a person attribute mapped to a “Managing Organization” PersonAttributeType metadata.

What would this entail?

  1. Add Managing Organization - PersonAttributeType metadata in the iniz config
  2. Registration module (REST-WS) to create person attribute subresource
  3. Registration module (FHIR) to include Patient.managingOrganization in Patient resource
  4. Translator updated to map FHIR.Patient.managingOrganization to/from org.openmrs.PersonAttribute & org.openmrs.PersonAttributeType
  5. FHIR2 searchPatients to factor in filtering by managingOrganization search/query param

What are your thoughts/suggestions?

cc: @eudson @ibacher @dkayiwa @mozzy @mogoodrich

There are two modules designed to provide something like this facility:

  1. Data Filter
  2. Location-Based Access Control

Of those, Data Filter is probably the more robust.

Thanks @ibacher for the suggestion.

We have deployed the datafilter module and noted the following:

  • The locations dropdown in the login page in refapp-2.x is not populated. Understandably because at this point, the user is not known (session not established).

  • The locations dropdown in the login page in OHRI/O3 is populated properly. The locations (basis/bases) in the dropdown are those linked to the sessionUser (entity) in datafilter_entity_basis_map

This so far is a non-issue as @asen123 can confirm that there is imminent complete upgrade to O3.

The challenge we have is; we have a sessionUser (entity) linked to a location (Hope Clinic) (basis) in datafilter_entity_basis_map and a patient (entity) linked to the same location (Hope Clinic) (basis) in datafilter_entity_basis_map BUT, the patient list is blank with a 504 - Gateway timeout.

The superuser doesn’t face this challenge (No 504 - Gateway timeout error), all patients are loaded successfully.

Any idea what we are missing?

cc: @eudson

1 Like