Your wearable is leaking your pulse to a server you don't own.
Every time you run, a Bluetooth Low Energy peripheral broadcasts your cardiac rhythm into a proprietary black box. I got tired of export buttons that take three business days to email a zip file of CSVs, so I spent a weekend building a local-first pipeline for my fitness data.
Heart rate telemetry is just numbers over time. Yet, standard relational databases choke on the write amplification when you ingest one sample every single second. Treat a continuous stream like a standard CRUD table and your disk IO spikes while queries crawl.
The fix borrows a page from industrial IoT engineers. Instead of appending raw rows indefinitely, I designed a SQLite schema that relies on rigid time-bucket partitioning. Active workout data stays in a rolling in-memory buffer before flushing fixed five-minute chunks into compressed binary blobs on disk. SQLite handles the file management, and a lightweight custom parser runs the delta compression.
Here's the core schema design that keeps my local dashboard snappy, even with millions of raw samples:
CREATE TABLE workouts (
id TEXT PRIMARY KEY,
started_at INTEGER NOT NULL,
sport_type TEXT NOT NULL
);
CREATE TABLE heart_rate_chunks (
workout_id TEXT NOT NULL,
bucket_epoch INTEGER NOT NULL,
sample_count INTEGER NOT NULL,
compressed_deltas BLOB NOT NULL,
PRIMARY KEY (workout_id, bucket_epoch),
FOREIGN KEY (workout_id) REFERENCES workouts(id)
);
Storing small integer deltas instead of absolute timestamps and raw beats-per-minute integers shrinks the storage footprint hard. A two-hour marathon trace fits comfortably inside a file smaller than a high-resolution JPEG. More importantly, I can run local analytics without my laptop fan spinning up to jet-engine speeds.
Building your own health stack forces you to confront how little control we have over our most intimate metrics. When your wellness data lives on your own hardware, you stop looking at fitness as a streak to maintain for an app badge and start treating it as a personal dataset to actually understand.












