The Science of Your Rhythm

Technical Architecture · Physiological Modeling · AI Methodology

1. The Sensor Layer: Polar H10

The foundation of Your Rhythm Studio is medical-grade data acquisition. While consumer smartwatches use Photoplethysmography (PPG) — measuring blood volume changes via light — the Polar H10 captures the actual electrical potential of the heart (Electrocardiography).

Standard ECG Morphology (P-QRS-T)
P QRS T Atrial Depolarization (P) Ventricular Depolarization (QRS) Repolarization (T)

The QRS Structure

The **QRS complex** is the most prominent feature of an ECG signal. It represents the rapid depolarization of the left and right ventricles. Because the ventricles contain more muscle mass than the atria, the QRS complex is much larger than the P wave.

Our detection pipeline focuses on the **R-peak** (the highest point) as a temporal anchor. We measure the **QRS width** (from the start of the Q-wave to the end of the S-wave) to distinguish between narrow-complex (supraventricular) and wide-complex (ventricular) events.

Technical Deep Dive: Signal Characteristics
  • Sampling Rate: 130 Hz native sampling. Each second of data contains 130 voltage measurements.
  • Lead Configuration: Single-lead (equivalent to Einthoven Lead I/II depending on strap placement).
  • Transmission: Bluetooth Low Energy (BLE) HRP profile for heart rate and a custom GATT characteristic for raw ECG streaming.
  • Bandpass Filter: Digital Butterworth filter (0.5Hz - 40Hz) to remove baseline wander and high-frequency muscle noise.

2. Arrhythmia Detection Pipeline

Detecting an arrhythmia requires more than just an AI model. It involves a multi-stage pipeline that cleans, segments, analyzes, and then validates every single heartbeat.

The 5-Stage Detection Pipeline
1
Preprocessing: 0.5-40Hz Bandpass + Z-Score normalization.
2
R-Peak Discovery: Pan-Tompkins algorithm locates the heart's electrical anchors.
3
Morphology AI: 1D-CNN classifies the 1-second window around each peak.
4
Hybrid Timing Logic: Re-evaluates beats based on prematurity and compensatory pauses.
5
Pattern Recognition: Groups beats into sequences like Bigeminy, Trigeminy, or VT.

Morphology vs. Timing

Arrhythmias are detected using two complementary methods:

  • Morphology (The Shape): The AI looks for "Wide and Bizarre" QRS complexes, which are the hallmark of PVCs (Premature Ventricular Contractions).
  • Timing (The Rhythm): Some events, like PACs (Premature Atrial Contractions), may look morphologically normal but appear "early" compared to the baseline rhythm. We use hybrid logic to catch these by looking for a shortened R-R interval followed by a compensatory pause.
Technical Deep Dive: The Neural Network (AgeV4)

Arrhythmia Agent: Uses a 1D-Convolutional Neural Network (1D-CNN) trained on the MIT-BIH Arrhythmia Database. It analyzes a 1-second window (130 samples) centered on the R-peak (43 samples before, 87 after).

Rule-Based Overrides: To prevent false positives, we apply a "Safety Guard." If the AI classifies a beat as a PVC ('V') but the calculated QRS width is less than 50ms, it is automatically reverted to a Normal ('N') classification, as true ventricular beats are physiologically wider.

3. Dual-Agent AI Architecture

Analysis is performed by two independent Neural Networks, collectively referred to as the AgeV4 architecture. These agents are optimized for on-device inference using TensorFlow Lite.

1D-CNN Architecture (Simplified)
INPUT
130 samples
CONV 1D
Feature extraction
POOLING
Downsampling
DENSE
Classification
OUTPUT
Probabilities

Agent 2: Apnea Detector

A temporal monitor that looks for long-term patterns in heart rate variability associated with breathing cessation events during sleep.

Technical Deep Dive: Apnea Architecture

Apnea Agent: A Temporal 1D-CNN with Global Max Pooling. It analyzes 60-second windows (7,800 samples) to detect Respiratory Sinus Arrhythmia (RSA) disruptions. Input: (batch, 7800, 1). Binary output (Apnea/Normal). Trained on the PhysioNet Apnea-ECG Database.

4. The Mobile Engine

The Android app serves as the real-time processing hub. It performs signal denoising, beat detection, and AI inference without ever sending your raw data to a cloud server.

Z-Score Normalization Formula
z = (x - μ) / σ
Ensures the AI sees the shape of the beat, regardless of signal amplitude.

Privacy & Efficiency

By running the neural networks locally (on-device), we achieve two goals: Total Privacy (your ECG never leaves your phone) and Real-time Feedback (latency is measured in milliseconds, not seconds).

Technical Deep Dive: Preprocessing Pipeline
  1. Pan-Tompkins Algorithm: A digital bandpass filter (5-15Hz) followed by derivative and squaring operations to isolate the QRS spike.
  2. Z-Score Normalization: Each window is normalized (val - mean) / std to make the AI invariant to sensor gain or skin contact quality.
  3. Event Stitching: To save space, the app can export "Events Only" files which contain high-resolution 130Hz data only around detected anomalies, while maintaining a 1Hz trend for the rest of the session.

4. Sleep & Respiratory Science

When you select the Sleeping activity, the app activates a specialized multi-modal analysis pipeline combining heart rate, HRV, and accelerometer data.

Sleep Stage Motion (ENMO) HRV (RMSSD)
Wake High (>0.05g) Variable
REM Low (<0.01g) High (>45ms)
Light Low (<0.01g) Medium (25-45ms)
Deep Zero (<0.005g) Low (<25ms)

Sleep Staging (Hypnogram)

We classify sleep into Wake, Light, Deep, and REM using a proprietary algorithm based on two primary inputs:

  • Motion (ENMO std): The standard deviation of gravity-subtracted acceleration identifies waking periods.
  • HRV (RMSSD): High RMSSD with low motion indicates REM sleep; low RMSSD with zero motion typically indicates Deep sleep.

Respiratory Rate Estimation

While you sleep, your chest movement modulates the accelerometer signal. We use a windowed Fast Fourier Transform (FFT) on the Z-axis (up/down) movement to isolate the breathing frequency (typically 0.1 to 0.5 Hz).

FFT: Movement to Breathing Rate
1. Raw ACC Z (Time Domain)
↴ FFT
2. Power Spectrum (Frequency Domain)
14 Breaths/Min

5. Establishing Baselines (RHR & HRV)

The most important data point in Your Rhythm Studio is your Morning Baseline. Your autonomic nervous system is a sensitive indicator of stress, recovery, and impending illness.

RMSSD Calculation
RMSSD = √[ mean( (RRi+1 - RRi)2 ) ]
Quantifies the variation between consecutive heartbeats.

Why "First Thing in the Morning"?

Measurements taken after coffee, stress, or a commute are "contaminated" by sympathetic activation. For a true baseline, you should measure RHR and HRV while sitting or lying still immediately after waking. This represents your body's "ready state" for the day.

Resting Heart Rate (RHR): An indicator of overall cardiovascular efficiency. A rising RHR often precedes symptoms of overtraining or viral infection.

HRV (RMSSD): An indicator of parasympathetic (recovery) dominance. A significant drop in your morning HRV suggests that your nervous system is still under stress from previous days.

6. Clinical References & Datasets

Our models and algorithms are built upon decades of clinical research and open-access databases.

  • MIT-BIH Arrhythmia Database: Used for training the beat-level classification agent.
  • PhysioNet Apnea-ECG Database: Used for training the sleep disordered breathing agent.
  • Task Force on HRV (1996): Standards for measurement, physiological interpretation, and clinical use of HRV.
  • Pan & Tompkins (1985): A real-time QRS detection algorithm for ECG signals.