ResearchKit is an open source software framework that makes it easy to create apps for medical research or for other research projects.

Overview

ResearchKit Framework

VCS Platform CocoaPods Carthage Compatible License

The ResearchKit™ framework is an open source software framework that makes it easy to create apps for medical research or for other research projects.

Getting More Information

  • Join the ResearchKit Forum for discussing uses of the ResearchKit framework and related projects.

Use Cases

A task in the ResearchKit framework contains a set of steps to present to a user. Everything, whether it’s a survey, the consent process, or active tasks, is represented as a task that can be presented with a task view controller.

Surveys

The ResearchKit framework provides a pre-built user interface for surveys, which can be presented modally on an iPhone, iPod Touch, or iPad. See Creating Surveys for more information.

Consent

The ResearchKit framework provides visual consent templates that you can customize to explain the details of your research study and obtain a signature if needed. See Obtaining Consent for more information.

Active Tasks

Some studies may need data beyond survey questions or the passive data collection capabilities available through use of the HealthKit and CoreMotion APIs if you are programming for iOS. ResearchKit's active tasks invite users to perform activities under semi-controlled conditions, while iPhone sensors actively collect data. See Active Tasks for more information. ResearchKit active tasks are not diagnostic tools nor medical devices of any kind and output from those active tasks may not be used for diagnosis. Developers and researchers are responsible for complying with all applicable laws and regulations with respect to further development and use of the active tasks.

Charts

ResearchKit includes a Charts module. It features three chart types: a pie chart (ORKPieChartView), a line graph chart (ORKLineGraphChartView), and a discrete graph chart (ORKDiscreteGraphChartView).

The views in the Charts module can be used independently of the rest of ResearchKit. They don't automatically connect with any other part of ResearchKit: the developer has to supply the data to be displayed through the views' dataSources, which allows for maximum flexibility.

Getting Started

Requirements

The primary ResearchKit framework codebase supports iOS and requires Xcode 8.0 or newer. The ResearchKit framework has a Base SDK version of 8.0, meaning that apps using the ResearchKit framework can run on devices with iOS 8.0 or newer.

Installation

The latest stable version of ResearchKit framework can be cloned with

git clone -b stable https://github.com/ResearchKit/ResearchKit.git

Or, for the latest changes, use the master branch:

git clone https://github.com/ResearchKit/ResearchKit.git

Building

Build the ResearchKit framework by opening ResearchKit.xcodeproj and running the ResearchKit framework target. Optionally, run the unit tests too.

Adding the ResearchKit framework to your App

This walk-through shows how to embed the ResearchKit framework in your app as a dynamic framework, and present a simple task view controller.

1. Add the ResearchKit framework to Your Project

To get started, drag ResearchKit.xcodeproj from your checkout into your iOS app project in Xcode:

Adding the ResearchKit framework to your
   project

Then, embed the ResearchKit framework as a dynamic framework in your app, by adding it to the Embedded Binaries section of the General pane for your target as shown in the figure below.

Adding the ResearchKit framework to
   Embedded Binaries

Adding the ResearchKit framework to Embedded Binaries

Note: You can also import ResearchKit into your project using a dependency manager such as CocoaPods or Carthage.

2. Create a Step

In this walk-through, we will use the ResearchKit framework to modally present a simple single-step task showing a single instruction.

Create a step for your task by adding some code, perhaps in viewDidAppear: of an existing view controller. To keep things simple, we'll use an instruction step (ORKInstructionStep) and name the step myStep.

Objective-C

ORKInstructionStep *myStep =
  [[ORKInstructionStep alloc] initWithIdentifier:@"intro"];
myStep.title = @"Welcome to ResearchKit";

Swift

let myStep = ORKInstructionStep(identifier: "intro")
myStep.title = "Welcome to ResearchKit"

3. Create a Task

Use the ordered task class (ORKOrderedTask) to create a task that contains myStep. An ordered task is just a task where the order and selection of later steps does not depend on the results of earlier ones. Name your task task and initialize it with myStep.

Objective-C

ORKOrderedTask *task =
  [[ORKOrderedTask alloc] initWithIdentifier:@"task" steps:@[myStep]];

Swift

let task = ORKOrderedTask(identifier: "task", steps: [myStep])

4. Present the Task

Create a task view controller (ORKTaskViewController) and initialize it with your task. A task view controller manages a task and collects the results of each step. In this case, your task view controller simply displays your instruction step.

Objective-C

ORKTaskViewController *taskViewController =
  [[ORKTaskViewController alloc] initWithTask:task taskRunUUID:nil];
taskViewController.delegate = self;
[self presentViewController:taskViewController animated:YES completion:nil];

Swift

let taskViewController = ORKTaskViewController(task: task, taskRun: nil)
taskViewController.delegate = self
present(taskViewController, animated: true, completion: nil)

The above snippet assumes that your class implements the ORKTaskViewControllerDelegate protocol. This has just one required method, which you must implement in order to handle the completion of the task:

Objective-C

- (void)taskViewController:(ORKTaskViewController *)taskViewController
       didFinishWithReason:(ORKTaskViewControllerFinishReason)reason
                     error:(NSError *)error {

    ORKTaskResult *taskResult = [taskViewController result];
    // You could do something with the result here.

    // Then, dismiss the task view controller.
    [self dismissViewControllerAnimated:YES completion:nil];
}

Swift

func taskViewController(_ taskViewController: ORKTaskViewController, 
                didFinishWith reason: ORKTaskViewControllerFinishReason, 
                                    error: Error?) {
    let taskResult = taskViewController.result
    // You could do something with the result here.

    // Then, dismiss the task view controller.
    dismiss(animated: true, completion: nil)
}

If you now run your app, you should see your first ResearchKit framework instruction step:

HelloWorld example screenshot

What else can the ResearchKit framework do?

The ResearchKit ORKCatalog sample app is a good place to start. Find the project in ResearchKit's samples directory. This project includes a list of all the types of steps supported by the ResearchKit framework in the first tab, and displays a browser for the results of the last completed task in the second tab. The third tab shows some examples from the Charts module.

License

The source in the ResearchKit repository is made available under the following license unless another license is explicitly identified:

Copyright (c) 2015 - 2018, Apple Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1.  Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2.  Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Comments
  • Charts for ResearchKit (Issue #92)

    Charts for ResearchKit (Issue #92)

    API for Line, Discrete and Pie charts for RK.

    Do you feel the circular progress view for the day's tasks that appears is the AppCore apps' dashboards qualifies as a chart that should be included too, seems broadly useful to most/all RK apps. Badges is another which could also be included.

    I think including those charts in RK and the catalog may encourage developers to contribute their own charts to the proj which can't be a bad thing

    One of the big challenges of RK apps face will be to retain participants for as long as possible, a broader range of great looking/ interesting dashboard charts is one way to do that. #92

    to test API review 
    opened by coxy1989 75
  • Printing support

    Printing support

    Been looking at this today but it is a complex issue.

    I have implemented printing support for my app, but it would be nice to see it built into ResearchKit.

    There would be a use for both printing out of results (to either provide patients or to add to non-electronic records), and to print blank questions (the use case springing immediately to mind is as part of an investigating site's research file which is mandatory for all research, but other cases may occur where a patient or professional may want a paper version of a survey or form).

    Consent has some PDF creation built in so some work has been done.

    The first issue is that ORKResults do not disclose any of their localised text in the result contents. Classes operating on ORKResults currently need to know the corresponding ORKQuestionStep if they are to display the results to the user. I think to support result management either the ORKResult may need to return its corresponding QuestionStep object or extract and provide relevant data from that step. The former may be better as you may want to render an option list either by just showing the selected choice(s) or in other cases showing what all the available options were.

    ORKResult subclasses could add A createHTMLSummary function. Subclasses which do not support printing return a blank string or a 'not available'. Otherwise they would put the step title in H1, and then summarise the question result within a

    block.

    The print function may need to support the user addition of CSS for formatting.

    new feature 
    opened by md0u80c9 34
  • Location Question Type

    Location Question Type

    This pull request adds support for a new location question and answer type. It can be used as a single question step and/or in a form task. You may have multiple entries in the form task and while interacting with each individual form item, the map will hide or show depending on your current selection. The location question handles the permission request for accessing the devices current location, when using the current location button. It will reverse geocode the current location value to an address and fill it in the question answer field.

    new feature 
    opened by QuintilesRK 30
  • Scale answer support in form items (issue #4)

    Scale answer support in form items (issue #4)

    This is a very basic implementation of issue #4. There is obviously some refactoring that should be considered for Survey and Form table cells as there is much they have in common. I didn't tackle that, but instead added just the bare necessities for a scale answer as a forum item. When PR #33 is merged, the height function will need to change in my new scale form cell class, as well as in the survey version to take into account vertical orientations.

    I tested this by modifying the ORKCatalog app to include two new form items in the Form example: an integer and a decimal slider. I can include the change to the ORKCatalog app in this PR if desired.

    accessibility 
    opened by brucehappy 27
  • Add vertical scale answer format

    Add vertical scale answer format

    I have implemented vertical scale support (issue #3).

    ORKScaleSlider now has the isVertical property. When set to YES, it internally uses the UIView'stransform property and some minor bounds and touch trickery to draw and work in vertical.

    ORKScaleSliderView now has vertical support through the use of the new isVertical method from the ORKScaleAnswerFormatProvider.

    New classes: ORKVerticalScaleAnswerFormat and ORKContinuousVerticalScaleAnswerFormat. The corresponding example steps have been added to ORKCatalog's Scale Question.

    opened by rsanchezsaez 27
  • Build with Xcode 13 error

    Build with Xcode 13 error

    When I try to build ResearchKit with the latest Xcode 13.1, I got an error: 'unarchiveObjectWithData:' is deprecated: first deprecated in iOS 12.0 - Use +unarchivedObjectOfClass:fromData:error: instead. Can anyone tell me how to fix this ?

    opened by zxcheergo 23
  • Hole Peg Test task

    Hole Peg Test task

    This pull-request adds a new active task: HPT (Hole Peg Test).

    Pegboard tests of hand dexterity are commonly used in clinical settings to assess upper extremity function in various populations.

    This task is well documented in the scientific literature to mesure the MSFC score in Multiple Sclerosis or Parkinson Disease for instance Earhart et al., 2011.

    It is one of the three tasks needed to assess the MSFC score: • T25FWPASAT. • 9-Hole Peg Test (this PR).

    Practically speaking, this task generates a two step test where participant must put a variable number of peg in a hole, and then remove them. This task tests both hands.

    You can test this new task directly with the ORKCatalog application.

    Please feel free to comment code and scientific aspect of this HPT task.

    Task in action:

    img_0025

    img_0026

    img_0027

    new feature 
    opened by julientherier 23
  • Add navigable ordered task and step navigation rules

    Add navigable ordered task and step navigation rules

    New feature dealing with issues #86 and #138.

    See the issue pages, the header documentation, and the researchkit-dev mailing list thread (subject: 'ResearchKit: navigation rules') for implementation details.

    For now, this has one follow-on issue: Implement an NSPredicate JSON serializer (#152).

    API review 
    opened by rsanchezsaez 23
  • Incorporate Touch ID into ResearchKit informed consent

    Incorporate Touch ID into ResearchKit informed consent

    rdar://problem/20177525

    Some applications may wish to establish a passcode during informed consent, and then use either that passcode or touch ID on further uses of a ResearchKit app to access certain features.

    This task is to add a concept of authentication at the task or task view controller level. We will also need an authentication setup step to create a passcode during informed consent and optionally enable Touch ID.

    For reference UI, look at how Touch ID is set up during initial setup of an iPhone. For reference code, it may be helpful to look at AppCore, e.g. APCKeychainStore and APCChangePasscodeViewController, but the details of a ResearchKit implementation are likely to be quite different.

    new feature 
    opened by jwe-apple 23
  • Issue #1 - Image Capture

    Issue #1 - Image Capture

    Here is my first attempt at finalizing the image capture code I used for my mock ups. As I'm sure you are aware, you will need to test on a real device in order to use the camera.

    The step supports different orientations and updates the preview and resultant image orientation accordingly. In landscape orientation, I have made the continue button view translucent to give the preview more room. The step supports specifying the template image to show over the preview, as well as insets to use for that image from the preview content frame. These insets can be points or percentage, as specified with a boolean property. Navigating back and forward through an image capture task which has already captured an image should work as expected. The file saved to disk uses complete unless open protection.

    I do think there needs to be a little more work on handling the situation when a user denies access to the camera. I had some code in there to specifically request permission, but took it out for simplicity. I think it needs to go back in to help handle that situation better.

    In my mock ups, I had hacked InstructionStep in order to get the images in the steps leading to the image capture tinted, as well as, changing the default text of the continue button on the first two steps. I didn't want to include those hacks in the PR, but I do think it looks much better with the tinting enabled, and presently there is no way to enable that within ORKTest. So, I think we should look to add something to support this. As for the continue button text in the steps, I do prefer my mocked up version too. Let me know if you think we should pursue either of these.

    I do see some oddness on the ORKStepHeaderView's layout of the instruction label, but since that's only used when there was an error in the image capture, I'm putting it on the back burner.

    Happy to hear any and all suggestions to improve this.

    to test 
    opened by brucehappy 22
  • [ORKTextField] Coherent placeholder handling

    [ORKTextField] Coherent placeholder handling

    This PR makes the handing of the placeholder in ORKTextField more similar to what UITextField does.

    It comprises of two changes:

    • Remove extra spacing between unit number and placeholder text. This makes the space between the unit and the placeholder to be consistent between editing and non editing modes.
    • Do not hide placeholder when the editing text is empty (same as with UITextField).

    Also reuses form item cells in ORKStepViewController so cells are not created twice when calculating their height.


    Before:

    simulator screen shot 9 sep 2015 02 46 13 simulator screen shot 9 sep 2015 02 59 19 simulator screen shot 9 sep 2015 02 46 20


    After:

    simulator screen shot 9 sep 2015 03 05 42 simulator screen shot 9 sep 2015 03 05 47 simulator screen shot 9 sep 2015 03 05 53

    opened by rsanchezsaez 21
  • No Option to Save Results if Task Cancelled

    No Option to Save Results if Task Cancelled

    Hello, I have an issue with ResearchKit after updating to 2.1. I am no longer given the option to save results when canceling a task. This is despite the fact that the delegate returns "true" repeatedly when "supportsSaveAndRestore" is called.

    After much digging, I find that when the cancel button action is called, the code no longer calls the "dismissWithoutConfirmation" method that was called in the older version of ResearchKit. This function would go through all the results to see if any were "saveable." Without this function in place, "saveable" is always false, and therefore the "save" option is not offered even though "supportsSaveAndRestore" is true.

    There is a similar function in the new version called "shouldDismissWithSwipe", but it is not called at the time the cancel button is pressed. I do get the save option if I tell the cancel action to look there.

    Also.... even when I do get the save button by making this modification, and the results are saved... restoration with restoration data also does not work.

    You can reproduce the error by following the instructions on the ResearchKit GitHub page to create a new project from scratch. You are never given the option to save a cancelled task even with "supportsSaveAndRestore" is true.

    Is anyone having luck with ResearchKit 2.1 when it comes to saving and restoring tasks?

    Thanks!

    opened by cmetts 0
  • `ORKSpeechRecognitionStepIdentifier` missing `FOUNDATION_EXPORT`

    `ORKSpeechRecognitionStepIdentifier` missing `FOUNDATION_EXPORT`

    https://github.com/ResearchKit/ResearchKit/blob/fc67cc944c9f33a7701214a4bb53ecd03d07f553/ResearchKit/Common/ORKOrderedTask_Private.h#L40-L66 It appears that

    FOUNDATION_EXPORT NSString *const ORKSpeechRecognitionStepIdentifier;
    

    is missing from the first code snippet, I’m using it to extract results from when the task view controller completes — instead of using my own hardcoded string.

    opened by Brett-Best 1
  • Button Title Layout Clipping

    Button Title Layout Clipping

    Using the latest ResearchKit (and the catalog project) from main (https://github.com/ResearchKit/ResearchKit/commit/fc67cc944c9f33a7701214a4bb53ecd03d07f553) I am seeing some issues when I press on the buttons at the bottom of the task view controller.

    1. Note when I press the button into highlighted state the font changes
    2. On release the font doesn’t get changed back either
    3. If you hold for long enough or move your finger a bit or sometimes only have to press down, the title of the button gets truncated

    See video below for reproduction https://user-images.githubusercontent.com/6104381/205573863-1499a564-4ebf-4799-9ecd-e6a756a704d4.mp4 If the video doesn’t play in browser, download it instead.

    Tested using Xcode 14.1, iOS 16.1/16.2b4

    opened by Brett-Best 4
  • ORKVisualConsentStep deprecated

    ORKVisualConsentStep deprecated

    It seems that ORKVisualConsentStep has been deprecated. In the code, there is a reference to ORKInstructionStep that should be used instead, but this one is not taking a ConsentDocument as argument. Note that ORKConsentReviewStep is still there (and accepts a ConsentDocument). Also, in the code comments, there are still some references to ORKVisualConsentStep, which is a little confusing. Could you give us any example of how to best replace the deprecated ORKVisualConsentStep with the new practise? Do I need to break down whatever is defined in the ConsentDocument into many ORKInstructionSteps? Many thanks!

    opened by claus-zinn 0
  • Using ORKTaskViewController on SwiftUI do not use the entire screen

    Using ORKTaskViewController on SwiftUI do not use the entire screen

    Hey ResearchKit Team,

    I'm facing a strange behavior when using the ORKTaskViewController on a SwiftUI view, the viewController seems to not be able to use the entire screen space, being only in the middle of the screen, and adding the navigation controls outside where you expect as viewController.

    I'm using:

    Xcode 14
    iOS: 15.5
    Simulator: iPhone 13 Pro
    

    | UIKit | SwiftUI | :-------------------------:|:-------------------------: Simulator Screen Shot - iPhone 13 Pro - 2022-11-28 at 12 56 05 | Simulator Screen Shot - iPhone 13 Pro - 2022-11-28 at 12 57 49

    opened by raafaelima 0
Releases(2.1.0)
Owner
ResearchKit is an open source software framework that makes it easy to create apps for medical research or for other research projects.
null
ESF modular ingestion tool for development and research.

ESFang This is a tool devised for modular consumption of EndpointSecurity Framework (ESF) events from the MacOs environment. This is my attempt to ove

F-Secure Countercept 17 Dec 5, 2022
Project Flat iOS is the iOS client of Agora Flat open source classroom.

Agora Flat iOS Project flat is the iOS client of Agora Flat open source classroom. 中文 Features Open sourced front-end and back-end [Flat Web][flat-web

netless 24 Dec 12, 2022
An open-source task management app for daily general operations

Taskaholic An open-source task management app for daily general operations, sepa

Aiden 1 Sep 19, 2022
Open-source API Client for iOS, iPadOS, macOS. Built with SwiftUI

Yogu Open-source API Client for iOS, iPadOS, macOS. Built with SwiftUI ?? Yogu is currently in development, and not actually usable yet. Please DO NOT

Beomjun Gil 5 Oct 29, 2022
Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your mobile app.

Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your mobile app. With a few lines of code, you can connect your app with the Shopify platform and let your users buy your products using Apple Pay or their credit card.

Shopify 411 Jan 2, 2023
gradle plugin for building Xcode Projects for iOS, watchOS, macOS or tvOS

gradle-xcodePlugin The gradle xcode plugin (gxp) makes it easier to build Xcode projects by specifying the build settings in a single configuration fi

null 444 Dec 5, 2022
MainTask - Create main task by using a simple way

MainTask Create a main task by using a simple way. MainTask { print(Thread.c

Underthestars-zhy 1 Jan 17, 2022
LibreSDK - Open FreeStyle Libre

LibreSDK - Open FreeStyle Libre Since there are a dozen of repositories floating around on github trying to decode the contents of a FreeStyle Libre.

Julian Groen 0 Feb 6, 2022
Alter SDK is a cross-platform SDK consisting of a real-time 3D avatar system, facial motion capture, and an Avatar Designer component built from scratch for web3 interoperability and the open metaverse.

Alter SDK is a cross-platform SDK consisting of a real-time 3D avatar system, facial motion capture, and an Avatar Designer component built from scratch for web3 interoperability and the open metaverse.

Alter 45 Nov 29, 2022
PayByBank SDK is an alternative and easier form of Open Banking solutions.

PayByBank SDK (iOS) The Ecospend Gateway presents PayByBank SDK as an alternative and easier form of Open Banking Instant Payment solutions. PayByBank

Ecospend Technologies Limited 8 Oct 10, 2022
A Demo using Vision Framework building on Core ML Framework

Core-ML-Sample A Demo using Core ML, Vision Framework and Swift 4. This demo is based on Inception V3 network. You must run it with Xcode 9 and iOS 11

杨萧玉 215 Nov 9, 2022
The official CovPass(-Check) iOS apps

CovPass / CovPass Check Einfach. Sicher. Papierlos. Mit der CovPass-App können Bürgerinnen und Bürger ihre Corona-Impfungen direkt auf das Smartphone

null 96 Dec 18, 2022
150,000+ stickers API & SDK for iOS Apps.

English | 한국어 Stipop UI SDK for iOS Stipop SDK provides over 150,000 .png and .gif stickers that can be easily integrated into mobile app chats, comme

Stipop, Inc. 19 Dec 20, 2022
Used to integrate the Facebook Platform with your iOS & tvOS apps.

Facebook SDK for iOS This open-source library allows you to integrate Facebook into your iOS app. Learn more about the provided samples, documentation

Meta 7.3k Jan 3, 2023
1Password Extension for iOS Apps

Retirement As 1Password continues to evolve on iOS we’ve been given new opportunities to take advantage of additions to the operating system that fulf

AgileBits 2.6k Jan 4, 2023
Twitter Kit is a native SDK to include Twitter content inside mobile apps.

Twitter will be discontinuing support for Twitter Kit on October 31, 2018. Read the blog post here. Twitter Kit for iOS Background Twitter Kit is a na

Twitter Archive 674 Dec 18, 2022
Fetch the update available status for iOS or macOS apps based on the bundle identifier.

AppUpdately Fetch the update status for a given app bundle identifier, without the need of any remote configuration. Simply provide your app's bundle

Antoine van der Lee 30 Dec 20, 2022
Home-assistant-swift-sdk - Used to integrate the Home Assistant APIs with your Swift-based apps.

home-assistant-swift-sdk This open-source library allows you to interact with a Home Assistant instance in your Swift-based (e.g., iOS, macOS, etc.) a

Alexander Golden 0 Dec 31, 2021
Project(s) for iOS mobile apps

Pre-work - Calculator tip app tip calculator is a tip calculator application for iOS. Submitted by: William Hiltz Time spent: 2 hours spent in total U

null 0 Jan 9, 2022