A restriction clause is an expression that modifies a condition so that only those episodes in the case that are described by the restriction are considered.
For example, given the following case:
05 feb 03 23 oct 03 06 nov 03 Cholesterol [ < 5.5] 5.6* 6.1* Triglyceride [0.0, 1.8] 0.8 1.1 1.8 HDL [0.9, 3.5] 2.2 0.5*
the condition: all Cholesterol are high, where Cholesterol is numeric consists of two parts. The first part: all Cholesterol are high is the condition we want, but by itself is not true for the case as the earliest episode does not have a cholesterol value. However, we can add the restriction clause: where Cholesterol is numeric to give a condition that is actually true for the case.
If a condition contains a restriction clause, the evaluation of that condition for a case takes two steps. The first step is to produce a cut-down version of the case, in which episodes that do not satisfy the restriction clause have been removed. In the example above, the restriction clause has the effect of removing the first episode, which has a blank, and therefore non-numeric, cholesterol value. The restricted case is:
23 oct 03 06 nov 03 Cholesterol [ < 5.5] 5.6* 6.1* Triglyceride [0.0, 1.8] 1.1 1.8 HDL [0.9, 3.5] 2.2 0.5*
We can use almost any expression of the form where, within last, before, after or of latest … values in a restriction clause. For example, for this case:
23 oct 08 06 nov 08 01 jan 09 15 apr 09 30 apr 09 19 jul 09 11 aug 09 Chol [ < 5.2] 5.6* 6.1* 6.2* 5.1 6.5* 5.0 4.8 Trig [0.6, 2.0] 2.0 2.0 2.3* 1.8 1.7 1.7 1.8 HDL [ > 1.0] 1.2 1.5 1.4 1.6 1.6 1.7 1.4 LDL [ < 3.4] 4.2* 4.5* 3.9* 3.3 4.3* 3.2 3.3 Fasting T T F T F T T Notes check rx on stat check on stat
all Trig are normal, where Fasting is “T”
all Chol are normal, within last month
all LDL are normal, within last 10 weeks
all LDL are high, before Notes contains “rx”
no HDL is high, after Notes contains “rx”
all Trig are normal, of latest 3 values
We can use two restriction clauses at once using the ‘and’ keyword:
all Chol are normal, after Notes contains “rx” and where Fasting is “T”