diff --git a/sql/condition-glucose-grafana.sql b/sql/condition-glucose-grafana.sql index d7f5616..3f7badd 100644 --- a/sql/condition-glucose-grafana.sql +++ b/sql/condition-glucose-grafana.sql @@ -27,5 +27,7 @@ FROM generate_series($__timeFrom(), $__timeTo(), '1 minute'::interval) AS ts ) AS gi_next ON true WHERE gi_prev.time IS NOT NULL and gi_next.time IS NOT NULL AND gi_next.time <> gi_prev.time ) -SELECT ts as time, samp_value as value +SELECT ts as time, + public.ema(samp_value ::real, 0.33) over (order by ts asc) as smoothval, + samp_value as absvalue FROM coallated;