Steps after new bahmni installation

We use Bahmni to demonstrate integration and information flow for patients. Bahmni in turn uses OpenMRS as a EMR, and there are some setups on Bahmni/OpenMRS front that need to be done, following which you can start using Bahmni effectively.

Steps after new Bahmni installation and before sync to HIE

For Bahmni to be able to synchronized data effectively with HIE, the following steps need to performed on Bahmni before the synchronization with HIE begins (Before you put the bdshr-client and tr-client omod to synchronize with HIE). These steps need to be done only once after Bahmni is setup for the first time.

  1. Disable "superman" user if it is created.
  2. After Config setup, Before deployment TR omod or before synchronization with TR, do the following
    1. The answers in any valueset synced from TR for Drug order (dosage forms, routes of administration, etc) must be manually added as set members to the corresponding concept set that Bahmni provides.
      The below sqls must be run before we can start synchronizing data from TR and should be run only once.
      1. Open "Drug routes" and rename all the members under it (append it with "Retired", so that there are no name conflicts) and retire them. Then, remove all the members in "Drug routes" concept 

        Retire default bahmni drug routes
        create temporary table toRetire as (select concept_id from concept_set where concept_set=(select concept_id from concept_name where name='Drug Routes' and concept_name_type='FULLY_SPECIFIED'));
        
        update concept_name set name = concat(name,' Retired') where concept_id in (select concept_id from toRetire);
        update concept set retired = 1, date_retired = now(), retire_reason = 'TR concept to be used', retired_by = 1 where concept_id in (select concept_id from toRetire);
        
        delete from concept_set where concept_set=(select concept_id from concept_name where name='Drug Routes' and concept_name_type='FULLY_SPECIFIED');
        
        drop table toRetire;
      2. Open "Dosing units" .Rename,Retire and Remove the following concepts from the dosing Units:
        Drop,Tablespoon,Teaspoon,Tablet(s),Capsule(s)

        Retire default bahmni dosing units
        create temporary table toRetire as (select concept_id from concept_set where concept_set=(select concept_id from concept_name where name='Dosing units' and concept_name_type='FULLY_SPECIFIED'));
        
        update concept_name set name = concat(name,' Retired') where concept_id in (select concept_id from toRetire);
        update concept set retired = 1, date_retired = now(), retire_reason = 'TR concept to be used', retired_by = 1 where concept_id in (select concept_id from toRetire);
        
        delete from concept_set where concept_set=(select concept_id from concept_name where name='Dosing units' and concept_name_type='FULLY_SPECIFIED') and concept_id in (select concept_id from toRetire) ;
        
        drop table toRetire;
        select concept_id into @tablet_concept_id from concept_name where name = 'Tablet' and concept_name_type = 'FULLY_SPECIFIED';
        update concept_name set name = concat(name,' Retired') where concept_id = @tablet_concept_id;
        update concept set retired = 1, date_retired = now(), retire_reason = 'TR concept to be used', retired_by = 1 where concept_id = @tablet_concept_id;

