├── README.md
└── hackpack-research
├── hackpack-research.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── hackpack-research.xcscmblueprint
│ └── xcuserdata
│ │ ├── joyhsu0504.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── olivia.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
└── xcuserdata
│ ├── joyhsu0504.xcuserdatad
│ └── xcschemes
│ │ ├── hackpack-research.xcscheme
│ │ └── xcschememanagement.plist
│ └── olivia.xcuserdatad
│ └── xcschemes
│ └── xcschememanagement.plist
└── hackpack-research
├── AppDelegate.swift
├── Assets.xcassets
└── AppIcon.appiconset
│ └── Contents.json
├── Base.lproj
├── LaunchScreen.storyboard
└── Main.storyboard
├── ConsentDocument.swift
├── ConsentTask.swift
├── FirstViewController.swift
├── HealthKitViewController.swift
├── Info.plist
├── SurveyTask.swift
└── hackpack-research.entitlements
/README.md:
--------------------------------------------------------------------------------
1 | # hackpack-researchkit
2 |
3 | Requires Mac & XCode 9+
4 |
5 | In this iOS hackpack we will be tackling on Apple's ResearchKit and Healthkit using Swift 4 and XCode 9. The functions include creating a consent form to request consent from users, distributing a survey form with different types of questions, and access point for the iOS App to collect data from iPhone's Health App.
6 |
7 | --------------------------------------------------------------------------------
8 |
9 | To begin, let's create a standard XCode project. We want to embed ResearchKit and HealthKit into our iOS App through the steps below.
10 |
11 | **Step 0:** Please register a developer's account (for HealthKit use)- should take around 5-10 min. [https://developer.apple.com/programs/] Git clone this repository and follow along the steps! Use [master] for full solutions and [starterkit] to fill in code.
12 |
13 | **Step 1:** To download the latest version of ResearchKit, and type in Terminal *git clone -b stable [https://github.com/ResearchKit/ResearchKit.git](https://github.com/ResearchKit/ResearchKit)*. Then, tap into the file with .xcodeprj extension and build the project by running ResearchKit framework.
14 |
15 | **Step 2:** Drag *ResearchKit.xcodeproj* into your current iOS project and copy items if needed. If you do not see an arrow by ResearchKit after dragging it in, either wait for it to load, or close and reopen the project.
16 |
17 | 
18 |
19 | **Step 3:** Go to *General* settings on your project and scroll down to *Embedded Binaries*. Click the + button and add in ResearchKit.
20 |
21 | 
22 |
23 | **Step 4:** To use HealthKit, go to *Capabilities* settings and scroll to the bottom to turn on HealthKit access, and it should automatically add it in your project.
24 |
25 | 
26 |
27 | **Step 5:** In your info.plist, right click to open as source code, then paste in:
28 | ```swift
29 | NSHealthShareUsageDescription
30 | Need to share healthkit information
31 | NSHealthUpdateUsageDescription
32 | Need healthkit to track steps
33 | ```
34 |
35 | 
36 |
37 | **Step 6:** *(optional)* If you are testing your code in XCode simulator, you have to simulate data from the Health App in order to get results from HealthStore. To do so, run the iPhone simulator, click on the hardware tab home button, then navigate to the Health App. Tap on the category you want, and use the + button to add in data. For example, when getting step count, go to *Activities* to add in different amounts of exercise for different days.
38 |
39 | These steps above install ResearchKit and HealthKit for your Xcode project!
40 |
41 | --------------------------------------------------------------------------------
42 |
43 | The *master* branch includes the completed code with ResearchKit consent & survey forms as well as HealthKit access & step count. The *starterkit* branch includes the code with comments and parts for you to add on/customize yourself for each part of the project.
44 |
45 | **Main.storyboard** creates navigation controller, buttons to link to functions for Consent, Survey, and Steps Count, textboxes to describe uses, and a separate view controller for HealthKit data. Buttons and textboxes are aligns to fit every spec of iPhone product.
46 |
47 | **FirstViewController.swift** links consent and survey buttons to their specific functions, which presents a new taskViewController with specific tasks (ex. ConsentTask, SurveyTasks) executed. The taskViewController inherits from ORKTaskViewController to dismiss viewController after action is completed.
48 |
49 | **ConsentDocument.swift** and **ConsentTasks.swift** creates a consent form to ask for user consent to research study. **ConsentTasks.swift** creates an ORKOrderedTask to increment through the created document. **ConsentDocument.swift** makes an ORKConsentDocument with specific question for users to agree to, and a signature portion of the form. An example of pre-built consent items looks like this:
50 | ```Swift
51 | let consentSectionTypes: [ORKConsentSectionType] = [
52 | .overview,
53 | .dataGathering,
54 | .privacy,
55 | .dataUse,
56 | .studySurvey,
57 | .studyTasks,
58 | .withdrawing
59 | ]
60 | ```
61 |
62 | **SurveyTask.swift** creates a simple survey form for users to fill out. It is also an ORKOrderedTask that initializes format and details of questions asked as well as a summary step to increment through. A sample question looks like this:
63 | ```Swift
64 | let nameAnswerFormat = ORKTextAnswerFormat(maximumLength: 20)
65 | nameAnswerFormat.multipleLines = false
66 | let nameQuestionStepTitle = "What is your name?"
67 | let nameQuestionStep = ORKQuestionStep(identifier: "QuestionStep", title: nameQuestionStepTitle, answer: nameAnswerFormat)
68 | steps += [nameQuestionStep]
69 | ```
70 |
71 | **HealthKitViewController.swift** asks for HealthKit access and gets user's step count from the past seven days. Keep in mind that the HealthKit access form will only appear once as the user only needs to accepts the agreement once. Sample code for requesting authorization of information looks like this:
72 | ```Swift
73 | if HKHealthStore.isHealthDataAvailable() {
74 | let stepsCount = NSSet(object: HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.stepCount))
75 | let sharedObjects = NSSet(objects: HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.height),HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.bodyMass))
76 |
77 | healthStore.requestAuthorization(toShare: sharedObjects as? Set, read: stepsCount as? Set, completion: { (success, err) in
78 | self.getStepCount(sender: self)
79 | })
80 |
81 | }
82 | ```
83 | and creating a query for HealthStore to execute looks like this:
84 | ```Swift
85 | let predicate = HKQuery.predicateForSamples(withStart: dates, end: Date(), options: [])
86 | let query = HKSampleQuery(sampleType: type!, predicate: predicate, limit: 0, sortDescriptors: nil) {
87 | query, results, error in
88 | var steps: Double = 0
89 | var allSteps = [Double]()
90 | if let myResults = results {
91 | for result in myResults as! [HKQuantitySample] {
92 | print(myResults)
93 | steps += result.quantity.doubleValue(for: HKUnit.count())
94 | allSteps.append(result.quantity.doubleValue(for: HKUnit.count()))
95 | }
96 | }
97 | completion(steps, allSteps, error as NSError?)
98 |
99 | }
100 |
101 | // Executes query through healthstore
102 | healthStore.execute(query)
103 | ```
104 |
105 | These are some of the functionalities of Swift 4 & XCode 9 with ResearchKit and HealthKit. You can easily customize these items and save information to utilize in other parts of the iOS App to create a healthcare hack!
106 |
107 | ### License
108 | MIT
109 |
110 | # About HackPacks 🌲
111 |
112 | HackPacks are built by the [TreeHacks](https://www.treehacks.com/) team to help hackers build great projects at our hackathon that happens every February at Stanford. We believe that everyone of every skill level can learn to make awesome things, and this is one way we help facilitate hacker culture. We open source our hackpacks (along with our internal tech) so everyone can learn from and use them! Feel free to use these at your own hackathons, workshops, and anything else that promotes building :)
113 |
114 | If you're interested in attending TreeHacks, you can apply on our [website](https://www.treehacks.com/) during the application period.
115 |
116 | You can follow us here on [GitHub](https://github.com/treehacks) to see all the open source work we do (we love issues, contributions, and feedback of any kind!), and on [Facebook](https://facebook.com/treehacks), [Twitter](https://twitter.com/hackwithtrees), and [Instagram](https://instagram.com/hackwithtrees) to see general updates from TreeHacks.
117 |
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 4551A797220E44E300C35792 /* ResearchKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 45706FB2220E447900548E39 /* ResearchKit.framework */; };
11 | 4551A798220E44E300C35792 /* ResearchKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 45706FB2220E447900548E39 /* ResearchKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
12 | AD78784D1DD4642400D5B6E5 /* ConsentDocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD78784C1DD4642400D5B6E5 /* ConsentDocument.swift */; };
13 | AD78784F1DD4644700D5B6E5 /* ConsentTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD78784E1DD4644700D5B6E5 /* ConsentTask.swift */; };
14 | AD7878511DD4646800D5B6E5 /* SurveyTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD7878501DD4646800D5B6E5 /* SurveyTask.swift */; };
15 | ADB22A3A1E20DAF400A8B177 /* FirstViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADB22A391E20DAF400A8B177 /* FirstViewController.swift */; };
16 | ADBD82CD1DEBF52E0075444E /* HealthKitViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADBD82CC1DEBF52E0075444E /* HealthKitViewController.swift */; };
17 | ADBD82D01DEBF76A0075444E /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBD82CF1DEBF76A0075444E /* HealthKit.framework */; };
18 | ADDCABD61DD4390200F31CC9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADDCABD51DD4390200F31CC9 /* AppDelegate.swift */; };
19 | ADDCABDB1DD4390200F31CC9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ADDCABD91DD4390200F31CC9 /* Main.storyboard */; };
20 | ADDCABDD1DD4390200F31CC9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ADDCABDC1DD4390200F31CC9 /* Assets.xcassets */; };
21 | ADDCABE01DD4390200F31CC9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ADDCABDE1DD4390200F31CC9 /* LaunchScreen.storyboard */; };
22 | /* End PBXBuildFile section */
23 |
24 | /* Begin PBXContainerItemProxy section */
25 | 4551A799220E44E300C35792 /* PBXContainerItemProxy */ = {
26 | isa = PBXContainerItemProxy;
27 | containerPortal = 45706FAB220E447900548E39 /* ResearchKit.xcodeproj */;
28 | proxyType = 1;
29 | remoteGlobalIDString = B183A4731A8535D100C76870;
30 | remoteInfo = ResearchKit;
31 | };
32 | 45706FB1220E447900548E39 /* PBXContainerItemProxy */ = {
33 | isa = PBXContainerItemProxy;
34 | containerPortal = 45706FAB220E447900548E39 /* ResearchKit.xcodeproj */;
35 | proxyType = 2;
36 | remoteGlobalIDString = B183A5951A8535D100C76870;
37 | remoteInfo = ResearchKit;
38 | };
39 | 45706FB3220E447900548E39 /* PBXContainerItemProxy */ = {
40 | isa = PBXContainerItemProxy;
41 | containerPortal = 45706FAB220E447900548E39 /* ResearchKit.xcodeproj */;
42 | proxyType = 2;
43 | remoteGlobalIDString = 86CC8E9A1AC09332001CCD89;
44 | remoteInfo = ResearchKitTests;
45 | };
46 | /* End PBXContainerItemProxy section */
47 |
48 | /* Begin PBXCopyFilesBuildPhase section */
49 | ADDCAC1B1DD43A3100F31CC9 /* Embed Frameworks */ = {
50 | isa = PBXCopyFilesBuildPhase;
51 | buildActionMask = 2147483647;
52 | dstPath = "";
53 | dstSubfolderSpec = 10;
54 | files = (
55 | 4551A798220E44E300C35792 /* ResearchKit.framework in Embed Frameworks */,
56 | );
57 | name = "Embed Frameworks";
58 | runOnlyForDeploymentPostprocessing = 0;
59 | };
60 | /* End PBXCopyFilesBuildPhase section */
61 |
62 | /* Begin PBXFileReference section */
63 | 45706FAB220E447900548E39 /* ResearchKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ResearchKit.xcodeproj; path = ../../ResearchKit/ResearchKit.xcodeproj; sourceTree = ""; };
64 | AD78784C1DD4642400D5B6E5 /* ConsentDocument.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConsentDocument.swift; sourceTree = ""; };
65 | AD78784E1DD4644700D5B6E5 /* ConsentTask.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConsentTask.swift; sourceTree = ""; };
66 | AD7878501DD4646800D5B6E5 /* SurveyTask.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SurveyTask.swift; sourceTree = ""; };
67 | ADB22A391E20DAF400A8B177 /* FirstViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FirstViewController.swift; sourceTree = ""; };
68 | ADBD82CC1DEBF52E0075444E /* HealthKitViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HealthKitViewController.swift; sourceTree = ""; };
69 | ADBD82CE1DEBF6B10075444E /* hackpack-research.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "hackpack-research.entitlements"; sourceTree = ""; };
70 | ADBD82CF1DEBF76A0075444E /* HealthKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HealthKit.framework; path = System/Library/Frameworks/HealthKit.framework; sourceTree = SDKROOT; };
71 | ADDCABD21DD4390200F31CC9 /* hackpack-research.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "hackpack-research.app"; sourceTree = BUILT_PRODUCTS_DIR; };
72 | ADDCABD51DD4390200F31CC9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
73 | ADDCABDA1DD4390200F31CC9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
74 | ADDCABDC1DD4390200F31CC9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
75 | ADDCABDF1DD4390200F31CC9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
76 | ADDCABE11DD4390200F31CC9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
77 | /* End PBXFileReference section */
78 |
79 | /* Begin PBXFrameworksBuildPhase section */
80 | ADDCABCF1DD4390100F31CC9 /* Frameworks */ = {
81 | isa = PBXFrameworksBuildPhase;
82 | buildActionMask = 2147483647;
83 | files = (
84 | 4551A797220E44E300C35792 /* ResearchKit.framework in Frameworks */,
85 | ADBD82D01DEBF76A0075444E /* HealthKit.framework in Frameworks */,
86 | );
87 | runOnlyForDeploymentPostprocessing = 0;
88 | };
89 | /* End PBXFrameworksBuildPhase section */
90 |
91 | /* Begin PBXGroup section */
92 | 45706FAC220E447900548E39 /* Products */ = {
93 | isa = PBXGroup;
94 | children = (
95 | 45706FB2220E447900548E39 /* ResearchKit.framework */,
96 | 45706FB4220E447900548E39 /* ResearchKitTests.xctest */,
97 | );
98 | name = Products;
99 | sourceTree = "";
100 | };
101 | ADBD82C51DEBF5180075444E /* Frameworks */ = {
102 | isa = PBXGroup;
103 | children = (
104 | ADBD82CF1DEBF76A0075444E /* HealthKit.framework */,
105 | );
106 | name = Frameworks;
107 | sourceTree = "";
108 | };
109 | ADDCABC91DD4390100F31CC9 = {
110 | isa = PBXGroup;
111 | children = (
112 | 45706FAB220E447900548E39 /* ResearchKit.xcodeproj */,
113 | ADDCABD41DD4390200F31CC9 /* hackpack-research */,
114 | ADDCABD31DD4390200F31CC9 /* Products */,
115 | ADBD82C51DEBF5180075444E /* Frameworks */,
116 | );
117 | sourceTree = "";
118 | };
119 | ADDCABD31DD4390200F31CC9 /* Products */ = {
120 | isa = PBXGroup;
121 | children = (
122 | ADDCABD21DD4390200F31CC9 /* hackpack-research.app */,
123 | );
124 | name = Products;
125 | sourceTree = "";
126 | };
127 | ADDCABD41DD4390200F31CC9 /* hackpack-research */ = {
128 | isa = PBXGroup;
129 | children = (
130 | ADBD82CE1DEBF6B10075444E /* hackpack-research.entitlements */,
131 | ADDCABD51DD4390200F31CC9 /* AppDelegate.swift */,
132 | AD78784C1DD4642400D5B6E5 /* ConsentDocument.swift */,
133 | AD78784E1DD4644700D5B6E5 /* ConsentTask.swift */,
134 | AD7878501DD4646800D5B6E5 /* SurveyTask.swift */,
135 | ADBD82CC1DEBF52E0075444E /* HealthKitViewController.swift */,
136 | ADB22A391E20DAF400A8B177 /* FirstViewController.swift */,
137 | ADDCABD91DD4390200F31CC9 /* Main.storyboard */,
138 | ADDCABDC1DD4390200F31CC9 /* Assets.xcassets */,
139 | ADDCABDE1DD4390200F31CC9 /* LaunchScreen.storyboard */,
140 | ADDCABE11DD4390200F31CC9 /* Info.plist */,
141 | );
142 | path = "hackpack-research";
143 | sourceTree = "";
144 | };
145 | /* End PBXGroup section */
146 |
147 | /* Begin PBXNativeTarget section */
148 | ADDCABD11DD4390100F31CC9 /* hackpack-research */ = {
149 | isa = PBXNativeTarget;
150 | buildConfigurationList = ADDCABFA1DD4390200F31CC9 /* Build configuration list for PBXNativeTarget "hackpack-research" */;
151 | buildPhases = (
152 | ADDCABCE1DD4390100F31CC9 /* Sources */,
153 | ADDCABCF1DD4390100F31CC9 /* Frameworks */,
154 | ADDCABD01DD4390100F31CC9 /* Resources */,
155 | ADDCAC1B1DD43A3100F31CC9 /* Embed Frameworks */,
156 | );
157 | buildRules = (
158 | );
159 | dependencies = (
160 | 4551A79A220E44E300C35792 /* PBXTargetDependency */,
161 | );
162 | name = "hackpack-research";
163 | productName = "hackpack-research";
164 | productReference = ADDCABD21DD4390200F31CC9 /* hackpack-research.app */;
165 | productType = "com.apple.product-type.application";
166 | };
167 | /* End PBXNativeTarget section */
168 |
169 | /* Begin PBXProject section */
170 | ADDCABCA1DD4390100F31CC9 /* Project object */ = {
171 | isa = PBXProject;
172 | attributes = {
173 | LastSwiftUpdateCheck = 0810;
174 | LastUpgradeCheck = 1010;
175 | ORGANIZATIONNAME = "Joy Hsu";
176 | TargetAttributes = {
177 | ADDCABD11DD4390100F31CC9 = {
178 | CreatedOnToolsVersion = 8.1;
179 | DevelopmentTeam = 8GEKYYW3CQ;
180 | LastSwiftMigration = 1010;
181 | ProvisioningStyle = Automatic;
182 | SystemCapabilities = {
183 | com.apple.HealthKit = {
184 | enabled = 1;
185 | };
186 | };
187 | };
188 | };
189 | };
190 | buildConfigurationList = ADDCABCD1DD4390100F31CC9 /* Build configuration list for PBXProject "hackpack-research" */;
191 | compatibilityVersion = "Xcode 3.2";
192 | developmentRegion = English;
193 | hasScannedForEncodings = 0;
194 | knownRegions = (
195 | en,
196 | Base,
197 | );
198 | mainGroup = ADDCABC91DD4390100F31CC9;
199 | productRefGroup = ADDCABD31DD4390200F31CC9 /* Products */;
200 | projectDirPath = "";
201 | projectReferences = (
202 | {
203 | ProductGroup = 45706FAC220E447900548E39 /* Products */;
204 | ProjectRef = 45706FAB220E447900548E39 /* ResearchKit.xcodeproj */;
205 | },
206 | );
207 | projectRoot = "";
208 | targets = (
209 | ADDCABD11DD4390100F31CC9 /* hackpack-research */,
210 | );
211 | };
212 | /* End PBXProject section */
213 |
214 | /* Begin PBXReferenceProxy section */
215 | 45706FB2220E447900548E39 /* ResearchKit.framework */ = {
216 | isa = PBXReferenceProxy;
217 | fileType = wrapper.framework;
218 | path = ResearchKit.framework;
219 | remoteRef = 45706FB1220E447900548E39 /* PBXContainerItemProxy */;
220 | sourceTree = BUILT_PRODUCTS_DIR;
221 | };
222 | 45706FB4220E447900548E39 /* ResearchKitTests.xctest */ = {
223 | isa = PBXReferenceProxy;
224 | fileType = wrapper.cfbundle;
225 | path = ResearchKitTests.xctest;
226 | remoteRef = 45706FB3220E447900548E39 /* PBXContainerItemProxy */;
227 | sourceTree = BUILT_PRODUCTS_DIR;
228 | };
229 | /* End PBXReferenceProxy section */
230 |
231 | /* Begin PBXResourcesBuildPhase section */
232 | ADDCABD01DD4390100F31CC9 /* Resources */ = {
233 | isa = PBXResourcesBuildPhase;
234 | buildActionMask = 2147483647;
235 | files = (
236 | ADDCABE01DD4390200F31CC9 /* LaunchScreen.storyboard in Resources */,
237 | ADDCABDD1DD4390200F31CC9 /* Assets.xcassets in Resources */,
238 | ADDCABDB1DD4390200F31CC9 /* Main.storyboard in Resources */,
239 | );
240 | runOnlyForDeploymentPostprocessing = 0;
241 | };
242 | /* End PBXResourcesBuildPhase section */
243 |
244 | /* Begin PBXSourcesBuildPhase section */
245 | ADDCABCE1DD4390100F31CC9 /* Sources */ = {
246 | isa = PBXSourcesBuildPhase;
247 | buildActionMask = 2147483647;
248 | files = (
249 | AD78784F1DD4644700D5B6E5 /* ConsentTask.swift in Sources */,
250 | AD7878511DD4646800D5B6E5 /* SurveyTask.swift in Sources */,
251 | ADBD82CD1DEBF52E0075444E /* HealthKitViewController.swift in Sources */,
252 | AD78784D1DD4642400D5B6E5 /* ConsentDocument.swift in Sources */,
253 | ADDCABD61DD4390200F31CC9 /* AppDelegate.swift in Sources */,
254 | ADB22A3A1E20DAF400A8B177 /* FirstViewController.swift in Sources */,
255 | );
256 | runOnlyForDeploymentPostprocessing = 0;
257 | };
258 | /* End PBXSourcesBuildPhase section */
259 |
260 | /* Begin PBXTargetDependency section */
261 | 4551A79A220E44E300C35792 /* PBXTargetDependency */ = {
262 | isa = PBXTargetDependency;
263 | name = ResearchKit;
264 | targetProxy = 4551A799220E44E300C35792 /* PBXContainerItemProxy */;
265 | };
266 | /* End PBXTargetDependency section */
267 |
268 | /* Begin PBXVariantGroup section */
269 | ADDCABD91DD4390200F31CC9 /* Main.storyboard */ = {
270 | isa = PBXVariantGroup;
271 | children = (
272 | ADDCABDA1DD4390200F31CC9 /* Base */,
273 | );
274 | name = Main.storyboard;
275 | sourceTree = "";
276 | };
277 | ADDCABDE1DD4390200F31CC9 /* LaunchScreen.storyboard */ = {
278 | isa = PBXVariantGroup;
279 | children = (
280 | ADDCABDF1DD4390200F31CC9 /* Base */,
281 | );
282 | name = LaunchScreen.storyboard;
283 | sourceTree = "";
284 | };
285 | /* End PBXVariantGroup section */
286 |
287 | /* Begin XCBuildConfiguration section */
288 | ADDCABF81DD4390200F31CC9 /* Debug */ = {
289 | isa = XCBuildConfiguration;
290 | buildSettings = {
291 | ALWAYS_SEARCH_USER_PATHS = NO;
292 | CLANG_ANALYZER_NONNULL = YES;
293 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
294 | CLANG_CXX_LIBRARY = "libc++";
295 | CLANG_ENABLE_MODULES = YES;
296 | CLANG_ENABLE_OBJC_ARC = YES;
297 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
298 | CLANG_WARN_BOOL_CONVERSION = YES;
299 | CLANG_WARN_COMMA = YES;
300 | CLANG_WARN_CONSTANT_CONVERSION = YES;
301 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
302 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
303 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
304 | CLANG_WARN_EMPTY_BODY = YES;
305 | CLANG_WARN_ENUM_CONVERSION = YES;
306 | CLANG_WARN_INFINITE_RECURSION = YES;
307 | CLANG_WARN_INT_CONVERSION = YES;
308 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
309 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
310 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
311 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
312 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
313 | CLANG_WARN_STRICT_PROTOTYPES = YES;
314 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
315 | CLANG_WARN_SUSPICIOUS_MOVES = YES;
316 | CLANG_WARN_UNREACHABLE_CODE = YES;
317 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
318 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
319 | COPY_PHASE_STRIP = NO;
320 | DEBUG_INFORMATION_FORMAT = dwarf;
321 | ENABLE_STRICT_OBJC_MSGSEND = YES;
322 | ENABLE_TESTABILITY = YES;
323 | FRAMEWORK_SEARCH_PATHS = "";
324 | GCC_C_LANGUAGE_STANDARD = gnu99;
325 | GCC_DYNAMIC_NO_PIC = NO;
326 | GCC_NO_COMMON_BLOCKS = YES;
327 | GCC_OPTIMIZATION_LEVEL = 0;
328 | GCC_PREPROCESSOR_DEFINITIONS = (
329 | "DEBUG=1",
330 | "$(inherited)",
331 | );
332 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
333 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
334 | GCC_WARN_UNDECLARED_SELECTOR = YES;
335 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
336 | GCC_WARN_UNUSED_FUNCTION = YES;
337 | GCC_WARN_UNUSED_VARIABLE = YES;
338 | IPHONEOS_DEPLOYMENT_TARGET = 10.1;
339 | MTL_ENABLE_DEBUG_INFO = YES;
340 | ONLY_ACTIVE_ARCH = YES;
341 | SDKROOT = iphoneos;
342 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
343 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
344 | TARGETED_DEVICE_FAMILY = "1,2";
345 | };
346 | name = Debug;
347 | };
348 | ADDCABF91DD4390200F31CC9 /* Release */ = {
349 | isa = XCBuildConfiguration;
350 | buildSettings = {
351 | ALWAYS_SEARCH_USER_PATHS = NO;
352 | CLANG_ANALYZER_NONNULL = YES;
353 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
354 | CLANG_CXX_LIBRARY = "libc++";
355 | CLANG_ENABLE_MODULES = YES;
356 | CLANG_ENABLE_OBJC_ARC = YES;
357 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
358 | CLANG_WARN_BOOL_CONVERSION = YES;
359 | CLANG_WARN_COMMA = YES;
360 | CLANG_WARN_CONSTANT_CONVERSION = YES;
361 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
362 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
363 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
364 | CLANG_WARN_EMPTY_BODY = YES;
365 | CLANG_WARN_ENUM_CONVERSION = YES;
366 | CLANG_WARN_INFINITE_RECURSION = YES;
367 | CLANG_WARN_INT_CONVERSION = YES;
368 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
369 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
370 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
371 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
372 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
373 | CLANG_WARN_STRICT_PROTOTYPES = YES;
374 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
375 | CLANG_WARN_SUSPICIOUS_MOVES = YES;
376 | CLANG_WARN_UNREACHABLE_CODE = YES;
377 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
378 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
379 | COPY_PHASE_STRIP = NO;
380 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
381 | ENABLE_NS_ASSERTIONS = NO;
382 | ENABLE_STRICT_OBJC_MSGSEND = YES;
383 | FRAMEWORK_SEARCH_PATHS = "";
384 | GCC_C_LANGUAGE_STANDARD = gnu99;
385 | GCC_NO_COMMON_BLOCKS = YES;
386 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
387 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
388 | GCC_WARN_UNDECLARED_SELECTOR = YES;
389 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
390 | GCC_WARN_UNUSED_FUNCTION = YES;
391 | GCC_WARN_UNUSED_VARIABLE = YES;
392 | IPHONEOS_DEPLOYMENT_TARGET = 10.1;
393 | MTL_ENABLE_DEBUG_INFO = NO;
394 | SDKROOT = iphoneos;
395 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
396 | TARGETED_DEVICE_FAMILY = "1,2";
397 | VALIDATE_PRODUCT = YES;
398 | };
399 | name = Release;
400 | };
401 | ADDCABFB1DD4390200F31CC9 /* Debug */ = {
402 | isa = XCBuildConfiguration;
403 | buildSettings = {
404 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
405 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
406 | CODE_SIGN_ENTITLEMENTS = "hackpack-research/hackpack-research.entitlements";
407 | DEVELOPMENT_TEAM = 8GEKYYW3CQ;
408 | INFOPLIST_FILE = "hackpack-research/Info.plist";
409 | IPHONEOS_DEPLOYMENT_TARGET = 11.0;
410 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
411 | PRODUCT_BUNDLE_IDENTIFIER = "oliviabrown.hackpack-research";
412 | PRODUCT_NAME = "$(TARGET_NAME)";
413 | SWIFT_VERSION = 4.2;
414 | };
415 | name = Debug;
416 | };
417 | ADDCABFC1DD4390200F31CC9 /* Release */ = {
418 | isa = XCBuildConfiguration;
419 | buildSettings = {
420 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
421 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
422 | CODE_SIGN_ENTITLEMENTS = "hackpack-research/hackpack-research.entitlements";
423 | DEVELOPMENT_TEAM = 8GEKYYW3CQ;
424 | INFOPLIST_FILE = "hackpack-research/Info.plist";
425 | IPHONEOS_DEPLOYMENT_TARGET = 11.0;
426 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
427 | PRODUCT_BUNDLE_IDENTIFIER = "oliviabrown.hackpack-research";
428 | PRODUCT_NAME = "$(TARGET_NAME)";
429 | SWIFT_VERSION = 4.2;
430 | };
431 | name = Release;
432 | };
433 | /* End XCBuildConfiguration section */
434 |
435 | /* Begin XCConfigurationList section */
436 | ADDCABCD1DD4390100F31CC9 /* Build configuration list for PBXProject "hackpack-research" */ = {
437 | isa = XCConfigurationList;
438 | buildConfigurations = (
439 | ADDCABF81DD4390200F31CC9 /* Debug */,
440 | ADDCABF91DD4390200F31CC9 /* Release */,
441 | );
442 | defaultConfigurationIsVisible = 0;
443 | defaultConfigurationName = Release;
444 | };
445 | ADDCABFA1DD4390200F31CC9 /* Build configuration list for PBXNativeTarget "hackpack-research" */ = {
446 | isa = XCConfigurationList;
447 | buildConfigurations = (
448 | ADDCABFB1DD4390200F31CC9 /* Debug */,
449 | ADDCABFC1DD4390200F31CC9 /* Release */,
450 | );
451 | defaultConfigurationIsVisible = 0;
452 | defaultConfigurationName = Release;
453 | };
454 | /* End XCConfigurationList section */
455 | };
456 | rootObject = ADDCABCA1DD4390100F31CC9 /* Project object */;
457 | }
458 |
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research.xcodeproj/project.xcworkspace/xcshareddata/hackpack-research.xcscmblueprint:
--------------------------------------------------------------------------------
1 | {
2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "1314DBC80CCF147331DCB14457FD7EA973B2B7CF",
3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {
4 |
5 | },
6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
7 | "9CF6181E3789E3853840089C16D4B9FDDB9B31E2" : 9223372036854775807,
8 | "1314DBC80CCF147331DCB14457FD7EA973B2B7CF" : 9223372036854775807,
9 | "6BBB14D18404D37303A51A25CEF2D4EDDAFF0564" : 9223372036854775807
10 | },
11 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "7AF3A499-8CF0-422F-8B98-3B5407DCF466",
12 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
13 | "9CF6181E3789E3853840089C16D4B9FDDB9B31E2" : "hackpack-researchkit\/hackpack-research\/ResearchKit\/",
14 | "1314DBC80CCF147331DCB14457FD7EA973B2B7CF" : "hackpack-researchkit\/",
15 | "6BBB14D18404D37303A51A25CEF2D4EDDAFF0564" : "hackpack-researchkit\/hackpack-research\/CareKit\/"
16 | },
17 | "DVTSourceControlWorkspaceBlueprintNameKey" : "hackpack-research",
18 | "DVTSourceControlWorkspaceBlueprintVersion" : 204,
19 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "hackpack-research\/hackpack-research.xcodeproj",
20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
21 | {
22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/TreeHacks\/hackpack-researchkit.git",
23 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
24 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "1314DBC80CCF147331DCB14457FD7EA973B2B7CF"
25 | },
26 | {
27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/carekit-apple\/CareKit.git",
28 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
29 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "6BBB14D18404D37303A51A25CEF2D4EDDAFF0564"
30 | },
31 | {
32 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/ResearchKit\/ResearchKit.git",
33 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
34 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "9CF6181E3789E3853840089C16D4B9FDDB9B31E2"
35 | }
36 | ]
37 | }
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research.xcodeproj/project.xcworkspace/xcuserdata/joyhsu0504.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TreeHacks/hackpack-researchkit/73b4ab03684d361ce67cd7e85e74b48b5d26da70/hackpack-research/hackpack-research.xcodeproj/project.xcworkspace/xcuserdata/joyhsu0504.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research.xcodeproj/project.xcworkspace/xcuserdata/olivia.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TreeHacks/hackpack-researchkit/73b4ab03684d361ce67cd7e85e74b48b5d26da70/hackpack-research/hackpack-research.xcodeproj/project.xcworkspace/xcuserdata/olivia.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research.xcodeproj/xcuserdata/joyhsu0504.xcuserdatad/xcschemes/hackpack-research.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
43 |
49 |
50 |
51 |
52 |
53 |
59 |
60 |
61 |
62 |
63 |
64 |
74 |
76 |
82 |
83 |
84 |
85 |
86 |
87 |
93 |
95 |
101 |
102 |
103 |
104 |
106 |
107 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research.xcodeproj/xcuserdata/joyhsu0504.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | hackpack-research.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | ADDCABD11DD4390100F31CC9
16 |
17 | primary
18 |
19 |
20 | ADDCABE51DD4390200F31CC9
21 |
22 | primary
23 |
24 |
25 | ADDCABF01DD4390200F31CC9
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research.xcodeproj/xcuserdata/olivia.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | hackpack-research.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 2
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // hackpack-research
4 | //
5 | // Created by Joy Hsu on 11/9/16.
6 | // Copyright © 2016 Joy Hsu. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(_ application: UIApplication) {
23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
25 | }
26 |
27 | func applicationDidEnterBackground(_ application: UIApplication) {
28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(_ application: UIApplication) {
33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | func applicationDidBecomeActive(_ application: UIApplication) {
37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38 | }
39 |
40 | func applicationWillTerminate(_ application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | AvenirNext-Bold
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
39 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
134 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research/ConsentDocument.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ConsentDocument.swift
3 | // hackpack-research
4 | //
5 | // Created by Joy Hsu on 11/10/16.
6 | // Updated by Olivia Brown on 1/27/18.
7 | // Copyright © 2018 TreeHacks. All rights reserved.
8 | //
9 |
10 |
11 | import Foundation
12 | import ResearchKit
13 |
14 | public var ConsentDocument: ORKConsentDocument {
15 |
16 | let consentDocument = ORKConsentDocument()
17 | consentDocument.title = "Example Consent"
18 |
19 | let consentSectionTypes: [ORKConsentSectionType] = [
20 | .overview,
21 | .dataGathering,
22 | .privacy,
23 | .dataUse,
24 | .studySurvey,
25 | .studyTasks,
26 | .withdrawing
27 | ]
28 |
29 | let consentSections: [ORKConsentSection] = consentSectionTypes.map { contentSectionType in
30 |
31 | let consentSection = ORKConsentSection(type: contentSectionType)
32 | if (contentSectionType == ORKConsentSectionType.overview){
33 | consentSection.summary = "The following will inform you about our study"
34 | consentSection.content = "In this study you will be asked to submit exercise information."
35 | }
36 | if (contentSectionType == ORKConsentSectionType.dataGathering){
37 | consentSection.summary = "We will primarily be tracking your activity levels"
38 | consentSection.content = "In this study you will be asked to submit exercise information."
39 | }
40 | if (contentSectionType == ORKConsentSectionType.privacy){
41 | consentSection.summary = "We will not be sharing your data with anyone outside our team"
42 | consentSection.content = "In this study you will be asked to submit exercise information."
43 | }
44 | if (contentSectionType == ORKConsentSectionType.dataUse){
45 | consentSection.summary = "Data will be used to inform your physician and motivate you "
46 | consentSection.content = "In this study you will be asked to submit exercise information."
47 | }
48 | if (contentSectionType == ORKConsentSectionType.studySurvey){
49 | consentSection.summary = "To understand your results, we ask you to complete a questionnaire on your health history and physical condition."
50 | consentSection.content = "In this study you will be asked to submit exercise information."
51 | }
52 | if (contentSectionType == ORKConsentSectionType.studyTasks){
53 | consentSection.summary = "As part of the study you will receive occasional notifications in regards to your activity."
54 | consentSection.content = "In this study you will be asked to submit exercise information."
55 | }
56 | if (contentSectionType == ORKConsentSectionType.withdrawing){
57 | consentSection.summary = "You can withdraw from the study and stop receiving notifications at any time."
58 | consentSection.content = "In this study you will be asked to submit exercise information."
59 | }
60 | return consentSection
61 | }
62 |
63 | consentDocument.sections = consentSections
64 |
65 | consentDocument.addSignature(ORKConsentSignature(forPersonWithTitle: nil, dateFormatString: nil, identifier: "ConsentDocumentParticipantSignature"))
66 |
67 |
68 | return consentDocument
69 | }
70 |
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research/ConsentTask.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ConsentTask.swift
3 | // hackpack-research
4 | //
5 | // Created by Joy Hsu on 11/10/16.
6 | // Updated by Olivia Brown on 1/27/18.
7 | // Copyright © 2018 TreeHacks. All rights reserved.
8 | //
9 |
10 | import Foundation
11 | import ResearchKit
12 |
13 | public var ConsentTask: ORKOrderedTask {
14 |
15 | var steps = [ORKStep]()
16 |
17 | let consentDocument = ConsentDocument
18 | let visualConsentStep = ORKVisualConsentStep(identifier: "VisualConsentStep", document: consentDocument)
19 | steps += [visualConsentStep]
20 |
21 | guard let signature = consentDocument.signatures?.first else { fatalError() }
22 |
23 | let reviewConsentStep = ORKConsentReviewStep(identifier: "ConsentReviewStep", signature: signature, in: consentDocument)
24 |
25 | reviewConsentStep.text = "Review Consent"
26 | reviewConsentStep.reasonForConsent = "Consent to join study"
27 |
28 | steps += [reviewConsentStep]
29 |
30 | return ORKOrderedTask(identifier: "ConsentTask", steps: steps)
31 |
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research/FirstViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FirstViewController.swift
3 | // hackpack-research
4 | //
5 | // Created by Joy Hsu on 1/7/17.
6 | // Updated by Olivia Brown on 1/27/18.
7 | // Copyright © 2018 Olivia Brown. All rights reserved.
8 | //
9 |
10 | import Foundation
11 | import UIKit
12 | import ResearchKit
13 |
14 |
15 | class FirstViewController: UIViewController {
16 |
17 | @IBAction func consentTapped(sender : AnyObject) {
18 | let taskViewController = ORKTaskViewController(task: ConsentTask, taskRun: nil)
19 | taskViewController.view.tintColor = UIColor.blue // pick the color
20 | taskViewController.delegate = self
21 | present(taskViewController, animated: true, completion: nil)
22 | }
23 |
24 | @IBAction func surveyTapped(sender : AnyObject) {
25 | let taskViewController = ORKTaskViewController(task: SurveyTask, taskRun: nil)
26 | taskViewController.delegate = self
27 | taskViewController.view.tintColor = UIColor.blue // pick the color
28 | present(taskViewController, animated: true, completion: nil)
29 | }
30 |
31 | override func viewDidLoad() {
32 | super.viewDidLoad()
33 | // Do any additional setup after loading the view, typically from a nib.
34 | }
35 |
36 | override func didReceiveMemoryWarning() {
37 | super.didReceiveMemoryWarning()
38 | // Dispose of any resources that can be recreated.
39 | }
40 | }
41 |
42 |
43 | extension FirstViewController : ORKTaskViewControllerDelegate {
44 |
45 | func taskViewController(
46 | _ taskViewController: ORKTaskViewController,
47 | didFinishWith reason: ORKTaskViewControllerFinishReason,
48 | error : Error?) {
49 |
50 | print("entering the dismiss function")
51 | if error != nil {
52 | NSLog("Error: \(String(describing: error))")
53 | }
54 | else {
55 | switch reason {
56 | case .completed:
57 | if let signatureResult =
58 | taskViewController.result.stepResult(forStepIdentifier:
59 | "your identifier"
60 | )?.firstResult as? ORKConsentSignatureResult {
61 | if signatureResult.consented {
62 |
63 | }
64 | }
65 | else {
66 | }
67 |
68 | default: break
69 | }
70 | }
71 |
72 | // Dismiss the task’s view controller when the task finishes
73 | taskViewController.dismiss(animated: true, completion: nil)
74 |
75 | }
76 |
77 |
78 | }
79 |
80 |
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research/HealthKitViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // HealthKitViewController.swift
3 | // hackpack-research
4 | //
5 | // Created by Joy Hsu on 11/27/16.
6 | // Updated by Olivia Brown on 1/27/18.
7 | // Copyright © 2018 Olivia Brown. All rights reserved.
8 | //
9 |
10 | import Foundation
11 | import UIKit
12 | import HealthKit
13 |
14 | class HealthKitViewController: UIViewController
15 | {
16 | let healthStore = HKHealthStore()
17 | override func viewDidLoad() {
18 | super.viewDidLoad()
19 | checkAvailability()
20 | getStepCount(sender: self)
21 | }
22 |
23 | func checkAvailability() {
24 | if HKHealthStore.isHealthDataAvailable() {
25 | let stepsCount = NSSet(object: HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.stepCount) as Any)
26 | let sharedObjects = NSSet(objects: HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.height) as Any,HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.bodyMass) as Any)
27 |
28 | healthStore.requestAuthorization(toShare: sharedObjects as? Set, read: stepsCount as? Set, completion: { (success, err) in
29 | self.getStepCount(sender: self)
30 | })
31 |
32 | } else {
33 | }
34 | }
35 |
36 | func recentSteps(completion: @escaping (Double, [Double], NSError?) -> ()) {
37 | let type = HKSampleType.quantityType(forIdentifier: HKQuantityTypeIdentifier.stepCount)
38 |
39 | let date = Date()
40 | let calendar = Calendar.current
41 | let curryear = calendar.component(.year, from: date)
42 | let currmonth = calendar.component(.month, from: date)
43 | let currday = calendar.component(.day, from: date)
44 | let last = DateComponents(calendar: nil,
45 | timeZone: nil,
46 | era: nil,
47 | year: curryear,
48 | month: currmonth,
49 | day: currday-7,
50 | hour: nil,
51 | minute: nil,
52 | second: nil,
53 | nanosecond: nil,
54 | weekday: nil,
55 | weekdayOrdinal: nil,
56 | quarter: nil,
57 | weekOfMonth: nil,
58 | weekOfYear: nil,
59 | yearForWeekOfYear: nil)
60 |
61 | let dates = calendar.date(from: last)!
62 |
63 | let predicate = HKQuery.predicateForSamples(withStart: dates, end: Date(), options: [])
64 | let query = HKSampleQuery(sampleType: type!, predicate: predicate, limit: 0, sortDescriptors: nil) {
65 | query, results, error in
66 | var steps: Double = 0
67 | var allSteps = [Double]()
68 | if let myResults = results {
69 | for result in myResults as! [HKQuantitySample] {
70 | print(myResults)
71 | steps += result.quantity.doubleValue(for: HKUnit.count())
72 | allSteps.append(result.quantity.doubleValue(for: HKUnit.count()))
73 | }
74 | }
75 | completion(steps, allSteps, error as NSError?)
76 |
77 | }
78 | healthStore.execute(query)
79 | }
80 |
81 | @IBOutlet var stepCount : UILabel!
82 | @IBOutlet var avgCount : UILabel!
83 | @IBAction func getStepCount(sender: AnyObject) {
84 | recentSteps() { steps, allSteps, error in
85 | DispatchQueue.main.sync {
86 | var avgStep: Double = 0
87 | avgStep = steps/7
88 | self.stepCount.text = "Avg \(steps) steps"
89 | self.avgCount.text = "Total \(avgStep) steps"
90 | }
91 |
92 | };
93 | }
94 | }
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | NSHealthShareUsageDescription
24 | Need to share healthkit information
25 | NSHealthUpdateUsageDescription
26 | Need healthkit to track steps
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UIRequiredDeviceCapabilities
32 |
33 | armv7
34 | healthkit
35 |
36 | UISupportedInterfaceOrientations
37 |
38 | UIInterfaceOrientationPortrait
39 |
40 | UISupportedInterfaceOrientations~ipad
41 |
42 | UIInterfaceOrientationPortrait
43 | UIInterfaceOrientationPortraitUpsideDown
44 | UIInterfaceOrientationLandscapeLeft
45 | UIInterfaceOrientationLandscapeRight
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research/SurveyTask.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SurveyTask.swift
3 | // hackpack-research
4 | //
5 | // Created by Joy Hsu on 11/10/16.
6 | // Updated by Olivia Brown on 1/27/18.
7 | // Copyright © 2018 TreeHacks. All rights reserved.
8 | //
9 |
10 | import Foundation
11 | import ResearchKit
12 |
13 | public var SurveyTask: ORKOrderedTask {
14 |
15 | var steps = [ORKStep]()
16 |
17 | let instructionStep = ORKInstructionStep(identifier: "IntroStep")
18 | instructionStep.title = "Basic Information"
19 | instructionStep.text = "The following will be some basic information about yourself"
20 | steps += [instructionStep]
21 |
22 | let nameAnswerFormat = ORKTextAnswerFormat(maximumLength: 20)
23 | nameAnswerFormat.multipleLines = false
24 | let nameQuestionStepTitle = "What is your name?"
25 |
26 | let nameQuestionStep = ORKQuestionStep(identifier: "QuestionStep", title: nameQuestionStepTitle, question: nil, answer: nameAnswerFormat)
27 | steps += [nameQuestionStep]
28 |
29 | var textChoices1 = [ORKTextChoice]()
30 | for x in 1...75{
31 | let idx = x-1
32 | textChoices1.append(ORKTextChoice(text: "\(x)", value: idx as NSCoding & NSCopying & NSObjectProtocol))
33 | }
34 |
35 | let nameAnswerFormat2 = ORKValuePickerAnswerFormat(textChoices:textChoices1)
36 | let nameQuestionStepTitle2 = "What is your age?"
37 | let nameQuestionStep2 = ORKQuestionStep(identifier: "QuestionStep2", title: nameQuestionStepTitle2, question: nil, answer: nameAnswerFormat2)
38 | steps += [nameQuestionStep2]
39 |
40 | let nameAnswerFormat3 = ORKHeightAnswerFormat()
41 | let nameQuestionStepTitle3 = "What is your height?"
42 | let nameQuestionStep3 = ORKQuestionStep(identifier: "QuestionStep3", title: nameQuestionStepTitle3, question: nil, answer: nameAnswerFormat3)
43 | steps += [nameQuestionStep3]
44 |
45 | let nameAnswerFormat4 = ORKTextAnswerFormat(maximumLength: 20)
46 | nameAnswerFormat4.multipleLines = false
47 | let nameQuestionStepTitle4 = "What is your weight?"
48 | let nameQuestionStep4 = ORKQuestionStep(identifier: "QuestionStep4", title: nameQuestionStepTitle4, question: nil, answer: nameAnswerFormat4)
49 | steps += [nameQuestionStep4]
50 |
51 | let questQuestionStepTitle = "What is your gender?"
52 | let textChoices = [
53 | ORKTextChoice(text: "Male", value: 0 as NSCoding & NSCopying & NSObjectProtocol),
54 | ORKTextChoice(text: "Female", value: 1 as NSCoding & NSCopying & NSObjectProtocol),
55 | ORKTextChoice(text: "Other", value: 2 as NSCoding & NSCopying & NSObjectProtocol)
56 | ]
57 | let questAnswerFormat: ORKTextChoiceAnswerFormat = ORKAnswerFormat.choiceAnswerFormat(with: .singleChoice, textChoices: textChoices)
58 | let questQuestionStep = ORKQuestionStep(identifier: "TextChoiceQuestionStep", title: questQuestionStepTitle, question: nil, answer: questAnswerFormat)
59 | steps += [questQuestionStep]
60 |
61 | let questQuestionStepTitle2 = "Do you have diabetes?"
62 | let textChoices2 = [
63 | ORKTextChoice(text: "Yes", value: 0 as NSCoding & NSCopying & NSObjectProtocol),
64 | ORKTextChoice(text: "No", value: 1 as NSCoding & NSCopying & NSObjectProtocol)
65 | ]
66 | let questAnswerFormat2: ORKTextChoiceAnswerFormat = ORKAnswerFormat.choiceAnswerFormat(with: .singleChoice, textChoices: textChoices2)
67 | let questQuestionStep2 = ORKQuestionStep(identifier: "TextChoiceQuestionStep2", title: questQuestionStepTitle2, question: nil, answer: questAnswerFormat2)
68 | steps += [questQuestionStep2]
69 |
70 | let questQuestionStepTitle3 = "Do you have heart disease?"
71 | let textChoices3 = [
72 | ORKTextChoice(text: "Yes", value: 0 as NSCoding & NSCopying & NSObjectProtocol),
73 | ORKTextChoice(text: "No", value: 1 as NSCoding & NSCopying & NSObjectProtocol)
74 | ]
75 | let questAnswerFormat3: ORKTextChoiceAnswerFormat = ORKAnswerFormat.choiceAnswerFormat(with: .singleChoice, textChoices: textChoices3)
76 | let questQuestionStep3 = ORKQuestionStep(identifier: "TextChoiceQuestionStep3", title: questQuestionStepTitle3, question: nil, answer: questAnswerFormat3)
77 | steps += [questQuestionStep3]
78 |
79 | let summaryStep = ORKCompletionStep(identifier: "SummaryStep")
80 | summaryStep.title = "Done"
81 | summaryStep.text = "Thank you for participating!"
82 | steps += [summaryStep]
83 |
84 | return ORKOrderedTask(identifier: "SurveyTask", steps: steps)
85 | }
86 |
--------------------------------------------------------------------------------
/hackpack-research/hackpack-research/hackpack-research.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.developer.healthkit
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------