Skip to main content

Data Selection Rules

Rules Grammar

The rules is a JSON, unique for each extension in AI-Rad Companion. The rules is the checks needed to be matched for the input data required by the respective extension to be invoked for processing.

The updated rules grammar in va30 support validations for Study, Series and Frame level. The frame level validation grammar is upgrade to rules in va20 with additional support for Enhanced modality images and private tag checks.

Each Study, Series and Frame level validation is divided into two parts:

Operations - Operations contains the logic for the validation to be performed. eg : the dicom tag required to be present or the value of particular dicom tag. Sequence - The sequence contains a logical Operator(OR, AND, NAND or NOR), list of operations and again a list of sequences. When multiple operations (also multiple sequences) have to be satisfied, then it is grouped in a sequence along with the operator AND, OR, NAND or NOR. eg : suppose for a series, either Operation S1 or S2 has to be satisfied, then we can add them to sequence with an OR operator. For further undertanding, please refer StudySelectorSequence section for Examples.

The model for the JSON is explained in the Rulesets section.

Sample rules can be found in the Sample Rules Files.

Sample Rules Files

Morphometry

{
"ClinicalExtension": {
"GroupMultipleMatchesAsOneProcessingRequest": true,
"StudySelectorSequence": {
"SelectorOperator": "OR",
"StudySelectorOperations": [
{
"Criteria": "All",
"Mandatory": true,
"SeriesSelectorSequence": {
"SelectorOperator": "OR",
"SeriesSelectorOperations": [
{
"SeriesDescription": "MPRAGE",
"Criteria": "All",
"ExtractOnlyMetadata": false,
"Mandatory": true,
"SelectorOperationsSequenceID": [1]
}
]
}
}
]
},
"SelectorOperationsSequences": [
{
"SelectorOperationsSequencesID": "1",
"SelectorOperator": "AND",
"SelectorOperationsSequences": [
{
"SelectorOperator": "OR",
"SelectorOperations": [
{
"SelectorAttribute": "(0018,0024)",
"SelectorCSValue": "tfl3d1",
"SelectorAttributeVR": "SH",
"SelectorAttributeVM": 1,
"SelectbyOperator": "CONTAINS"
},
{
"SelectorAttribute": "(0018,9005)",
"SelectorCSValue": "tfl3d1",
"SelectorAttributeVR": "SH",
"SelectorAttributeVM": 1,
"SelectbyOperator": "CONTAINS"
},
{
"SelectorAttribute": "(0021,0077)",
"SelectorCSValue": "tfl3d1",
"SelectorAttributeVR": "LO",
"SelectorAttributeVM": 1,
"PrivateCreatorCode": "SIEMENS MR SDI 02",
"SelectbyOperator": "CONTAINS"
}
]
},
{
"SelectorOperator": "AND",
"SelectorOperations": [
{
"SelectorAttribute": "(0018,0010)",
"SelectorCSValue": "",
"SelectorAttributeVR": "LO",
"SelectorAttributeVM": 1,
"SelectbyOperator": "EMPTY",
"DefaultValueIFSelectorAttributeMissing": "True"
},
{
"SelectorAttribute": "(0018,0012)\\(0008,0104)",
"SelectorCSValue": "",
"SelectorAttributeVR": "LO",
"SelectorAttributeVM": 1,
"SelectbyOperator": "EMPTY",
"DefaultValueIFSelectorAttributeMissing": "True"
}
]
},
{
"SelectorOperator": "AND",
"SelectorOperations": [
{
"SelectorAttribute": "(0008,0008)",
"SelectorCSValue": "LABEL",
"SelectorAttributeVR": "CS",
"SelectorAttributeVM": 6,
"SelectbyOperator": "NOTEQUALS"
},
{
"SelectorAttribute": "(0008,0008)",
"SelectorCSValue": "DEV",
"SelectorAttributeVR": "CS",
"SelectorAttributeVM": 6,
"SelectbyOperator": "NOTEQUALS"
},
{
"SelectorAttribute": "(0008,0008)",
"SelectorCSValue": "TIV",
"SelectorAttributeVR": "CS",
"SelectorAttributeVM": 6,
"SelectbyOperator": "NOTEQUALS"
},
{
"SelectorAttribute": "(0008,0008)",
"SelectorCSValue": "CSAPARALLEL",
"SelectorAttributeVR": "CS",
"SelectorAttributeVM": 6,
"SelectbyOperator": "NOTEQUALS"
},
{
"SelectorAttribute": "(0008,0008)",
"SelectorCSValue": "CSA MPR",
"SelectorAttributeVR": "CS",
"SelectorAttributeVM": 6,
"SelectbyOperator": "NOTEQUALS"
},
{
"SelectorAttribute": "(0008,0008)",
"SelectorCSValue": "CSA MPR THICK",
"SelectorAttributeVR": "CS",
"SelectorAttributeVM": 6,
"SelectbyOperator": "NOTEQUALS"
},
{
"SelectorAttribute": "(0008,0008)",
"SelectorCSValue": "CSA MIP",
"SelectorAttributeVR": "CS",
"SelectorAttributeVM": 6,
"SelectbyOperator": "NOTEQUALS"
},
{
"SelectorAttribute": "(0008,0008)",
"SelectorCSValue": "CSA MIP THIN",
"SelectorAttributeVR": "CS",
"SelectorAttributeVM": 6,
"SelectbyOperator": "NOTEQUALS"
},
{
"SelectorAttribute": "(0008,0008)",
"SelectorCSValue": "PARALLEL",
"SelectorAttributeVR": "CS",
"SelectorAttributeVM": 6,
"SelectbyOperator": "NOTEQUALS"
},
{
"SelectorAttribute": "(0008,0008)",
"SelectorCSValue": "RADIALSLICED",
"SelectorAttributeVR": "CS",
"SelectorAttributeVM": 6,
"SelectbyOperator": "NOTEQUALS"
},
{
"SelectorAttribute": "(0008,0008)",
"SelectorCSValue": "RADIAL",
"SelectorAttributeVR": "CS",
"SelectorAttributeVM": 6,
"SelectbyOperator": "NOTEQUALS"
},
{
"SelectorAttribute": "(0008,0008)",
"SelectorCSValue": "CURVED",
"SelectorAttributeVR": "CS",
"SelectorAttributeVM": 6,
"SelectbyOperator": "NOTEQUALS"
}
]
}
],
"SelectorOperations": [
{
"SelectorAttribute": "(0008,0060)",
"SelectorCSValue": "MR",
"SelectorAttributeVR": "CS",
"SelectorAttributeVM": 1,
"SelectbyOperator": "EQUALS"
}
]
}
]
}
}

Rulesets

RuleSets is the parent class of the JSON.

KeyDataTypeValue MultiplicityUsageDescription
ClinicalExtensionSEQ1MJSON Object containing the actual validation rules of the extension.

##Usage:

  • M - Mandatory,
  • O - Optional,
  • C - Conditional

Sample JSON rules is as shown :

{
"ClinicalExtension": {
...
}
}

Actual rules of Extensions can be found in Sample Rules Files .

ClinicalExtension

KeyDataTypeValue MultiplicityUsageDescription
ClinicalExtensionSEQ1MContains the validation rules of the extension.
GroupMultipleMatchesAsOneProcessingRequestboolean1MIndicates whether we need to group multiple matching Series/ Study into one ProcessingRequest. The ProcessingRequest is the unit which is used by Engine to invoke the Extension for processing. If this flag is false, then for each series matched in the rule, separate Processing Request is created and the extension will be triggered separately for each series.
StudySelectorSequenceSEQ1MJSON object which is a sequence for Study level validations.
SelectorOperationsSequencesSEQ1-nMJSON Array which is a list of sequences for Image/Frame level validations.

Sample ClinicalExtension object is as shown:

"ClinicalExtension": {
"ExtractOnlyMetadata": false,
"GroupMultipleMatchesAsOneProcessingRequest": true,
"StudySelectorSequence": {
..
},
"SelectorOperationsSequences: [
{...},
{...},
...
]
}

SelectorOperationsSequence

KeyDataTypeValue MultiplicityUsageDescription
SelectorOperationsSequenceSEQ1MSequence for image/frame level validations
SelectorOperationsSequencesIDint1MThe unique id of Sequeneces. This is mapped with Sequence Id in SeriesSelectorOperation.
SelectorOperatorEnum1MSignifies the logical operation which needs to be performed among the list of Operations and Sequences.
Supported Values :
  • AND
  • OR
  • NAND
  • NOR
SelectorOperationsSEQ1-nCJSON Array containing list of SelectorOperations. SelectorOperation contains the validation logic for the image validations.

Conditional as required only when direct SelectorOperations are required in sequence. If operations are included in further sequences, then this is omitted. Refer Examples for further explanation.
SelectorOperationsSequencesSEQ1-nCThis is required when we need additional complex operations check in a Sequence.

Conditional as required only when additional Sequences type check are required in rule. Refer Examples for further explanation.

This sequence is for Image level validations.

Please refer StudySelectorSequence for further explanation and Examples.

Example of SelectorOperationsSequence:

{
"SelectorOperationsSequencesID": "1",
"SelectorOperator": "AND",
"SelectorOperationsSequences": [
{..},
...
],
"SelectorOperations" : [
{..},
...
]
}


SelectorOperation

KeyDataTypeValue MultiplicityUsageDescription
SelectorOperationSEQ1MSelectorOperation contains the actual validation cehck for the images/frames.
SelectorAttributeVRstring1MValue Representation (DataType) of the Dicom Tag.
SelectorAttributeVMint1OValue Multiplicity of the Dicom Tag.

Default Value: 1
SelectorCSValuestring1MThe expected value of the dicom tag or the value to be compared.
SelectorAttributestring1MThe dicom tag value in (xxxx, xxxx) format.

eg: for modality tag, value will be (0008,0060).

For private tag, the value in this field will be (groupNumber, 00{elementId})
SelectorValueNumberint1OFor multi-valued tags, this field represents the index at which the desired value has to be compared.
Note: index begins at 1.
Default Value : -1 (No check required)
SelectorAttributePrivateCreatorstring1CIf the dicom tag is a private tag, then this field contains the Private Creator Code of the tag.

Conditional required only for private tags.
SelectorSequencePointerstring1CIf the Dicom Tag is of type Sequence(SQ), then this field will contain the Top Level Tag and SelectorAttribute will be contain the Lower Level Tag.
Conditonal as required only for tags having VR as Sequence (SQ).
FunctionalGroupPointerstring1CThis tag is for enhanced modalities. The tag present in this field will be first checked in Shared Functional Group Sequence. If not found, it will be checked in Per Frame Functional Group Sequence.
For private tag, the value in this field will be (groupNumber, 00{elementId})

Conditonal as required only for enhanced images.
SelectorSequencePointerPrivateCreatorstring1CIf the sequence tag is a private tag, then this field will contain the private creator code for the sequence tag.

Conditional as required only for private tags which have VR of type SQ.
FunctionalGroupPrivateCreatorstring1CIf the functional tag is a private tag, then this field will contain private creator code. Same as functional group. first Shared Functional Group will be checked, if not found will be checked in Per Frame Shared Functional Group

Conditional as required only for private tags inside the functional group.
DefaultValueIFSelectorAttributeMissingbool1OThe value if the Dicom Tag is not present in the dataset.

Default Value : false.
SelectbyOperatorEnum1MComparison operation to be performed.
Supported values:
  • EQUALS - checks the equality
  • CONTAINS - checks if tag contains the given value
  • EMPTY - checks if the tag is empty
  • NOTEMPTY - checks if the tag is not empty
  • NOTEQUALS - check if values are not equal
  • NOTCONTAINS - check if tag does not contain the value
  • EQUALSOREMPTY - checks if value is equal or empty.
  • LESS_THAN(only for numerical value) - checks if tag value is less than given value.
  • LESS_THAN_EQ (only for numerical value) - checks if tag value is less than or equal to given value.
  • GREATER_THAN (only for numerical value) - checks if tag value is greater than given value.
  • GREATER_THAN_EQ (only for numerical value) - checks if tag value is greater than or equal to given value.
  • STARTSWITH - checks if tag value starts with given value
  • NOTSTARTSWITH - checks if tag value does not start with given value
  • CONTAINSSUBSTRING- this is for tag having VM greater than 1.Will check any element in the array has the given substring.
  • NOTCONTAINSSUBSTRING- this is for tag having VM greater than 1.Will check any element in the array does not contain the given substring.
SelectbyCategoryEnum1CFor validations where value cannot be obtained directly from given Dicom Tag, category is used.
This is an enum which supports following value:
  • NONE
  • AGE - Age of the patient in integer.
  • IMAGE_PLANE - Check the image plane. Supported values are TRANSVERSAL, CORONAL, SAGITTAL.

Default Value - NONE.

Conditional as this is required only if age or Image Type has to be checked.

SelectorOperations contain Image/Frame level checks where Dicom fields are checked for a given condition.

Examples

  • To check if Tag (0001,0002) values contains "tagValue":
{
"SelectorAttribute" : "(0001, 0002)",
"SelectorAttributeVR": "CS",
"SelectorCSValue" : "tagValue",
"SelectbyOperator" : CONTAINS
}
  • Private Tag:

For the tag with value "IMAGE NUM 4", the value of the corresponding fields will be as below:

{
"SelectorCSValue" : "IMAGE NUM 4",
"SelectorAttribute" : "(0019,0008)",
"SelectorAttributePrivateCreator" : "SIEMENS MR HEADER"
}
  • Sequence (SQ) VR Tags:

For the above (0032, 1064) sequence tag, to read value of tag (0008, 0102) inside it:

{
"SelectorCSValue" : "L",
"SelectorAttribute" : "(0008, 0102)",
"SelectorSequencePointer" : "(0032, 1064)"
}
  • Enhanced Images (Functional Group)

for example, to read tag (0008,1160) inside a sequence tag (0008,1140) which is inside Shared Functional Group Sequence:

{
"SelectorCSValue" : "88",
"SelectorAttribute" : "(0008, 0160)",
"FunctionalGroupPointer" : "(0008, 1140)"
}

StudySelectorSequence

KeyDataTypeValue MultiplicityUsageDescription
StudySelectorSequenceSEQ1MSequence for Study level validations.
SelectorOperatorEnum1MSignifies the logical operation which needs to be performed among the list of Operations and Sequences.

Supported Values :
  • AND
  • OR
  • NAND
  • NOR
StudySelectorOperationsSEQ1-nCJSON Array containing list of StudySelectorOperations. StudySelectorOperation contains the actual validation logic for the studies.

It is Conditional as required only when direct SelectorOperations are required in sequence. If operations are included in further sequences, then this is omitted.
Refer Examples for further explanation.
StudySelectorSequencesSEQ1-nCJSON Array containing list of StudySelectorSequences. This is required when we need additional complex operations check in a Sequence.

It is Conditional as required only when additional Seqences type check are required in rule. Refer Examples for further explanation.

Examples

  • Example 1
{
"SelectorOperator" : "AND",
"StudySelectorOperations" : [
O1, // dummy place holder for operations
O2,
],
"StudySelectorSequences" : [
S1, // dummy place holder for sequences
S2,
]
}

The above example will be evaluated as follows : ( O1 && O2 && S1 && S2 )

  • Example 2

(O1 && (O2 || O3)) this is achieved as below:

{
"SelectorOperator" : "AND",
"StudySelectorOperations" : [
O1, // dummy place holder for operations
],
"StudySelectorSequences" : [
{
"SelectorOperator" : "OR",
"StudySelectorOperations" : [
O2,
O3
],
}
]
}
  • Example 3

Only SelectorOperations can be shown as follows:

(O1 && O2)

{
"SelectorOperator" : "AND",
"StudySelectorOperations" : [
O1, // dummy place holder for operations
O2,
],
}

StudySelectorOperation

KeyDataTypeValue MultiplicityUsageDescription
StudySelectorOperationSEQ1CStudySelectorOperation contains the validation check for the studies.
CriteriaEnum1MEnum specifying which Timepoint Study to select. When multiple studies are present in input, this field provides options to specify which study to choose.

Supported values:
  • ALL : Select all the Timepoint Studies.
  • LATEST : Select the latest Timepoint Study.
  • INITIAL : Select the oldest Timpoint based Study.
Mandatorybool1MSpecifies if the given study is essential or not. If an extension requires particular study to be mandatory as input, then this flag must be set. If flag is set and condition evaluates to false, the entire evaluation of sequence will be false.
SeriesSelectorSequenceSEQ1MJSON object is a sequence for series level validations required for the given study.

Sample StudySelectorOperations is as follows:

{
"Criteria": "All",
"Mandatory": true,
"SeriesSelectorSequence": {
.....
}
}

SeriesSelectorSequence


KeyDataTypeValue MultiplicityUsageDescription
SeriesSelectorSequenceSEQ1MSequence for series level validations which is required for the particuiar study
SelectorOperatorEnum1MSignifies the logical operation which needs to be performed among the list of Operations and Sequences.

Supported Values :
  • AND
  • OR
  • NAND
  • NOR
SeriesSelectorOperationsSEQ1-nCJSON Array containing list of SerieesSelectorOperations. SerieesSelectorOperation contains the actual validation logic for the series.

Conditional as it is required only when direct SelectorOperations are required in sequence. If operations are included in further sequences, then this is omitted.
Refer Examples for further explanation.
SeriesSelectorSequencesSEQ1-nCJSON Array required when additional complex operations check needed in a Sequence.

Conditional as required only when additional Sequences type check are required in rule.
Refer Examples for further explanation.

This sequence is to support Series level validations. Logically, all the sequences (study/ series/ image) has same functionality, except for the condition that the operations is going to be performed on a series/ study / image.

Please refer StudySelectorSequence for further explanation and examples.

Sample SeriesSelectorSequences is as shown:

{
"SelectorOperator": "OR",
"SeriesSelectorOperations": [
...
],
"SeriesSelectorSequences": [
...
]
}

SeriesSelectorOperation


KeyDataTypeValue MultiplicityUsageDescription
SeriesSelectorOperationSEQ1MSeriesSelectorOperation contains the actual validation logic for the series.
SeriesDescriptionstring1MThe name of the series.
CriteriaEnum1MEnum specifying which Timepoint Series to select.
Supported values:
  • ALL : Select all the Timepoint Series.
  • LATEST : Select the latest Timepoint Series.
  • INITIAL : Select the oldest Timpoint based Series.
Mandatorybool1MSpecifies if the given series is essential or not. If an extension requires particular series to be mandatory as input, then this flag must be set. If flag is set and condition evaluates to false, the entire evaluation of sequence will be false.
ExtractOnlyMetadatabool1OSpecifies only Metadata needs to be generated. If the input is not required to be generated by Data Filtering Service and only Metadata information is required by the extension, then this flag is set to true. If set to false, then DFS will generate the volume/ image data based on the input data.

Default Value - false.
RunSelectorOperatorSequenceOnAllImagesbool1OThis gives option to run Image level validations on all the images/frames for this series. If set to true, image level validations will be run on all the images, else only on the first image of the series.

Default Value - false.
MinimumNumberOfImagesInSeriesint1OCheck number of images in the series. If this field is not present, then the check is not performed. Else check will be done if series contains atleast the given number of images.
Default Value : -1(Check not required)
InvalidOnMissingSlicesbool1OCheck if there is gap between slices or some slices are missing in the series. If the flag is set, then gap is checked by Instance Number tag in Images.

Default Value - false.
SelectorOperationsSequenceIDSEQ1MList of ids of Image Sequence. All the sequences mentioned with the ids should be matched for this given series. SelectorOperationsSequence (Image Sequence) also has a corresponding Id. This id describes which Image Level validations should be satisfied for this series.

Sample SeriesSelectorOperation is as shown:
{
"SeriesDescription": "DefaultSeries",
"Criteria": "All",
"Mandatory": true,
"SelectorOperationsSequenceID": [1, 2]
}