Git Product home page Git Product logo

researchkit's Introduction

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.

Table of Contents

Requirements

The ResearchKit framework codebase supports iOS and requires Xcode 12.0 or newer. The ResearchKit framework has a Base SDK version of 13.0.

Documentation

ebedded-framework

View the ResearchKit framework documentation by setting ResearchKit as your target in Xcode and selecting 'Build Documentation' in the Product menu dropdown.

Getting Started

Install as an embedded framework

Download the project source code and drag in ResearchKit.xcodeproj. Then, embed ResearchKit framework in your app by adding it to the "Frameworks, Libraries, and Embedded Content" section for your target as shown in the figure below.

ebedded-framework

ORKCatalog App

The included catalog app demonstrates the different modules that are available in ResearchKit. Find the project in ResearchKit's samples directory.

catalog-home catalog-survey

Surveys

The ResearchKit framework provides a pre-built user interface for surveys, which can be presented modally on an iPhone or iPad. The example below shows the process to present a height question for a participant to answer.

import ResearchKit
import ResearchKitUI
    
let sectionHeaderFormItem = ORKFormItem(sectionTitle: "Your question here.")

let heightQuestionFormItem = ORKFormItem(identifier: "heightQuestionFormItem1", text: nil, answerFormat: ORKAnswerFormat.heightAnswerFormat())
heightQuestionFormItem.placeholder = "Tap here"

let formStep = ORKFormStep(identifier: "HeightQuestionIdentifier", title: "Height", text: "Local system")
formStep.formItems = [sectionHeaderFormItem, heightQuestionFormItem]

return formStep

The height question is presented in the figure below.

height-question height-question-2

Consent

The ResearchKit framework provides classes that you can customize to explain the details of your research study and obtain a signature if needed. Use ResearchKit's provided classes to quickly welcome, and inform your participants of what the study entails.

import ResearchKit
import ResearchKitUI

// Welcome page.
let welcomeStep = ORKInstructionStep(identifier: String(describing: Identifier.consentWelcomeInstructionStep))
welcomeStep.iconImage = UIImage(systemName: "hand.wave")
welcomeStep.title = "Welcome!"
welcomeStep.detailText = "Thank you for joining our study. Tap Next to learn more before signing up."
        
// Before You Join page.
let beforeYouJoinStep = ORKInstructionStep(identifier: String(describing: Identifier.informedConsentInstructionStep))
beforeYouJoinStep.iconImage = UIImage(systemName: "doc.text.magnifyingglass")
beforeYouJoinStep.title = "Before You Join"
        
let sharingHealthDataBodyItem = ORKBodyItem(text: "The study will ask you to share some of your Health data.",
                                            detailText: nil,
                                            image: UIImage(systemName: "heart.fill"),
                                            learnMoreItem: nil,
                                            bodyItemStyle: .image)
        
let completingTasksBodyItem = ORKBodyItem(text: "You will be asked to complete various tasks over the duration of the study.",
                                          detailText: nil,
                                          image: UIImage(systemName: "checkmark.circle.fill"),
                                          learnMoreItem: nil,
                                          bodyItemStyle: .image)
        
let signatureBodyItem = ORKBodyItem(text: "Before joining, we will ask you to sign an informed consent document.",
                                    detailText: nil,
                                    image: UIImage(systemName: "signature"),
                                    learnMoreItem: nil,
                                    bodyItemStyle: .image)
        
let secureDataBodyItem = ORKBodyItem(text: "Your data is kept private and secure.",
                                     detailText: nil,
                                     image: UIImage(systemName: "lock.fill"),
                                     learnMoreItem: nil,
                                     bodyItemStyle: .image)
        
beforeYouJoinStep.bodyItems = [
    sharingHealthDataBodyItem,
    completingTasksBodyItem,
    signatureBodyItem,
    secureDataBodyItem
]

The consent steps are presented in the figure below.

consent-welcome-page consent-before-you-join

Vist the Obtaining Consentarticle in ResearchKit's Documentation for more examples that include signature collection and PDF file storage.

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. 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.

Use predefined tasks provided by ResearchKit to guide your participants through specific actions.

import ResearchKit
import ResearchKitUI
import ResearchKitActiveTask

let orderedTask = ORKOrderedTask.dBHLToneAudiometryTask(withIdentifier: "dBHLToneAudiometryTaskIdentifier",
							intendedUseDescription: nil, options: [])
							
let taskViewController = ORKTaskViewController(task: orderedTask, taskRun: nil)
taskViewController.delegate = self

present(taskViewController, animated: true)

The dBHL Tone Audiometry task is presented in the figure below.

noise-check dbhl-tone-test

Getting Help

GitHub is our primary forum for ResearchKit. Feel free to open up issues about questions, problems, or ideas.

License

This project is made available under the terms of a BSD license. See the LICENSE file.

researchkit's People

Contributors

akshay-yadav-apple avatar bgannin avatar brucehappy avatar chrisnowak avatar codecadwallader avatar coxy1989 avatar davwillev avatar delebedev avatar erik-apple avatar eschramm avatar inidz avatar julientherier avatar jwe-apple avatar kelseydedoshka-apple avatar macroyau avatar marxon13 avatar md0u80c9 avatar ninoguba avatar p2 avatar pariecemckinney-apple avatar rsanchezsaez avatar rsanchezsaez-apple avatar srinathtm-apple avatar stevemoser avatar sye8 avatar syoung-smallwisdom avatar tommy60703 avatar umerkhan-apple avatar vtourraine avatar yuanzhu-apple avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

researchkit's Issues

[iPad] Crash when cancelling a task

There is a crash when cancelling a task on iPad, observed in the ORKTest app. This is to do with the action sheet presentation for task cancellation.

2015-04-21 15:48:29.100 ORKTest[250:8068] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented a UIAlertController () of style UIAlertControllerStyleActionSheet. The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this popover through the alert controller's popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem. If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.'

Add custom thumb assets for scales

The vertical scale relies on a non future-proof hack for rotating the default thumb view back into the original orientation (details here).

It would be better if we had a custom thumb asset which we could reference and rotate safely.

I suggest using the same new custom thumb asset for both horizontal and vertical scales.

[Review step] Support for displaying the results of active steps

rdar://problem/19220394

Participants should be able to review the data they've entered into RK apps. This issue is for adding support for active steps to the API from issues #89 and #90.

The results of active steps should also be presentable in some form in this UI. This may need to be quite custom for specific tasks, so it would be worth decoupling the presentation of results from the result classes themselves.

Refactor layout code

Layout code for most of the views is currently a bit over the place. Consider doing some refactoring to make it more homogenous and easier to maintain.

I don't have any specific suggestions right now, but it certainly feels like there is room for simplification.

Graphs for viewing historical HealthKit and ResearchKit data

AppCore has a graphing component that the initial apps use to present ResearchKit and HealthKit data (see APCGraph). We think it might make sense to import that code in some form into ResearchKit. Some of the requirements for HealthKit data display in research apps are very specific, so it might make sense to include some limited charting capabilities in ResearchKit.

This task is to review the APCGraph code and propose an appropriate API for ResearchKit graphing, and then import, document, and write appropriate demos.
#178

Vertical scale

Currently all our scales are horizontal. Some researchers want to have a vertical one.

Signature doesn't appear on PDF

After capturing a signature, I attempt to apply the signature to the consent document, and then generate a PDF.

The user's name, signature, and date don't appear on the PDF.

I'm pretty sure it's not user error, but here's my code to reproduce the issue.

This code applies the signature and generates the PDF:

