synheart_wear 0.1.2
synheart_wear: ^0.1.2 copied to clipboard
Unified wearable SDK for Synheart (HR, HRV, steps, energy, stress).
synheart_wear #
Unified wearable SDK โ Cross-device, cross-platform biometric data normalization with a single standardized output format. Stream HR, HRV, steps, calories, and stress signals from Apple Watch, Fitbit, Garmin, Whoop, and Samsung devices into your Flutter applications.
๐ Features #
- ๐ฑ Cross-Platform: Works on iOS and Android
- โ Multi-Device Support: Apple Watch, Fitbit, Garmin, Whoop, Samsung Watch
- ๐ Real-Time Streaming: Live HR and HRV data streams
- ๐ Unified Schema: Consistent data format across all devices
- ๐ Privacy-First: Consent-based data access with encryption
- ๐พ Local Storage: Encrypted offline data persistence
๐ฆ Installation #
Add synheart_wear to your pubspec.yaml:
dependencies:
synheart_wear: ^0.1.0
Then run:
flutter pub get
๐ฏ Quick Start #
Basic Usage #
import 'package:synheart_wear/synheart_wear.dart';
void main() async {
// Initialize the SDK
final synheart = SynheartWear();
await synheart.initialize();
// Read current metrics
final metrics = await synheart.readMetrics();
print('Heart Rate: ${metrics.getMetric(MetricType.hr)}');
print('Steps: ${metrics.getMetric(MetricType.steps)}');
}
Real-Time Streaming #
// Stream heart rate data every 5 seconds
synheart.streamHR(interval: Duration(seconds: 5))
.listen((metrics) {
print('Current HR: ${metrics.getMetric(MetricType.hr)}');
});
// Stream HRV data in 5-second windows
synheart.streamHRV(windowSize: Duration(seconds: 5))
.listen((metrics) {
print('HRV RMSSD: ${metrics.getMetric(MetricType.hrvRmssd)}');
});
Configuration #
final synheart = SynheartWear(
config: SynheartWearConfig(
enabledAdapters: {
DeviceAdapter.appleHealthKit,
DeviceAdapter.fitbit,
},
enableLocalCaching: true,
enableEncryption: true,
streamInterval: Duration(seconds: 3),
),
);
๐ Data Schema #
All wearable data follows the Synheart Data Schema v1.0:
{
"timestamp": "2025-10-20T18:30:00Z",
"device_id": "applewatch_1234",
"source": "apple_healthkit",
"metrics": {
"hr": 72,
"hrv_rmssd": 45,
"hrv_sdnn": 62,
"steps": 1045,
"calories": 120.4,
"stress": 0.3
},
"meta": {
"battery": 0.82,
"firmware_version": "10.1",
"synced": true
}
}
๐ง API Reference #
Core Methods #
| Method | Description |
|---|---|
initialize() |
Request permissions & setup adapters |
readMetrics() |
Get current biometric snapshot |
streamHR() |
Stream real-time heart rate |
streamHRV() |
Stream HRV in configurable windows |
getCachedSessions() |
Retrieve cached wearable data |
clearOldCache() |
Clean up old cached data |
Permission Management #
// Request specific permissions
final permissions = await synheart.requestPermissions(
permissions: {PermissionType.heartRate, PermissionType.steps},
reason: 'This app needs access to your health data for insights.',
);
// Check permission status
final status = synheart.getPermissionStatus();
print('HR permission: ${status[PermissionType.heartRate]}');
Local Storage #
// Get cached sessions
final sessions = await synheart.getCachedSessions(
startDate: DateTime.now().subtract(Duration(days: 7)),
limit: 100,
);
// Get cache statistics
final stats = await synheart.getCacheStats();
print('Total sessions: ${stats['total_sessions']}');
// Clear old data
await synheart.clearOldCache(maxAge: Duration(days: 30));
โ Supported Devices #
| Device | Platform | Integration | Status |
|---|---|---|---|
| Apple Watch | iOS | HealthKit | โ Ready |
| Fitbit | iOS/Android | REST API | ๐ In Development |
| Garmin | iOS/Android | Connect API | ๐ Planned |
| Whoop | iOS/Android | REST API | ๐ Planned |
| Samsung Watch | Android | Samsung Health | ๐ Planned |
๐ Privacy & Security #
- Consent-First Design: Users must explicitly approve data access
- Data Encryption: AES-256-CBC encryption for local storage
- Key Management: Automatic key generation and rotation
- No Persistent IDs: Anonymized UUIDs for experiments
- Compliant: Follows Synheart Data Governance Policy
- Right to Forget: Users can revoke permissions and delete encrypted data
๐๏ธ Architecture #
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ synheart_wear SDK โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโโโค
โ โ โ
โ โผ โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโโโค
โ Device Adapters Layer โ
โ (Apple, Fitbit, etc.) โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโโโค
โ โ โ
โ โผ โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโโโค
โ Normalization Engine โ
โ (standard output schema)โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโโโค
โ โ โ
โ โผ โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโโโค
โ Local Cache & Storage โ
โ (encrypted, offline) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฑ Example App #
Check out the complete example in examples/flutter_example/:
cd examples/flutter_example
flutter run
The example demonstrates:
- SDK initialization
- Permission requests
- Real-time data streaming
- Local storage management
๐งช Testing #
Run the test suite:
flutter test
Tests cover:
- Core SDK functionality
- Data model serialization
- Error handling scenarios
- Permission management
- Configuration system
๐ Roadmap #
| Version | Goal | Description |
|---|---|---|
| v0.1 | Core SDK | โ Apple Watch + Fitbit integration |
| v0.2 | Real-time streaming | ๐ HRV, HR over BLE |
| v0.3 | Extended device support | ๐ Garmin, Whoop, Samsung integration |
| v0.4 | SWIP integration | ๐ Add impact measurement hooks |
| v1.0 | Public Release | ๐ Open standard SDK and docs |
๐ค Contributing #
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
๐ License #
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Links #
- Documentation: docs/RFC.md
- Data Schema: schema/metrics.schema.json
- Synheart AI: synheart.ai
- Issues: GitHub Issues
๐ฅ Authors #
- Israel Goytom - Initial work - @isrugeek
- Synheart AI Team - RFC Design & Architecture
Made with โค๏ธ by the Synheart AI Team
Technology with a heartbeat.