fix: clarify event handling in waveform viewer

This commit is contained in:
2026-04-06 00:00:06 -04:00
parent ecb1147216
commit dfa09d2a4f
3 changed files with 94 additions and 30 deletions
+19 -10
View File
@@ -672,9 +672,14 @@ def _decode_a5_metadata_into(frames_data: list[bytes], event: Event) -> None:
b"Seis Loc:" at data[735]
b"Extended Notes" at data[774]
All frames are concatenated for a single-pass needle search. Fields already
set from the 0C waveform record are overwritten — A5 data is more complete
(the 210-byte 0C record only carries "Project:", not client/operator/etc.).
All frames are concatenated for a single-pass needle search.
NOTE: 5A appears to return the compliance config from when the *monitoring
session first started*, not per-event config. This means:
- "Project:" from 5A must NOT overwrite a value already set from the 0C record,
because 0C carries the correct per-event project name.
- "Client:", "User Name:", "Seis Loc:", "Extended Notes" are NOT present in the
210-byte 0C record at all, so 5A remains the sole source for those fields.
Modifies event in-place.
"""
@@ -709,13 +714,17 @@ def _decode_a5_metadata_into(frames_data: list[bytes], event: Event) -> None:
event.project_info = ProjectInfo()
pi = event.project_info
# Overwrite with A5 values — they are event-time authoritative.
# 0C waveform record only carried "Project:"; A5 carries the full set.
if project: pi.project = project
if client: pi.client = client
if operator: pi.operator = operator
if location: pi.sensor_location = location
if notes: pi.notes = notes
# "project" comes from 0C (per-event, set during _decode_waveform_record_into).
# 5A returns session-start compliance config — its "project" value is NOT
# per-event authoritative. Only use the 5A project as a fallback if 0C
# didn't supply one.
# client / operator / sensor_location / notes are NOT in the 0C record at all
# (confirmed from CLAUDE.md §SUB 5A), so 5A is the sole source for those.
if project and not pi.project: pi.project = project
if client: pi.client = client
if operator: pi.operator = operator
if location: pi.sensor_location = location
if notes: pi.notes = notes
log.debug(
"a5 metadata: project=%r client=%r operator=%r location=%r",