Skip to content
This repository was archived by the owner on Dec 22, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions Assignment Two.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/* Begin PBXBuildFile section */
63A3CE7CD4FC0CCD0333F867 /* Pods_Assignment_Two.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7DE9A4430C3A45320910A5E /* Pods_Assignment_Two.framework */; };
8E0A956625B6767B0025461E /* CKTaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E0A956525B6767B0025461E /* CKTaskViewController.swift */; };
8E0A956925B677950025461E /* RKTaskSamples.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E0A956825B677950025461E /* RKTaskSamples.swift */; };
8E0A956925B677950025461E /* GeneralPatientQuestionnaire.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E0A956825B677950025461E /* GeneralPatientQuestionnaire.swift */; };
8E35408925B8FE3A007B7029 /* SurveyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E35408825B8FE3A007B7029 /* SurveyView.swift */; };
8E35408D25B8FFC9007B7029 /* RoundedTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E35408C25B8FFC9007B7029 /* RoundedTextView.swift */; };
8E35409625B90E80007B7029 /* ORKESerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E35409425B90E80007B7029 /* ORKESerialization.m */; };
Expand All @@ -20,12 +20,14 @@
8EF8F77D2597C7DE000850BF /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8EF8F77C2597C7DE000850BF /* ContentView.swift */; };
8EF8F77F2597C7E1000850BF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8EF8F77E2597C7E1000850BF /* Assets.xcassets */; };
8EF8F7822597C7E1000850BF /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8EF8F7812597C7E1000850BF /* Preview Assets.xcassets */; };
FD472A5425BFC1F400F6A49A /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = FD472A5325BFC1F400F6A49A /* GoogleService-Info.plist */; };
FD472A5A25BFC75400F6A49A /* MedicationQuestionnaire.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD472A5925BFC75400F6A49A /* MedicationQuestionnaire.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
4483BDF88A5E2878F34C059F /* Pods-Assignment Two.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Assignment Two.release.xcconfig"; path = "Target Support Files/Pods-Assignment Two/Pods-Assignment Two.release.xcconfig"; sourceTree = "<group>"; };
8E0A956525B6767B0025461E /* CKTaskViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CKTaskViewController.swift; sourceTree = "<group>"; };
8E0A956825B677950025461E /* RKTaskSamples.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RKTaskSamples.swift; sourceTree = "<group>"; };
8E0A956825B677950025461E /* GeneralPatientQuestionnaire.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralPatientQuestionnaire.swift; sourceTree = "<group>"; };
8E35408825B8FE3A007B7029 /* SurveyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SurveyView.swift; sourceTree = "<group>"; };
8E35408C25B8FFC9007B7029 /* RoundedTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoundedTextView.swift; sourceTree = "<group>"; };
8E35409325B90E7F007B7029 /* Assignment Two-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Assignment Two-Bridging-Header.h"; sourceTree = "<group>"; };
Expand All @@ -42,6 +44,8 @@
8EF8F7812597C7E1000850BF /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
8EF8F7832597C7E1000850BF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
E7DE9A4430C3A45320910A5E /* Pods_Assignment_Two.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Assignment_Two.framework; sourceTree = BUILT_PRODUCTS_DIR; };
FD472A5325BFC1F400F6A49A /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
FD472A5925BFC75400F6A49A /* MedicationQuestionnaire.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MedicationQuestionnaire.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -100,6 +104,7 @@
8EF8F76E2597C7DE000850BF = {
isa = PBXGroup;
children = (
FD472A5325BFC1F400F6A49A /* GoogleService-Info.plist */,
8EF8F7792597C7DE000850BF /* Assignment Two */,
8EF8F7782597C7DE000850BF /* Products */,
BC78C6756808D892DF11E798 /* Pods */,
Expand All @@ -123,7 +128,8 @@
8E35408B25B8FEF2007B7029 /* Views */,
8EF8F77A2597C7DE000850BF /* Assignment_TwoApp.swift */,
8E35409825B90F1B007B7029 /* RKTaskDelegate.swift */,
8E0A956825B677950025461E /* RKTaskSamples.swift */,
8E0A956825B677950025461E /* GeneralPatientQuestionnaire.swift */,
FD472A5925BFC75400F6A49A /* MedicationQuestionnaire.swift */,
);
path = "Assignment Two";
sourceTree = "<group>";
Expand Down Expand Up @@ -215,6 +221,7 @@
files = (
8EF8F7822597C7E1000850BF /* Preview Assets.xcassets in Resources */,
8EF8F77F2597C7E1000850BF /* Assets.xcassets in Resources */,
FD472A5425BFC1F400F6A49A /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -268,14 +275,15 @@
buildActionMask = 2147483647;
files = (
8E8775DD25B8F8B800AB350A /* HeaderView.swift in Sources */,
8E0A956925B677950025461E /* RKTaskSamples.swift in Sources */,
8E0A956925B677950025461E /* GeneralPatientQuestionnaire.swift in Sources */,
8E35409D25B90F7A007B7029 /* CKStudyUser.swift in Sources */,
8E35408925B8FE3A007B7029 /* SurveyView.swift in Sources */,
8EF8F77D2597C7DE000850BF /* ContentView.swift in Sources */,
8E35408D25B8FFC9007B7029 /* RoundedTextView.swift in Sources */,
8E35409625B90E80007B7029 /* ORKESerialization.m in Sources */,
8E0A956625B6767B0025461E /* CKTaskViewController.swift in Sources */,
8EF8F77B2597C7DE000850BF /* Assignment_TwoApp.swift in Sources */,
FD472A5A25BFC75400F6A49A /* MedicationQuestionnaire.swift in Sources */,
8E35409925B90F1B007B7029 /* RKTaskDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -408,15 +416,15 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"Assignment Two/Preview Content\"";
DEVELOPMENT_TEAM = CQRZ4E7K9U;
DEVELOPMENT_TEAM = Z7SA65KY4V;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = "Assignment Two/Supporting Files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "edu.stanford.cs342.Assignment-Two";
PRODUCT_BUNDLE_IDENTIFIER = "edu.stanford.cs342.Assignment-Two-CCH";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Assignment Two/Supporting Files/Assignment Two-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -434,15 +442,15 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"Assignment Two/Preview Content\"";
DEVELOPMENT_TEAM = CQRZ4E7K9U;
DEVELOPMENT_TEAM = Z7SA65KY4V;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = "Assignment Two/Supporting Files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "edu.stanford.cs342.Assignment-Two";
PRODUCT_BUNDLE_IDENTIFIER = "edu.stanford.cs342.Assignment-Two-CCH";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Assignment Two/Supporting Files/Assignment Two-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down
104 changes: 104 additions & 0 deletions Assignment Two/GeneralPatientQuestionnaire.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
//
// StudyTasks.swift
//
// Created for Biodesign's CS342
// Copyright © 2019 Stanford University.
// All rights reserved.
//

import ResearchKit

/**
This file contains some sample `ResearchKit` tasks
that you can modify and use throughout your project!
*/
struct GeneralPatientQuestionnaire {

/**
Sample task template!
*/
static let form: ORKOrderedTask = {
var steps = [ORKStep]()

/*
CS342 -- ASSIGNMENT 2
Add steps to the array above to create a survey!
*/

// Introduction
let instructionStep = ORKInstructionStep(identifier: "Introstep")
instructionStep.title = "SF-12 Patient Questionnaire"
instructionStep.text = "Welcome"
instructionStep.image = UIImage(named: "doctor")
instructionStep.detailText = "This information will help your doctors keep track of how you feel and how well you are able to do your usual activities. If you are unsure about how to answer a question, please give the best answer you can."
steps.append(instructionStep)

// Q1
let firstStepAnswerFormat = ORKAnswerFormat.scale(withMaximumValue: 5, minimumValue: 1, defaultValue: 3, step: 1, vertical: false, maximumValueDescription: "Excellent", minimumValueDescription: "Poor")
let firstStep = ORKQuestionStep(identifier: "SF-12-1", title: "Patient Questionnaire", question: "In general, how would you describe your health?", answer: firstStepAnswerFormat)
steps.append(firstStep)

// Q2
let secondStepAnswerFormat = ORKAnswerFormat.scale(withMaximumValue: 3, minimumValue: 1, defaultValue: 2, step: 1, vertical: false, maximumValueDescription: "Limited a lot", minimumValueDescription: "Not limited at all")
let secondStep = ORKQuestionStep(identifier: "SF-12-2", title: "Activites", question: "To what extent does your health limit you in moderate activities, such as moving a table, pushing a vacuum cleaner, or playing golf?", answer: secondStepAnswerFormat)
steps.append(secondStep)

// Q3
let thirdStepAnswerFormat = ORKAnswerFormat.scale(withMaximumValue: 3, minimumValue: 1, defaultValue: 2, step: 1, vertical: false, maximumValueDescription: "Limited a lot", minimumValueDescription: "Not limited at all")
let thirdStep = ORKQuestionStep(identifier: "SF-12-3", title: "Activites", question: "To what extent does your health limit you walking up several flights of stairs consecutively?", answer: thirdStepAnswerFormat)
steps.append(thirdStep)

// Q4
let fourthStepAnswerFormat = ORKAnswerFormat.booleanAnswerFormat()
let fourthStep = ORKQuestionStep(identifier: "SF-12-4", title: "Activities", question: "During the past four weeks, have you accomplished less than you would like due to your physical health?", answer: fourthStepAnswerFormat)
steps.append(fourthStep)

// Q5
let fifthStepAnswerFormat = ORKAnswerFormat.booleanAnswerFormat()
let fifthStep = ORKQuestionStep(identifier: "SF-12-5", title: "Activities", question: "During the past four weeks, have you been limited in the kind of work or activities you can undertake by your physical health?", answer: fifthStepAnswerFormat)
steps.append(fifthStep)

// Q6
let sixthStepAnswerFormat = ORKAnswerFormat.booleanAnswerFormat()
let sixthStep = ORKQuestionStep(identifier: "SF-12-6", title: "Activities", question: "During the past four weeks, have you accomplished less than you would like due to emotional problems?", answer: sixthStepAnswerFormat)
steps.append(sixthStep)

// Q7
let seventhStepAnswerFormat = ORKAnswerFormat.booleanAnswerFormat()
let seventhStep = ORKQuestionStep(identifier: "SF-12-7", title: "Activities", question: "During the past four weeks, did you perform work or activities less carefully than usual due to emotional problems?", answer: seventhStepAnswerFormat)
steps.append(seventhStep)

// Q8
let eighthStepAnswerFormat = ORKAnswerFormat.scale(withMaximumValue: 5, minimumValue: 1, defaultValue: 3, step: 1, vertical: false, maximumValueDescription: "Extremely", minimumValueDescription: "Not at all")
let eighthStep = ORKQuestionStep(identifier: "SF-12-8", title: "Pain", question: "During the last four weeks, how much did pain interfere with your normal work (including both housework and work outside the home)?", answer: eighthStepAnswerFormat)
steps.append(eighthStep)

// Q9
let ninthStepAnswerFormat = ORKAnswerFormat.scale(withMaximumValue: 6, minimumValue: 1, defaultValue: 3, step: 1, vertical: false, maximumValueDescription: "All of the time", minimumValueDescription: "None of the time")
let ninthStep = ORKQuestionStep(identifier: "SF-12-9", title: "Emotions", question: "During the last four weeks, how often have you felt calm and peaceful?", answer: ninthStepAnswerFormat)
steps.append(ninthStep)

// Q10
let tenthStepAnswerFormat = ORKAnswerFormat.scale(withMaximumValue: 6, minimumValue: 1, defaultValue: 3, step: 1, vertical: false, maximumValueDescription: "All of the time", minimumValueDescription: "None of the time")
let tenthStep = ORKQuestionStep(identifier: "SF-12-10", title: "Emotions", question: "During the last four weeks, how often have you had a lot of energy?", answer: tenthStepAnswerFormat)
steps.append(tenthStep)

// Q11
let eleventhStepAnswerFormat = ORKAnswerFormat.scale(withMaximumValue: 6, minimumValue: 1, defaultValue: 3, step: 1, vertical: false, maximumValueDescription: "All of the time", minimumValueDescription: "None of the time")
let eleventhStep = ORKQuestionStep(identifier: "SF-12-11", title: "Emotions", question: "During the last four weeks, how often have you felt downhearted and blue?", answer: eleventhStepAnswerFormat)
steps.append(eleventhStep)

// Q12
let twelfthStepAnswerFormat = ORKAnswerFormat.scale(withMaximumValue: 6, minimumValue: 1, defaultValue: 3, step: 1, vertical: false, maximumValueDescription: "All of the time", minimumValueDescription: "None of the time")
let twelfthStep = ORKQuestionStep(identifier: "SF-12-12", title: "Emotions", question: "During the last four weeks, how often has your physical health or emotional problems interfered with your social activities (like visiting with friends, relatives, etc.)?", answer: twelfthStepAnswerFormat)
steps.append(twelfthStep)

let summaryStep = ORKInstructionStep(identifier: "SummaryStep")
summaryStep.title = "SF-12 Complete"
summaryStep.text = "Thank you for completing the survey."
summaryStep.image = UIImage(named: "Portrait")
steps.append(summaryStep)

return ORKOrderedTask(identifier: "GeneralPatientQuestionnaire", steps: steps)
}()
}
Loading