411ef8139e
New endpoint GET /db/events/{id}/report.pdf returns a single-page
letter-portrait PDF for any event with waveform data on disk.
Architecture:
sfm/report_pdf.py — gather_report_data() assembles fields from
SeismoDb row + .sfm.json sidecar (bw_report block) + .h5 samples;
render_event_report_pdf() turns that into PDF bytes via matplotlib.
sfm/server.py — new endpoint wires them together, streams PDF back
with Content-Disposition: inline so the browser displays it.
sfm_webapp.html — new "Download PDF" button in the event modal
footer that opens the endpoint in a new tab.
Fields surfaced — same coverage as a Blastware Event Report:
Header metadata (date/time, trigger source, range, sample rate,
project, client, operator, location, serial+firmware,
battery, calibration, file name)
Microphone block (PSPL in dB(L) + psi, ZC freq, channel test)
Per-channel stats (PPV, ZC Freq, Time of Peak, Peak Accel,
Peak Disp, Sensor Check) for Tran/Vert/Long
Peak Vector Sum
Waveform plot (MicL/Long/Vert/Tran stacked, shared time axis,
trigger marker, symmetric Y for geo, zero-anchored
mic) — OR per-interval bar chart for histograms.
Rendering pipeline = matplotlib only (vector PDF, no headless-browser
dep). Adds matplotlib>=3.8 to deps.
Visual layout is approximate until reference PDFs from Instantel land
at docs/reference/instantel/ for iteration. USBM RI8507 / OSMRE
compliance chart is stubbed (placeholder rectangle) — separate work
item.
Smoke-tested on a K558 waveform event: 77 KB valid PDF, all fields
populated correctly from the snapshot DB.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
25 lines
637 B
TOML
25 lines
637 B
TOML
[build-system]
|
|
requires = ["setuptools>=68", "wheel"]
|
|
build-backend = "setuptools.build_meta"
|
|
|
|
[project]
|
|
name = "seismo-relay"
|
|
version = "0.19.0"
|
|
description = "Python client and REST server for MiniMate Plus seismographs"
|
|
requires-python = ">=3.10"
|
|
dependencies = [
|
|
"fastapi>=0.104",
|
|
"uvicorn[standard]>=0.24",
|
|
"pyserial>=3.5",
|
|
"sqlalchemy>=2.0",
|
|
"python-multipart>=0.0.7",
|
|
"h5py>=3.10",
|
|
"numpy>=1.24",
|
|
"matplotlib>=3.8",
|
|
]
|
|
|
|
[tool.setuptools.packages.find]
|
|
# Auto-discovers minimateplus/, micromate/, sfm/, bridges/ as packages
|
|
where = ["."]
|
|
include = ["minimateplus*", "micromate*", "sfm*", "bridges*"]
|