func taskViewController(taskViewController: ORKTaskViewController, didFinishWithReason reason: ORKTaskViewControllerFinishReason, error: NSError?) {

    if let signatureResult = taskViewController.result.stepResultForStepIdentifier("consent review step identifier")?.firstResult as? ORKConsentSignatureResult {
        // the cast succeeds

        // signatureResult is not nil
        // signatureResult.signature is not nil

        signatureResult.applyToDocument(consentDocument)
    }

    consentDocument.makePDFWithCompletionHandler { (data, error) -> Void in
        if let data = data where data.length > 0 {
            // data is not nil
            self.PDFData = data
            self.viewPDFButton.hidden = false
        }
    }

    taskViewController.dismissViewControllerAnimated(true, completion: nil)
}

The consent document is successfully generated, but no signature appears on the PDF:

image

Note that the second signature, as well as the "Participant" string makes it in.

Here's how I create the consent document:

private var consentDocument: ORKConsentDocument {
    // Create the document
    let consentDocument = ORKConsentDocument()
    consentDocument.title = "Consent to Zombie Research"
    consentDocument.signaturePageTitle = "Consent Signature"
    consentDocument.signaturePageContent = "I agree to participate in this zombie-related research study."

    // Add participant signature
    let participantSignature = ORKConsentSignature(forPersonWithTitle: "Participant", dateFormatString: nil, identifier: "participant signature identifier")

    consentDocument.addSignature(participantSignature)

    // Add investigator signature for the PDF.
    let investigatorSignature = ORKConsentSignature(forPersonWithTitle: "Zombie Investigator",
        dateFormatString: nil,
        identifier: "investigator signature identifier",
        givenName: "George",
        familyName: "A. Romero",
        signatureImage: UIImage(named: "signature")!,
        dateString: "10/1/1968")

    consentDocument.addSignature(investigatorSignature)

    // Create "consent sections" in case the user wants more details before giving consent
    let consentOverview = ORKConsentSection(type: .Overview)
    consentOverview.content = "It's important to research zombies so we can get rid of them. Thanks in advance for all of your help researching them."

    let consentPrivacy = ORKConsentSection(type: .Privacy)
    consentPrivacy.content = "All information will be strictly confidential, unless a zombie eats your braaaaaaaaains…"

    consentDocument.sections = [consentOverview, consentPrivacy]

    return consentDocument
}

Here's how I create the consent review step:

    let signature = consentDocument.signatures!.first as! ORKConsentSignature

    let reviewConsentStep = ORKConsentReviewStep(identifier: "consent review step identifier", signature: signature, inDocument: consentDocument)

    reviewConsentStep.text = "I love, and agree to perform, zombie research."
    reviewConsentStep.reasonForConsent = "Zombie research is important."

Am I missing something or is this a bug?

Fitness task can get stuck on step 5

We've had intermittent reports that the fitness task can get "stuck" at step 5. This has been reproduced once each with ORKCatalog and ORKTest, but we have not been able to reproduce consistently enough to determine root cause.

[Review step] API design

rdar://problem/19220394

Participants should be able to review the data they've entered into ResearchKit apps. This issue is for designing an API for supporting this in ResearchKit.

We'd like to have a review step that could be placed at the end of a survey task, which would allow the user to review their answers. This would take the form of a table view, with roughly one row per answer. It might make sense to make each step a section, so that all the answers in a form come together in a single section.

Tapping on an answer should allow the user to jump to that answer. Supporting this jump will require modifications to ORKTaskViewController, and may also require changes to the ORKTask protocol. We're open to suggestions on how exactly the "jump" should work, but a secondary modal presentation is unlikely to be the right answer.

The review step should also be usable stand-alone. For instance, an app might store both the task the user completed, and the results of that task. By restoring those, and attaching them to the review step, it should be possible to allow review of their data in a new, entirely separate task.

See also #90 and #91 for follow-on tasks.

[iPad] Visual metrics for iPad

  • Add ORKScreenTypeiPad and create visual metrics for iPad in ORKSkin.
    Make UI elements on iPad not stay on the top and leave bottom half empty. Instead, make the vertical alignment more vertically centered, like in the initial setup of a new iPad

img_0005

