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.


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 into 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’s details including organization 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), “File” – and then “Load Guidelines, Archetypes, FHIR Profile”.

Clicking “Load Guidelines, Archetypes, FHIR Profile” will open up a sub-window within the Editor.

Clicking “Select file(s)” 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 archetypes and one output archetype. The input archetypes are created to hold the input of height and weight and the output archetype 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 two 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.

Assign the blank elements as shown below:

  1. Click on Data binding.
  2. Choose the body weight archetype from the folder.
  3. Click on the checkmark to select it.

Next, the element attributes can be entered:

  1. Click on the Element slot.
  2. Choose the Quantity value Weight.
  3. Click on the checkmark.

Do the same for the next element, instantiating Event Time.

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

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 archetype to contain a Height Quantity element and a Date Time element with Function Predicate set to max.

The last instantiated archetype is an output archetype 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.

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

  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 archetype from the folder
  4. Click on the checkmark to select it.

Complete the BMI archetype by instantiating the Quantity value Body Mass Index.


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 checkmark.

Once the checkmark 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 checkmark.

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 archetype 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 checkmark.

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 archetype.
  3. Click on the checkmark.

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 the magnitude from the body weight archetype to instantiate it in the expression editor on the left.

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

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


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. Click on the calendar sign to open a calendar. Click on a date och choose a time to set the Date Time 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 show the calculated BMI
  3. Fired rules show that the rule Calculate BMI has been fired.
  4. The 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. Give a name for the test case from the Execution tab. Add more test cases using the same structure if desired.
  2. Click on Add test fixture.
  3. The test cases are added to the test fixture in the Test Tab.
  4. Click on Execute.
  5. See the result summary showing the total number of tests passed or failed, the percentage of rules covered by the test fixture, and the results for each test case.