GDL rules with "age-dependent" reference ranges

Rong Chen Rong.Chen at
Tue Mar 8 01:45:23 EST 2016

Hi Birger

We use DV_DATETIME for patient's birthday and use GDL rule to calculate the actual age at any give point of time. It works in our decision support systems.

I think the operation on DV_DURATION should work too. The actual operation is done by the underlying java library. If you report the issue to the tracker,, we will look into it.

One more thing, you probably want to use .value assignment instead of create operator in your then statement.


From: openEHR-technical [openehr-technical-bounces at] on behalf of Birger Haarbrandt [birger.haarbrandt at]
Sent: Monday, February 29, 2016 4:58 PM
To: For openEHR technical discussions
Subject: GDL rules with "age-dependent" reference ranges

Hi there,

besides of our core acitivities, we recently fiddled a little with GDL to evaluate, if it might be of use for a decision support project in the context of a pediatric ICU. One challenge with guidelines in pediatric patients is that the reference ranges of variables depent on the age of a patient at the time of the clinical event.

In SPARQL/SWRL (as in XML) I can easily calculate the number of days between the birth of a patient and the clinical event by simply subtract the datetime of the event from the datetime of the birth. The result is of type "duration".

In the data types information model specs it says:

"For example, two dates can be subtracted, but the result is a duration, not another date. For this reason, the operations add, subtract and diff are defined rather than ‘+’ or ‘-’. Date/time types, as well as the relative
concept duration, are defined in the Date Time Package on page 54." and

"The DV_DURATION class is used for expressing durations of clinical phenomena and differences
between absolute times"

So I expect this to work identically.

If I try this operation using the test function of the GDL Editor, the result test set for any example data entry is empty. I made a CDS archetype with an element of type Duration to store the result. In GDL it looks as follows:

rules = <
            ["gt0025"] = (RULE) <
                when = <"$gt0024!=null",...>
                then = <"$gt0026.create($gt0028.value=($gt0024.value-$gt0019.value))",...>
                priority = <1>

Is this a bug or did I miss something?

Any help is really appreciated.


Birger Haarbrandt, M.Sc.

Peter L. Reichertz Institut für Medizinische Informatik
Technische Universität Braunschweig und
Medizinische Hochschule Hannover
Mühlenpfordtstraße 23
D-38106 Braunschweig

T +49 (0)531 391-2129
F +49 (0)531 391-9502
birger.haarbrandt at<mailto:birger.haarbrandt at>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the openEHR-technical mailing list