Auto-Calculation of Observations

Purpose and Benefits

Bahmni supports auto-calculation of observations in forms. One can use this feature for calculated fields like BMI (Body Mass Index). 

Refer to the screenshot below, where BMI and BMI values (Calculated Values) are shown in the Nutritional Values Display Control in the Patient Dashboard:

Patient Dashboard


Below are mentioned the steps to be followed for BMI calculation. Similar steps can be used to capture any other Auto-Calculated observations.

1) Setup the BMI Data concept in OpenMRS, as a container for BMI and BMI Abnormal concepts. Refer to the screenshot below:

BMI Data Setup in OpenMRS

2) Setup BMI (For BMI Values) and BMI Status (For BMI Statuses such as Normal, Underweight, etc.) Concepts. Choose Class as "Computed" as these are Calculated Values. The screenshot below displays the BMI and BMI Status concepts setup in OpenMRS:

Setting up BMI Concept in OpenMRS

Setting up BMI Status Concept in OpenMRS

3) Configure Calculated Concepts as concept names in the dashboard.json config. Refer to the code snippet below:

 "nutritionalValues": {
                "title":"Nutritional Values",
                "name": "vitals",
                "isObservation": true,
                "displayOrder": 11,
                "dashboardParams": {
                    "conceptNames": [
                        "BMI STATUS"
                    "numberOfVisits": 2

Refer to for further information.

4) For auto-calculation of BMI, the latest instance of Height and Weight will be calculated from the groovy script and validated by referencing them with the BMI_chart. For further information refer to

Here are sample groovy script and BMI charts: BMI_chart.csv    BahmniObsValueCalculator.groovy

See this discussion and video also (how to auto-calculate fields in Forms):

The Bahmni documentation is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)