Skip to main content

Current Chapter

Current chapter – Special syntax


Arrays

Each selected patient will usually be represented by a single row in the report, apart from when the operator “ALL” is used in the qualifying criteria of the clinical data extraction criteria fields.  This indicates that an array is required. Rather than specifying a single value such as the earliest or latest, all values are required to be made available so that a combination of records in a sequence can be identified.

Arrays allow logic to be applied to more than one instance or occurrence of an event, OR to determine whether multiple criteria are met.

The following example shows how an array may be displayed and used within the rules. Any field which requires the return of an array of records will be surrounded by { } for example {EXSMOK_DAT}. The qualifying criteria column indicates that ALL records are to be returned.

The qualifying criteria column indicates that all records are to be returned.


Example field Code cluster (if applicable) Qualifying criteria Results 
{EXSMOK-DAT} EXSMOK_COD ALL <= ACHV_DAT Return each date when a code from the EXSMOK_COD cluster was recorded in the patient record up to and including the achievement date
{EXSMOK1-DAT} EXSMOK_COD

ALL (>= (EXSMOK_DAT – 24 months)

AND < (EXSMOK_DAT – 12 months)

AND <= ACHV_DAT)
For each record in the {EXSMOK_DAT} array, return each date when a code from the EXSMOK_COD cluster was recorded in the patient record, where these codes were recorded between 12 and 24 months prior to each {EXSMOK_DAT} record.
{EXSMOK2-DAT} EXSMOK_COD

ALL (>= (EXSMOK_DAT – 36 months)

AND < (EXSMOK_DAT – 24 months)

AND <= ACHV_DAT)
For each combination of {EXSMOK_DAT} and {EXSMOK1_DAT} array records, return each date when a code from the EXSMOK_COD cluster was recorded in the patient record, where these codes were recorded between 24 and 36 months prior to the relevant {EXSMOK_DAT} record
3YEAREX_DAT Not applicable

Latest array entry in {EXSMOK_DAT}

where

{EXSMOK1_DAT} index ≠ Null

AND {EXSMOK2_DAT} index ≠ Null
Return the latest date from the {EXSMOK_DAT} array where there are values in the EXSMOK_DAT, EXSMOK1_DAT and EXSMOK2_DAT fields. This indicates that there are 3 consecutive years with the presence of an EXSMOK_COD code.

Where fields are set up to return one value for each value in an array, these will be specified in square brackets. Examples can be seen below:

Example field Code cluster if applicable  Qualifying criteria Result  
{BP_DAT} BP_COD ALL >= ACHV_DAT Return each date when a code from the BP_COD cluster was recorded in the patient record up to and including the achievement date.
BPBMI_DAT] BMI_COD

Earliest

>= {BP_DAT}

AND

<= (BP_DAT+ 6 months)

For each record in the {BP_DAT} array, return the first date when a code from the BMI_COD cluster was recorded in the patient record, within 6 months of the associated {BP_DAT} value.

(one BMI date per date in the {BP_DAT} array)

Using the example above if a patient had the following activity in their record.

Code from cluster Date recorded 
BMI_COD 20/03/2010
BP_COD 3/04/2010
BP_COD 7/06/2010
BMI_COD 15/06/2010
BMI_COD 30/06/2010
BP_COD 18/09/2010

Then the following results would be returned in the {BP_DAT} array and for the [BPBMI_DAT] field:

{BP_DAT} results [BPBMI_DAT] results
03/04/2010 15/06/2010
07/06/2010 15/06/2010
18/09/2010 NULL 

For fields with square brackets the data returned may be multiple per patient, not one per patient like standard earliest/latest fields (the earliest BMI record per BP recording rather than the earliest BMI record for the patient).


Maximum/minimum value in timeframe

The ‘maximum value within a timeframe’ syntax was introduced to business rules in 2015. This type of rule aims to identify the maximum or minimum value or score associated with a set of clinical codes which was recorded during a set timeframe. This is structured as per the example below:

Example field Code cluster (if applicable) Qualifying criteria Result 
TESTMAX_VAL TEST_COD

Maximum score

(>=REG_DAT AND <= ACHV_DAT)

The maximum score associated with a code from the TEST_COD cluster which was recorded between Date of patient registration and achievement date.

 

NOTE: If the maximum score is achieved more than once during this timeframe, only one record of the score is required to be returned.

In the example above, all scores associated with the codes from the TEST_COD cluster which were recorded between the specified dates (registration date and achievement date) should be interrogated. The highest of those values should be returned. Values recorded outside of the specified timeframes are not included so if the patient previously had a higher score this is not taken into account.

The resulting data item for the TESTMAX_VAL field in the table above should be a single value showing the highest test score recorded during the time period specified in the qualifying criteria. Regardless of how many times this score was achieved during the timeframe specified, the score should only be returned once for this field.


Further resources


Last edited: 28 September 2026 2:25 pm