Skip to content

Commit

Permalink
Added BudiSurvey
Browse files Browse the repository at this point in the history
  • Loading branch information
lina-fang committed Jan 30, 2022
1 parent d492e89 commit 76f086b
Show file tree
Hide file tree
Showing 11 changed files with 128 additions and 43 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified CardinalKit/.DS_Store
Binary file not shown.
Binary file modified CardinalKit/CardinalKit-Example/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
1D6A5A01279E5FD900184D5F /* MoodSurvey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D6A5A00279E5FD900184D5F /* MoodSurvey.swift */; };
1D6A5A01279E5FD900184D5F /* BudiSurvey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D6A5A00279E5FD900184D5F /* BudiSurvey.swift */; };
27653A13272A2E7700D74E83 /* LocalTaskListItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27653A12272A2E7700D74E83 /* LocalTaskListItemView.swift */; };
2B19DD9226FE1BEB00649CE1 /* JsonToSurvey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B19DD9126FE1BEB00649CE1 /* JsonToSurvey.swift */; };
2B19DD9426FE1D2600649CE1 /* TestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B19DD9326FE1D2600649CE1 /* TestViewController.swift */; };
Expand Down Expand Up @@ -109,7 +109,7 @@
/* Begin PBXFileReference section */
032F303C2A05A5F1C23F25B1 /* Pods-CardinalKit_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CardinalKit_Example.debug.xcconfig"; path = "Target Support Files/Pods-CardinalKit_Example/Pods-CardinalKit_Example.debug.xcconfig"; sourceTree = "<group>"; };
07D78DA16FC9C3C7709EA243 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
1D6A5A00279E5FD900184D5F /* MoodSurvey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoodSurvey.swift; sourceTree = "<group>"; };
1D6A5A00279E5FD900184D5F /* BudiSurvey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BudiSurvey.swift; sourceTree = "<group>"; };
1FA79795EFBE53D3F8311C90 /* Pods-CardinalKit_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CardinalKit_Example.release.xcconfig"; path = "Target Support Files/Pods-CardinalKit_Example/Pods-CardinalKit_Example.release.xcconfig"; sourceTree = "<group>"; };
270AF36127872C13002945A7 /* CardinalKit_ExampleRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = CardinalKit_ExampleRelease.entitlements; sourceTree = "<group>"; };
27653A12272A2E7700D74E83 /* LocalTaskListItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalTaskListItemView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -483,7 +483,7 @@
8E7FFFBC25DE38E4002982B4 /* CoffeeChartDataSource.swift */,
8E0A4391244A4A0400656518 /* LocalTaskItem.swift */,
2BD5328426C30F2E00C4636E /* CloudTaskItem.swift */,
1D6A5A00279E5FD900184D5F /* MoodSurvey.swift */,
1D6A5A00279E5FD900184D5F /* BudiSurvey.swift */,
);
path = Model;
sourceTree = "<group>";
Expand Down Expand Up @@ -736,7 +736,7 @@
8E6E1E2E25353A1E0024B8DF /* PatientIDView.swift in Sources */,
8E6E1E0B2534FF640024B8DF /* OnboardingViewController+Coordinator.swift in Sources */,
8E40DC042471E5940027536B /* CKNetworkManager.swift in Sources */,
1D6A5A01279E5FD900184D5F /* MoodSurvey.swift in Sources */,
1D6A5A01279E5FD900184D5F /* BudiSurvey.swift in Sources */,
8EA664B025941A4D00B6A45A /* SurveyItemViewController.swift in Sources */,
8E9CDEBA2591843200C8A228 /* CKConfig.swift in Sources */,
2F94C5F22536543600DF8866 /* SceneDelegate+CardinalKit.swift in Sources */,
Expand Down
Binary file not shown.
Binary file modified CardinalKit/CardinalKit-Example/CardinalKit/.DS_Store
Binary file not shown.
Binary file modified CardinalKit/CardinalKit-Example/CardinalKit/Components/.DS_Store
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
//
// MoodSurvey.swift
// CardinalKit_Example
//
// Created by Lina Fang on 23.01.22.
// Copyright © 2022 CocoaPods. All rights reserved.
//

import ResearchKit
import Foundation

