From 870a10365e912f9dc7786cd8754dee4012030689 Mon Sep 17 00:00:00 2001 From: Brian Harrison Date: Thu, 2 Apr 2026 02:00:00 -0400 Subject: [PATCH] server: fill ev.sample_rate from compliance config for /device/events sample_rate is a device-level setting stored in the compliance config, not per-event in the waveform record. After downloading events, backfill ev.sample_rate from info.compliance_config.sample_rate for any event that didn't get it from the waveform record decode path. Co-Authored-By: Claude Sonnet 4.6 --- sfm/server.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sfm/server.py b/sfm/server.py index 4b58051..47ab414 100644 --- a/sfm/server.py +++ b/sfm/server.py @@ -315,6 +315,13 @@ def device_events( except Exception as exc: raise HTTPException(status_code=500, detail=f"Device error: {exc}") from exc + # Fill sample_rate from compliance config where the event record doesn't supply it. + # sample_rate is a device-level setting, not stored per-event in the waveform record. + if info.compliance_config and info.compliance_config.sample_rate: + for ev in events: + if ev.sample_rate is None: + ev.sample_rate = info.compliance_config.sample_rate + return { "device": _serialise_device_info(info), "event_count": len(events),