We are working for a client, who is using OpenMRS. They wants to use the Bahmni-Appointments-Module on top of OpenMRS(without the whole bahmni distribution).
We had started working towards this. Here is some information about the steps we have taken. While testing the Bahmni Appointments module on OpenMRS ref app, we found out there are conflicts with existing openmrs appointments scheduling module.
An association from the table patient_appointment_audit refers to an unmapped class: org.openmrs.module.appointments.model.Appointment
As an easy fix, we removed the existing appointment scheduling app. Post this step, OpenMRS is unable to start these three modules:
Reference Metadata Module
Reference Demo Data Module
Chart Search Module
We wanted to hear from the broader community about:
What could be a possible way to mitigate these issues?
What are the possible reasons for these modules requiring appointments scheduling module?
Will it be possible to replace the openmrs appointments scheduling module with the bahmni appointment scheduling module?
No, I have not yet got the chance to do it yet. Surely, that’s one option I can try by cloning them locally remove dependency and try starting. I have not yet got the time to do it, working on other things to get Bahmni Appointment Scheduling on OpenMRS.
Another thing is I am not very sure, why do these modules require AS module so I test those specific features. I am not fully aware of these modules, I ran into this problem because I was using refapp-docker image and that comes with these modules.
If I check the references for AppointmentType in the reference-metadata code, I don’t see any references for it. This is the only reference which doesn’t look like of AppointmentType model. I think it should have worked, not sure if I am missing anything trivial here.
In other words, if i got the reference application and simply replace require_module with aware_of_module in only that one module, would i reproduce the problem you are reporting of? java.lang.NoClassDefFoundError: org/openmrs/module/appointmentscheduling/AppointmentType
There’s chances that a couple of conditional beans have to be put in place so that everything’s still fine when the non-required module is missing. That’s going to be the complicated part.
I’m saying that while skipping through this in 15 sec, so take it with a grain of salt.
@mksd, Or I would say the references to all aware_of_modules should be conditional if possible.
E.g.
if(appSchedulingModuleIsStarted){// do app scheduling stuff}
Here is the way to know if a module is installed and started. I am just not sure where is it referring to appointment scheduling type since I don’t see any references.
I figured out the problem. It is not the reference-metadata module which is creating problem, but it is the reference-demodata which is giving those errors.
I removed the reference-demodata module and restart the server, it seems to be working as expected.
Just adding some more information here. I was trying to fix the demodata module by putting a guard clause here like below:
Module m = ModuleFactory.getModuleById("appointmentscheduling");
if (m == null){
log.info("Not creating demo data for appointment-scheduling since the appointment-scheduling module is not installed");
return;
}
While this should work, right now I feel it fails while creating bean for AppointmentTypeDeployHandler. This bean mentions AppointmentType as the Type for AbstractObjectDeployHandler. I think because of this it will always try to resolve AppointmentType as spring bean in the module startup.
I tried annotating it with @Lazy annotation but that was not helpful either. @dkayiwa, @mksd Do you have some info on how this could be tackled?
I will create a card to change the reference-metadata omod to have aware_of dependency for appointmentscheduling instead of required.
As of now I cannot fix the reference-demodata because of the problem above. We will not be able to run reference-demodata without appointment-scheduling. I can actually change the reference-demodata to have a required dependency on appointment-scheduling since these two are tightly coupled. Let me know your thoughts.