Add support for array input for all constraints in HangingProtocolService validator (#3322)

Co-authored-by: Bill Wallace <wayfarer3130@gmail.com>
This commit is contained in:
Sofien-SellamiandBill Wallace authored and GitHub committed 2023-06-29 10:56:40 -04:00
1 parent aeb61f40da
commit e653961858
3 files changed
+977 -174

No files matched your search

@@ -246,7 +246,23 @@ A list of criteria for the protocol along with the provided points for ranking.
- `constraint`: the constraint that needs to be satisfied for the attribute. It accepts a `validator` which can be
[`equals`, `doesNotEqual`, `contains`, `doesNotContain`, `startsWith`, `endsWidth`]
- | Rule | Single Value | Array Value | Example |
|--- |--- |--- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| equals | === | All members are === in same order | value = ['abc', 'def', 'GHI']<br/>testValue = 'abc' (Fail)<br/><br/> = ['abc'] (Fail)<br/><br/> = ['abc', 'def', 'GHI'] (Valid)<br/><br/> = ['abc', 'GHI', 'def'] (Fail)<br/><br/> = ['abc', 'def'] (Fail)<br/><br/>value = 'Attenuation Corrected'<br/>testValue = 'Attenuation Corrected' (Valid)<br/> = 'Attenuation' (Fail)<br/><br/> value = ['Attenuation Corrected'] <br/> testValue = ['Attenuation Corrected'] (Valid)<br/> = 'Attenuation Corrected' (Valid) <br/> = 'Attenuation' (Fail) <br/> |
| doesNotEqual | !== | Any member is !== for the array, either in value, order, or length | value = ['abc', 'def', 'GHI']<br/>testValue = 'abc' (Valid)<br/> = ['abc'] (Valid)<br/> = ['abc', 'def', 'GHI'] (Fail)<br/> = ['abc', 'GHI', 'def'] (Valid)<br/> = ['abc', 'def'] (Valid)<br/><br/>value = 'Attenuation Corrected'<br/>testValue = 'Attenuation Corrected' (Fail)Valid<br/><br/> = 'Attenuation' (Valid) <br/><br/> value = ['Attenuation Corrected']<br/> testValue = ['Attenuation Corrected'] (Fail) <br/> = 'Attenuation Corrected' (Fail) <br/> = 'Attenuation' (Fail) |
| includes | Not allowed | Value is equal to one of the values of the array | value = ['abc', 'def', 'GHI']<br/>testValue = ['abc'] (Valid)<br/><br/> = ‘abc’ (Fail)<br/><br/>= [‘abc’] (Fail)<br/><br/> = ‘dog’ (Fail)<br/><br/> = = [‘att’, ‘abc’] (Valid)<br/><br/> = ['abc', 'def', 'dog'] (Valid)<br/><br/> = ['cat', 'dog'] (Fail)<br/><br/><br/> value = 'Attenuation Corrected' <br/> testValue = ['Attenuation Corrected', 'Corrected'] (Valid)<br/>= ['Attenuation', 'Corrected'] (Fail)<br/><br/><br/>value = ['Attenuation Corrected']<br/>testValue = 'Attenuation Corrected' (Fail)<br/> = ['Attenuation Corrected', 'Corrected'] (Valid)<br/> = ['Attenuation', 'Corrected'] (Fail) |
| doesNotInclude | Not allowed | Value is not in one of the values of the array | value = ['abc', 'def', 'GHI']<br/>testValue = ‘Corr’ (Valid)<br/><br/> = ‘abc’ (Fail)<br/><br/> = [‘att’, ‘cor’] (Valid)<br/><br/> = ['abc', 'def', 'dog'] (Fail)<br/><br/><br/>value = 'Attenuation Corrected' <br/> testValue = ['Attenuation Corrected', 'Corrected'] (Fail) <br/> = ['Attenuation', 'Corrected'] (Valid) <br/><br/><br/>value = ['Attenuation Corrected'] <br/> testValue = 'Attenuation' (Fail)<br/> = ['Attenuation Corrected', 'Corrected'] (Fail) <br/>= ['Attenuation', 'Corrected'] (Valid) |
| containsI | String containment (case insensitive) | String containment (case insensitive) is OK for one of the rule values | value = 'Attenuation Corrected'<br/>testValue = ‘Corr’ (Valid)<br/> = ‘corr’ (Valid)<br/><br/> = [‘att’, ‘cor’] (Valid)<br/><br/> = [‘Att’, ‘Wall’] (Valid)<br/><br/> = [‘cat’, ‘dog’] (Fail)<br/><br/><br/><br/>value = ['abc', 'def', 'GHI']<br/>testValue = 'def' (Valid)<br/><br/> = 'dog' (Fail)<br/><br/> = ['gh', 'de'] (Valid)<br/><br/> = ['cat', 'dog'] (Fail)<br/> |
| contains | String containment (case sensitive) | String containment (case sensitive) is OK for one of the rule values | value = 'Attenuation Corrected'<br/>testValue = ‘Corr’ (Valid)<br/> = ‘corr’ (Fail)<br/> = [‘att’, ‘cor’] (Fail)<br/> = [‘Att’, ‘Wall’] (Valid)<br/><br/> = [‘cat’, ‘dog’] (Fail)<br/><br/><br/>value = ['abc', 'def', 'GHI']<br/><br/>testValue = 'def' (Valid)<br/> = 'dog' (Fail)<br/><br/> = ['cat', 'de'] (Valid)<br/><br/> = ['cat', 'dog'] (Fail) |
| doesNotContain | String containment is false | String containment is false for all values of the array | value = 'Attenuation Corrected'<br/>testValue = ‘Corr’ (Fail)<br/><br/><br/> = ‘corr’ (Valid)<br/><br/> = [‘att’, ‘cor’] (Valid)<br/><br/> = [‘Att’, ‘Wall’] (Fail)<br/><br/> = [‘cat’, ‘dog’] (Valid)<br/><br/>value = ['abc', 'def', 'GHI']<br/>testValue = 'def' (Fail)<br/><br/><br/> = 'dog' (Valid)<br/><br/> = ['cat', 'de'] (Fail)<br/><br/> = ['cat', 'dog'] (Valid) |
| doesNotContainI | String containment is false (case insensitive) | String containment (case insensitive) is false for all values of the array | value = 'Attenuation Corrected'<br/>testValue = ‘Corr’ (Fail)<br/><br/> = ‘corr’ (Fail)<br/><br/> = [‘att’, ‘cor’] (Fail)<br/><br/> = [‘Att’, ‘Wall’] (Fail)<br/><br/> = [‘cat’, ‘dog’] (Valid)<br/><br/><br/>value = ['abc', 'def', 'GHI']<br/>testValue = 'DEF' (Fail)<br/><br/> = 'dog' (Valid)<br/><br/> = ['cat', 'gh'] (Fail)<br/><br/> = ['cat', 'dog'] (Valid) |
| startsWith | Value begins with characters | Starts with one of the values of the array | value = 'Attenuation Corrected'<br/>testValue = ‘Corr’ (Fail)<br/><br/> = ‘Att’ (Fail)<br/><br/> = ['cat', 'dog', 'Att'] (Valid)<br/><br/> = [‘cat’, ‘dog’] (Fail)<br/><br/><br/>value = ['abc', 'def', 'GHI']<br/>testValue = 'deg' (Valid)<br/><br/> = ['cat', 'GH'] (Valid)<br/><br/> = ['cat', 'gh'] (Fail)<br/><br/> = ['cat', 'dog'] (Fail) |
| endsWith | Value ends with characters | ends with one of the value of the array | value = 'Attenuation Corrected'<br/>testValue = ‘TED’ (Fail)<br/><br/> = ‘ted’ (Valid)<br/><br/> = ['cat', 'dog', 'ted'] (Valid)<br/><br/> = [‘cat’, ‘dog’] (Fail)<br/><br/><br/>value = ['abc', 'def', 'GHI']<br/>testValue = 'deg' (Valid)<br/><br/> = ['cat', 'HI'] (Valid)<br/><br/> = ['cat', 'hi'] (Fail)<br/><br/> = ['cat', 'dog'] (Fail) |
| greaterThan | value is => to rule | Not applicable | value = 30<br/><br/>testValue = 20 (Valid)<br/> = 40 (Fail)<br/><br/> |
| lessThan | value is <= to rule | Not applicable | value = 30<br/><br/>testValue = 40 (Valid)<br/> = 20 (Fail)<br/> |
| range | Not applicable | 2 value requested (min and max) | value = 50<br/><br/>testValue = [10,60] (Valid)<br/> = [60, 10] (Valid)<br/><br/> = [0, 10] (Fail)<br/><br/> = [70, 80] (Fail)<br/><br/> = 45 (Fail)<br/><br/> = [45] (Fail) |
| notNull | Not Applicable | Not Applicable | No value |
A sample of the matching rule is above which matches against the study description to be PETCT
```js