Redesign the PDF report: landscape pages, headers/footers, icon, daily stats
Every report section now gets its own landscape A4 page (or, for Dagoverzicht, one page per day) via a GlucoseReportPDF(FPDF) subclass with a real header (section title, report version, insulin/pump/sensor type from new REPORT_* env vars) and footer (page number, generation timestamp, Nightscout link) on every page, plus an original SVG icon in the header — inspired by the LibreView AGP report. New "Insulineprofiel" PDF section mirrors the dashboard page (basal bar chart, ISF/carb-ratio segments, DIA). Each Dagoverzicht day now draws the same basal/bolus/carb/target overlays as the interactive charts (matplotlib port of the Plotly helpers from #30) plus a new per-day stats block (reporting.daily_stats: avg/min/max glucose, total/basal/bolus/SMB insulin, hypo/hyper counts and durations). Builds on #29 (profile data) and #30 (overlay logic/colors).
This commit is contained in:
+9
-3
@@ -5,7 +5,12 @@ from auth import require_auth
|
||||
from nightscout_client import NightscoutConfigError
|
||||
from pdf_export import AVAILABLE_SECTIONS, SECTION_EVENTS, build_report_pdf
|
||||
from reporting import HIGH, LOW, VERY_HIGH, VERY_LOW, detect_events, summarize_events
|
||||
from ui_common import load_range_data, render_completeness_warning, select_period_days
|
||||
from ui_common import (
|
||||
load_profile,
|
||||
load_range_data,
|
||||
render_completeness_warning,
|
||||
select_period_days,
|
||||
)
|
||||
|
||||
st.set_page_config(page_title="Glucose dashboard — Export", page_icon="📊", layout="wide")
|
||||
require_auth()
|
||||
@@ -17,7 +22,8 @@ start, end, days = select_period_days(default_label="90 dagen")
|
||||
sections = st.multiselect("Onderdelen", AVAILABLE_SECTIONS, default=AVAILABLE_SECTIONS)
|
||||
|
||||
try:
|
||||
glucose, _treatments = load_range_data(start, end)
|
||||
glucose, treatments = load_range_data(start, end)
|
||||
profile = load_profile()
|
||||
except NightscoutConfigError as exc:
|
||||
st.error(str(exc))
|
||||
st.stop()
|
||||
@@ -43,7 +49,7 @@ if SECTION_EVENTS in sections:
|
||||
events = detect_events(glucose, threshold, direction)
|
||||
events_summary[label] = summarize_events(events, days)
|
||||
|
||||
pdf_bytes = build_report_pdf(sections, glucose, events_summary, start, end)
|
||||
pdf_bytes = build_report_pdf(sections, glucose, events_summary, start, end, treatments=treatments, profile=profile)
|
||||
|
||||
st.download_button(
|
||||
"Download PDF",
|
||||
|
||||
Reference in New Issue
Block a user