Episode attributes are used to identify episodes in a case at which a number of conditions all apply.

For example, suppose that we need to identify patients who have had gestational diabetes. One indication of this will be that there is an episode at which:

  • the ‘Pregnant’ attribute has value “true”
  • the ‘CollectionType’ attribute has value “Fasting”
  • the ‘Glucose’ value is elevated.

Consider this case:

                      05 Feb 03    06 Oct 03    07 Nov 04
Pregnant                 false        true         false
Glucose                  4.1          7.8*         4.5
CollectionType           R            F            F

The elevated value in the middle episode suggests gestational diabetes.

It would be difficult to write a condition that expressed the fact that three assertions held for a single episode other than the current episode. Instead, we use an Episode Attribute.

In the situation above, we could define an Episode Attribute “GestationalDiabetes” with three conditions:

  • Pregnant is “true”
  • CollectionType is “F”
  • Glucose is high.

This episode attribute puts a true or false value into each episode of the case.

To evaluate the value for Feb 03, the later episodes are ignored, leaving this data:

                      05 Feb 03
Pregnant                 false
Glucose                  4.1
CollectionType           R

Each of the conditions is evaluated against this case, and the results are ‘ANDed’ together (so that if any one of them is false, the result is false).

To evaluate the value for Oct 03, that episode and the earlier one are used, leaving this data:

                      05 Feb 03    06 Oct 03
Pregnant                 false        true
Glucose                  4.1          7.8*
CollectionType           R            F

Again, each of the conditions is evaluated for this cut-down case, and the overall result is the conjunction of these values. In evaluating Nov 04 value, the whole case is used as this is the latest episode.

So the values for “GestationalDiabetes” are:

                      05 Feb 03    06 Oct 03    07 Nov 04
Pregnant                 false        true         false
Glucose                  4.1          7.8*         4.5
CollectionType           R            F            F
GestationalDiabetes      false        true         false

A more complex example

Let’s now see how to use the Attribute Editor to create and edit an Episode Attribute.

In this example, we will be building an Episode Attribute that detects instances of over-treatment in patients on thyroid medication.

To create the Episode Attribute we start the Attribute Editor and then, from the Edit menu, select the ‘Add episode attribute…’ item. We will be prompted for the name of the new attribute:

22 EPi 7.4

After we click ‘Ok’, we will be given a screen in which we can add conditions:

23 Epi 7.4

Clicking the ‘Add’ button brings up the Expression Editor

.

Note that we can write expressions that involve Text Attributes and other Derived Attributes, even including other Episode Attributes.

Here is the Episode Attribute with the three conditions we require:

24 Epi 7.4

We will explain the strange looking condition ( current ( previous FT3 ) ) is high later.

Episode attributes have the added  flexibility of and/or: The user has the choice of weather they want at lease one condition to be true, or all of them must be true for the attribute to test true.

When the Attribute Editor is closed, the new Attribute is added to the case (it is in beneath the Thyroid Function Tests folder):

.25 Epi 7.4

The most recent episode (on the right)is the only one at which the three conditions we added all hold.

To understand the complex condition, recall that Episode Attributes evaluate an episode by a disregarding all later episodes (i.e. to the right) and evaluating each of the  conditions against this cut-down case. When evaluating the highlighted episode, the Episode Attribute is using this truncated case:

.

The FT3values are:26 Epi 7.4

The phrase ‘previous FT3’ cuts of the last sample: The phrase ‘current previous FT3’ then evaluates to just the sample 6.1, which is high.

For more information, see the help on the current and previous functions.