img_0003

  • The size of the consent signature area needs to be adjusted. It would look better if we increase the height and reduce the width of this area on both iPad and iPhone 6+.

screen shot 2015-04-21 at 16 00 26

Revise all 'updateConstraints' implementations

Some updateConstraints implementations may be accumulating duplicate constraints. They also need to call [super updateConstraints] last, but some of them call it early. Revise this.

See comments here for more details.

taskViewController(_:shouldPresentStep:) crashes in Swift

In this delegate method:

func taskViewController(taskViewController: ORKTaskViewController, shouldPresentStep step: ORKStep) -> Bool {
    // use step
}

step is guaranteed by the method signature to be non-nil, and crashes when using step if it's not. But this method has many code paths that can return nil:

- (ORKStep *)stepAfterStep:(ORKStep *)step withResult:(ORKTaskResult *)result {
    NSArray *steps = _steps;

    if (steps.count <= 0) {
        return nil;
    }

    ORKStep *currentStep = step;
    ORKStep *nextStep = nil;

    if (currentStep == nil) {
        nextStep = steps[0];
    } else {
        NSUInteger index = [self indexOfStep:step];

        if (NSNotFound != index && index != (steps.count-1)) {
            nextStep = steps[index+1];
        }
    }
    return nextStep;
}

One possible workaround would be to wrap [ORKTaskViewController -shouldPresentStep:] in an if (step) {…}.

[iPad] Make HealthKit optional

HealthKit is not available on iPad. Make HealthKit optional in ResearchKit by making all use of HealthKit features conditional on HealthKit framework being present.

[iPad] Add horizontal side margins to tableviews for iPad

In the iPad introductory screens, table views have horizontal margins of 115pt on each side. For ResearchKit, we would like to apply the same margins for table views and in fact probably most other vertically scrolling content as well.

Example:

img_0003

Rotation issues in consent views

If you rotate the iPhone 6 from portrait to landscape in the mid of the consent visual views:

  • Screen layout doesn't update, scrolling is not enabled, and the next button cannot be seen. If you go to the previous screen, the layout updates.
  • When the layout updates after switching screens, the video animation view layout is not updated, so the animation and the static images no longer match.

Happens in stable as well.

ORKTest should include a test of repeated identifiers in a task

If a task repeats the same question multiple times with the same identifier, there should be just one reported result from the task, that should include the most recent value entered.

The intermediate results reported during the task should also be accurate for each time the same identifier was presented.

We have had reports that this does not work correctly; this task is to investigate, add a test case for it in ORKTest, and fix the issue (if any).

[Review step] Implementation of review step

rdar://problem/19220394

Participants should be able to review the data they've entered into RK apps. This issues is for implementing the review step, following on from #89 (API design)

We'd like to have a review step that could be placed at the end of a survey task, which would allow the user to review their answers. This would take the form of a table view, with roughly one row per answer. It might make sense to make each step a section, so that all the answers in a form come together in a single section.

Tapping on an answer should allow the user to jump to that answer. Supporting this jump will require modifications to ORKTaskViewController, and may also require changes to the ORKTask protocol. We're open to suggestions on how exactly the "jump" should work, but a secondary modal presentation is unlikely to be the right answer.

The review step should also be usable stand-alone. For instance, an app might store both the task the user completed, and the results of that task. By restoring those, and attaching them to the review step, it should be possible to allow review of their data in a new, entirely separate task.

Active task exiting after step 3

I am testing the use of active tasks with something like this:

let fitnessTask = ORKOrderedTask.fitnessCheckTaskWithIdentifier("fitness", intendedUseDescription: "description", walkDuration: NSTimeInterval(360), restDuration: NSTimeInterval(60), options: ORKPredefinedTaskOption.None)
let taskViewController = ORKTaskViewController(task: fitnessTask, taskRunUUID: nil)
taskViewController.delegate = self
presentViewController(taskViewController, animated: true, completion: nil)

After reaching step 3 where there is a countdown to the start of the activity, I hear the audio instructions saying "after six minutes ...". The app then returns to the screen where the app was launched from, effectively exiting the ResearchKit flow of screens.

