The following examples will demonstrate how to use both the greater than (gt) and the greather than or equal to (gte) operators with the following data types:

  • INT
  • REAL
  • DATE

The ‘gt’ and ‘gte’ operators can not be used with ST or FILE.

Example 1

The first example will demonstrate how to specify a temperature is greater than a particular positive value.  The data type is INT so no decimal places are allowed.

    <RuleDef OID=”RULE1″ Name=”This is an example”>
        <Description>The temperature for this subject was greater than 105 degrees</Description>
        <Expression>ITEM_OID gt 105</Expression>

If the DataType was REAL, decimal places would be allowed.

Example 2

The second example is similar, but it is stating that a value for one item is greater than or equal to the value for another item.  The second item is part of the same Group as the first item.  Both items must be of the same DataType in order for this comparison to work.  If one item is an INT and the other is DATE, the RuleExpression will be invalid.

    <RuleDef OID=”RULE2″ Name=”This is an example”>
        <Description>Temperature is different</Description>
        <Expression>ITEM_OID_1 gte ITEM_OID_2</Expression>

If the second item was not part of the same group, but contained in the same CRF, the Expression would have to be written as follows:

    <RuleDef OID=”RULE3″ Name=”This is an example”>
        <Description>Temperature is different</Description>
        <Expression>ITEM_OID_1 gte GROUP_OID.ITEM_OID_2</Expression>

The path will continue to grow to the left if you have to include the CRF or CRF Version, or the Study Event Definition.  Each piece of the path is separated with a period (.) and everything must be capitalized.

Example 3

The following example uses DATEs with the greater than or the greater than and equal to operators.  The same principle applies where the system can only compare items of the same DataType.

    <RuleDef OID=”RULE4″ Name=”This is an example”>
        <Description>Visit Date is greater than today’s date</Description>
        <Expression>ITEM_OID_1 gt _CURRENT_DATE</Expression>

_CURRENT_DATE is a system level property that will pull the “today’s date” from the server OpenClinica is installed on.

    <RuleDef OID=”RULE5″ Name=”This is an example”>
        <Description>The date is 2013 or later</Description>
        <Expression>ITEM_OID_1 gt 2012-12-31</Expression>

Notice the date must be in the ISO 8601 format otherwise the system will reject the RuleExpression.

As we go through the rest of the operators, we will also demonstrate how to combine multiple operators into a RuleExpression which should provide even greater clarity on how to use Rules.