Advanced Lab Configuration


Bahmni also provides support for further customization of the Lab module. Below is a list of advanced configuration options 

1. Configure lab test ranges based on gender

1)  Refer to this to create the Labtest in OpenMRS. Created test should have datatype as Numeric. Do not specify the limits for this test in OpenMRS.

2)         Make sure above created lab test is synced in OpenELIS.

3)         Go to Administrator tab in OpenELIS and navigate to Result Limits. Click on Add button to add the limits Gender wise as shown below.

Test ranges set for male.

Test ranges set for female.

4)         Order the above configured test for different gender from OpenMRS and check the ranges been applied based on the gender. Out of range test results will automatically marked as abnormal and will be displayed in red as shown below.


2. Configure OpenELIS Lab Tests with results not displayed in Bahmni

As an use-case, when a blood transfusion is required, the doctor orders a cross match panel. Orders within the panel are performed for both the patient (recipient) and for the donor. Furthermore, most of the tests are the same. In-case the cross-match fails for the patient, another cross-match is repeated for the same patient with another donor. This iterates till a fitment is found. The donor test results must not be viewed on the patient dashboard, as it may lead to a misunderstanding and is also redundant.

However, the concerned tests must be created in OpenELIS only, and will be accordingly mentioned in a groovy script so as not to be consumed by OpenMRS. Please note that the groovy script will not work for tests which are synced to OpenELIS via OpenMRS , and sync failure events will be created (expected behaviour).

The sample groovy script below restricts " * (Relative) " tests from being consumed by OpenMRS.

import org.openmrs.*
import org.bahmni.module.elisatomfeedclient.api.domain.OpenElisAccession;
import org.bahmni.module.elisatomfeedclient.api.domain.OpenElisTestDetail;
import org.bahmni.module.elisatomfeedclient.api.elisFeedInterceptor.ElisFeedAccessionInterceptor;
import java.util.*

public class FiterDonorTestResults implements ElisFeedAccessionInterceptor {
    public ArrayList<String> donorTests = ["Haemoglobin (Relative)","VDRL Rapid (Relative)", "VDRL ELISA (Relative)", "Blood Group (Relative)","Malaria Parasite (Relative)","HIV Tridot (Relative)","HIV ELISA (Blood) (Relative)", "HCV Tridot (Relative)","Malaria Parasite (Relative)","VDRL ELISA (Relative)","DRL Rapid (Relative)"];
    public void run(OpenElisAccession openElisAccession) {
        Iterator<OpenElisTestDetail> iter = openElisAccession.getTestDetails().iterator();
            if(donorTests.contains( {


3. Remove Tests from Samples Collected Backlog Dashboard

Sample Collected Backlog is a section on Lab Dashboard which displays list of samples for which sample is collected. If there is use-case of canceling the pending tests and removing them from the Backlog section, then this page will show how to remove those tests from the Lab Dashboard section named Sample Collected Backlog.

One such use-case of removing the samples from the list would be adding a sample multiple times by mistake or clinicians wanting to cancel tests whose sample is collected .


                                    Tests in Samples Collected Backlog List

In order to remove the sample from the Lab Dashboard Section Samples Collected Backlog, please follow the below mentioned steps.

Login to the OpenELIS database

OpenELIS database name is "clinlims"

Execute the query

Execute the query below with the proper accession numbers. The query mentioned below will update the status of the analysis to "Test Canceled" (status_id=15)

Please make sure of updating the query with proper accession numbers with in the IN clause of query and comment which holds the reason for canceling

Execution Warning

Please be careful while executing this query because this query will remove from the dashboard any test with the given accession number.

UPDATE analysis
SET status_id=15, comment='Write any comment here about the reason for this action'
FROM sample_item si, sample s
WHERE analysis.sampitem_id =
    AND = si.samp_id
    AND s.accession_number in ('27082015-006','27082015-006');

4. To remove “Validate” option from OpenELIS

OpenELIS by default has an option to validate the lab results (usually done by the lab supervisor) once results are entered by the lab tech. But there may be implementations that does not require the validation option as they don’t validate the lab results. 

Follow the below steps to remove the validation option from OpenELIS.

1) Login to clinlims (OpenELIS) database :

psql -Uclinlims

2) Check for "value" in site_information table by using the below query :

(The value will be "true" by default and we need to change its value to “false”)

select * from site_information where name = 'validate all results';

3) Use the below query to update the value to false :

 update site_information set value = 'false' where name = 'validate all results';

4) Check if value is changed to “false” by using the below query :

select * from site_information where name = 'validate all results';  

5) Restart OpenELIS service by using the below command :

 sudo service bahmni-lab restart

5. Accession Number Generation Logic

The default Accession Number format is DDMMYYYY-XXX, where DDMMYYYY denotes the Accession Number generation date and XXX is the serial number which will start from 001 on every new date. There is a configuration in Administration - Site Information section named as acessionFormat, through which the user can change the Accession Number format to YYYYXXXXXXX. Where YYYY is the year and XXXXXXX is the serial number which will start from 0000001 every year.

Also, to achieve this user also has to update the value for property “acessionFormat” to “FULL_YEARNUM_SEVEN“ in site_information table in OpenELIS DB (Refer below query).

update site_information set value='FULL_YEARNUM_SEVEN' where name='acessionFormat';

The configuration of accession number format is only allowed during system installation. The change of logic is not supported after an accession number is already generated.

6. Test Method Management

Laboratories use a variety of methodologies to analyse the tests. User has the option to add the different methods from Administration - Test Methods screen. Added methods can be edited or deactivated from the same screen.

Test Method Management

Also, user can associate the desired active method to a test while editing it from Administration - Test screen.

Associate Method with a Test

7. Free text reference range information for lab tests

For certain tests, reference range information has to be captured as free text in the masters and printed on the report. This is because in many cases, the ranges may not fit within the existing age and gender framework, there are ranges mentioned for pregnant ladies, mensus cycle, fetus etc. Also in many cases, labs would like to give extra information like desired range, borderline range etc in the lab report.

To achieve this, user can capture the desired information in the "Reference Info" field (Free Text field) is added in the Administration - Test - Test details screen.

Reference Info

8. Disable auto-modification of orders in Bahmni after editing the same in Open ELIS during sample collection

In ELIS if some test(s) is removed from the order from a clinical lab order at the time of sample collection, respective test(s) gets discontinued in Bahmni. Such tests won't be visible on Bahmni dashboard anymore, making it appear like those tests were never ordered. This is a concern to the ordering doctor. Even if the patient refused to do the test later at the lab, the original order should not get discontinued from the EMR. Same is the case when some extra test(s) added to the order while the sample collection, those gets sync to Bahmni and appears in the Dashboard.

To disable this behaviour user can go to the OpenMRS - Administration - Advance Settings and add a new property (if not existing) with Name = elisatomfeedclient.discontinueCancelledOrders. When the property value is set false, system will be working as default behaviour, but when the value of the property is set true, then the modifications in the order won't be synced to Bahmni.

Open MRS - Advance Settings

OpenMRS Advanced Settings