Compare commits
17
Commits
ba826dfac6
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eec88a62b8 | ||
|
|
c2b8e76774 | ||
|
|
ed4f3d2213 | ||
|
|
03c272316f | ||
|
|
30bfdd6eff | ||
|
|
fb14a8f7bb | ||
|
|
e9c01ce8d4 | ||
|
|
d2258dad4e | ||
|
|
e050e602c2 | ||
|
|
fc1c7c7936 | ||
|
|
7d0d12079b | ||
|
|
5203aab849 | ||
|
|
5b65718b72 | ||
|
|
483762607e | ||
|
|
d0b66368d5 | ||
|
|
2eb1d25028 | ||
|
|
cc821f9ee3 |
No files matched your search
+145
-1
@@ -4,7 +4,42 @@ All notable changes to seismo-relay are documented here.
|
||||
|
||||
---
|
||||
|
||||
## Unreleased
|
||||
## v0.35.0 — 2026-11-16
|
||||
|
||||
**The file-only decode reaches 80 of Blastware's 88 report fields, and SFM
|
||||
reads monitor logs (.MLG).**
|
||||
|
||||
Three lines of work ship together.
|
||||
|
||||
**The file-only decode, groups D (part 2), E and F.** 80 of Blastware's 88
|
||||
report fields now match on every DL2 event, 47 at v0.34.0. The last 16 values,
|
||||
in two causes, are left as they are by decision (Brian, 2026-11-11).
|
||||
- **New, from the unit's own records in the file:**
|
||||
- ZC frequency, peak displacement and times of peak
|
||||
- the sensor check results
|
||||
- the Monitor Log line
|
||||
- over range (Blastware's `OORANGE`)
|
||||
- **Fixed:**
|
||||
- a range-1 mic read 8× high (7 DL2 events)
|
||||
- the mic dB offset
|
||||
- a unit without a mic lost its sensor-check traces
|
||||
|
||||
**Monitor logs (.MLG).** SFM reads Blastware's monitor logs and keeps each
|
||||
unit's monitoring timeline: sessions, gaps and what each means, and call-ins,
|
||||
including calls that left no file. It answers "was unit X monitoring at T",
|
||||
which is what a shot report needs for a unit that did not trigger. Nothing flows
|
||||
in until the watcher forwards `.MLG`s or they are bulk-imported.
|
||||
|
||||
**An escaped checksum is the checksum, not data (#58).** SFM's live reads no
|
||||
longer carry a stray byte, which had corrupted the battery and memory status and
|
||||
the call-home read.
|
||||
|
||||
Prod still overlays a paired ASCII report onto the decode. Retiring that overlay
|
||||
is the plan's step 3 and is not part of this release.
|
||||
|
||||
⚠ **This release owes a backfill, about 8 hours on the NAS, and creates two
|
||||
empty tables on first start.** There is no migration, and no stored event time
|
||||
moves. See *Migration*.
|
||||
|
||||
### Added
|
||||
- **ZC frequency, peak displacement and times of peak come from the unit's own
|
||||
@@ -135,6 +170,68 @@ All notable changes to seismo-relay are documented here.
|
||||
- No schema change.
|
||||
- The over-range flags are on the decoded event only: not stored in the
|
||||
DB, sidecar or `.h5` yet.
|
||||
- **Monitor logs (.MLG): SFM reads them and keeps each unit's monitoring
|
||||
timeline** (`feat/mlg-import`, merged 2026-11-16). Spec
|
||||
`docs/superpowers/specs/2026-11-09-mlg-unit-timeline-design.md`.
|
||||
- **Why (Brian, 2026-11-09):** every unit sends an `.MLG` at every call-in,
|
||||
whatever its mode. A continuous-mode unit sends no event file on a quiet
|
||||
day, so its `.MLG` is the only proof it was monitoring. That proof is what
|
||||
a shot report attaches for a unit that did not trigger. Outage history is
|
||||
the second use.
|
||||
- **The format, measured** (reference D.4, rewritten):
|
||||
- an 18-byte prefix, then length-led 292-byte records
|
||||
- each record ends in a CRC-16/AUG-CCITT over `[0:288]`, little-endian:
|
||||
3,329 / 3,329 records
|
||||
- `minimateplus/mlg_file.py` reads it, checking every record's checksum,
|
||||
and writes it: 16 / 16 real files rebuilt byte for byte
|
||||
- the old unused writer in `blastware_file.py` (big-endian, a zero CRC
|
||||
at the wrong end) is removed
|
||||
- `minimateplus/crc.py` is the one CRC, now used by
|
||||
`micromate/setup_block.py` too
|
||||
- **Storage:** new tables `mlg_files` (one row per file received) and
|
||||
`mlg_records` (one row per record, stored once). The original file is kept
|
||||
under `<store>/<serial>/mlg/`.
|
||||
- An empty file has no serial inside. It takes the longest known serial
|
||||
its `<serial><counter>` name starts with, or is stored as unresolved,
|
||||
never guessed.
|
||||
- Only plain serials become directories.
|
||||
- **The timeline** (`sfm/mlg_timeline.py`):
|
||||
- **sessions:** how each ended, its events, and its trigger level as
|
||||
logged
|
||||
- **gaps and what each means:** call-in, scheduled off, lost power,
|
||||
stopped by a person, memory full, no restart after a call-in, records
|
||||
missing
|
||||
- **clock steps:** the unit's clock steps back an hour at its first
|
||||
call-in after daylight saving ends
|
||||
- **call-ins:** delivered, no_file (a Modem Exit that left no file) and
|
||||
nothing_new (an empty file)
|
||||
- **"Was it monitoring at T"** answers monitoring / not_monitoring / unknown,
|
||||
naming the records and file behind the answer. It never claims more than
|
||||
the records show: a gap across a missing call-in number (files are
|
||||
numbered) reads unknown.
|
||||
- **Routes:** `POST /db/import/mlg_file`; `GET /db/units/{serial}/timeline`,
|
||||
`/db/units/{serial}/monitoring_at`, `/db/mlg_records` and
|
||||
`/db/mlg_files/{id}` (the original, for printing).
|
||||
- **Tools:** `scripts/import_mlg_dir.py` (bulk import, with a dry run) and
|
||||
`scratch/check_mlg_vs_events.py` (cross-check against the event files'
|
||||
footers).
|
||||
- **Measured on DL2's 1,273-file sample** (BE6907 and BE12844 from 2026,
|
||||
BE8081 from 2018–19):
|
||||
- 0 errors, 0 unresolved
|
||||
- BE8081's 785 Event Recorded records match its 785 event files, both ways
|
||||
- every recorded event falls inside a session
|
||||
- two real outages: BE6907 recorded nothing for 14 days from 2026-10-07,
|
||||
and BE8081 didn't restart after a failed call over Labor Day 2019
|
||||
- ⚠ **Operational:**
|
||||
- Two new tables are created on first start: no migration, no backfill,
|
||||
no `TOOL_VERSION` bump (the event decode and the `.h5` files are
|
||||
unchanged).
|
||||
- Nothing arrives until `.MLG`s are imported. The watcher does not forward
|
||||
them yet (`../series3-watcher`, Brian's call).
|
||||
- DL2's full set (~86,000 files) loads with `scripts/import_mlg_dir.py`.
|
||||
Load it from a robocopy copy: a Windows zip shifts summer file dates by
|
||||
an hour.
|
||||
- Terra-View shows none of it yet.
|
||||
|
||||
### Fixed
|
||||
- **The mic's own range: a range-1 mic reads an eighth.**
|
||||
@@ -236,6 +333,53 @@ All notable changes to seismo-relay are documented here.
|
||||
- **Reference D.6, "Reading a mismatch":** 256, 4,096 and 65,536 mean a number
|
||||
outgrew its 8-, 12- or 16-bit box. Every case so far is listed (Brian's
|
||||
observation, 2026-11-05).
|
||||
- **Reference D.4, rewritten:** the `.MLG` format, measured.
|
||||
- Its framing, CRC and fields.
|
||||
- How Blastware writes the files: one per call-in, no record repeated, and
|
||||
a Modem Exit that is not a file's last record was a call that left no file.
|
||||
- How a session appears, and the cross-check against the event files.
|
||||
- The old D.4.1–D.4.3 (a 308-byte header, a CRC at each record's start) are
|
||||
kept, marked retracted.
|
||||
|
||||
### Migration
|
||||
|
||||
⚠ **A backfill, no schema migration.** Not rehearsed on a prod snapshot.
|
||||
|
||||
**Before you start:**
|
||||
- `TOOL_VERSION` is bumped to **0.35.0**, which gates the regeneration, so no
|
||||
`--force` is needed.
|
||||
- **Back up `seismo_relay.db` first.**
|
||||
|
||||
**Then:**
|
||||
1. **Deploy.** On first start SFM creates `mlg_files` and `mlg_records`, both
|
||||
empty. No other table changes, and no event row or id moves.
|
||||
2. **In the `sfm` container, run `python scripts/backfill_sidecars.py`.** It
|
||||
re-decodes every event file. ⚠ **Plan about 8 hours**: v0.34.0's run took
|
||||
13:13 → 21:16 on 2026-11-05.
|
||||
- **Report-less events gain a ZC frequency** in the existing `*_zc_freq` /
|
||||
`*_zc_above_range` columns. Terra-View shows a frequency where it showed
|
||||
"—".
|
||||
- **The range-1 mic events' `mic_ppv` and `.h5` mic samples drop 8×** (7
|
||||
in DL2; e.g. K557J1XQ.GF0W reads 79.4 dB(L), not 97.5). Report-paired
|
||||
events keep the report's value.
|
||||
- **A unit without a mic gets its geophone sensor-check traces** in its
|
||||
`.h5` (BE16352's 8 DL2 events).
|
||||
- **On the decoded event only, not stored in the DB or `.h5` yet:** the
|
||||
sensor-check results, the Monitor Log line, over range, displacement and
|
||||
times of peak.
|
||||
- No stored event time moves.
|
||||
3. **Run `python scripts/backfill_event_shape.py --db-path
|
||||
bridges/captures/seismo_relay.db --store-root bridges/captures/waveforms`.**
|
||||
It recomputes the shape and offset metrics.
|
||||
4. **Optional, any time after: load DL2's `.MLG`s.**
|
||||
- Copy `C:\Blastware 10\Event\autocall home` with robocopy, not a zip: a
|
||||
Windows zip shifts summer file dates by an hour.
|
||||
- Run `python scripts/import_mlg_dir.py <dir> --db-path ... --store-root
|
||||
...`, with `--dry-run` first.
|
||||
- On the dev box, a 1,273-file sample loaded in 13 s with 0 errors.
|
||||
|
||||
**Terra-View** needs no change: it reads rows by id. ZC frequencies appear,
|
||||
and the range-1 mic values drop.
|
||||
|
||||
## v0.34.0 — 2026-11-04
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
Ground-up Python replacement for **Blastware**, Instantel's Windows-only software for
|
||||
managing MiniMate Plus seismographs. Connects over direct RS-232 or cellular modem
|
||||
(Sierra Wireless RV50 / RV55). Current version: **v0.34.0**.
|
||||
(Sierra Wireless RV50 / RV55). Current version: **v0.35.0**.
|
||||
|
||||
Stack-level context — which repo owns what, and how the three project versions
|
||||
pair — lives in `../terra-view/docs/tmi-stack.md`, which is also loaded as
|
||||
@@ -10,7 +10,7 @@ pair — lives in `../terra-view/docs/tmi-stack.md`, which is also loaded as
|
||||
|
||||
---
|
||||
|
||||
## Where things stand (updated 2026-11-05)
|
||||
## Where things stand (updated 2026-11-16)
|
||||
|
||||
Read this first when picking the project back up.
|
||||
|
||||
@@ -31,7 +31,7 @@ Read this first when picking the project back up.
|
||||
3. switch ingest so reports are kept only for checking (retire the overlay)
|
||||
4. stop the watchers forwarding reports
|
||||
- Until step 3, prod keeps the report as truth wherever one exists.
|
||||
- **🔑 Monitor logs (.MLG) and each unit's timeline (2026-11-13, `feat/mlg-import`).**
|
||||
- **🔑 Monitor logs (.MLG) and each unit's timeline (v0.35.0, 2026-11-16).**
|
||||
- **What:** every unit sends an `.MLG` at every call-in, in every mode. SFM reads it
|
||||
(`minimateplus/mlg_file.py`, reference D.4) and keeps each unit's monitoring timeline:
|
||||
sessions, gaps and what they mean, clock steps, and the call-ins, including calls that
|
||||
@@ -56,14 +56,14 @@ Read this first when picking the project back up.
|
||||
- **Byte layouts** of every field read from the file:
|
||||
`docs/instantel_protocol_reference.md` Appendix **D.6**.
|
||||
|
||||
**Where the decoder stands on `dev`** (2026-11-09, run `20261109-144544`):
|
||||
**Where the decoder stands** (v0.35.0; run `20261109-144544`):
|
||||
**80 of 88 fields match on every event**, up from about 6 before v0.33.0,
|
||||
47 before group D and 59 after it. Every other field matches or is accepted
|
||||
under a carve-out with its evidence.
|
||||
- Groups A, B, C and D part 1 shipped in v0.34.0 (#50, #51).
|
||||
- D part 2 (the unit's own summary), E (the sensor check), F (the monitor
|
||||
log), over range and the mic fixes are on `dev` and owe the next release
|
||||
a backfill.
|
||||
log), over range and the mic fixes shipped in v0.35.0, with its backfill
|
||||
(`TOOL_VERSION` 0.35.0).
|
||||
- Left: 16 values in two causes -- the vector sum's last digit on 4
|
||||
waveform/histogram twins, and 4 accelerations (reference D.6.11). Brian
|
||||
decided 2026-11-11 to leave both as they are, documented.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# seismo-relay `v0.34.0`
|
||||
# seismo-relay `v0.35.0`
|
||||
|
||||
A ground-up replacement for **Blastware** — Instantel's aging Windows-only
|
||||
software for managing seismographs. Supports both the **MiniMate Plus
|
||||
@@ -114,6 +114,19 @@ over direct RS-232 or cellular modem (Sierra Wireless RV50 / RV55).
|
||||
> ⚠ The deploy migrates the events table and owes an overnight backfill that
|
||||
> moves every Series-3 histogram time by one second. See the changelog's
|
||||
> *Migration*.
|
||||
>
|
||||
> **v0.35.0 (2026-11-16)** reaches 80 of Blastware's 88 report fields from the
|
||||
> event file alone, and reads monitor logs.
|
||||
> - **The file-only decode, groups D–F:** ZC frequency, displacement, times of
|
||||
> peak, the sensor check, the Monitor Log line and over range, all from the
|
||||
> unit's own records. A range-1 mic no longer reads 8× high.
|
||||
> - **Monitor logs (.MLG):** SFM reads Blastware's `.MLG` files and keeps each
|
||||
> unit's monitoring timeline, so it can answer "was unit X monitoring at T"
|
||||
> for a shot report. See the `.MLG` endpoints below.
|
||||
> - **An escaped checksum is the checksum, not data (#58).**
|
||||
>
|
||||
> ⚠ The deploy owes a backfill (about 8 hours on the NAS) and creates two
|
||||
> empty tables. See the changelog's *Migration*.
|
||||
> See [CHANGELOG.md](CHANGELOG.md) for full version history.
|
||||
|
||||
---
|
||||
@@ -272,6 +285,10 @@ Query the SQLite database written by `ach_server.py`. All read-only except
|
||||
| `GET` | `/db/monitor_log` | Monitoring intervals |
|
||||
| `GET` | `/db/sessions` | ACH call-home session history |
|
||||
| `PATCH` | `/db/events/{id}/false_trigger?value=true` | Flag / unflag false triggers |
|
||||
| `GET` | `/db/units/{serial}/timeline?from_dt=&to_dt=` | A unit's monitoring timeline from its `.MLG`s: sessions (how each ended, events, trigger level), gaps and what each means, clock steps, call-ins (delivered / no_file / nothing_new). Times are the unit's own clock. |
|
||||
| `GET` | `/db/units/{serial}/monitoring_at?at=` | Was the unit monitoring at `at`: `monitoring` / `not_monitoring` / `unknown`, with the session or gap that says so and the records and file behind it. |
|
||||
| `GET` | `/db/mlg_records?serial=&from_dt=&to_dt=` | A unit's raw `.MLG` records, oldest first |
|
||||
| `GET` | `/db/mlg_files/{id}` | The original `.MLG`, byte for byte (for printing or opening in Blastware) |
|
||||
|
||||
### File ingest endpoints
|
||||
|
||||
@@ -286,6 +303,7 @@ its Blastware filename and moved in place (see *Database* below).
|
||||
|--------|-----|-------------|
|
||||
| `POST` | `/db/import/blastware_file` | Series III: `.AB0*` / `.N00` binaries + paired `_ASCII.TXT`. Source: `series3-watcher`. |
|
||||
| `POST` | `/db/import/idf_file` | Series IV: `.IDFH` / `.IDFW` binaries + paired `.IDFW.txt` / `.IDFH.txt`. Source: `thor-watcher`. |
|
||||
| `POST` | `/db/import/mlg_file` | Series III monitor logs (`.MLG`), with each file's modified time as a JSON form field `mtimes`. Each file stored once; a damaged file stores nothing. Source: `scripts/import_mlg_dir.py` today; `series3-watcher` does not forward `.MLG`s yet. |
|
||||
|
||||
### DB snapshot / restore endpoints
|
||||
|
||||
@@ -402,13 +420,15 @@ reverse-engineering plan. The `micromate/idf_file.py` stub is where
|
||||
|
||||
`ach_server.py` and the file-ingest endpoints write to
|
||||
`bridges/captures/seismo_relay.db` (SQLite, WAL mode) via the `SeismoDb`
|
||||
persistence layer. Three tables, all unit-keyed by serial number:
|
||||
persistence layer. The main tables, all unit-keyed by serial number:
|
||||
|
||||
| Table | Key | Contents |
|
||||
|-------|-----|----------|
|
||||
| `ach_sessions` | UUID | Per-call-home audit record: serial, timestamp, peer IP, events_downloaded, monitor_entries, duration_seconds |
|
||||
| `events` | UUID, UNIQUE(serial, timestamp) | Triggered events: timestamp, Tran/Vert/Long/VectorSum/Mic PPV, project/client/operator/sensor_location strings, sample_rate, record_type, false_trigger flag, **`device_family`** ("series3" / "series4"), `blastware_filename` (binary at-rest in `waveforms/`), sidecar references |
|
||||
| `monitor_log` | UUID, UNIQUE(serial, start_time) | Monitoring intervals: serial, waveform_key, start_time, stop_time, duration_seconds, geo_threshold_ips |
|
||||
| `monitor_log` | UUID, UNIQUE(serial, start_time) | Monitoring intervals from live 0x0A reads (`ach_server.py` only): serial, waveform_key, start_time, stop_time, duration_seconds, geo_threshold_ips |
|
||||
| `mlg_files` | UUID, UNIQUE(file_name, sha256) | One row per Blastware `.MLG` received (v0.35.0): serial, size, record count, empty flag, call-in flag, the file's modified time, where the original is kept, and the call it came from (`last_stop`, `no_file_stops`) |
|
||||
| `mlg_records` | UUID, UNIQUE(serial, start, stop, flag word, trigger source) | One row per `.MLG` log record, stored once: start, stop (NULL = monitoring started), flag word, trigger source, Blastware's text and trigger level |
|
||||
|
||||
**Deduplication is by `(serial, timestamp)`** — the device clock is the
|
||||
stable natural key. Repeat call-homes or re-runs UPSERT the row in place,
|
||||
@@ -533,6 +553,7 @@ Use **com0com** or **VSPD** to create the virtual COM pair on Windows.
|
||||
- [x] Monitor control (start/stop, status polling, battery/memory)
|
||||
- [x] Monitor log entries (continuous monitoring intervals without full waveform download)
|
||||
- [x] Blastware file ingest at `/db/import/blastware_file` (paired with `series3-watcher`)
|
||||
- [x] Blastware monitor logs (`.MLG`) at `/db/import/mlg_file`, and each unit's monitoring timeline (`/db/units/{serial}/timeline`, `/monitoring_at`) (v0.35.0)
|
||||
|
||||
**Series IV (Micromate / Thor) device support:**
|
||||
- [x] Thor IDF file ingest at `/db/import/idf_file` (paired with `thor-watcher`, v0.18.0+)
|
||||
@@ -542,7 +563,7 @@ Use **com0com** or **VSPD** to create the virtual COM pair on Windows.
|
||||
- [ ] Live-device protocol — pending codec
|
||||
|
||||
**Data persistence:**
|
||||
- [x] SQLite database (`seismo_relay.db`) with `events`, `monitor_log`, `ach_sessions` tables
|
||||
- [x] SQLite database (`seismo_relay.db`) with `events`, `monitor_log`, `ach_sessions`, `device_commands`, `mlg_files` and `mlg_records` tables
|
||||
- [x] Per-row `device_family` column ("series3" / "series4") for clean UI / unit-of-measurement dispatch (v0.19.0+)
|
||||
- [x] Deduplication by `(serial, timestamp)` — natural key handles post-erase counter resets
|
||||
- [x] UPSERT on re-import refreshes every device-authoritative field (peaks, project, sample_rate); preserves operator review state (`false_trigger`)
|
||||
|
||||
@@ -54,7 +54,7 @@ SIDECAR_KIND = "sfm.event"
|
||||
# bumped without a `pip install` re-run — leading to confusing stale
|
||||
# version stamps in sidecars. Bump this constant and CHANGELOG.md
|
||||
# together at release time.
|
||||
TOOL_VERSION = "0.34.0" # file-only decode groups A-D, histogram times (#51); gates the backfill regen
|
||||
TOOL_VERSION = "0.35.0" # file-only decode groups D2, E, F, over range, mic range; gates the backfill regen
|
||||
|
||||
try:
|
||||
# Best-effort: prefer the installed metadata when it's NEWER than the
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "seismo-relay"
|
||||
version = "0.34.0"
|
||||
version = "0.35.0"
|
||||
description = "Python client and REST server for MiniMate Plus seismographs"
|
||||
requires-python = ">=3.10"
|
||||
dependencies = [
|
||||
|
||||
Reference in new issue
Block a user