From 05de094429acab7fbb9f7bb34e345408fe640d25 Mon Sep 17 00:00:00 2001 From: Ryan Voots Date: Fri, 9 May 2025 21:05:52 -0400 Subject: [PATCH] new ema function --- sql/condition-glucose-grafana.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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;