How to hide fragments on the patient dashboard on Ref-App 2.9.0

Application Name: Reference Application Version Number: 2.9.0

Question: I would like to hide fragments of the Patient dashboard such as vitals, obsGraph and others. However the method suggested by @mksd in How to hide vitals & diagnosis on patient dashboard page? does not work for me. I was able to successfully disable the attachments and the allergy fragments but not the coreapps fragments. Here is the code that I used in a fork from the reference application:

diff --git a/api/src/main/java/org/openmrs/module/referenceapplication/ReferenceApplicationActivator.java b/api/src/main/java/org/openmrs/module/referenceapplication/ReferenceApplicationAct>
index e37e87c..8e415fd 100644
--- a/api/src/main/java/org/openmrs/module/referenceapplication/ReferenceApplicationActivator.java
+++ b/api/src/main/java/org/openmrs/module/referenceapplication/ReferenceApplicationActivator.java
@@ -91,7 +91,11 @@ public class ReferenceApplicationActivator extends BaseModuleActivator {
        
                appFrameworkService.disableApp("registrationapp.basicRegisterPatient");
                appFrameworkService.disableApp("coreapps.awaitingAdmission");
-       
+                     appFrameworkService.disableExtension("org.openmrs.module.coreapps..mostRecentVitals.clinicianDashboardFirstColumn");
+                     appFrameworkService.disableExtension("org.openmrs.module.coreapps..mostRecentVitals.clinicianDashboardSecondColumn");
+                     appFrameworkService.disableExtension("org.openmrs.module.attachments.patientDashboard.secondColumnFragments.att");
+                     appFrameworkService.disableExtension("org.openmrs.module.allergyui.patientDashboard.secondColumnFragments");
+
                administrationService.saveGlobalProperty(new GlobalProperty("registrationcore.patientNameSearch",
                        "registrationcore.ExistingPatientNameSearch"));

It seems to me that appFrameworkService.disableExtension is using the Extension id to disable the correct extension but several extensions in coreapps seems to use the same ID:

What am I missing ?

Thank you for your help,

Nicolas

@npiaget , did you call the above methods in the started() method of the module’s activator??

yes, sorry :wink:, forget to mention it

did you have to write the extension like that ??

it should be as simple as "coreapps.mostRecentVitals.clinicianDashboardFirstColumn"

I have tried both ways. Just to test that I had the correct Extension ID, I have added the following line in the started() method:

List<Extension> extensions = appFrameworkService.getAllEnabledExtensions();
for (Extension i : extensions) {
  log.error(i.getId());
}

wich output this:

ERROR - ReferenceApplicationActivator.started(98) |2019-12-19 22:06:06,275| org.openmrs.module.coreapps.createVisit                                                                           
ERROR - ReferenceApplicationActivator.started(98) |2019-12-19 22:06:06,276| org.openmrs.module.coreapps.createRetrospectiveVisit                                                              
ERROR - ReferenceApplicationActivator.started(98) |2019-12-19 22:06:06,276| owa.metadatamapping.adminGroup                                                                                    
ERROR - ReferenceApplicationActivator.started(98) |2019-12-19 22:06:06,277| owa.metadatamapping.adminLink                                                                                     
ERROR - ReferenceApplicationActivator.started(98) |2019-12-19 22:06:06,277| formentryapp.forms.homepageLink                                                                                   
ERROR - ReferenceApplicationActivator.started(98) |2019-12-19 22:06:06,277| owa.conceptdictionary.adminGroup                                                                                  
ERROR - ReferenceApplicationActivator.started(98) |2019-12-19 22:06:06,278| owa.conceptdictionary.adminLink                                                                                   
ERROR - ReferenceApplicationActivator.started(98) |2019-12-19 22:06:06,278| coreapps.mergePatientsHomepageLink                                                                                
ERROR - ReferenceApplicationActivator.started(98) |2019-12-19 22:06:06,279| org.openmrs.module.coreapps.diagnoses.clinicianDashboardFirstColumn                                               
ERROR - ReferenceApplicationActivator.started(98) |2019-12-19 22:06:06,279| coreapps.activeVisitsHomepageLink                                                                                 
ERROR - ReferenceApplicationActivator.started(98) |2019-12-19 22:06:06,279| org.openmrs.module.coreapps.mostRecentVitals.clinicianDashboardFirstColumn                                        
ERROR - ReferenceApplicationActivator.started(98) |2019-12-19 22:06:06,280| org.openmrs.module.coreapps.mostRecentVitals.clinicianDashboardFirstColumn                                        
ERROR - ReferenceApplicationActivator.started(98) |2019-12-19 22:06:06,280| org.openmrs.module.coreapps.mostRecentVitals.clinicianDashboardFirstColumn                                        
ERROR - ReferenceApplicationActivator.started(98) |2019-12-19 22:06:06,281| org.openmrs.module.coreapps.mostRecentVitals.clinicianDashboardSecondColumn                                       
ERROR - ReferenceApplicationActivator.started(98) |2019-12-19 22:06:06,281| org.openmrs.module.coreapps.mostRecentVitals.clinicianDashboardFirstColumn                                        
ERROR - ReferenceApplicationActivator.started(98) |2019-12-19 22:06:06,282| org.openmrs.module.coreapps.mostRecentVitals.clinicianDashboardSecondColumn

if you dont mind , can you give a github link/PR to the actual code where you where trying to do this ??

Sure here:

Can you try this? appFrameworkService.disableApp("coreapps.mostRecentVitals")

and: appFrameworkService.disableApp("coreapps.diagnoses")

1 Like

Sorry Daniel, I’m just realizing now that your solution works! Please ignore my first post. Thanks for your help @dkayiwa and @mozzy !

Thanks @dkayiwa, actually that really makes sense, as all those widgets are configured as apps not merely extensions :slightly_smiling_face: