HealthKit is a framework designed by Apple to allow healthcare and fitness apps to work together, access and share health data while maintaining user’s privacy and control over the data. In iOS 8.0, the framework can automatically save information from compatible Bluetooth LE heart rate screens. If accessible, the framework can likewise consequently import activity information from the M7 motion coprocessor. Different gadgets and information sources must have a similar app that can access the information and save it to HealthKit.

Here are some important points that will help you understand HealthKit in a better way.

  1. Lots of apps on the App Store generate Health Data but are unable to share health data amongst themselves. Since different apps track various kinds of health data and store at different places. In the case of emergency, data is available but cannot be used in a way as needed. Therefore, there is a need for the system where all the applications track health data using corresponding hardware and store it at the central place in order to make it available wherever required. This central place is called HealthKit.
  2. HealthKit not only generates health information. But also provides a storage with well manageable structure.
  3. To understand HealthKit better, explore the below points-
    1. Data sources
    2. Health Store
    3. In built Health app

1. Data sources

  • M8 Processor – Track number of steps, jumping etc.
  • Bluetooth-based hardware – Health Info
  • In built Health app – Manual entry
  • App stores apps – Track all kind of health data using possible ways

These data sources are responsible for generating different kinds of health related data. Now, this health data can be stored in the central place called Health Store using HealthKit.

2. What kind of Health data we can store into HealthStore using HealthKit API : –

HKObject Type HealthKit API

a. Actually, above HealthKit object types are categorized as:

HealtKit object categorize

b. Well, Now we know what kind of data we can track using HealthKit. We need to understand the structure and object types to know how to track the health data; diagrammatically represented as follows :

HealthKi structure and object types

Each health information or data is considered as an Object. Each object can be characteristic or sample and sample further can be quantity or Category type.

c. Above diagram shows structure while the question remains as it is. How can we track Health Info? Answer is as follows :
How Can We Track Health Info

Code To Track Health Info in HealthKit
Above two examples explains how to create quantity type health detail as the object which can be called as Sample and the second snapshot shows the API used to store that sample in the HealthStore.

Now, If one of the application calculated body temperature in some way. By using above APIs we can store that body temperature into Health Store. Now onwards any application can access this information.

d. How to access Health Info from HealthKit?

How to access Health Info from HealthKit

e. Are health details available publicly? The answer is obvious NO. To access health details from health store we have to pass through request authorization.

Privacy and Permissions

3. In-built Health app consists of 5 things :
Healthkit filters the data gathered by any third-party health and fitness apps. This data then gets transferred into the Apple’s Health App. Here, the app classifies the bulk data into easy to consume formats. In-built health app consist

  • Medical Id
  • Manual Entry as data point
  • Health data privacy permissions
  • Dashboard
  • Export health details

More about Apple’s HealthKit for developers

  • HealthKit framework is used to store and retrieve health related information
  • Unit conversion can be handled by HealthKit using HKUnit
  • There are around 60 object types
  • We cannot create our own object type
  • Each object type is recognized by object identifier
  • Each sample type is stored with start date and end date
  • Each object has UID, Source, and Metadata (Custom data)
  • All the information is Read only.
  • Every quality is classified into discrete or cumulative
  • Privacy and permission needed since health info is sensitive, done by request authorization with different roles.
  • Localization needs to handle the application. Mass, length & energy formatting helps to localize the health details.
  • Overall, HealthKit is to store and share health data between all apps depending on authorization provided by the user.

Quality of data
Apple’s HealthKit has comprehensive data type, including your gender, Sleep patterns, Workout duration and intensity, Blood type, Body temperature, Heart rate, Blood alcohol level, Blood glucose, Diet, Cycling and walking activity and more.

Type of data recorded by HealthKit
HealthKit stores and manages various information such as:

  • Body measurements and weight history
  • Heartbeat rate
  • Number of steps and distance travelled
  • Calories burnt
  • Favorite types of activity and sports
  • Length of exercise

Moreover, HealthKit allows the user to track their sleep too. HealthKit is also focused on whole variety of data from medical apps including:

  • Lab results statistics (including glucose blood level)
  • Medications (prescriptions alerts and note)
  • Nutrition data (types of food consumed, calories and carbohydrate count)
  • Sleep data
  • Vitals (pulse and blood pressure, body temperature)

Supporting Bluetooth Smart Device
In case of wireless health device a standard has been set since 2011 for Bluetooth Smart, or Bluetooth Low Energy or Bluetooth 4.0, a technology that comes with iOS since 2012. Any app can connect to the devices that stick to Bluetooth Smart Profiles. For example, iOS 8 has in-built accessory support for the Bluetooth smart devices such as heart rate, blood glucose, blood pressure and health thermometer. Once the user connects any of these accessories to the HealthKit, a HealthKit-connected app will be able to read data from the device.

What is lacking in Apple HealthKit?

  • HealthKit does not provide a system for sharing health data between people. The data can only be shared by single user and that too between the apps that user has or uses.
  • Apple HealthKit data is not accessible from anywhere other than iOS device. For example, Mayo Clinic being a partner of HealthKit will use it to enable patients of Mayo Clinic to share their health data stored in HealthKit with their doctor via Epic MyChart app.
  • Apple provides iOS developers with complete set of tools to keep data safe and secure on the device. But Apple doesn’t enforce that developers use the tools
  • Apple’s HealthKit also does not include any social interaction feature in it. However, social interactions are available for third-party app developers and pharma apps when required.
  • HealthKit stores health data on the device and is not allowed to store personal health information in iCloud, this makes it unable to be managed on web and sync across devices

By giving a standardized configuration and mechanism for health and fitness data, HealthKit will encourage development of apps and gadgets that can share health information with each other. Thus, clients can anticipate exchanging between apps without worrying about moving their information. Despite the fact that HealthKit does not provide any way to share information with other individuals, different applications do, thus when those apps contact with these platforms, it will permit users to share their health information with other individuals, and healthcare providers.

Author Bio

mobisoft-pritam

Ravindra Waghmare is the Co-founder and COO at Mobisoft Infotech. He is an expert in solutioning,software consultancy, process definition and improvements, business analysis,and project execution. He has 10+ years of experience in software development,consulting, delivery, company operations, talent acquisition, processes and sales.