From 501b5080e95047f46ff77de362da8a9d77aac104 Mon Sep 17 00:00:00 2001 From: Brian Harrison Date: Thu, 2 Apr 2026 14:33:33 -0400 Subject: [PATCH] server: backfill event.project_info fields from compliance config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 210-byte waveform record only stores "Project:" — client, operator, sensor_location, and notes are device-level settings in SUB 1A, not per-event fields. Backfill those into each event's project_info after download, same pattern as the sample_rate backfill. Co-Authored-By: Claude Sonnet 4.6 --- sfm/server.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sfm/server.py b/sfm/server.py index 09a43d0..eafdefd 100644 --- a/sfm/server.py +++ b/sfm/server.py @@ -323,6 +323,20 @@ def device_events( if ev.sample_rate is None: ev.sample_rate = info.compliance_config.sample_rate + # Backfill event.project_info fields that the 210-byte waveform record doesn't carry. + # The waveform record only stores "Project:" — client/operator/sensor_location/notes + # live in the SUB 1A compliance config, not in the per-event record. + if info.compliance_config: + cc = info.compliance_config + for ev in events: + if ev.project_info is None: + ev.project_info = ProjectInfo() + pi = ev.project_info + if pi.client is None: pi.client = cc.client + if pi.operator is None: pi.operator = cc.operator + if pi.sensor_location is None: pi.sensor_location = cc.sensor_location + if pi.notes is None: pi.notes = cc.notes + return { "device": _serialise_device_info(info), "event_count": len(events),