I am using the emulator that comes with xcode. These messages are written to the console:
2015-04-27 14:14:42.531 body-atlas[24728:789974] -[ORKTaskViewController showViewController:goForward:animated:] 901 <ORKTaskViewController: 0x7f84e3de6f40> <ORKInstructionStepViewController: 0x7f84e3cc7ca0>

2015-04-27 14:14:42.535 body-atlas[24728:789974] -[ORKStepViewController viewWillAppear:] 139 <ORKInstructionStepViewController: 0x7f84e3cc7ca0>

2015-04-27 14:14:42.536 body-atlas[24728:789974] __63-[ORKTaskViewController showViewController:goForward:animated:]_block_invoke598 918 <ORKTaskViewController: 0x7f84e3de6f40> <ORKInstructionStepViewController: 0x7f84e3cc7ca0>

2015-04-27 14:14:43.570 body-atlas[24728:789974] -[ORKTaskViewController showViewController:goForward:animated:] 901 <ORKTaskViewController: 0x7f84e3de6f40> <ORKInstructionStepViewController: 0x7f84e3da0300>

2015-04-27 14:14:43.594 body-atlas[24728:789974] -[ORKStepViewController viewWillAppear:] 139 <ORKInstructionStepViewController: 0x7f84e3da0300>

2015-04-27 14:14:43.878 body-atlas[24728:789974] __63-[ORKTaskViewController showViewController:goForward:animated:]_block_invoke598 918 <ORKTaskViewController: 0x7f84e3de6f40> <ORKInstructionStepViewController: 0x7f84e3da0300>

2015-04-27 14:14:44.254 body-atlas[24728:789974] -[ORKActiveStepViewController prepareStep] 260 <ORKCountdownStepViewController: 0x7f84e3fb84f0>

2015-04-27 14:14:44.254 body-atlas[24728:789974] -[ORKActiveStepViewController prepareStep] 260 <ORKCountdownStepViewController: 0x7f84e3fb84f0>

2015-04-27 14:14:44.254 body-atlas[24728:789974] -[ORKTaskViewController startAudioPromptSessionWithError:] 570 *** Started audio session

2015-04-27 14:14:44.257 body-atlas[24728:789974] __66-[ORKTaskViewController requestHealthAuthorizationWithCompletion:]_block_invoke_2 466 Requesting health access

2015-04-27 14:14:44.260 body-atlas[24728:790259] __82-[ORKTaskViewController requestHealthStoreAccessWithReadTypes:writeTypes:handler:]_block_invoke 365 Health access: error=Error Domain=com.apple.healthkit Code=4 "Missing com.apple.developer.healthkit entitlement." UserInfo=0x7f84e3cd1840 {NSLocalizedDescription=Missing com.apple.developer.healthkit entitlement.}

2015-04-27 14:14:44.260 body-atlas[24728:789974] __66-[ORKTaskViewController requestHealthAuthorizationWithCompletion:]_block_invoke382 479 Requesting pedometer access

2015-04-27 14:14:44.263 body-atlas[24728:789974] __66-[ORKTaskViewController requestHealthAuthorizationWithCompletion:]_block_invoke406 509 Requesting location access

2015-04-27 14:14:44.265 body-atlas[24728:789974] -[ORKTaskViewController startAudioPromptSessionWithError:] 570 *** Started audio session

2015-04-27 14:14:44.266 body-atlas[24728:789974] -[ORKTaskViewController showViewController:goForward:animated:] 901 <ORKTaskViewController: 0x7f84e3de6f40> <ORKCountdownStepViewController: 0x7f84e3fb84f0>

2015-04-27 14:14:44.272 body-atlas[24728:789974] -[ORKActiveStepViewController prepareStep] 260 <ORKCountdownStepViewController: 0x7f84e3fb84f0>

