Study Definition module

 

Long derivations

The maximum length of derivation expressions is 4000 characters.  In some cases, there is a need for even larger expressions.  This section describes a workaround, using Arezzo, to create derivations of a much greater length (up to about 40K).  Some knowledge of the Arezzo editor and Arezzo concepts is required to implement the workaround.

Additional benefits of this approach are:

One-off derivations

Some derivations are only calculated once for each study subject, and never change thereafter. These one-time derivations can be created using a simple Arezzo enquiry.

  1. Start Arezzo by clicking the Arezzo button on the Study Definition tool bar.

  2. Create an enquiry in the top level plan by clicking on the green diamond enquiry tool in the tool bar and then clicking in the plans area. See image

  3. Create a mandatory source for the enquiry, using a name which does not conflict with any existing Arezzo data items or tasks, or questions, eForms or visits.

  4. Edit its Derivation rule to enter the desired derivation. You can use the Expression Editor by clicking on the button with three dots. The limit to the length of the derivation here is about 40K characters.

  5. Save the Arezzo definition and exit back to the Study Definition module.  Edit the question and enter the name of the newly created Arezzo data item in the derivation field.

The derivation in Arezzo will be run once, when a new subject is created, and the value will be populated into the question.

Dynamic derivations

Where derivations depend on the values of other questions they may need to be recalculated every time the dependent values change. You can use a similar technique as for one-off derivations, with the addition of Arezzo cycles, internal triggers, postconditions and the Arezzo dateof function.

 

Create an action within the top-level plan and set its postcondition to

last_derivation_time = now

Set the action's Automatic property to Yes (this prevents the action from generating a popup window).

Create a plan called derived_data within the top-level plan, set its number of cycles property to –1 and create a scheduling link between the action and the plan. Example

 

Open up the derived_data plan and create an enquiry called derivations (and its associated source) as for one-off derivations, described above.

Copy the set_derivation_time action into the plan (you can do this by dragging the action from the task tree into the derived_data plan), and as before set its Automatic property to Yes.

Add a scheduling constraint from the enquiry to the action.

Add an internal trigger to the enquiry so that it is only activated when one or more of the questions on which the derivation is based have changed, for example

dateof( Screening:Dem:Sex ) isafter last_derivation_time

Example

 

Note: The dateof function returns the time at which the named question was actually added to Arezzo.

Save the Arezzo definition and exit back to the Study Definition module.  Edit the question and enter the name of the newly created Arezzo data item (the name of the source in the derivations enquiry) in the derivation field.

 

The above steps have created a derivation (of length up to about 40K) which will be calculated whenever there is a change in any of the dependent data item values.  Note that this will only be re-calculated when an eForm is saved – it will not be calculated dynamically while a form is open.