Add clinical threshold lines to AGP/Dagoverzicht charts, TIR stacked bar to Samenvatting

Closes gitea #14, #15.
This commit is contained in:
2026-08-01 22:26:26 +02:00
parent 699848b479
commit 00fb81b283
5 changed files with 135 additions and 3 deletions
+9 -1
View File
@@ -9,7 +9,13 @@ from reporting import (
sensor_active_percent,
tir_breakdown_5band,
)
from ui_common import load_range_data, render_completeness_warning, select_period_days
from ui_common import (
build_tir_stacked_bar_figure,
get_colors,
load_range_data,
render_completeness_warning,
select_period_days,
)
st.set_page_config(page_title="Glucose dashboard — Samenvatting", page_icon="📊", layout="wide")
require_auth()
@@ -66,6 +72,8 @@ cols = st.columns(5)
for col, band in zip(cols, band_labels, strict=True):
col.metric(band_labels[band], f"{tir[band]:.0f}%", help=f"Streefwaarde: {band_targets[band]}")
st.plotly_chart(build_tir_stacked_bar_figure(tir, get_colors()), width="stretch")
st.caption(
f"Periode: {start.strftime('%d-%m-%Y')} t/m {end.strftime('%d-%m-%Y')} "
f"({len(glucose)} metingen) · streefwaarden volgens Battelino et al. 2019"
+2
View File
@@ -7,6 +7,7 @@ from data_processing import TARGET_HIGH, TARGET_LOW
from nightscout_client import NightscoutConfigError
from reporting import agp_percentile_bands
from ui_common import (
add_threshold_lines,
get_colors,
hex_to_rgba,
load_range_data,
@@ -102,6 +103,7 @@ fig.update_layout(
yaxis={"title": "mmol/L", "gridcolor": colors["grid"], "zeroline": False},
xaxis={"title": "Uur van de dag", "gridcolor": colors["grid"], "tickmode": "linear", "dtick": 2},
)
add_threshold_lines(fig, colors)
st.plotly_chart(fig, width="stretch")
st.caption(
f"Periode: {start.strftime('%d-%m-%Y')} t/m {end.strftime('%d-%m-%Y')} ({len(glucose)} metingen)"
+2
View File
@@ -7,6 +7,7 @@ from auth import require_auth
from data_processing import TARGET_HIGH, TARGET_LOW
from nightscout_client import NightscoutConfigError
from ui_common import (
add_threshold_lines,
get_colors,
load_range_data,
render_completeness_warning,
@@ -74,6 +75,7 @@ for i, day in enumerate(dates, start=1):
col=1,
)
fig.update_yaxes(title_text="mmol/L", gridcolor=colors["grid"], row=i, col=1)
add_threshold_lines(fig, colors, row=i)
fig.update_xaxes(title_text="Uur van de dag", range=[0, 24], dtick=4, gridcolor=colors["grid"])
fig.update_layout(