2015-04-27 14:14:44.294 body-atlas[24728:789974] -[ORKStepViewController viewWillAppear:] 139 <ORKCountdownStepViewController: 0x7f84e3fb84f0>

2015-04-27 14:14:44.294 body-atlas[24728:789974] -[ORKActiveStepViewController viewWillAppear:] 147 <ORKCountdownStepViewController: 0x7f84e3fb84f0>

2015-04-27 14:14:44.578 body-atlas[24728:789974] -[ORKActiveStepViewController viewDidAppear:] 155 <ORKCountdownStepViewController: 0x7f84e3fb84f0>

2015-04-27 14:14:44.579 body-atlas[24728:789974] __63-[ORKTaskViewController showViewController:goForward:animated:]_block_invoke598 918 <ORKTaskViewController: 0x7f84e3de6f40> <ORKCountdownStepViewController: 0x7f84e3fb84f0>

2015-04-27 14:14:44.582 body-atlas[24728:789974] -[ORKActiveStepViewController start] 304 <ORKCountdownStepViewController: 0x7f84e3fb84f0>

2015-04-27 14:14:49.625 body-atlas[24728:789974] -[ORKActiveStepViewController finish] 358 <ORKCountdownStepViewController: 0x7f84e3fb84f0>

2015-04-27 14:14:49.626 body-atlas[24728:789974] -[ORKActiveStepViewController prepareStep] 260 <ORKFitnessStepViewController: 0x7f84e3de9af0>

2015-04-27 14:14:49.626 body-atlas[24728:789974] -[ORKActiveStepViewController prepareStep] 260 <ORKFitnessStepViewController: 0x7f84e3de9af0>

2015-04-27 14:14:49.627 body-atlas[24728:789974] -[ORKTaskViewController showViewController:goForward:animated:] 901 <ORKTaskViewController: 0x7f84e3de6f40> <ORKFitnessStepViewController: 0x7f84e3de9af0>

2015-04-27 14:14:49.630 body-atlas[24728:789974] -[ORKActiveStepViewController prepareStep] 260 <ORKFitnessStepViewController: 0x7f84e3de9af0>

2015-04-27 14:14:49.655 body-atlas[24728:789974] -[ORKStepViewController viewWillAppear:] 139 <ORKFitnessStepViewController: 0x7f84e3de9af0>

2015-04-27 14:14:49.655 body-atlas[24728:789974] -[ORKActiveStepViewController viewWillAppear:] 147 <ORKFitnessStepViewController: 0x7f84e3de9af0>

2015-04-27 14:14:49.655 body-atlas[24728:789974] -[ORKActiveStepViewController viewWillDisappear:] 170 <ORKCountdownStepViewController: 0x7f84e3fb84f0>

2015-04-27 14:14:49.656 body-atlas[24728:789974] -[ORKActiveStepViewController suspend] 333 <ORKCountdownStepViewController: 0x7f84e3fb84f0>

2015-04-27 14:14:49.938 body-atlas[24728:789974] -[ORKActiveStepViewController viewDidAppear:] 155 <ORKFitnessStepViewController: 0x7f84e3de9af0>

2015-04-27 14:14:49.938 body-atlas[24728:789974] __63-[ORKTaskViewController showViewController:goForward:animated:]_block_invoke598 918 <ORKTaskViewController: 0x7f84e3de6f40> <ORKFitnessStepViewController: 0x7f84e3de9af0>

2015-04-27 14:14:49.942 body-atlas[24728:789974] -[ORKActiveStepViewController start] 304 <ORKFitnessStepViewController: 0x7f84e3de9af0>

2015-04-27 14:14:49.944 body-atlas[24728:789974] -[ORKActiveStepViewController viewWillDisappear:] 170 <ORKFitnessStepViewController: 0x7f84e3de9af0>

2015-04-27 14:14:49.944 body-atlas[24728:789974] -[ORKActiveStepViewController suspend] 333 <ORKFitnessStepViewController: 0x7f84e3de9af0>

I am using swift with the latest version of xcode. Also when I deploy this app to an actual iPhone, the same thing occurs - it also exits after step 3.

