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),