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.
Key | DataType | Value Multiplicity | Usage | Description |
---|---|---|---|---|
ClinicalExtension | SEQ | 1 | M | JSON 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
Key | DataType | Value Multiplicity | Usage | Description |
---|---|---|---|---|
ClinicalExtension | SEQ | 1 | M | Contains the validation rules of the extension. |
GroupMultipleMatchesAsOneProcessingRequest | boolean | 1 | M | Indicates 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. |
StudySelectorSequence | SEQ | 1 | M | JSON object which is a sequence for Study level validations. |
SelectorOperationsSequences | SEQ | 1-n | M | JSON 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
Key | DataType | Value Multiplicity | Usage | Description |
---|---|---|---|---|
SelectorOperationsSequence | SEQ | 1 | M | Sequence for image/frame level validations |
SelectorOperationsSequencesID | int | 1 | M | The unique id of Sequeneces. This is mapped with Sequence Id in SeriesSelectorOperation. |
SelectorOperator | Enum | 1 | M | Signifies the logical operation which needs to be performed among the list of Operations and Sequences. Supported Values :
|
SelectorOperations | SEQ | 1-n | C | JSON 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. |
SelectorOperationsSequences | SEQ | 1-n | C | This 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
Key | DataType | Value Multiplicity | Usage | Description |
---|---|---|---|---|
SelectorOperation | SEQ | 1 | M | SelectorOperation contains the actual validation cehck for the images/frames. |
SelectorAttributeVR | string | 1 | M | Value Representation (DataType) of the Dicom Tag. |
SelectorAttributeVM | int | 1 | O | Value Multiplicity of the Dicom Tag. Default Value: 1 |
SelectorCSValue | string | 1 | M | The expected value of the dicom tag or the value to be compared. |
SelectorAttribute | string | 1 | M | The 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}) |
SelectorValueNumber | int | 1 | O | For 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) |
SelectorAttributePrivateCreator | string | 1 | C | If the dicom tag is a private tag, then this field contains the Private Creator Code of the tag. Conditional required only for private tags. |
SelectorSequencePointer | string | 1 | C | If 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). |
FunctionalGroupPointer | string | 1 | C | This 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. |
SelectorSequencePointerPrivateCreator | string | 1 | C | If 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. |
FunctionalGroupPrivateCreator | string | 1 | C | If 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. |
DefaultValueIFSelectorAttributeMissing | bool | 1 | O | The value if the Dicom Tag is not present in the dataset. Default Value : false. |
SelectbyOperator | Enum | 1 | M | Comparison operation to be performed. Supported values:
|
SelectbyCategory | Enum | 1 | C | For validations where value cannot be obtained directly from given Dicom Tag, category is used. This is an enum which supports following value:
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
Key | DataType | Value Multiplicity | Usage | Description |
---|---|---|---|---|
StudySelectorSequence | SEQ | 1 | M | Sequence for Study level validations. |
SelectorOperator | Enum | 1 | M | Signifies the logical operation which needs to be performed among the list of Operations and Sequences. Supported Values :
|
StudySelectorOperations | SEQ | 1-n | C | JSON 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. |
StudySelectorSequences | SEQ | 1-n | C | JSON 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
Key | DataType | Value Multiplicity | Usage | Description |
---|---|---|---|---|
StudySelectorOperation | SEQ | 1 | C | StudySelectorOperation contains the validation check for the studies. |
Criteria | Enum | 1 | M | Enum 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:
|
Mandatory | bool | 1 | M | Specifies 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. |
SeriesSelectorSequence | SEQ | 1 | M | JSON object is a sequence for series level validations required for the given study. |
Sample StudySelectorOperations is as follows:
{
"Criteria": "All",
"Mandatory": true,
"SeriesSelectorSequence": {
.....
}
}
SeriesSelectorSequence
Key | DataType | Value Multiplicity | Usage | Description |
---|---|---|---|---|
SeriesSelectorSequence | SEQ | 1 | M | Sequence for series level validations which is required for the particuiar study |
SelectorOperator | Enum | 1 | M | Signifies the logical operation which needs to be performed among the list of Operations and Sequences. Supported Values :
|
SeriesSelectorOperations | SEQ | 1-n | C | JSON 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. |
SeriesSelectorSequences | SEQ | 1-n | C | JSON 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
Key | DataType | Value Multiplicity | Usage | Description |
---|---|---|---|---|
SeriesSelectorOperation | SEQ | 1 | M | SeriesSelectorOperation contains the actual validation logic for the series. |
SeriesDescription | string | 1 | M | The name of the series. |
Criteria | Enum | 1 | M | Enum specifying which Timepoint Series to select. Supported values:
|
Mandatory | bool | 1 | M | Specifies 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. |
ExtractOnlyMetadata | bool | 1 | O | Specifies 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. |
RunSelectorOperatorSequenceOnAllImages | bool | 1 | O | This 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. |
MinimumNumberOfImagesInSeries | int | 1 | O | Check 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) |
InvalidOnMissingSlices | bool | 1 | O | Check 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. |
SelectorOperationsSequenceID | SEQ | 1 | M | List 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]
}