Thanks in advance for your help.

Task list

We think that maintaining a list of tasks, and scheduling when they need to occur, is going to be common to apps using ResearchKit.

AppCore has a task list for seeing today's tasks, tracking which have been done, and launching them (see APCActivitiesViewController). A view controller for presenting a list of pending tasks (which might be the same as the list of scheduled tasks), as well as the recently completed tasks, might be a useful addition to ResearchKit.

This task is to review the AppCore activities list, and propose how to incorporate into ResearchKit.

See also #93

Scale answer format support in form items

So you can have an array of scale questions on a form.

  • Form items can have section headers, each scale should occupy one section.
  • Question text will be displayed as section header

Add version tags

I think it would be very useful to start tagging “versions” of the framework.

It would be useful to keep track of the progress being made, new features/tasks being added, and would facilitate a lot of things going forward.

I’m not sure if keeping track of the versions from the framework itself would be interesting, but having at least Git tags seems very important to me. It’s also basically mandatory for CocoaPods, and other similar dependencies managers.

git tag 1.0
git tag push --tags

Add option to include signatures in HTML consent review

In the HTML consent review, one @ekhall submitted a PR #111 to include signatures in the HTML consent review. The PR was rejected, but this is not a bad idea. There are two ways of doing it: 1) making the HTML accept a template, and define certain templated elements like {{signature}} to place signatures directly in your own HTML. 2) Appending the same signature HTML from the standard consent.

[iPad] Make visual assets bigger on iPad

In active tasks and consent the visual assets look a bit small. Experiment with whether the @3x assets could be repurposed at @2x for iPad to get 150% size increase. Also adjust RKSkin layout metrics to match, if necessary.

Example:
img_0005

Why do you use UIPageViewController inside UINavigationController?

I noticed that ORKTaskViewController uses following hierarchy of view controllers:

ORKTaskViewController
  UINavigationController
    UIPageViewController
      ORKStepViewController

I wonder why don't just simplify the code and throw away page view controller? You can push step view controllers in navigation controller in a similar way.

Audio predefined task: audio step should not show too loud if outputdir is nil and developer ignored the error

rdar://problem/20503028

Currently, if the output directory is nil, we report an error to the developer via the task view controller delegate. If the developer does not handle the error, the task continues, and the audio recorder setup fails, which results in the audio showing as "too loud".

Instead, the audio step view should display some kind of error state to indicate that there was an error setting up audio. This should be a useful prompt to the developer to do some error handling - though we hope users will never see it.

Unexpected paging in ORKHTMLPDFWriter

Current implementation of ORKHTMLPDFWriter produces unexpected page breaks, if input HTML has center / right aligned content.

Example of problematic HTML:

NSMutableString* html = [NSMutableString string];
[html appendString:@"<html><body>"];
for (int i=0; i<200; i++) {
    [html appendString:@"<div align=\"right\">line</div>"];
}
[html appendString:@"</body></html>"];

PDF created from this HTML will have unexpectedly large bottom margin.

Upon further investigation I found out that this issue is most likely caused by [UIWebView viewPrintFormatter], however I could not find any solution / workaround for this.

ORKRecorderConfiguration and ORKRecorder should have an identifier

The aim is to let recorder generated result object has a meaningful identifier which can be used to link back to the ORKRecorderConfiguration object.

  • The identifier will be passed from ORKRecorderConfiguration to ORKRecorder.
  • The identifier is like ORKStep identifier which is supplied by developer.

Add image answer format to capture image in a question step

Some researchers are interested in developing medical research apps that require access to the camera and save images in high resolution.

  • Create an image answer format class which could have a few attributes like: resolution, flash light, and output format.
  • Design a question step UI interface to capture an image and display it to the user.
  • ORKFileResult should be used to return the image file reference.

Task scheduling

We think that maintaining a list of tasks, and scheduling when they need to occur, is going to be common to apps using ResearchKit.

AppCore has a task scheduling component, which stores schedules for tasks in a CoreData database. Schedules are defined with cron-like expressions. It interacts with a particular back-end service to obtain schedules, and then stores and applies these schedules. See APCTasksReminderManager, APCScheduler, etc.

This task is to review the AppCore task scheduler, and propose how to generalize it for ResearchKit in a way that's more agnostic to the back-end, and can function using local notifications only.

Note that work is continuing on AppCore at the moment to improve support for offsets for the starting point of schedules, and better control of "grace periods" (how long after a scheduled event time the user has to respond).

Unit tests required!

See also #94

Fitness task step images change position after transition

When transitioning to a an ORKFitnessStep's from a previous one. The image (if any) moves to a higher position after the transition finishes. This causes a visual glitch.

This happens on iPhone 5 and 6 screen sizes. iPhone 4 screen size is not affected. It happens on stable as well, so it isn't a recent regression.

Serialize ORKResult object tree into JSON

I have a working ResearchKit app, except I'm having trouble serializing the results ORKResult, ORKStepResult, etc. into JSON to upload to a server.

I see in the ORKResult docs that this isn't supported:

When you receive a result, you can store it temporarily by archiving it with NSKeyedArchiver, because all ORKResult objects implement NSSecureCoding. If you want to serialize the result object to other formats, you’re responsible for implementing this.

So, I guess I can get this to JSON like so:

  • ORKResult -> NSData via NSKeyedArchiver
  • NSData -> NSDictionary via NSPropertyListSerialization
  • NSDictionary -> JSON via NSJSONSerialization

But then I get all of NSKeyedArchiver's stuff, and it doesn't really seem optimal.

Is there a better way, perhaps adapting ORKJSONLogFormatter (which I haven't fully reviewed, but looks like it's written for logging non-survey results)?

I know JSON isn't ideal for all applications, but it would be great for some.

As a bonus, this feature could make implementing debugDescription methods on the result objects easy, which could aid in debugging.

Extend ORKOrderedTask to include navigation rules

Either subclass ORKOrderedTask, or extend it, to include navigation rules.

A navigation rule would be something which can be asked if it matches the current step. If it matches the current step, then if provided with the results of the task to date, it should provide the step identifier for the next step. A concrete navigation rule class might be one checks if the result is equal to a particular question result. Although a block might be nicer, it would not be possible to serialize, so we prefer direct equality checks for now. A future generalization might be the use of predicates.

Any navigation rule classes should be serializable with NSSecureCoding, and serialization support in ORKESerialization in the ORKTest project would also be appropriate.

This task is to propose suitable API, implement, and ideally write unit tests.

Can't sign consent in landscape on iPhone 6

If my iPhone 6 is in landscape when the ORKConsentReviewStep appears, the view is too short vertically, which causes vertical scrolling behavior. This makes it impossible to sign.

If I rotate to portrait, then back to landscape, the issue persists.

If I rotate to portrait, sign the form, then back to landscape, the issue no longer persists.

Validation checks in ORKOrderedTask and ORKFormStep for identifier's uniqueness

rdar://problem/20430177

In a simple ordered task, or in a form step, the identifier is used to identify the result of a question or form item. Validation code already exists for steps and tasks; that validation should be extended in the case of ORKOrderedTask and ORKFormStep to verify that the identifiers of their items are unique.

A unit test to verify the validation behavior would be nice too!

Visual consent screens should be scrollable

Currently, scrolling is disabled on visual consent screens.

When the consent content is taller than the screen, we should allow vertical scroll (a scroll view is already present, so enabling scrolling itself will be easy).

The difficulty is that the animation between consecutive screens needs to work, and the animation itself is played in a view that is overlaid on top of the view of the VC managing the transition. When a transition is required, we should scroll to the top first, then navigate. Scrolling to the top first is only necessary for forward navigation, since animations are only applied on forward navigation and not on backward navigation in visual consent.

If you have an idea for a different work-around, happy to hear it.

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.