Modified name and changed date to group as an argument

This commit is contained in:
Joaquin Ossa 2024-11-26 10:33:03 +01:00
parent 0f5eb5fba2
commit 658980e48f
2 changed files with 38 additions and 16 deletions

View file

@ -1,13 +1,13 @@
{% test kpis_outlier_detector(
model, column_name, sigma_threshold=3, days_to_consider=14
{% test kpis_daily_outlier_detector(
model, date_column, column_name, sigma_threshold=3, days_to_consider=14
) %}
with
-- Retrieve recent data based on the defined days_to_consider
recent_data as (
select date_day, {{ column_name }}
select {{ date_column }}, {{ column_name }}
from {{ model }}
where
date_day between (
{{ date_column }} between (
current_date - interval '{{ days_to_consider + 1 }} days'
) and (current_date - interval '1 day')
),
@ -27,7 +27,7 @@
> {{ sigma_threshold }} as is_outlier
from {{ model }}
cross join metrics_stats
where date_day = current_date - interval '1 day'
where {{ date_column }} = current_date - interval '1 day'
)
-- Return failing rows if any values are flagged as outliers
select *