Running Bahmni Appointments scheduling on OpenMRS

Would Conditional loading based on running modules help you? https://wiki.openmrs.org/display/docs/Supporting+different+OpenMRS+versions

Thanks @dkayiwa, Looks like this is what I want. I will give it a try to fix the reference-demodata.

@mddubey something I noticed is that we cannot yet remove AS and ASUI from the Ref App (and from our distro, which is my actual concern).

The reason being that ASUI requires AS and Reference Metadata will not start without ASUI having started because of this line producing the below trace:

org.openmrs.module.metadatadeploy.MissingMetadataException: No such Privilege with identifier 'App: appointmentschedulingui.home'
  at org.openmrs.module.metadatadeploy.MetadataUtils.existing(MetadataUtils.java:56)
  at org.openmrs.module.metadatadeploy.bundle.CoreConstructors$2.transform(CoreConstructors.java:533)
  at org.apache.commons.collections.CollectionUtils.collect(CollectionUtils.java:632)
  at org.apache.commons.collections.CollectionUtils.collect(CollectionUtils.java:610)
  at org.openmrs.module.metadatadeploy.bundle.CoreConstructors.role(CoreConstructors.java:530)
  at org.openmrs.module.metadatadeploy.bundle.CoreConstructors.role(CoreConstructors.java:550)
  at org.openmrs.module.referencemetadata.RolePrivilegeMetadata.install(RolePrivilegeMetadata.java:147)
  at org.openmrs.module.metadatadeploy.api.impl.MetadataDeployServiceImpl.installBundle(MetadataDeployServiceImpl.java:111)

I haven’t looked into this more than that but @dkayiwa @mogoodrich do you know why Reference Metadata seems to be installing ASUI privileges? Why is the module not responsible for setting up its own privileges?

Am not aware of any reason other than wanting to set up metadata from one place. But this can be changed or refactored to address the current need.

@mksd, this looks a bit strange. Today I was able to see the metadata module getting started, though this error might be there in the logs not as a start-up error but just an usual exception.

I feel the reference metadata is trying to install the roles and expecting the privileges to be installed by some other module. ASUI probably.

To fix this we can wrap all the AS/ASUI related install role in a if block, if the AS and ASUI module are present then only try installing roles.

@dkayiwa please correct if this assumption is wrong.

@mddubey what is required by the above code of Reference Metadata is not for ASUI to be running, it is for ASUI to have run at least once. It is overkill to surround it with if statement checking whether ASUI has started.

This connects to the wider challenge of deprecating Reference Metadata in favour of an OpenMRS configuration. See https://github.com/jsibley/convert-rmd-to-iniz (cc @jsibley).

Two options IMO:

  1. We migrate the creation of all AS and ASUI metadata to the modules themselves.
  2. We prioritise the overall deprecation of Reference Metadata.

@mksd, If we talk about the first option say, we started creating roles as well as part of AS and ASUI module. The Reference Metadata module is still doing some things like Inheriting Doctor Role from Appointment Scheduling.

I think these things will still be done as part of reference data and it will create the same problem if the role doesn’t exist. So these need to go behind a condition if the module started.

I will create a card which will fix this by putting a condition for if appointmentscheduling and appointmentscheduling-ui are not present.

@dkayiwa FYI this is part of option 2, the goal in the end is to get rid of Reference Metadata altogether.

@dkayiwa

I have created a card here (https://issues.openmrs.org/browse/RA-1637) and raised a possible fix in this PR(https://github.com/openmrs/openmrs-module-referencemetadata/pull/49).

I was not able to claim the card though, I think because it is still in backlog.