Functions¶
flowtask.events.events.alerts.functions
¶
average
¶
average.
Calculates the average of a value compared with a threshold. Args: data (dict): extract column from data. column (str): column to calculate. threshold (float): value to be used for threshold deviation (float): max deviation acceptable for threshold allow_below (bool): if True, the threshold is not evaluated on minimum values.
between
¶
Checks if the actual value in the specified column is between two given values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
Dictionary containing the column data. |
required |
column
|
str
|
Column name to evaluate. |
required |
value
|
list
|
A list containing two values: [min_value, max_value]. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
Tuple[str, Union[int, float], bool]
|
(column, actual_value, True/False) |
equal
¶
Check if the actual value on a specified column in the data is equal to the given threshold value.
gt
¶
Check if the actual value on a specified column in the data is greater than to the given threshold value.
has_columns
¶
Check if the actual value on a specified column in the data is equal to the given threshold value.
lt
¶
Check if the actual value on a specified column in the data is less than to the given threshold value.
max_value
¶
Checks if the actual value of a specified column in the data is less than or equal to the given threshold value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
Dictionary containing the data to be checked. |
required |
column
|
str
|
Name of the column in the data whose value needs to be checked. |
required |
value
|
Union[int, float]
|
The threshold value. The actual value in the data |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
Tuple[str, Union[int, float], bool]
|
A tuple containing: - column (str): Name of the column that was checked. - actual_value (Union[int, float]): The actual value from the data for the specified column. - val (bool): True if the actual value is less than or equal to the threshold, False otherwise. |
min_value
¶
Checks if the actual value of a specified column in the data is greater than or equal to the given threshold value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
Dictionary containing the data to be checked. |
required |
column
|
str
|
Name of the column in the data whose value needs to be checked. |
required |
value
|
Union[int, float]
|
The threshold value. The actual value in the data should be greater than or equal to this. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
Tuple[str, Union[int, float], bool]
|
A tuple containing: - column (str): Name of the column that was checked. - actual_value (Union[int, float]): The actual value from the data for the specified column. - val (bool): True if the actual value is greater than or equal to the threshold, False otherwise. |
missing_columns
¶
Check if all required columns exist in the 'columns' field of the given data.
:param data: Dictionary containing the structure with "columns". :param column: Name of the column to check (by default: "columns"). :param value: List of columns to check. :return: Tuple (checked_key, missing_columns, bool)