To Synchronize Concepts from Terminology Registry (TR) :- 

  1. Deploy terminology client omod. (The location should be /opt/openmrs/modules for RPM based installation and should be owned by bahmni user.)
  2. Start the schedulers in the following order
    1. Start Terminology Feed Retry Task and Concept Reference Term Feed Feed Task. Wait for the sync to finish and failed events if any for ref terms to clear.
    2. Start Terminology Feed Task. Wait for the sync to finish and failed events if any for concepts to clear.
    3. Start Medication Feed Task. Wait for the sync to finish and failed events if any for medication to clear.
  3. After sync of concepts from TR is complete (make sure that there are no failed events created in Bahmni related to TR sync). Also, make sure that Step 5 in "Steps after new Bahmni installation and before sync to HIE" is complete.

    1. Add the answers of the coded concept "routes of administration" as members of "drug routes". 

      Add drug routes
      set @drug_routes_concept_id = 0;
      set @tr_routes_concept_id = 0;
      
      select concept_id into @drug_routes_concept_id from concept_name where name = 'Drug Routes' and concept_name_type = 'FULLY_SPECIFIED';
      
      select concept_id into @tr_routes_concept_id from concept_name where name = 'Route of Administration' and concept_name_type = 'FULLY_SPECIFIED';
      
      delete from concept_set where concept_set = @drug_routes_concept_id;
      
      create temporary table toAdd as (select answer_concept, @drug_routes_concept_id as concept_id, '1' as creator, now() as date_created, uuid() as uuid from concept_answer where concept_id = @tr_routes_concept_id);
      
      insert into concept_set (concept_id, concept_set, creator, date_created, uuid) select answer_concept, concept_id, creator, date_created, uuid from toAdd;
      
      drop table toAdd;


    2. Add the answers of the coded concept "Medication Forms", "Medication package forms", "quantity units" as members of "dosing units".

      Add Dose units
      set @drug_dose_units_concept_id = 0;
      set @tr_medication_forms_concept_id = 0;
      set @tr_medication_package_forms_concept_id = 0;
      set @tr_quantity_units_concept_id = 0;
      
      select concept_id into @drug_dose_units_concept_id from concept_name where name = 'Dosing Units' and concept_name_type = 'FULLY_SPECIFIED';
      
      select concept_id into @tr_medication_forms_concept_id from concept_name where name = 'Medication Forms' and concept_name_type = 'FULLY_SPECIFIED';
      
      select concept_id into @tr_medication_package_forms_concept_id from concept_name where name = 'Medication Package Forms' and concept_name_type = 'FULLY_SPECIFIED';
      
      select concept_id into @tr_quantity_units_concept_id from concept_name where name = 'Quantity Units' and concept_name_type = 'FULLY_SPECIFIED';
      
      delete from concept_set where concept_set = @drug_dose_units_concept_id;
      
      create temporary table toAdd as (select answer_concept, @drug_dose_units_concept_id as concept_id, '1' as creator, now() as date_created, uuid() as uuid from concept_answer where concept_id in (@tr_medication_forms_concept_id, @tr_medication_package_forms_concept_id, @tr_quantity_units_concept_id));
      
      insert into concept_set (concept_id, concept_set, creator, date_created, uuid) select answer_concept, concept_id, creator, date_created, uuid from toAdd;
      
      drop table toAdd;

