Skip to content

Export health data (CSV + Apple Health integration) #34

Description

@rachitwatts

Problem

Break compliance data is locked inside Blink. Quantified-self users want to correlate it with other health data, and Apple Health integration adds perceived value and credibility.

Proposal

CSV Export

  • Export all SessionEvent data as CSV from the Dashboard
  • Columns: timestamp, event_type, duration_seconds, configured_duration_seconds, reason, metadata
  • Date range picker: today / this week / this month / all time / custom range
  • File saved to user-chosen location via NSSavePanel

Apple Health Integration

  • Log Mindful Minutes during completed breaks via HKHealthStore
  • Each completed break = one HKCategoryTypeIdentifier.mindfulSession entry
  • Duration = actual break duration (not configured, in case they end early)
  • Requires HealthKit entitlement and permission prompt

UX Details

  • "Export Data" button in Analytics settings section (already has the data deletion button)
  • "Apple Health" toggle in a new "Integrations" settings section
  • First toggle prompts for HealthKit permission
  • Show confirmation: "Break data will appear in Apple Health → Mindfulness"
  • Skipped/snoozed breaks are NOT logged (only completed breaks)

Why This Matters

Serves the quantified-self audience and adds perceived value at near-zero cost. Apple Health integration makes Blink feel like a "real" health app, not just a timer. CSV export builds trust — users who can export their data feel less locked in.

Technical Notes

  • HealthKit framework, HKHealthStore
  • Entitlement: com.apple.developer.healthkit
  • HKCategoryTypeIdentifier.mindfulSession for mindful minutes
  • Write samples in AnalyticsService when a break-completed event is recorded
  • CSV export: simple string builder from SwiftData query results
  • NSSavePanel for file save location

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium priorityenhancementNew feature or requestintegrationSystem and third-party integrations

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions