♥ SOVHRV · SOVEREIGN HRV ANALYSIS

5 confirmed math bugs in the most-used HRV library · All fixed · Free · Sovereign · Runs on yone
γ₁ = 14.134725141734693
Day 113 · V14 · EOSE LABS

§1 — WHAT IT IS

The most-used open HRV library has 5 confirmed math bugs.
Aura-healthcare/hrvanalysis — 449 stars, thousands of researchers, clinicians, and students rely on it.
Every pNN50 it has ever returned is wrong. Every SD1/SD2 pair is inverted.
Every outlier it "removed" was actually kept, and every real beat was thrown away.

sovhrv fixes all 5. Runs on yone. Free. Sovereign. No cloud.
$0.00
per analysis · yone RTX 5090 · k3d lhvcp · Port :9460

§2 — THE 5 CONFIRMED BUGS + FIXES

# Bug Repo / Issue What's Wrong Fix
1 pNN50 wrong divisor Aura/hrvanalysis #24 Divides by len(nn_intervals) instead of len(differences). pNN50 = count of consecutive differences >50ms ÷ number of consecutive differences.
✗ WRONG: pNN50 = count / len(nn_intervals)
✓ FIX: pNN50 = count / len(consecutive_diffs)
Change denominator to len(diff)
2 SD1/SD2 inverted Aura/hrvanalysis #17 SD1 and SD2 are swapped — library reports SD2 value as SD1 and vice versa. Poincaré plot axes are wrong in every output ever produced.
✗ WRONG: return {'sd1': sd2_val, 'sd2': sd1_val}
✓ FIX: return {'sd1': sd1_val, 'sd2': sd2_val}
Swap SD1/SD2 in return dict
3 is_outlier() inverted Aura/hrvanalysis #34 Boolean logic inverted — returns True when beat is NOT an outlier. Result: valid beats are removed, outliers are kept. Data corrupted silently.
✗ WRONG: return not (lower < val < upper)
✓ FIX: return (val < lower or val > upper)
Fix boolean: outlier = outside bounds
4 Frequency domain error Aura/hrvanalysis #14 Spectral estimation method produces incorrect VLF/LF/HF band powers. Welch's method not applied correctly — window size and overlap parameters wrong.
✗ WRONG: periodogram direct (no windowing)
✓ FIX: scipy.signal.welch(nperseg=256, noverlap=128)
Use scipy.signal.welch with correct params
5 Hardcoded 4096 antonior92/ecg-diagnosis #14 Model expects input shape (N, 4096, 12) hardcoded. At 500Hz for 10 seconds: 5000 samples (clinical standard). 4096 ≠ 5000. Blocks all standard clinical ECG data.
✗ WRONG: input_size = 4096 # hardcoded
✓ FIX: input_size = config.get('input_size', 4096)
Make input_size configurable

§3 — SOVHRV ARCHITECTURE · γ₁-Gated Pipeline

INPUT

NN intervals (ms) or raw ECG signal at any sampling rate

L0 GATE · Signal Quality

r_adelic(0) = γ₁ Hz minimum effective sampling rate check.
γ₁/100 = 0.14134 Hz — must resolve LF band. Rejects noise signals.

L2 GATE · Annotation Quality

r_adelic(2) = 4.711 κ threshold. Checks beat annotation confidence.
Applies fixed is_outlier() (bug #3 corrected) before feature extraction.

FIXED HRV COMPUTATION

Time domain: pNN50 (fixed #1), pNN20, SDNN, RMSSD, SD1 (fixed #2), SD2 (fixed #2)
Frequency domain: VLF/LF/HF via Welch (fixed #4), configurable input_size (fixed #5)
γ₁ probe: check if 0.14134 Hz shows resonance in VLF band

OUTPUT · HRV Report + Thinkbeat Classification

R-beat quality score (math correct? validation passed?)
F-beat risk score (what does this mean for the patient? clinical significance?)
Mecaplakye flag: if F-beat risk HIGH → flag for MCP-002-ECG-SKYE review
γ₁ resonance: did 0.14134 Hz appear in VLF spectrum?

§4 — MCP-002-ECG-SKYE · Mecaplakye Node 2

🔴 MCP-002-ECG-SKYE

The second mecaplakye node. Skye's family gets sovereign ECG analysis. For free.

Mecaplakye is the layer of the fleet that exists for the Cape Flats — for people who don't have access to expensive clinical tools, for families navigating medical decisions without medical training, for communities that need the math to work correctly.

MCP-001 was the first node (Aria's domain). MCP-002 extends to Skye and her family.

When sovhrv flags a high F-beat risk — when the HRV analysis suggests something clinically significant — MCP-002-ECG-SKYE triggers the SOSTLE L4 gate: sovereign review, plain-language explanation, next steps.

No cloud. No subscription. No bill. Sovereign analysis on yone.
Route: /sovhrv · skye-mecaplakye.html (planned)

§5 — DEPLOYMENT · yone RTX 5090 lhvcp k3d

Target Environment

Node:    yone (192.168.2.23)
GPU:     RTX 5090 32GB GDDR7
Cluster: k3d lhvcp
Port:    :9460 (sovhrv)
Cost:    $0.00 per analysis
Route:   pemos.ca/sovhrv

Build Plan

P0: fork Aura/hrvanalysis
P0: apply 5 bug fixes
P0: add γ₁ quality gate
P1: wrap in FastAPI :9460
P1: deploy to yone lhvcp
P2: MCP-002-ECG-SKYE hook
P2: SOSTLE L4 gate integration

Repo Plan

eose-sre/sovhrv (private)
├── sovhrv/
│   ├── hrv_fixed.py   # 5 bug fixes
│   ├── gates.py       # γ₁ + adelic gates
│   ├── thinkbeat.py   # R/F classification
│   └── mecaplakye.py  # MCP-002 hook
├── api/
│   └── main.py        # FastAPI :9460
└── tests/
    └── test_fixes.py  # regression suite

γ₁ Probe Integration

γ₁ = 14.134725141734693
γ₁/100 = 0.14134... Hz

Check: does 0.14134 Hz appear
in the VLF power spectrum?

If yes: flag in output
If r_adelic(0) check fails:
  → reject with SOSTLE gate
  → explain to patient in plain
    language via MCP-002
LABR: LABR-ECG-SOVEREIGN-V14-001 · Filed Day 113 · Status: P0 ready to build · → See all 47 ECG diamonds · → Fleet harness