To Synchronize Data to and from SHR and MCI :- 

  1. Deploy bdshr client omod. You can get released versions from GitHub. (The location should be /opt/openmrs/modules for RPM based installation and should be owned by bahmni user.)
  2. To populate Locations, Facilities and Providers from HRM 
    Go to OpenMRS UI -> Manage Schedulers -> and set the LR Sync, FR Sync and PR Sync to start on startup and start off the schedulers.
    (If you have a provision to populate the data directly, you can do so and then start the schedulers).

  3. Create Users which are recognized by HIE. (To be done after step 2 is finished).
    1. Create a user from OpenMRS administration console and provide him the following roles
      Doctor, Nurse, RegistrationClerk, EmergencyRegistration, bahmni-document-uploader (or give him privilage-full).
    2. if the user is going to do any clinical assessment like encounter (diagnosis, drug or test order, record observation), then its better that you also register this user as a provider which is synced from PR. To add the user as a provider. --> In admin screen of openmrs goto manage providers and create a new provider for the user or link with a existing provider synced from PR.
      Providers synced from PR usually have only digits set in the identifier section of openrmrs provider. You can validate this by going to HRM and looking for a provider with this identifier. 
  4. Set up patient identifier in Bahmni

    1. Set up prefix for patient identifiers, in Administration -> "Manage Patient Identifier Sources" in openmrs. 
      Identifier type = (patient identifier)

    2. Go to Openmrs -> Administration -> Maintanence -> Settings → SHR  and set Default Patient Identifier Source Id as the source id generated in the above step.
  5. Create locations identified by HIE. (To be done after step 2 is finished).
    1. Login Locations for CHW application:  You can do this via OpenMRS Admin interface. Goto Administration->Locations, identify the location and edit it. Assign 'Login Location' and save.  You will also have to put the appropriate address for the location.
    2. Alternatively, to tag a location as a login location, run the following sqls :-

      INSERT INTO location_tag_map(location_id, location_tag_id)
      VALUES((Select location_id from location where name ='<location name>'),
      (Select location_tag_id from location_tag where name ='Login Location'));
       
      or 
      select * from location where uuid=(select internal_id from shr_id_mapping where external_id='facility code');
      verify location name from the above result.
      use the location_id from the above result and execute the below result
      insert into location_tag_map values($location_id, (select location_tag_id from location_tag where name = 'Login Location'));
    3. Tag the hospital location as "Visit Location". (For a CHW instance, the visit location will be the community clinics. It will be the same as the login locations.)

    4. For all the login locations, the parent location should be configured. The parent location will be the visit location or hospital location. (This is not applicable for CHW as the visit location and login location are the community clinics itself).


    1. Remove the "Bahmni Diagnosis Status" concept from the "Visit Diagnosis" concept set (If you are using the Diagnosis tab in Bahmni to enter Diagnosis).

      DELETE FROM concept_set WHERE concept_id = (SELECT concept_id FROM concept_name WHERE name='Bahmni Diagnosis Status' AND concept_name_type='FULLY_SPECIFIED');
    2. Remove the privilege "app:clinical:deleteDiagnosis" from all user roles.

      DELETE FROM role_privilege WHERE privilege = 'app:clinical:deleteDiagnosis';


  6. Set up global properties -
    You can setup the global properties through OpenMRS UI OR you can execute the sqls given below (refer code block : Setup Global Properties)
    1. For "concept.causeOfDeath" and "concept.unspecifiedCauseOfDeath"
      Go to Openmrs -> Administration -> Maintanence -> Settings → Concept
      1. Cause of Death = {concept id of locally synced cause of death concept}
      2. Unspecified Cause of Death = {concept id of locally synced unspecified cause of death concept}

    2. Go to Openmrs -> Administration -> Maintanence -> Settings -> SHR
      1. Default Patient Identifier Source Id = {default patient identifier source }

      2. Ignore Concept List  = {concept id of concepts that are not be synced with SHR}
      3. Concept Relationship Type = {concept id of locally synced Relationship Type}
      4. Concept Quantity Units = {concept id of locally synced Quantity Units}
      5. Concept Immunization Reason = {concept id of locally synced Immunization Reason}
      6. Concept Immunization Refusal Reason = {concept id of locally synced No Immunization Reason}
      7. Concept Immunization Status = {concept id of locally synced Immunization Status}
      8. Concept Procedure Status = {concept id of locally synced Procedure Status}
      9. Concept Procedure Outcome = {concept id of locally synced Procedure Outcome}

      10. Concept Route of Administration = {concept id of locally synced Route Of Administration}

      11. Concept Medication Forms = {concept id of locally synced Medication Forms}

      12. Concept Medication Package Forms = {concept id of locally synced Medication Package Forms} 
        (You can use the code block for global property to set the concepts only)

        Setup Global Properties
        update global_property set property_value=(select concept_id from concept_name where name='Cause of Death' and concept_name_type='FULLY_SPECIFIED') where property='concept.causeOfDeath';
        
        update global_property set property_value=(select concept_id from concept_name where name='Unspecified cause of death' and concept_name_type='FULLY_SPECIFIED') where property='concept.unspecifiedCauseOfDeath';
         
        update global_property set property_value=(select concept_id from concept_name where name='Immunization Reason' and concept_name_type='FULLY_SPECIFIED') where property='shr.concept.immunizationReason';
        
        update global_property set property_value=(select concept_id from concept_name where name='No Immunization Reason' and concept_name_type='FULLY_SPECIFIED') where property='shr.concept.immunizationRefusalReason';
        
        update global_property set property_value=(select concept_id from concept_name where name='Immunization Status' and concept_name_type='FULLY_SPECIFIED') where property='shr.concept.immunizationStatus';
         
        update global_property set property_value=(select concept_id from concept_name where name='Procedure Status' and concept_name_type='FULLY_SPECIFIED') where property='shr.concept.procedureStatus';
         
        update global_property set property_value=(select concept_id from concept_name where name='Procedure Outcome' and concept_name_type='FULLY_SPECIFIED') where property='shr.concept.procedureOutcome';
        
        update global_property set property_value=(select concept_id from concept_name where name='Route of Administration' and concept_name_type='FULLY_SPECIFIED') where property='shr.concept.routeOfAdministration';
        
        update global_property set property_value=(select concept_id from concept_name where name='Relationship Type' and concept_name_type='FULLY_SPECIFIED') where property='shr.concept.relationshipType';
        
        update global_property set property_value=(select concept_id from concept_name where name='Quantity Units' and concept_name_type='FULLY_SPECIFIED') where property='shr.concept.quantityUnits';
        
        update global_property set property_value=(select concept_id from concept_name where name='Medication Forms' and concept_name_type='FULLY_SPECIFIED') where property='shr.concept.medicationForms';
        
        update global_property set property_value=(select concept_id from concept_name where name='Medication Package Forms' and concept_name_type='FULLY_SPECIFIED') where property='shr.concept.medicationPackageForms';


  7. We need to add "Dispensed" concept to "shr obs ignore list" in global properties.
  8. Add the following concepts as set members to
    1.  Mandatory : 
      1. Relationship Type -> Family Member History
    2. Optional : 
      1. Immunization Reason -> Immunization Incident Group
      2. No Immunization Reason -> Immunization Incident Group
      3. Immunization Status-> Immunization Incident Group
      4. Procedure Outcome ->  Procedure Template
      5. Procedure Status-> Procedure Template

      select concept_id into @concept_set from concept_name where name='Immunization Incident Group' and concept_name_type='FULLY_SPECIFIED';
      select property_value into @concept_id from global_property where property='shr.concept.immunizationReason';
      insert into concept_set (concept_id, concept_set,creator,date_created,uuid) values(@concept_id,@concept_set,1,now(),uuid());
      
      
      select concept_id into @concept_set from concept_name where name='Immunization Incident Group' and concept_name_type='FULLY_SPECIFIED';
      select property_value into @concept_id from global_property where property='shr.concept.immunizationRefusalReason';
      insert into concept_set (concept_id, concept_set,creator,date_created,uuid) values(@concept_id,@concept_set,1,now(),uuid());
      
      
      select concept_id into @concept_set from concept_name where name='Immunization Incident Group' and concept_name_type='FULLY_SPECIFIED';
      select property_value into @concept_id from global_property where property='shr.concept.immunizationStatus';
      insert into concept_set (concept_id, concept_set,creator,date_created,uuid) values(@concept_id,@concept_set,1,now(),uuid());
      
      
      select concept_id into @concept_set from concept_name where name='Family Member History' and concept_name_type='FULLY_SPECIFIED';
      select property_value into @concept_id from global_property where property='shr.concept.relationshipType';
      insert into concept_set (concept_id, concept_set,creator,date_created,uuid) values(@concept_id,@concept_set,1,now(),uuid());
      
      
      select concept_id into @concept_set from concept_name where name='Procedure Template' and concept_name_type='FULLY_SPECIFIED';
      select property_value into @concept_id from global_property where property='shr.concept.procedureOutcome';
      insert into concept_set (concept_id, concept_set,creator,date_created,uuid) values(@concept_id,@concept_set,1,now(),uuid());
      
      
      select concept_id into @concept_set from concept_name where name='Procedure Template' and concept_name_type='FULLY_SPECIFIED';
      select property_value into @concept_id from global_property where property='shr.concept.procedureStatus';
      insert into concept_set (concept_id, concept_set,creator,date_created,uuid) values(@concept_id,@concept_set,1,now(),uuid());
  9. For local envs only (not to be done for prod), add uncategorized diagnosis to diagnosis set of sets concept as a set member.
  10. Add immunizations to the coded concept "vaccine". 
  11. Change the datatype of the concept "procedure" to coded and add procedures like colposcopy, histopathology etc to it.
  12. To setup Order Types refer Steps to setup new Openmrs Order Type.
  13. In CHW to setup Print HID Page need to do the following:-
    1. Add Print HID Card privilege to the user who should be able to View/Operate "Print Health ID Cards" App.
    2. Create a role for fieldworkers(CHWs, HAs, CHCPs). This role should be given to all users who are responsible to go on field and register patient(for printing HIDs).
    3. Put the name of above role into openmrs=>admin=>settings=>users=>fieldWorkerRoleName.

