Skip to content

WHOOP HCI-capture extraction + CSV ground-truth correlation (#103)#133

Open
digitalerdude wants to merge 1 commit into
ryanbr:mainfrom
digitalerdude:whoop-export-pr
Open

WHOOP HCI-capture extraction + CSV ground-truth correlation (#103)#133
digitalerdude wants to merge 1 commit into
ryanbr:mainfrom
digitalerdude:whoop-export-pr

Conversation

@digitalerdude

Copy link
Copy Markdown

Was & warum

Zwei stdlib-Tools in Tools/linux-capture/, die einen WHOOP-Datenexport nutzbar machen, um die un-dekodierten Deep-Record-Layouts aus #103 zu knacken (type-0x2F, 5/MG-History-Typen — siehe docs/WHOOP5_DEEP_DATA.md).

Der Import dieses CSV-Formats ist bereits vollständig gelöst (inkl. lokalisierter DE/ES-Header, #3). Die offene Lücke laut #103 ist das Decoding — und genau dafür ist ein eigener Export das ideale Known-Plaintext-Material.

Tools

  • hci_extract.py — parst ein Phone-Bluetooth-HCI-Capture der offiziellen App (iOS .pklg / Android btsnoop_hci.log), reassembliert L2CAP/ATT und gibt die CRC-validen WHOOP-Frames als das projekteigene capture.json-Format aus. Nur WHOOP-Streams landen im Output (Frames anderer Geräte fallen weg). App-Writes werden als dir:tx mitgeschnitten (die Enable-Sequenz).
  • correlate_ground_truth.py — Known-Plaintext-Feldsuche. Kreuzt Capture-Records gegen die offiziellen Nacht-Werte eines WHOOP-CSV-Exports (HRV, Ruhe-HF, Hauttemperatur, SpO₂, Atemfrequenz) und findet pro Biometrie das Byte-Offset + Encoding + Scale. Die lokalisierten Header-Aliase sind aus dem Swift-Importer (CSVParsing.swift) gespiegelt. Distribution-Overlap-Scoring (Recall + Precision) verwirft Konstanten und Zufallstreffer.

Privacy

Beide Tools laufen lokal; correlate gibt nur Offsets/Encodings aus, nie Gesundheitswerte. So können 5/MG-Besitzer eine bestätigte Feld-Zuordnung auf #103 beitragen, ohne Capture oder Datenexport zu posten.

Verifikation

  • Volle Pipeline gegen einen echten deutschen Export getestet (332 Nächte laden sauber): btsnoop-Log → hci_extract (331 type-47 Frames) → correlate gewinnt Ruhe-HF (Offset 10, u8) und Hauttemperatur (Offset 14, float32) exakt zurück.
  • 25 neue stdlib-Tests (btsnoop/pklg-Parser, L2CAP/ATT-Reassembly, CSV-Aliase, geplante-Werte-Recovery + False-Positive-Ablehnung). Gesamt-Suite: 129 grün.

Mapped Offsets folgen weiterhin der Projektregel real captures, never invented offsets, bevor sie in parseFrameWhoop5 / whoop_protocol.json landen.

🤖 Generated with Claude Code



Two stdlib tools in Tools/linux-capture that turn a WHOOP data export into
leverage for the un-decoded deep-record layouts tracked in ryanbr#103:

- hci_extract.py: parse a phone Bluetooth HCI capture (iOS .pklg /
  Android btsnoop) of the official app, reassemble L2CAP/ATT, and emit the
  CRC-valid WHOOP frames as the project's capture.json. Only WHOOP streams
  reach the output.
- correlate_ground_truth.py: known-plaintext field search. Cross-reference
  capture records against the official per-night values in a WHOOP CSV export
  (reusing the Swift importer's localized header aliases) to locate each
  biometric's byte offset + encoding. Distribution-overlap scoring (recall +
  precision) rejects constants and coincidences. Prints offsets only, so the
  output is safe to post on ryanbr#103 while health data stays local.

Docs: new README sections + a ground-truth-correlation note in
WHOOP5_DEEP_DATA.md. 25 new stdlib tests; full suite 129 green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant