Skip to content

m3data/earthian-biosense

Repository files navigation

EarthianBioSense

Repo Status Version License

Biosignal acquisition and analysis for research into adaptive capacity — how it can be sensed, supported, and stewarded through somatic and computational signals.

Captures heart rate variability from Polar H10 monitors, computes HRV metrics, and tracks autonomic state as a trajectory through phase space rather than reducing it to single numbers.

What It Does

  • Heart rate capture from Polar H10 (HR + RR intervals)
  • Classic HRV metrics: RMSSD, SDNN, pNN50 (clinically meaningful parasympathetic indicators)
  • Custom HRV metrics: amplitude, entrainment (breath-heart coupling), breath rate estimation
  • Phase space trajectory: tracks movement through a 3D manifold (entrainment, breath, amplitude)
  • Dynamics computation: velocity, curvature, stability — not just where you are, but how you're moving
  • Mode classification: 6-mode system from heightened alertness to settled presence
  • JSONL export: full trajectory data for post-session analysis

Capture Methods

macOS Desktop App — v0.1.0

Native macOS app built with Tauri v2 (Rust + webview). Designed for long-duration background data collection — start a session, hide the window, come back hours later.

Location: desktop/

Features:

  • 11MB native app, ~0.4% CPU idle
  • BLE connection to Polar H10 via btleplug (CoreBluetooth)
  • Full HRV processing in Rust (32 unit tests) — port of the Python pipeline
  • Live phase space visualisation in the webview
  • Session recording to JSONL (schema 1.1.0, compatible with all other tools)
  • Session replay from the same app

Install: Download the DMG from GitHub Releases, or build from source:

cd desktop
cargo tauri build

Requires: macOS 12+, Rust toolchain, Polar H10 chest strap.

iOS App (EBSCapture) — v0.2

Native iOS app for mobile capture with on-device HRV processing. Pairs with Polar H10 via Bluetooth, records sessions with real-time feedback, exports enriched JSONL.

Location: ios/EBSCapture/

Features:

  • SwiftUI interface with earth-warm theme
  • Real-time HRV metrics: RMSSD, SDNN, pNN50 computed on-device
  • Real-time feedback: mode indicator, entrainment/coherence gauges during recording
  • Profile management: multi-person support with per-profile analytics
  • Session analytics: detailed per-session metrics view (HRV, mode distribution, HR stats)
  • Profile insights: trend charts, comparison views, aggregated metrics over time
  • Activity tagging (meditation, walking, conversation, etc.)
  • Session management and export
  • iOS 16+ (Charts framework)

Python Terminal App

Desktop capture with real-time ASCII visualization. The desktop app above is the recommended replacement for new sessions.

python src/app.py

Features:

  • Live terminal UI
  • WebSocket streaming to downstream clients
  • Direct session recording

Installation

macOS Desktop App (recommended)

Download from Releases or build:

cd desktop
cargo tauri build
open src-tauri/target/release/bundle/macos/EarthianBioSense.app

Python (processing + desktop capture)

git clone https://github.com/m3data/earthian-biosense.git
cd Earthian-BioSense
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

iOS

Open ios/EBSCapture/EBSCapture.xcodeproj in Xcode. Build and run on device (BLE requires physical device, not simulator).

Processing Pipeline

iOS captures export raw JSONL with HR and RR intervals. The processing script enriches these with computed metrics:

python scripts/process_session.py sessions/ios-exports/2025-12-29_115820.jsonl

Output: sessions/ios-exports/2025-12-29_115820_processed.jsonl

Adds:

  • HRV metrics (amplitude, entrainment, breath rate, volatility)
  • Phase dynamics (position, velocity, curvature, stability)
  • Mode classification with soft membership
  • Movement annotation

Mode Classification

Six modes emerge from position in feature space (entrainment, breath steadiness, amplitude, volatility):

Mode Description
heightened alertness High reactivity, low entrainment
subtle alertness Attentive but not reactive
transitional Moving between states
settling Approaching coherence
rhythmic settling High entrainment, steady breath
settled presence Sustained rhythmic settling

Modes use soft classification — you're never fully "in" one mode, but have membership across all six.

Output Format (Schema 1.1.0)

Each processed record contains:

{
  "ts": "2025-12-29T11:58:21.748Z",
  "hr": 77,
  "rr": [785],
  "metrics": {
    "amp": 164,
    "ent": 0.576,
    "ent_label": "[entrained]",
    "breath": 6.2,
    "volatility": 0.0825,
    "mode": "settling",
    "mode_score": 0.543
  },
  "phase": {
    "position": [0.576, 0.5, 0.82],
    "velocity": [0.041, 0.0, 0.033],
    "velocity_mag": 0.053,
    "curvature": 0.047,
    "stability": 0.867,
    "history_signature": 0.229,
    "phase_label": "settling into coherence",
    "coherence": 0.55,
    "movement_annotation": "settled",
    "movement_aware_label": "settling",
    "soft_mode": {
      "primary": "settling",
      "secondary": "rhythmic settling",
      "ambiguity": 0.23,
      "membership": {
        "heightened alertness": 0.02,
        "subtle alertness": 0.08,
        "transitional": 0.15,
        "settling": 0.45,
        "rhythmic settling": 0.25,
        "settled presence": 0.05
      }
    }
  }
}

Research

Preprint: Mytka, M. (2026). Jointly Tracing Coupling Mode Transitions in Human-AI Interaction: Semantic and Somatic Signals. SSRN. https://dx.doi.org/10.2139/ssrn.6439347

Architecture

┌──────────────────────────────────────────────────────────────────────┐
│                         Capture Layer                                │
├──────────────────────┬───────────────────────┬───────────────────────┤
│  macOS Desktop App   │  iOS App (EBSCapture) │  Python Terminal App  │
│  v0.1.0 (Tauri/Rust) │  v0.2 (SwiftUI)       │                      │
│  - Long-duration     │  - Mobile capture      │  - Desktop capture   │
│  - Background BLE    │  - On-device HRV       │  - WebSocket stream  │
│  - Rust HRV pipeline │  - Real-time feedback  │  - ASCII viz         │
│  - Live phase viz    │  - Profile analytics   │                      │
│  - Session replay    │  - Session insights    │                      │
└──────────┬───────────┴───────────┬───────────┴───────────┬───────────┘
           │                       │                       │
           ▼                       ▼                       ▼
┌──────────────────────────────────────────────────────────────────────┐
│                    JSONL Sessions (schema 1.1.0)                     │
│   All three apps write the same format — sessions are portable       │
└──────────────────────────────────────────────────────────────────────┘

Requirements

macOS desktop app:

  • macOS 12+ (Apple Silicon or Intel)
  • To build from source: Rust toolchain (rustup), Tauri CLI (cargo install tauri-cli)

Python processing:

  • Python 3.11+
  • Dependencies in requirements.txt

iOS capture:

  • macOS with Xcode 15+
  • iOS 16+ device (Charts framework; BLE requires physical device)

Hardware:

  • Polar H10 chest strap (~$90 AUD)
  • Requires skin contact to activate

License

Earthian Stewardship License (ESL-A) v0.1

Core commitments:

  • Respect somatic sovereignty
  • No manipulation, surveillance, or entrainment without consent
  • Non-commercial by default; commercial use requires permission
  • Share-back safety improvements to the commons

"Each moment is a point on a trajectory, not a dot on a line. Movement matters."

About

A biosignal framework for understanding coupling dynamics between human nervous systems

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors