As promised, last week Apple released the source code for ResearchKit, their framework for building and running medical studies on iPhones. We did some Quick Research on ResearchKit soon after its announcement last month and since its release we’ve spent some time playing with some of ResearchKit’s features.

Along with the ResearchKit Xcode project, Apple has also released the source code for the five launch applications including the mPower app that Max Little, the speaker at the first SP+EE Mobile Health Meetup last week, worked on.

One of the first things to notice when you visit the GitHub repository is that much of the documentation and the ResearchKit Framework itself is written in Objective-C and not in Swift, the latter being a programming language for OS X and iOS that Apple released last year. However, this absence is already being addressed in parts of the documentation and as the framework is in an open source environment it probably won’t be long until the Programming Guide and API are updated to include Swift snippets and references too.

Apple have also included a sample application named ORKCatalog in ResearchKit. The app consists of a list of the pre-built tasks and there is a results tab to view the results of the most recently completed task. From looking through the app it seems that TaskListRow.swift in the ‘Presenting Tasks’ group acts as a good library of the different ResearchKit tasks written in Swift and is also very well annotated.

As part of SP+EE, we have recently worked on a digital healthcare project which involved designing for issues such as informed consent, data collection and leading the user through specific processes. This prompted us to create our own little demo app using ResearchKit so we could try implementing the three main types of task.

Our Demo Application

Before the user can take part in a study they need give their consent for their information to be collected and used. The framework provides you with a set of pre-formatted consent section types that cover things like how the data is gathered, privacy and withdrawal. These templates have some quite nice transition animations, but these only work if the steps are displayed in a specific order. You can also add a custom consent section type that can be easily configured to add different images and information.

A custom consent section

Overall, it’s very quick to build simple flows and each of the consent sections is compiled to a review step followed by name and signature steps. It will be interesting to see what type of consent models are required as more researchers begin to use this framework for different types of studies. For instance how would the consent process work for a study that looks at the relationship between two people? Other nice pre-built additions might include an eligibility step as seen in the launch applications or maybe a consent step for reminders if a task needs completing at a specific time.

Survey Task

The process for building surveys is pretty simple and again there are number of pre-built designs to collect different types of data. We set up a simple Quality of Life questionnaire that has 13 items and uses the pre-built text choice question which can be formatted to provide single or multiple answers.

Quality of Life Questionnaire

The results for each task can then be collected on completion and computed into a specific result (a Quality of Life score in this instance). In addition to this, you can also analyse the result of a specific step during the process and have flows that change depending on the answer given by the user, which offers a lot of flexibility.

The fledgling ResearchKit community has already started contributing some new survey answer formats. Giving participants the ability to resubmit previous answers for a task if these haven’t changed might be a helpful function.

Active task

We set up a predefined task to ask the user to walk for five minutes and rest for five minutes, with results being gathered from available sources such as the accelerometer, pedometer, location, and heart rate data (this might be gathered from the Apple Watch when it is released). There are five active tasks that come with ResearchKit but we imagine the library of tasks will grow quite quickly.

Countdown step in an active task

You can create custom active tasks by defining sub-classes of ORKActiveStep and ORKActiveStepViewController. There are some helpful reusable patterns such as a countdown step, which gives you time to prepare before a task starts, and a completion step, which lets you know that the activity has been completed successfully. Another reusable step that could prove useful might be letting the user know that they have not carried out a step correctly and asking them to retry.

What’s next for ResearchKit?

One thing we haven’t figured out yet is how to set the timing of certain tasks (for instance, a Quality of Life measurement might only need to be taken every six weeks) or how to set reminders for tasks (for instance, remind the user to complete this task every evening), but it looks like these are things that Apple is thinking about and looking to implement in the near future.

ResearchKit seems very well considered and as the community grows it will be interesting to see how it evolves in order to combat common problems and extend it’s reach, more specifically:

  • We have found data privacy and security to be very important and sensitive issues. Apple has left it very much in the hands of the researchers how this data is transmitted and stored after it has been collected. The development of guidelines and best practices would probably be beneficial for insuring data is secured.

  • Controlling attrition rates will be important to ensuring the success of a study. What sort of design patterns will be developed in order to keep participants engaged and contributing rich and useful data?

  • ResearchKit is fairly easy to prototype with but it seems that extending support for Swift programmers will be an important part of making the framework more accessible to a wide pool of potential researchers.

You can look at and download our ResearchKit demo app on the SP+EE GitHub repository. If you would like to chat to us about anything mentioned in this post, you can contact us here or come to our next Mobile Health Meetup!