Data requirements
The data requirements are used to validate the data input of processing and output modules.
The requirements define what the data object (fields and tags) has to contain or not contain.
A requirement consists of single expressions, embedded into (
and )
and is chained by an and
.
An or
behaviour is achieved by adding a new requirement to the requirement list.
Expressions are case-sensitive!
Note: If there are no requirements, just pass an empty list ([]
).
Example
["((key * with ints/floats) and (keys == 1))",
"(key * with int/float)"]
This means that either each key (*
) must contain a list of integers or floats, and only one key is allowed ((keys == 1)
).
Or an unlimited number of keys, but each value must be an integer or float.
This would result in the following two acceptable data objects:
{
"test": [
1,
3,
2
]
}
or
{
"test1": 1,
"test2": 2,
"test3": 3
}
Keywords
key |
Required key followed by the user-specific value. Can be combined with with ( e.g. (key test with int) ).
Keys can also be inverted by ! (e.g. every key except (key !test with int) ).
You can also accept all keys with * (e.g. every key (key * with int) ).
Note: Only keys without space are allowed!
|
keys |
Number of elements in the data object followed by an operator
(== , != , >= , <= , < , > ) and integer (e.g. (keys == 2) ).
|
length |
Check the length of lists (e.g. length test1 == 1 , length * equal , length !event == 1 , or length test1 == test2 ).
The following operators are allowed: == , != , >= , <= , < , > .
Note: Only keys without space are allowed.
|
value |
Check the value of a key (e.g. value event == "init" , where event is the key).
Note: Only keys without space are allowed.
The following operators are allowed: == , != , >= , <= , < , > .
If the comparison value can be a float, integer, or boolean but should be a string, use "" to encapsulate it: e.g. (value string == "3") ,
where string is "3" - evaluates True , whereby (value string == 3) , where string is "3" - evaluates False .
|
and | Connecting expressions with an and . |
or | Connecting expressions with an or . |
with | Defining data types of key-values or data types of lists (e.g. (key * with ints) ). |
() | Encapsulate expressions. |
Data types
int | An integer. |
float | A float. |
number | A float or integer. |
str | A string. |
bool | A boolean. |
list | A list with items of undefined type. |
ints | A list of integers. |
floats | A list of floats. |
numbers | A list with floats or integers. |
strs | A list of strings. |
bools | A list of booleans. |
int/ints
. Means, int
or ints
(e.g. key * with int/ints
).
Note: Lists with multiple data types are currently not supported (expect numbers
).
Creating Modules
Introduction