The GUI and text input

Each ELEMENT in openEHR can have only one data type. Although many aspects to support the User Interface (UI) are available in the openEHR Framework, some aspects require particular attention.

Multiple selection from a list

It is common in a UI to make available a list where the user can select multiple values. An example might be please select the country (ies) where you have citizen ship and provide a multiselect list. This can also be provided with check boxes or through other interface approaches.

As each element only has one data type and these (apart from DV_PARAGRAPH) do not allow for multiple selection, the approach to this is to have multiple elements with the values. Let us use the above example.

In the archetype editor, create a CLUSTER called Country or Countries of citizenship.

Next create an ELEMENT called Country of citizenship.

Set the data value to DV_TEXT with the source from a terminology.

Set the ELEMENT occurrences to 1..*

The result in data will be:

For one country:

  • CLUSTER {Country or Countries of citizenship}
    • ELEMENT {Country of citizenship}
      • Value = Australia

For multiple countries:

  • CLUSTER {Country or Countries of citizenship}
    • ELEMENT {Country of citizenship}
      • Value = United Kingdom
    • ELEMENT {Country of citizenship_1}
      • value = Pakistan

This may look a little clunky but it provides clean data with the ability to query the data effectively. The display script can easily be set to display:

For one country:
Country of citizenship: Australia

For multiple countries:
Country or countries of citizenship: United Kingdom, Pakistan