Extracting bahmni common code base as NPM library

Hello Everyone,

We are able to get the appointments module running on the OpenMRS in one of our environments. Below are the things which has been done to accomplish this:

  • We enabled appointments module to figure out if it is running on Bahmni or OpenMRS using a global-property named bahmni.appointments.runningOnOpenMRS. If it is running on OpenMRS it fetches the username and login location of the logged-in user and sets it in cookies.

  • Bahmni UI expects the configurations(base_config_url) to be available at /bahmni_config/openmrs/apps/. We played a story to be able to override the base_config_url. Right now it is provided as a global-property named bahmni.config.baseUrlForUIConfigs.

  • We wanted a similar feature to be able to override the constants defined as part of Bahmni.Common.Constants and Bahmni.Appointment.Constants. For this, we have enabled UI module to fetch an overridden-constants.json file and override constants from it. This JSON file is expected to be in base_config_url. E.g. In a usual bahmni instance this file is expected to be put as /var/www/bahmni_config/openmrs/apps/overridden_constants.json. More details about this are in the story.

  • Extracted BahmniCore APIs being used by appointments module in a different repository. A new pipeline is created to build this, and we will configure it to publish to artifactory.

In existing appointments UI module, loading the translations was the first step done when the UI module starts up. It has been changed to

  • First Override Config Base URL
  • Then Override Constants
  • Then Load Translations

This is needed because the tranlsation directories might have been overridden as part of 2nd step which are stored as constants. Below websequence diagrams should clarify the differences in both.

Existing%20Appointment%20UI%20Module

New%20Appointment%20UI%20Module

As mentioned in the previous update, we faced conflicts between bahmni-appointment-scheduling and openmrs-appointment-scheduling. We started a thread about this and we will be following up on that.

Let us know if there are any questions/suggestions.

CC: @angshuonline @mksd @mksrom @snehabagri @binduak @rrameshbtech