Turning on/off web-app fragments for client specific locations

Hello all, I will be using an example to explain this issue well. Suppose OpenMRS is deployed in two locations A & B. Both locations have client specific needs which are deployed on the patient dashboard written in AngularJS. I understand I can use angular attributes like ng-if and by querying patient address but I would like to manually turn it on/off from the manage apps page. If I am not wrong I will have to add app definition for that but would I be able to link it to a particular fragment on the dashboard.

If yes, it would be nice if you could tell me any link where I can find that or instruct me on how to achieve it.



Why not create separate apps for each site so that you only turn on the features that you need

Take a look at this: https://wiki.openmrs.org/display/docs/Conditionally+displaying+Apps+and+Extensions

So I couldn’t figure out from the documentation on how to make the app for my particular scenario. So when user clicks on a patient on the active patients app it is redirected to a dashboard page. I want to have fragments on this page which I can turn on/off according to the need. But I cannot figure out how to do that from the documentation.

The fragments would be like, recent visits, patient profile image, past visit complaints, patient analysis, doctor notes for the patient etc

Would be nice if you could help me out with this.


@hardikk08 Can you give 2 or 3 examples for example:

  1. All patients:
    • fragment 1, fragment 2, fragment 3
  2. Female above 25 years only
    • fragment 5, fragment 7, fragment 8
  3. Child between 0 and 5 - irrespective of gender
    • fragment 4, fragment 5

@ssmusoke - Pitching in to explain the background a bit better. Our team uses OpenMRS to set up telemedicine programs with partner organizations. We’ve built our own UI module for telemedicine. But each deployment is different and requires some little tweaks to customize for each program. For example, one deployment is for primary health care, the other for cardiac care and a third for prison medicine. For each program we have to create a separate cloud-hosted instance of OpenMRS.

We have a base configuration with a common workflow and common UI elements that are used across all programs (we have created some fragments, and we use some from the uicommons module) and then based on the program, we add new ui elements by adding new fragments (eg: cardiac care program wants a fragment to view ECG data). So lets say fragment 1, fragment 2 and fragment 3 are common to all programs. For program 1 we have an additional fragment 4, for program 2 we have two more fragments lets call them fragments 4 & 5.

Right now we have been managing these by having separate branches on our module git repo for each program. However, as our number of programs grows this makes code management very challenging.

So the solution we came up with was to create a library of fragments that we could then turn on/off while configuring an OpenMRS instance for a program.

Does that explain the intent and need behind Hardik’s question better?

Basically we want to replicate the functionality of how we can currently turn on/off fragments like Vitals,Diagnoses, Allergies, Weight graph etc. on the clinician facing patient dashboard. That way we can create a library of fragments and configure each OpenMRS instance in a modular way.

Look forward to your suggestions on this and also to understand how the functionality for this currently works on the clinician facing patient dashboard.

Link to our module’s Git repo: https://github.com/Intelehealth/intelehealth-openmrs-ui

We do this… we have a single “PIH EMR” distro that we install at several sites and customize for each. Unfortunately watch we’ve done is not really documented and can be hard to follow, and I’m swamped right now working on deliverables, but I can point you in the direction of our code at least… :slight_smile:

Basically, you want to have different apps and extensions configured per implementation. Apps and Extensions are generally set up via json, but we put a Java wrapper on top of this and then turn apps on/off based on a “PihConfig”. It’s unclear if this was the best approach, as it makes setting up a new implementation dependent on Java code.

Here’s where we set up our configuration framework:

And here is where we use that framework to decide what apps to turn on/off per implementation:

There’s a lot to digest there, but hopefully it helps a bit… :slight_smile:

Take care, Mark

Thanks @mogoodrich! Will look into it and get back to you with questions.