struct BudiSurvey {

static let budiSurvey: ORKOrderedTask = {
var steps = [ORKStep]()

// Q1
let textChoiceQ1aAnswerFormat = ORKTextAnswerFormat.textAnswerFormat()
let textStepQ1a = ORKQuestionStep(identifier: "Q1aQuestionStep", title: "Question #1", question: "What is your first name?", answer: textChoiceQ1aAnswerFormat)

steps += [textStepQ1a]

let textChoiceQ1bAnswerFormat = ORKTextAnswerFormat.textAnswerFormat()
let textStepQ1b = ORKQuestionStep(identifier: "Q1bQuestionStep", title: "Question #1", question: "What is your last name?", answer: textChoiceQ1bAnswerFormat)

steps += [textStepQ1b]

// Q2
let textChoiceQ2AnswerFormat = ORKDateAnswerFormat.dateAnswerFormat()
let textStepQ2 = ORKQuestionStep(identifier: "Q2QuestionStep", title: "Question #2", question: "Please enter your birthday.", answer: textChoiceQ2AnswerFormat)

steps += [textStepQ2]


// Q3
let textChoicesQ3 = [
ORKTextChoice(text: "Before preschool", value: 0 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Preschool", value: 1 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Pre-k", value: 2 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Kindergarten", value: 3 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Grades 1-12", value: 4 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Undergraduate", value: 5 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Graduate", value: 5 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Other", value: 5 as NSCoding & NSCopying & NSObjectProtocol),
]
let textChoiceQ3AnswerFormat = ORKAnswerFormat.valuePickerAnswerFormat(with: textChoicesQ3)
let textStepQ3 = ORKQuestionStep(identifier: "Q3QuestionStep", title: "Question #3", question: "What grade are you in?", answer: textChoiceQ3AnswerFormat)

steps += [textStepQ3]

// Q4
let textChoicesQ4 = [
ORKTextChoice(text: "Yes", value: 0 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "No", value: 1 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "I don't know", value: 2 as NSCoding & NSCopying & NSObjectProtocol)
]
let textChoiceQ4AnswerFormat = ORKAnswerFormat.choiceAnswerFormat(with: .singleChoice, textChoices: textChoicesQ4)
let textStepQ4 = ORKQuestionStep(identifier: "Q4QuestionStep", title: "Question #4", question: "Do you have a diagnosis of cerebral palsy?", answer: textChoiceQ4AnswerFormat)

steps += [textStepQ4]

// Q5
let textChoicesQ5 = [
ORKTextChoice(text: "Spastic", value: 0 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Dyskinetic", value: 1 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Ataxic", value: 2 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "I don't know", value: 3 as NSCoding & NSCopying & NSObjectProtocol)
]
let textChoiceQ5AnswerFormat = ORKAnswerFormat.choiceAnswerFormat(with: .multipleChoice, textChoices: textChoicesQ5)
let textStepQ5 = ORKQuestionStep(identifier: "Q5QuestionStep", title: "Question #5", question: "What type(s) of cerebral palsy do you have? (check all that apply)", answer: textChoiceQ5AnswerFormat)

steps += [textStepQ5]

// Q7
let textChoicesQ7 = [
ORKTextChoice(text: "Wheelchair", value: 0 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Walker", value: 1 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Orthotics", value: 2 as NSCoding & NSCopying & NSObjectProtocol)
]
let textChoiceQ7AnswerFormat = ORKAnswerFormat.choiceAnswerFormat(with: .multipleChoice, textChoices: textChoicesQ7)
let textStepQ7 = ORKQuestionStep(identifier: "Q7QuestionStep", title: "Question #7", question: "Do you use any assistive technology? (check all that apply)", answer: textChoiceQ7AnswerFormat)

steps += [textStepQ7]

// Q8

let textChoicesQ8 = [
ORKTextChoice(text: "Walking", value: 0 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Taking the stairs", value: 1 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Talking", value: 2 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Eating & Swallowing", value: 3 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Taking a shower", value: 4 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Going to the bathroom", value: 5 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Brushing my teeth", value: 6 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Texting & Using my phone", value: 7 as NSCoding & NSCopying & NSObjectProtocol),
ORKTextChoice(text: "Sleeping", value: 8 as NSCoding & NSCopying & NSObjectProtocol)
]
let textChoiceQ8AnswerFormat = ORKAnswerFormat.choiceAnswerFormat(with: .multipleChoice, textChoices: textChoicesQ8)
let textStepQ8 = ORKQuestionStep(identifier: "Q8QuestionStep", title: "Question #8", question: "What sorts of activities to you find difficult? (check all that apply)", answer: textChoiceQ8AnswerFormat)

steps += [textStepQ8]

// Summary

let summaryStep = ORKCompletionStep(identifier: "SummaryStep")
summaryStep.title = "Thank you!"
summaryStep.text = "We appreciate your time."

steps += [summaryStep]

return ORKOrderedTask(identifier: "MoodSurvey", steps: steps)

}()


}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ enum LocalTaskItem: Int {
sampleFunCoffeeResult,
sampleCoreMotionAppleWatch,
sampleLearnItem,
moodSurvey
budiSurvey

/*
* STEP (2) for each item, what should its
Expand All @@ -42,8 +42,8 @@ enum LocalTaskItem: Int {
return "Coffee Results"
case .sampleLearnItem:
return "About CardinalKit"
case .moodSurvey:
return "Mood Survey"
case .budiSurvey:
return "BUDI Survey"
}
}

Expand All @@ -64,8 +64,8 @@ enum LocalTaskItem: Int {
return "ResearchKit Charts"
case .sampleLearnItem:
return "Visit cardinalkit.org"
case .moodSurvey:
return "Assess your mood."
case .budiSurvey:
return "Tell us more about you."
}
}

Expand Down Expand Up @@ -96,7 +96,7 @@ enum LocalTaskItem: Int {
*/
var section: String {
switch self {
case .sampleResearchKitSurvey, .sampleResearchKitActiveTask, .moodSurvey:
case .sampleResearchKitSurvey, .sampleResearchKitActiveTask, .budiSurvey:
return "Current Tasks"
case .sampleFunCoffeeSurvey, .sampleFunCoffeeResult:
return "Your Interests"
Expand All @@ -123,8 +123,8 @@ enum LocalTaskItem: Int {
return AnyView(CoffeeUIView())
case .sampleLearnItem:
return AnyView(LearnUIView())
case .moodSurvey:
return AnyView(CKTaskViewController(tasks: MoodSurvey.moodSurvey))
case .budiSurvey:
return AnyView(CKTaskViewController(tasks: BudiSurvey.budiSurvey))
}
}

Expand Down

This file was deleted.

0 comments on commit 76f086b

Please sign in to comment.