cph-cachet / flutter-plugins

A collection of Flutter plugins developed by CACHET
527 stars 625 forks source link

Health 10.2.0 #946

Open AsifAliAzim opened 2 months ago

AsifAliAzim commented 2 months ago

{ "value": { "__type": "NumericHealthValue", "numeric_value": 141.0 }, "type": "STEPS", "unit": "COUNT", "date_from": "2024-04-03T10:06:57.736", "date_to": "2024-04-03T10:12:51.724", "source_platform": "appleHealth", "source_device_id": "F74938B9-C011-4DE4-AA5E-CF41B60B96E7", "source_id": "com.apple.health.81AE7156-EC05-47E3-AC93-2D6F65C717DF", "source_name": "Asif's iPhone", "is_manual_entry": false }

  1. "value" in the documentation is mentioned to be a map but in reality, it is of String type "NumericHealthValue numeric_value: 141.0".
  2. Adding a unique identifier, like iPhone or Apple Watch would be helpful if we want to filter out iPhones and Apple Watch data. Currently, it is a little bit confusing if users do not mention the name of their iPhones it shows "iPhone X pro max" etc, and in other cases "UserName's iPhone".
  3. Adding some device-related information to this object will help a lot. Let say I want to consider only the current device data not Apple Watch or any other iPhone I am using - consider this a generic case. And this is how "device_info_plus" package returns data to us.

{ 'systemName': 'iOS', 'isPhysicalDevice': true, 'utsname': { 'release': 22.6.0, 'sysname': 'Darwin', 'nodename': 'Asif's-iPhone', 'machine': 'iPhone10,6', 'version': 'Darwin Kernel Version 22.6.0: Mon Feb 19 19:46:23 PST 2024; root:xnu-8796.142.1.703.5~1/RELEASE_ARM64_T8015', }, 'model': 'iPhone', 'localizedModel': 'iPhone', 'systemVersion': 16.7.7, 'name': 'iPhone', 'identifierForVendor': 'FF976ADB-D838-4082-A489-43BE686E94F0', }

You could say I can use " 'nodename': 'Asif's-iPhone'" from "device_info_plus" and "source_name": "Asif's iPhone" from HealthDataPoint but it is not that much satisfying. First we can not compare these Strings second since it is a generic case we don't know where our logic breaks.

Conclusion: Adding device-related information will help to filter data if we want only to consider the current device data.