Skip to content

Compare

Threshold-based change detection.

1 modules

ModuleDescription
Detectar MudançaDetectar se um valor mudou além do limite (por quantidade ou porcentagem)

Modules

Detectar Mudança

compare.change

Detectar se um valor mudou além do limite (por quantidade ou porcentagem)

Parameters:

NameTypeRequiredDefaultDescription
current_valuenumberYes-The current/new value to compare
previous_valuenumberYes-The previous/old value to compare against
modeselect (percent, absolute, any)NopercentO valor anterior/antigo para comparar
thresholdnumberNo5Mudança mínima para acionar (5 = 5% ou 5 unidades)
directionselect (both, up, down)NobothQual direção de mudança detectar

Output:

FieldTypeDescription
okbooleanSe a operação foi bem-sucedida
changedbooleanSe a operação foi bem-sucedida
directionstringSe a operação foi bem-sucedida
change_percentnumberDireção da mudança:
change_absolutenumberMudança percentual (positivo = aumento, negativo = diminuição)
current_valuenumberThe current value
previous_valuenumberThe previous value
summarystringO valor atual

Example: Crypto price alert (5% change)

yaml
current_value: 44500
previous_value: 42000
mode: percent
threshold: 5
direction: both

Example: Stock drop alert

yaml
current_value: 145.5
previous_value: 152.3
mode: percent
threshold: 3
direction: down

Example: Temperature change (absolute)

yaml
current_value: 32
previous_value: 25
mode: absolute
threshold: 5
direction: up

Released under the Apache 2.0 License.