Hello all!
I have been using HealthKit to collect some health data, and I also need to collect information about the device that the data came from.
If I use HKSampleQuery, HealthKit returns all data available from all sources (e.g. steps data from iPhone and Apple Watch). In this case, I can get the device from which the sample originated, but I will also receive duplicate data and will have to create some kind of internal logic to identify it.
If I use a different query, such as HKStatisticsCollectionQuery, I will be able to get the consolidated data, without duplicates, but I will not have the device information. I can use the option .separateBySource and get the source information, but the HKSource class has considerably less information than the device class, HKDevice.
Am I missing option? Is there a simple way to remove duplicates in HKSampleQuery, while identifying and acting upon duplicate information?
Thank you!