StunAssure → Architecture
System architecture

Measure. Verify. Enforce. Certify.

StunAssure is not a camera that guesses. It is a fail-safe verification stack re-anchored on the physics of stunning — four layers, each closing a gap where the science exists but the verification layer does not.

The shift

From “monitor & report” to verify & certify.

The crowded approach films fish and infers welfare from movement — but a fish can be immobile and still conscious. StunAssure instead measures the stun physically, verifies insensibility, enforces the wake-before-death window, and certifies the batch statistically. Each layer fills a field/translation gap: low scientific risk, high implementation novelty.

The four layers

Decided in order, aggregated conservatively.

The worst layer dominates the verdict — we never average a failure away. Anything not positively confirmed is UNCERTAIN → manual check, never a pass.

  1. Dose
  2. Recovery-clock
  3. Echo-Stun
  4. Welfare-by-Sampling
  • 01

    Dose

    Was an adequate electrical dose delivered? Field strength × duration vs the cited species spec, interpreted through water conductivity.

    Ready now Cheap inline logger; no species spec (sea bream) → UNCERTAIN, never invented.

  • 02

    Recovery-clock

    Was the fish bled before it could wake? Electrical stunning is reversible — salmon can recover from ~44 s. We time stun→bleed against a cited per-species threshold.

    Ready now The hazard nobody logs today; RSPCA mandates ≤15 s stun-to-bleed.

  • 03

    Echo-Stun optional

    A cheap electrical evoked-response “insensibility index” — the first low-cost proxy for lab-only EEG, modelled on the human BIS anesthesia monitor.

    Research Contact variant de-risked; never gates the cheaper tiers.

  • 04

    Welfare-by-Sampling

    Certify a whole batch at stated confidence from a small validated subsample — importing ISO 2859 acceptance sampling, which welfare auditing has never used.

    Ready now EU law leaves welfare sampling ad hoc; this gives a defensible confidence statement.

Data flow

Edge inputs → conservative engine → signed record.

Verification logic has zero runtime dependencies — it runs on a Raspberry Pi or a phone, offline, not only in the cloud.

Edge inputs (offline) field · duration · freq conductivity · stun→bleed + optional Echo-Stun probe Species library cited recovery + dose thresholds Verification engine dose · recovery-clock · evoked-response → PASS / UNCERTAIN / FAIL Welfare-by- Sampling (AQL) lot certification Operator alert + expert review (uncertain / fail) Signed batch report SHA-256
conservative engine & signed record edge inputs & certification data flow
The fail-safe contract

A false “safe” is the dangerous error — so we engineer against it.

Uncertainty never passes

Missing or un-verifiable evidence is UNCERTAIN → manual check, never a pass. A species with no published electrical spec cannot be certified on dose.

The recovery window is hard

If the stun→bleed interval exceeds the species recovery threshold, the verdict is FAIL — the fish risks waking before death.

The worst layer wins

Layers aggregate conservatively. One failing layer fails the verdict; we never average a failure away into a comfortable middle.

Heartbeat is not a proxy

The fish heart is myogenic — it beats for minutes after brain death — so a heartbeat is explicitly rejected as evidence of insensibility.

From design to running code

The core already exists — and it’s tested.

The verification engine is a working, zero-dependency prototype. You can run it yourself in the live demo.

Architecture componentPrototype moduleStatus
Species threshold library (cited)species.pyBuilt
Verification engine (dose · recovery · echo · aggregate)engine.pyBuilt · tested
Welfare-by-Sampling (AQL)sampling.pyBuilt · tested
Signed batch report (SHA-256)report.pyBuilt · tested
Batch simulator / demo harnesssimulator.py · cli.pyBuilt
Inline stun-dose + recovery loggerfirmware (ESP32)Design
Echo-Stun signal processingevoked-response moduleResearch
Verification core: 49 automated tests, 94% coverage, type-checked. Hardware items are designed, not yet built.