Health & Fitness

RSS for tag

Explore the technical aspects of health and fitness features, including sensor data acquisition, health data processing, and integration with the HealthKit framework.

Health & Fitness Documentation

Post

Replies

Boosts

Views

Activity

cyclingSpeed is 0
Hi, I am running the "Building a multidevice workout app" sample: https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/building_a_multidevice_workout_app I do not get any values for the .cyclingSpeed Value? Is this correct or should there be any value while moving around? Also i wonder if i can get the GPS values like altimeter or location from the HKWorkoutSession? Thanks
1
0
582
Sep ’23
Would This Work? (Importing Medical Records)
So almost every EPIC customer is now at a version that would allow their medical records to be imported, many of them just haven't filled out the Apple form to list their organization. EPIC does publish a list of the FHIR endpoints for all of these customers though. Functionally it should be possible to write an app that authenticates the user to their provider, and downloads the FHIR data from the API, and then pushes it into Apple Health. The two things I'm not clear on though are: Are the Medical Records available to write to from an app, or is it only available through organizations registered through Apple using their UI? Would Apple consider this a replication of their functionality as far as App Store T's & C's go?
1
0
416
Aug ’23
Headphone accommodation with audiogram
Hi, i am developing an app to enter audiogram data to Apple HealthKit and i want to have a little more information about Apple‘s headphone accommodation. is there any information about how the accommodation exactly works? Which filters will be applied in the background? How are the filter coefficients created etc.? Is there any access to the resulting eq curve? Is there also dynamic compression used in a certain way? Kind regards, Tom
0
0
331
Aug ’23
HKLiveWorkoutBuilderDelegate not updating activeEnergyBurned HKQuantityType in watchOS 9.6.1(20U80)
The "func workoutBuilder(_ workoutBuilder: HKLiveWorkoutBuilder, didCollectDataOf collectedTypes: Set)" function from the "HKLiveWorkoutBuilderDelegate" is not updating data from "HKQuantityType.quantityType(forIdentifier: .activeEnergyBurned)" in a workout session. My app is using the same code as before and it stopped working since I updated my watch to the version 9.6.1(20U80). I am using Xcode 14.3.1 (14E300c). Is there any solution to address this matter?
0
0
374
Aug ’23
Apple Vision Pro and Radiology for diagnostic viewing and interpretation
Will Apple Vision Pro support medical imaging diagnostic software such as Horos or Osirix. I am really curious if radiologist will be able to view and manipulate. interpret exams with this headset with ease and use built in microphone for voice recognition/dictation while using hands to manipulate the imaging and also simultaneously being able to view report in field of view. This could really unlock some major potential for interpreting at least CT, Ultrasound and MRI exams. I don't think the resolution will be high enough to interpret diagnostic x-rays and definitely not mammograms due to MQSA regulations and physicist inspections requiring more detail and information. However, I want to be at the forefront of bringing in Vision Pro headsets in the medical imaging space with rel utilization in clinical practices. It may also be beneficial for patients who are curious to see their medical imaging or even as headsets to use while undergoing medical imaging outpatient biopsy procedures for ******/etc to help put them at ease during the procedures. This could really provide patient satisfaction and I think we are scratching the surface on a world of possibilities in healthcare with devices like this. Upon utilixation, I would like to creat presentation series and share information with my Radiology colleagues at national/international meetings.
3
1
1.8k
Aug ’23
Problem with Sharing in Fitness app
Hello, I use iPhone 14 Pro with iOS 17 Beta, my girlfriend use iPhone 13 with newest iOS 16. We used to use Fitness application to share our daily activity (steps, kcals etc.) Unfortunately last time our activity progress doesn't shows properly. In my phone I have 1000 steps for example, my gf see 0 steps. The same was at I was on iOS 16. Removing and invitating again doesn't help. What can we check? Thanks in advance :)
0
0
383
Aug ’23
Getting sharingDenied when trying to check for access to activitySummaryType
So, I've wrote the following code; let status = healthStore.authorizationStatus(for: .activitySummaryType()) switch status { case .notDetermined: return false case .sharingDenied: return false case .sharingAuthorized: return true @unknown default: return false } And it is hitting the .sharingDenied case. This doesn't make sense as on my phone I have allowed read access (there's no sharing option per the documentation). As soon as I change out to let's say; let checkHkQuantityTypeAuthorization = HKObjectType.quantityType(forIdentifier: .stepCount) I am able to hit the case .sharingAuthorized case. What doesn't make sense is that even though it fails this check, if I just go ahead and query for the Activity Summary for the ring data via; let predicate = HKQuery.predicate(forActivitySummariesBetweenStart: startDateComponents, end: endDateComponents) let query = HKActivitySummaryQuery(predicate: predicate) { (query, summaries, error) { ... } It works just fine and I can pull the Activity data without changing any permissions in the Privacy settings of my iPhone or iPad. So, I know I can pull the data just fine, and that everything is set correctly for the Entitlements. I just want to make sure that the user has actually allowed me to before I try to pull the data. Additional Notes: The REALLY weird thing is that that when I try to pull the .stepCount, is that it will hit the .sharingDenied case if I only have the user do READ access. So, I've had to make my app also request for WRITE (share) access. Like this doesn't make any sense for me to request both READ and WRITE access to step count when my app only needs read access (like Activity Summary data). This seems like a bug in my opinion as I don't see anything related in the documentation in regards to this on the If this is how this is supposed to work given the discussion on the documentation; To help prevent possible leaks of sensitive health information, your app cannot determine whether or not a user has granted permission to read data. If you are not given permission, it simply appears as if there is no data of the requested type in the HealthKit store. If your app is given share permission but not read permission, you see only the data that your app has written to the store. Data from other sources remains hidden. Source: https://developer.apple.com/documentation/healthkit/hkhealthstore/1614154-authorizationstatus Then that is completely confusing. I want to check if I have permissions to read this data otherwise why bother trying to read the data or try to present anything to the user except that they need to allow access to me reading this data. Apple says that you should only request to relevant Health data when you need it. So this check is worthless if I am trying to check before I do the query because the UI wants to display data in regard to activity data. Honestly, this is really confusing if all this falls into the discussion item on the documentation and Apple needs to do better. EDIT: Further reading the very top of the method definition yields; Returns the app’s authorization status for sharing the specified data type. Like why Apple? I want to know if I can READ the type so I can tell the user to allow me access or not. This is frustrating.
0
1
483
Jul ’23
Unable to see workout composition from preview in WorkoutKit
I am unable to see the workout composition from preview in the new WorkoutKit framework. This is reproducible on an iPhone running iOS 17.0 running xcode 15.0 beta 2. I downloaded the Sample Planner app that showcases the new WorkoutKit framework capabilities , introduced in the session 10016 of wwdc 23. I can create workout compositions but the preview presentation doesn’t work as expected. It shows a black screen without any info. I attached a screenshot. You can reproduce it on the sample app when showing the PresentPreviewDemo view.
4
1
863
Jul ’23
Crash on fetching health kit data
I am receiving the following crash when trying to query data from health kit. It seems to be complaining about end date being before start date however with the values I am passing in that is not possible. Also I tried to purposefully pass in end dates before start date and I still was not able to reproduce this crash. I have attached my code snippet and the crash logs here. Please Help :( self.statisticfetcher( type: HKObjectType.quantityType(forIdentifier: .bodyMass), options: .discreteAverage, metricType: .bodyWeight, statsHandler: { stats in if let quantity = stats.averageQuantity() { ... } return nil }) private func statisticfetcher( type: HKQuantityType?, options: HKStatisticsOptions, metricType: HealthMetricType, statsHandler: @escaping (HKStatistics) -> BASchema.HealthDataEntryInput?, resultHandler: ((HKStatisticsCollection?, Date, Date, Error?) -> Void)? = nil) { let res = getStartEndDate() let endDate = res.endDate let startDate = res.startDate guard let type = type else { return } let query = HKStatisticsCollectionQuery(quantityType: type, quantitySamplePredicate: nil, options: options, anchorDate: startDate, intervalComponents: DateComponents(day: 1)) let defaultResultHandler: (HKStatisticsCollection?, Date, Date, Error?) -> Void = { statCollection, startDate, endDate, error in if let error = error { return } guard let statCollection = statCollection else { return } statCollection.enumerateStatistics(from: startDate, to: endDate) { stats, _ in ... } } let resultHandler = resultHandler ?? defaultResultHandler query.initialResultsHandler = { _, statCollection, error in resultHandler(statCollection, startDate, endDate, error) } query.statisticsUpdateHandler = { _, _, statCollection, error in resultHandler(statCollection, startDate, endDate, error) } self.store.execute(query) self.subscribeToBackgroundDelivery(type: type) } private func subscribeToBackgroundDelivery(type: HKObjectType) { store.enableBackgroundDelivery(for: type, frequency: .immediate) { success, error in if(error != nil && !success) { print("Background Delivery for \(type) Failed!") } } }``` Fatal Exception: NSInternalInconsistencyException 0 CoreFoundation 0x9cb4 __exceptionPreprocess 1 libobjc.A.dylib 0x183d0 objc_exception_throw 2 Foundation 0x4e156c _userInfoForFileAndLine 3 HealthKit 0xe0d2c -[HKDateInterval initWithStartDate:endDate:] 4 HealthKit 0xc7a5c -[NSDateComponents(HealthKit) hk_dateIntervalForDate:anchorDate:outIndex:] 5 HealthKit 0x1a0f98 -[HKStatisticsCollection _statisticsDateIntervalAndIndex:forDate:] 6 HealthKit 0x1a0420 -[HKStatisticsCollection _insertStatistics:] 7 HealthKit 0x1a059c -[HKStatisticsCollection _resetStatistics:] 8 HealthKit 0x19efc8 -[HKStatisticsCollectionQuery _queue_deliverResetStatisticsObjects:forQuery:] 9 HealthKit 0x19e8bc __98-[HKStatisticsCollectionQuery client_deliverStatisticsBatch:resetStatistics:isFinal:anchor:query:]_block_invoke 10 libdispatch.dylib 0x2320 _dispatch_call_block_and_release 11 libdispatch.dylib 0x3eac _dispatch_client_callout 12 libdispatch.dylib 0xb534 _dispatch_lane_serial_drain 13 libdispatch.dylib 0xc0d8 _dispatch_lane_invoke 14 libdispatch.dylib 0x16cdc _dispatch_workloop_worker_thread 15 libsystem_pthread.dylib 0xddc _pthread_wqthread 16 libsystem_pthread.dylib 0xb7c start_wqthread
4
0
941
May ’23