shazino

Introduction to CareKit

Thursday, 12 May 2016 in dev journal by Vincent Tourraine

CareKit is a software framework created by Apple, for creating apps that help people better understand and manage their health. It provides customizable modules to record and display health-related data.

This article gives a technical presentation of CareKit, and introduces the various modules available to build your app.

CareKit screens
CareKit app screenshots, image Apple

Technical specifications

CareKit is a framework for iOS apps. Its user interface is primarily designed for the iPhone and iPod touch devices, but it also runs on iPad.

The framework is written in Objective-C, therefore it can be used in projects developed in Objective-C and/or Swift. CareKit requires Xcode 7.0, and only runs on devices with iOS 9.0 or newer.

Open source

CareKit is available as an open source project, hosted on GitHub:

https://github.com/carekit-apple/CareKit/

This repository contains all the source code and resources for CareKit. It also offers a sample app project to directly test its various components, as well as documentation and tests.

Apple is inviting everyone to contribute to this project. You can report issues, suggest new ideas, and even send “pull-requests” for modifications to be included in future releases. You will find detailed instructions about how to contribute in the repository itself.

Relation with ResearchKit

ResearchKit is another framework created by Apple, for creating medical research apps.

ResearchKit and CareKit might seem like similar frameworks, but they are technically completely distinct. You can use one without the other, or choose to combine them inside your app.

You’ll notice that the CareKit repository contains a reference to ResearchKit, in the form of a Git submodule. This connection is only used for the CareKit sample application, which illustrates how the framework can interact with ResearchKit. To be clear, this is simply an example, and you don’t need ResearchKit to use CareKit.

Components

The overall CareKit architecture is nicely summarized in the following illustration from the official documentation:

CareKit architecture

Care Plan Store

The “Care Plan Store” is responsible for storing the health data. It manages both the activities scheduling (what the user should do, and when), and the actual results (the date and details for every time an activity is performed).

It relies on a Core Data persistent store, but the implementation is completely abstracted from the developer (so you don’t need to know the Core Data API).

Care Card

Care Card Screenshot 1 Care Card Screenshot 2

The “Care Card” screen lists the activities that the user should perform on a regular basis, and tracks their day-by-day completion. You can think of it as a to-do list, with recurring items. For instance, taking a medication can be considered as an activity.

The user simply taps on the colored buttons to mark an activity as completed. Each activity also has a details screen to provide additional information to the user.

Symptom and Measurement Tracker

Symptoms Screenshot

The “Symptom and Measurement Tracker” screen lists actions and events intended to continuously assess the user health condition.

So it’s similar to the Care Card, with a list of items to complete every day. But instead of tracking if the user follows his or her treatment, this screen is about measuring its effectiveness, by collecting any relevant measurement.

Each item is associated to a particular result value. When available, the app can track the actual measurement, for instance by fetching data from the “Health” API (blood glucose, weight, etc). Or it can simply ask the user to evaluate a particular symptom (pain level, mood, etc).

CareKit doesn’t provide a user interface to record any particular measurement. ResearchKit, on the other hand, offers a wide range of components to collect this type of information, so this is a good opportunity to make these two frameworks work together. You can look at the CareKit sample app to see how to present ResearchKit view controllers from CareKit, and collect the results back to the Care Plan Store.

Insights

Insights Screenshot

The “Insights” screen provides feedback, by exposing the evolution of the user symptoms and measurements, based on the Care Card completion. In other words, this is the result of the first two screens, combined to help the user understand how the treatment is impacting his or her condition.

The actual content of this screen should obviously by customized for each particular app, to display relevant and insightful data.

Connect

Connect Screenshot 1 connect Screenshot 2

The “Connect” screen gives a list of persons with whom you can discuss your medical condition, and share data from the app itself. These contacts are divided into two sections: the medical team, and friends and family. The user can contact them with the usual phone, message, or mail integration, but can also generate and send a “report” based on the Care Plan Store data.

Note that these contacts details are not stored inside the Care Plan Store. CareKit also doesn’t provide a user interface to edit this list, so the app either needs to configure it automatically, or implement its own interface.

More information

You can find more information about CareKit with the online documentation and API reference. Apple also has an official blog to share news about the framework.

And if you have more questions about CareKit, feel free to send us a message at contact@shazino.com or on Twitter @Shazino.