GDL2 Guideline Tutorial BMI (FHIR)


Creating a Guideline




Overview and Trial Run


This tutorial guide is a supplement to the Archetypes guide, utilising existing models to provide a step-by-step demonstration on how to design basic guidelines for different types of clinical decision support (CDS) applications using the GDL2 Editor.

Creating a Guideline

In order to generate data for storage and documentation, a guideline is required. Guidelines are used to express clinical rules and algorithms, and use one or more archetypes or profiles to mimic the rules used in clinical practice. Even if two guidelines use the same archetypes/profiles they can be used to model different concepts according to the rules used in each guideline.

This guide provides step-by-step instructions on building a common calculation-based guideline model using the GDL2 Editor. This example builds on the steps from the earlier introductory guide that provides instructions on installing and setting up the GDL2 Editor.

The BMI provides a height- and weight-based method of categorizing the body mass of a person. There are different categories to take in to consideration, the main three ones are however: underweight, normal weight, and overweight. An overview of the finished BMI guideline is displayed below:


First, add metadata in the Description tab which is opened upon launching the program:

  1. Name the guideline.
  2. Enter the author details including organisation and date of creation.
  3. Select Author draft from the Authorship lifecycle drop-down menu.
  4. Add the Copyright.
  5. Use the + to add and – to remove keywords. The pencil icon can be used to edit existing keywords.
  6. Enter the names of any Contributors.

Next, enter text into the 1. Description, 2. Purpose, 3. Use, 4. Misuse and 5. References sections:

Once all the metadata is filled in, ensure the model is saved (6). Additionally, loading necessary openEHR Archetypes or FHIR Profiles will be required in order to build models in the coming steps. Loading Archetypes or FHIR Profiles are done by clicking (6), “Guideline” – and then “Import Archetype/FHIR Profile”.

Clicking “Import Archetype/FHIR Profile” will open up a subwindow within the Editor.

Clicking “Upload file” will point to the local repository. One archetype or FHIR profile can be selected, it is also possible to load multiple files in a compressed format (.zip).


After all the metadata has been added, the next tab to go to is the Definitions tab.

Complete definitions of the BMI are shown in the image below. There are two input profiles and one output profile. The input profiles are created to hold the input of height and weight and the output profile holds the BMI calculation:

The input parameters are defined in the left bar, and the output parameters are defined in the right bar.

  1. Drag and drop the Archetype instantiation element from the left-hand side to the main modelling screen.
  2. Drag and drop three Element instantiation elements by dropping them on top of the already instantiated blank Data binding.
  3. Drag and drop the Function Predicate element on top of the already instantiated blank Data binding.
  4. Drag and drop the IS_A Comparison element on top of the already instantiated blank Data binding.

Assign the blank elements as shown below:

  1. Click on Data binding.
  2. Choose the body weight profile from the folder.
  3. Click on the check mark to select it.

Next, the element attributes can be entered:

  1. Click on the Element slot.
  2. Choose the valueQuantity for Weight.
  3. Click on the check mark.

Name the valueQuantity element by clicking valueQuantity and writing the name in the textbox.

Do the same for the next element, instatiating coding[0].

Clicking on coding[0] allows you to name the element.

Do the same for the next element, instantiating effectiveDateTime.

Instantiate effectiveDateTime also in the Function Predicate element and select max from the dropdown list to ensure use of the most recent weight value.

Instantiate coding[0]  in the IS_A Comparison element to allow term binding.

  1. Click on the Element slot.
  2. Select coding[0].
  3. Click on the check mark.

Perform the term binding by following the steps shown below.

  1. Click on Constant value in the IS_A Comparison element.
  2. Click on Add local term in the appearing window. This opens a new window.

  1. Enter a text describing the local term
  2. Click on the check mark. This takes you back to the Select Term window.

  1. Make sure the newly added term is selected.
  2. Click on the check mark. This closes the window and brings you back to the Definitions tab.

  1. Go to the Binding tab.
  2. Click on Add terminology.
  3. Enter the terminology name “LOINC” and click on the check mark.

  1. Click on the plus sign.
  2. Select the term you want to bind to a terminology code.
  3. Click on the check mark.

  1. Double click in the empty space under Codes next to the local term and write the terminology code(s) that should be bound to the local term. Here, the code 29463-7, which is the LOINC code for body weight, has been entered.

Repeat the above sequence to create another blank input profile instantiation to hold the Height data element needed for calculating the BMI score as mentioned earlier. Instantiate a Height profile to contain a Height valueQuantity element, a coding[0] element, bound to the LOINC code for body height through the IS_A Comparison, and an effectiveDateTime element with Function Predicate set to max.

The last instantiated profile is an output profile which holds the BMI calculation result. This is made up of only one internal element: the holder for the calculated BMI value. There is no need for an effectiveDateTime element, as the calculation is triggered anew upon usage, and no need for a coding[0] element, as it is the only output type Observation profile.

Make sure to select the Output type when instantiating the profile:

  1. Click on Data binding within the archetype instantiation slot
  2. Choose Output in the drop down menu located in the upper right corner
  3. Choose the body_mass_index profile from the folder
  4. Click on the check mark to select it.

Complete the BMI profile by instantiating the valueQuantity element for BMI.


Once the definitions have been created, they can be used to construct the rules for the BMI calculation.

BMI has only one rule that calculates the body mass index. The following section will display the construction of the rule.

  1. Go to the Rule list tab.
  2. Click on Add new Rule.
  3. Enter the rule name and click on the check mark.

Once the check mark has been clicked, the guide shows a new window for the specific rule:

  1. Name of the created rule.
  2. Conditions modelling area.
  3. Actions modelling area.
  4. Condition elements – used to model the conditions required to be fulfilled for the rules to fire.
  5. Action elements – trigger when the conditions assigned in the top modelling area are fulfilled.

Conditions that must be fulfilled for the rule to calculate BMI:

Drag and drop two Attribute Comparison elements into the rule conditions modelling screen.

  1. Click into the first Element[@attribute] element.
  2. Choose unit  from the body weight profile.
  3. Click on the check mark.

Choose the == from the drop-down menu.

Click on Expression and choose kg from the drop-down menu.

Do the same steps for the Height profile and choose unit “cm”.

Once all the conditions for the BMI calculation rule have been entered, the actions in the bottom part of the rule modelling window can be set:

Instantiate two Set Attribute elements.

  1. Click on the first Element[@attribute] element.
  2. Select unit from the body mass index profile.
  3. Click on the check mark.

Click on Expression and select the unit kg/m2 from the drop-down menu

  1. Click on the second Element[@attribute] element.
  2. Select the magnitude attribute from the body mass index profile.
  3. Click on the check mark.

Click on Expression to open the Create Expression window. This window holds the Expression editor, where the expression for BMI can be created. The expression reads:

BMI [kg/m2] = weight [kg]/(height [cm]/100)^2 

  1. Double click on magnitude from the body weight profile to instantiate it in the expression editor on the left.

  1. After [Weight].magnitude, write /( to continue the expression.
  2. Double click on magnitude from the body height profile, after which it appears in the Expression Editor.
  3. Finish the expression by writing /100)^2 in the editor.
  4. Click on the check mark.

Once all the conditions and actions have been set – remember to save the model, which is done through Guideline in the menu.

Overview and Trial Run

Once all the data has been added, the Terminology tab displays the codes:

All that is left is to test the model. This is done in the Execution tab:

In the Execution tab, the Input fields are on the left, and the output fields are on the right.

There are several kinds of input types:

  1. Write input data in the text boxes.
  2. Choose input data from drop-down menus.
  3. Click on the calender sign to open a calender.
  4. Click on a date och choose a time to set the effectiveDateTime for the observation.

  1. Input data in all input fields.
  2. Click on Execute.

  1. Clicking Execute executes the guideline’s rules.
  2. Execution results shows the calculated BMI
  3. Fired rules shows that the rule Calculate BMI has been fired.
  4. Guideline fixture generates a test case based on the current input data.

Further testing can be done in the Test tab:

This tab holds a text fixture editor where test fixtures can be created, saved and uploaded to enable more extensive testing.

  1. Copy and paste the test fixture from the Execution tab. Add more test cases using the same structure if desired.
  2. Click on Execute.
  3. See the result for each test case.