Skip to content

Compare

Threshold-based change detection.

1 modules

ModuleDescription
Deteksi PerubahanDeteksi jika nilai telah berubah melebihi batas (berdasarkan jumlah atau persentase)

Modules

Deteksi Perubahan

compare.change

Deteksi jika nilai telah berubah melebihi batas (berdasarkan jumlah atau persentase)

Parameters:

NameTypeRequiredDefaultDescription
current_valuenumberYes-The current/new value to compare
previous_valuenumberYes-The previous/old value to compare against
modeselect (percent, absolute, any)NopercentNilai sebelumnya/lama untuk dibandingkan
thresholdnumberNo5Perubahan minimum untuk memicu (5 = 5% atau 5 unit)
directionselect (both, up, down)NobothArah perubahan yang akan dideteksi

Output:

FieldTypeDescription
okbooleanApakah operasi berhasil
changedbooleanApakah operasi berhasil
directionstringApakah operasi berhasil
change_percentnumberArah perubahan:
change_absolutenumberPerubahan persentase (positif = naik, negatif = turun)
current_valuenumberThe current value
previous_valuenumberThe previous value
summarystringNilai saat ini

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.