To get OpenELIS & OpenMRS working, you need to do the following.

  1. Setup OpenELIS
  2. Login to ELIS (http://192.168.33.18/openelis) - admin/adminADMIN!To create a user in openelis
    1. Go to openelis -> Administration -> Manage Users -> Add.

      Create user and Check all the roles available.

    2.  Copy the provider uuid from openmrs for the user.

      select uuid from provider where identifier = '<hrm provider id>';
    3.  Go to database :psql -U clinlims clinlims and execute the following sql :-

      update system_user set external_id = '<provider uuid from openmrs>' where id = <user id in openelis>;
  3. Setup OpenMRSPrior Requisites of "Tests" and "Panels"
    • Create a concept, (e.g. "Blood Sample") of class - Sample, datatype - N/A, is Set = true. Add it as a member of "Lab Samples" concept. This forms the basis of sample in OpenELIS.
    • Create a concept, (e.g. "Hematology Department") of class - Department, datatype - N/A, is set = true. Add it as a member of "Lab Departments" concept. This forms the basis of department in OpenELIS
  • To a test/panel to OpenELIS, do the following in OpenMRS
    • You should create the test in "Terminology Server".
    • Once the "test"/"panel" is synced to Local OpenMRS, you need to add the test/panel as member of "Blood Sample" and "Hematology Department" concepts you created above.
    • Once the "test"/"panel" is synced to Local OpenMRS, you need to add the test/panel as member of "All Tests and Panels" concepts you created above.
    • Once you have done the above, you can verify that tests have synced to ELIS, by going through menu->"Administration"->Test
  • Step up Drugs -
    • Make sure to map a concept drug to a dosage form.