Fields - anodot/daria GitHub Wiki
- Field configuration
- Field configuration
- Transformation functions
- List of transformation functions
- Lookup transformations
Field - is a general concept of an item that can be extracted from source data. Currently, fields are used in Observium and Topology integrations.
Example of field usage:
"dimension_configurations": {
"DESTINATION_STATE": {
"type": "variable",
"value_path": ["port_label", "port"],
"concat_by": "_",
"transformations": [
{
"type": "function",
"name": "substring",
"args": [0, 2]
},
{
"type": "lookup",
"name": "DEST_GROUP_CATEGORY",
"key": "ABBREVIATION",
"value": "STATE",
"compare_function": "contains",
"default": "other",
"strict": false
}
]
}
}
Field configuration
| Property | Required | Type | Description |
|---|---|---|---|
value_path |
yes | String | Array |
type |
no | String | Possible values are variable and constant. Default: variable |
value |
no | String | A value that is used for a field if it's a constant field |
transformations |
yes | Array | An array of transformations to apply to the extracted value |
transformations object configuration
| Property | Required | Type | Description |
|---|---|---|---|
type |
yes | String | Possible values are function and lookup |
name |
yes | String | A name of a transformation function to apply or a lookup to use |
function transformation configuration
| Property | Required | Type | Description |
|---|---|---|---|
type |
yes | String | Value function |
name |
yes | String | A name of a transformation function to apply |
args |
no | Array | A list of arguments to pass to a function |
lookup transformation configuration
| Property | Required | Type | Description |
|---|---|---|---|
type |
yes | String | Value lookup |
name |
yes | String | A name of a lookup to use |
key |
yes | String | A column name to match the transformed value |
value |
yes | String | A column name to take value from, when it's matched by a key |
compare_function |
no | String | Name of a function to use when searching for a key. Default - equals |
default |
no | String | A value to be used if the original value wasn't found in the lookup |
strict |
no | Boolean | true by default, when enabled the lookup will throw an exception if more than one value was found during lookup. When disabled, lookup results will be sorted and the first value will be used |
Transformation functions
A function configuration must have a name field that contains a function name to be applied to a value and might contain the args field, which contains a list of arguments to be passed to a function. For example, to divide a value by 8 write:
{
"type": "function",
"name": "divide",
"args": [8]
}
List of transformation functions:
to_upper() - Make a string uppercase. Example:
{
"type": "function",
"name": "to_upper"
}
regex_substring(pattern, repl) Extract a substring using a regex. Example, get the first group of the regex that matches everything after the dot:
{
"type": "function",
"name": "regex_substring",
"args": [".+\\.(.+)", "\\g<1>"]
}
divide(denominator: int|float) - divide a value. Example:
{
"type": "function",
"name": "divide",
"args": [8]
}
Lookup transformations
To learn about lookup transformations visit the data lookup wiki page