{"action":"created","comment":{"url":"https://api.github.com/repos/ResearchKit/ResearchKit/pulls/comments/37710005","id":37710005,"diff_hunk":"@@ -191,4 +195,133 @@ - (NSUInteger)hash {\n     return [super hash] ^ [_stepNavigationRules hash];\n }\n \n+#pragma mark - Predefined\n+\n+NSString * const ORKHolePegTestDominantPlaceStepIdentifier = @\"hole.peg.test.dominant.place\";\n+NSString * const ORKHolePegTestDominantRemoveStepIdentifier = @\"hole.peg.test.dominant.remove\";\n+NSString * const ORKHolePegTestNonDominantPlaceStepIdentifier = @\"hole.peg.test.non.dominant.place\";\n+NSString * const ORKHolePegTestNonDominantRemoveStepIdentifier = @\"hole.peg.test.non.dominant.remove\";\n+\n++ (ORKNavigableOrderedTask *)holePegTestTaskWithIdentifier:(NSString *)identifier\n+                                    intendedUseDescription:(nullable NSString *)intendedUseDescription\n+                                              dominantHand:(ORKSide)dominantHand\n+                                              numberOfPegs:(int)numberOfPegs\n+                                                 threshold:(double)threshold\n+                                                   rotated:(BOOL)rotated\n+                                                 timeLimit:(NSTimeInterval)timeLimit\n+                                                   options:(ORKPredefinedTaskOption)options {\n+    \n+    NSMutableArray *steps = [NSMutableArray array];\n+    NSString *dHand = dominantHand == ORKSideLeft ? ORKLocalizedString(@\"HOLE_PEG_TEST_LEFT\", nil) : ORKLocalizedString(@\"HOLE_PEG_TEST_RIGHT\", nil);\n+    NSString *ndHand = dominantHand == ORKSideLeft ? ORKLocalizedString(@\"HOLE_PEG_TEST_RIGHT\", nil) : ORKLocalizedString(@\"HOLE_PEG_TEST_LEFT\", nil);\n+    \n+    if (! (options & ORKPredefinedTaskOptionExcludeInstructions)) {\n+        NSString *pegs = [NSNumberFormatter localizedStringFromNumber:@(numberOfPegs) numberStyle:NSNumberFormatterNoStyle];\n+        {\n+            ORKInstructionStep *step = [[ORKInstructionStep alloc] initWithIdentifier:ORKInstruction0StepIdentifier];\n+            step.title = [[NSString alloc] initWithFormat:ORKLocalizedString(@\"HOLE_PEG_TEST_TITLE_%@\", nil), pegs];\n+            step.text = intendedUseDescription;\n+            step.detailText = [[NSString alloc] initWithFormat:ORKLocalizedString(@\"HOLE_PEG_TEST_INTRO_TEXT_%@\", nil), pegs];\n+            step.image = [UIImage imageNamed:@\"phoneholepeg\" inBundle:[NSBundle bundleForClass:[self class]] compatibleWithTraitCollection:nil];\n+            step.shouldTintImages = YES;\n+            \n+            ORKStepArrayAddStep(steps, step);\n+        }\n+        \n+        {\n+            ORKInstructionStep *step = [[ORKInstructionStep alloc] initWithIdentifier:ORKInstruction1StepIdentifier];\n+            step.title = [[NSString alloc] initWithFormat:ORKLocalizedString(@\"HOLE_PEG_TEST_TITLE_%@\", nil), pegs];\n+            step.text = [[NSString alloc] initWithFormat:ORKLocalizedString(@\"HOLE_PEG_TEST_INTRO_TEXT_2_%@\", nil), dHand, ndHand, pegs, pegs];\n+            step.detailText = ORKLocalizedString(@\"HOLE_PEG_TEST_CALL_TO_ACTION\", nil);\n+            UIImage *image1 = [UIImage imageNamed:@\"holepegtest1\" inBundle:[NSBundle bundleForClass:[self class]] compatibleWithTraitCollection:nil];\n+            UIImage *image2 = [UIImage imageNamed:@\"holepegtest2\" inBundle:[NSBundle bundleForClass:[self class]] compatibleWithTraitCollection:nil];\n+            UIImage *image3 = [UIImage imageNamed:@\"holepegtest3\" inBundle:[NSBundle bundleForClass:[self class]] compatibleWithTraitCollection:nil];\n+            UIImage *image4 = [UIImage imageNamed:@\"holepegtest4\" inBundle:[NSBundle bundleForClass:[self class]] compatibleWithTraitCollection:nil];\n+            step.image = [UIImage animatedImageWithImages:@[image1, image2, image3, image4] duration:2];\n+            step.shouldTintImages = YES;\n+            \n+            ORKStepArrayAddStep(steps, step);\n+        }\n+    }\n+    \n+    {\n+        {\n+            ORKHolePegTestPlaceStep *step = [[ORKHolePegTestPlaceStep alloc] initWithIdentifier:ORKHolePegTestDominantPlaceStepIdentifier];\n+            step.title = [NSString stringWithFormat:ORKLocalizedString(@\"HOLE_PEG_TEST_PLACE_INSTRUCTION_%@\", nil), dHand];\n+            step.text = ORKLocalizedString(@\"HOLE_PEG_TEST_TEXT\", nil);\n+            step.spokenInstruction = step.title;","path":"ResearchKit/Common/ORKNavigableOrderedTask.m","position":69,"original_position":69,"commit_id":"9e45652356739839ebf7a9f061051e45dad983c4","original_commit_id":"9e45652356739839ebf7a9f061051e45dad983c4","user":{"login":"rsanchezsaez","id":444313,"avatar_url":"https://avatars.githubusercontent.com/u/444313?v=3","gravatar_id":"","url":"https://api.github.com/users/rsanchezsaez","html_url":"https://github.com/rsanchezsaez","followers_url":"https://api.github.com/users/rsanchezsaez/followers","following_url":"https://api.github.com/users/rsanchezsaez/following{/other_user}","gists_url":"https://api.github.com/users/rsanchezsaez/gists{/gist_id}","starred_url":"https://api.github.com/users/rsanchezsaez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsanchezsaez/subscriptions","organizations_url":"https://api.github.com/users/rsanchezsaez/orgs","repos_url":"https://api.github.com/users/rsanchezsaez/repos","events_url":"https://api.github.com/users/rsanchezsaez/events{/privacy}","received_events_url":"https://api.github.com/users/rsanchezsaez/received_events","type":"User","site_admin":false},"body":"Are the always-on spoken instructions needed for this task? I'd think that only tasks with a non-visible screen (e.g., the phone is in your pocket) would need them.","created_at":"2015-08-23T20:08:56Z","updated_at":"2015-08-23T20:08:56Z","html_url":"https://github.com/ResearchKit/ResearchKit/pull/373#discussion_r37710005","pull_request_url":"https://api.github.com/repos/ResearchKit/ResearchKit/pulls/373","_links":{"self":{"href":"https://api.github.com/repos/ResearchKit/ResearchKit/pulls/comments/37710005"},"html":{"href":"https://github.com/ResearchKit/ResearchKit/pull/373#discussion_r37710005"},"pull_request":{"href":"https://api.github.com/repos/ResearchKit/ResearchKit/pulls/373"}}},"pull_request":{"url":"https://api.github.com/repos/ResearchKit/ResearchKit/pulls/373","id":42354803,"html_url":"https://github.com/ResearchKit/ResearchKit/pull/373","diff_url":"https://github.com/ResearchKit/ResearchKit/pull/373.diff","patch_url":"https://github.com/ResearchKit/ResearchKit/pull/373.patch","issue_url":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/373","number":373,"state":"open","locked":false,"title":"Hole Peg Test task","user":{"login":"julientherier","id":1104275,"avatar_url":"https://avatars.githubusercontent.com/u/1104275?v=3","gravatar_id":"","url":"https://api.github.com/users/julientherier","html_url":"https://github.com/julientherier","followers_url":"https://api.github.com/users/julientherier/followers","following_url":"https://api.github.com/users/julientherier/following{/other_user}","gists_url":"https://api.github.com/users/julientherier/gists{/gist_id}","starred_url":"https://api.github.com/users/julientherier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julientherier/subscriptions","organizations_url":"https://api.github.com/users/julientherier/orgs","repos_url":"https://api.github.com/users/julientherier/repos","events_url":"https://api.github.com/users/julientherier/events{/privacy}","received_events_url":"https://api.github.com/users/julientherier/received_events","type":"User","site_admin":false},"body":"This pull-request adds a new active task: HPT (Hole Peg Test).\r\n\r\n> Pegboard tests of hand dexterity are commonly used in clinical settings to assess upper extremity function in various populations.\r\n\r\nThis task is well documented in the scientific literature to mesure the [MSFC score in Multiple Sclerosis](http://www.nationalmssociety.org/For-Professionals/Researchers/Resources-for-Researchers/Clinical-Study-Measures/9-Hole-Peg-Test-(9-HPT)) or Parkinson Disease for instance [Earhart _et al._, 2011](http://www.ncbi.nlm.nih.gov/pubmed/22020457).\r\n\r\nIt is one of the three tasks needed to assess the MSFC score:\r\n• [T25FW](https://github.com/ResearchKit/ResearchKit/pull/329)\r\n• [PASAT](https://github.com/ResearchKit/ResearchKit/pull/289).\r\n• 9-Hole Peg Test (this PR).\r\n\r\nPractically speaking, this task generates a two step test where participant must put a variable number of peg in a hole, and then remove them. This task tests both hands.\r\n\r\nYou can test this new task directly with the ORKCatalog application.\r\n\r\nPlease feel free to comment code and scientific aspect of this HPT task.\r\n\r\nTask in action:\r\n\r\n![img_0025](https://cloud.githubusercontent.com/assets/1104275/9251806/33b0b73e-41d5-11e5-9e4b-1075754d6e05.PNG)\r\n\r\n![img_0026](https://cloud.githubusercontent.com/assets/1104275/9251805/33af0ca4-41d5-11e5-9d2c-ccba48df52ae.PNG)\r\n\r\n![img_0027](https://cloud.githubusercontent.com/assets/1104275/9251803/3389e230-41d5-11e5-92b5-d9b924c0fd21.PNG)","created_at":"2015-08-13T14:12:42Z","updated_at":"2015-08-23T20:08:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e2e894d9405726503286652856c77ffca575946","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ResearchKit/ResearchKit/pulls/373/commits","review_comments_url":"https://api.github.com/repos/ResearchKit/ResearchKit/pulls/373/comments","review_comment_url":"https://api.github.com/repos/ResearchKit/ResearchKit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/373/comments","statuses_url":"https://api.github.com/repos/ResearchKit/ResearchKit/statuses/9e45652356739839ebf7a9f061051e45dad983c4","head":{"label":"shazino:9hpt-task","ref":"9hpt-task","sha":"9e45652356739839ebf7a9f061051e45dad983c4","user":{"login":"shazino","id":1098612,"avatar_url":"https://avatars.githubusercontent.com/u/1098612?v=3","gravatar_id":"","url":"https://api.github.com/users/shazino","html_url":"https://github.com/shazino","followers_url":"https://api.github.com/users/shazino/followers","following_url":"https://api.github.com/users/shazino/following{/other_user}","gists_url":"https://api.github.com/users/shazino/gists{/gist_id}","starred_url":"https://api.github.com/users/shazino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shazino/subscriptions","organizations_url":"https://api.github.com/users/shazino/orgs","repos_url":"https://api.github.com/users/shazino/repos","events_url":"https://api.github.com/users/shazino/events{/privacy}","received_events_url":"https://api.github.com/users/shazino/received_events","type":"Organization","site_admin":false},"repo":{"id":37128941,"name":"ResearchKit","full_name":"shazino/ResearchKit","owner":{"login":"shazino","id":1098612,"avatar_url":"https://avatars.githubusercontent.com/u/1098612?v=3","gravatar_id":"","url":"https://api.github.com/users/shazino","html_url":"https://github.com/shazino","followers_url":"https://api.github.com/users/shazino/followers","following_url":"https://api.github.com/users/shazino/following{/other_user}","gists_url":"https://api.github.com/users/shazino/gists{/gist_id}","starred_url":"https://api.github.com/users/shazino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shazino/subscriptions","organizations_url":"https://api.github.com/users/shazino/orgs","repos_url":"https://api.github.com/users/shazino/repos","events_url":"https://api.github.com/users/shazino/events{/privacy}","received_events_url":"https://api.github.com/users/shazino/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shazino/ResearchKit","description":"ResearchKit is an open source software framework that makes it easy to create apps for medical research or for other research projects.","fork":true,"url":"https://api.github.com/repos/shazino/ResearchKit","forks_url":"https://api.github.com/repos/shazino/ResearchKit/forks","keys_url":"https://api.github.com/repos/shazino/ResearchKit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shazino/ResearchKit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shazino/ResearchKit/teams","hooks_url":"https://api.github.com/repos/shazino/ResearchKit/hooks","issue_events_url":"https://api.github.com/repos/shazino/ResearchKit/issues/events{/number}","events_url":"https://api.github.com/repos/shazino/ResearchKit/events","assignees_url":"https://api.github.com/repos/shazino/ResearchKit/assignees{/user}","branches_url":"https://api.github.com/repos/shazino/ResearchKit/branches{/branch}","tags_url":"https://api.github.com/repos/shazino/ResearchKit/tags","blobs_url":"https://api.github.com/repos/shazino/ResearchKit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shazino/ResearchKit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shazino/ResearchKit/git/refs{/sha}","trees_url":"https://api.github.com/repos/shazino/ResearchKit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shazino/ResearchKit/statuses/{sha}","languages_url":"https://api.github.com/repos/shazino/ResearchKit/languages","stargazers_url":"https://api.github.com/repos/shazino/ResearchKit/stargazers","contributors_url":"https://api.github.com/repos/shazino/ResearchKit/contributors","subscribers_url":"https://api.github.com/repos/shazino/ResearchKit/subscribers","subscription_url":"https://api.github.com/repos/shazino/ResearchKit/subscription","commits_url":"https://api.github.com/repos/shazino/ResearchKit/commits{/sha}","git_commits_url":"https://api.github.com/repos/shazino/ResearchKit/git/commits{/sha}","comments_url":"https://api.github.com/repos/shazino/ResearchKit/comments{/number}","issue_comment_url":"https://api.github.com/repos/shazino/ResearchKit/issues/comments{/number}","contents_url":"https://api.github.com/repos/shazino/ResearchKit/contents/{+path}","compare_url":"https://api.github.com/repos/shazino/ResearchKit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shazino/ResearchKit/merges","archive_url":"https://api.github.com/repos/shazino/ResearchKit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shazino/ResearchKit/downloads","issues_url":"https://api.github.com/repos/shazino/ResearchKit/issues{/number}","pulls_url":"https://api.github.com/repos/shazino/ResearchKit/pulls{/number}","milestones_url":"https://api.github.com/repos/shazino/ResearchKit/milestones{/number}","notifications_url":"https://api.github.com/repos/shazino/ResearchKit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shazino/ResearchKit/labels{/name}","releases_url":"https://api.github.com/repos/shazino/ResearchKit/releases{/id}","created_at":"2015-06-09T11:51:43Z","updated_at":"2015-06-09T11:51:46Z","pushed_at":"2015-08-13T14:30:46Z","git_url":"git://github.com/shazino/ResearchKit.git","ssh_url":"git@github.com:shazino/ResearchKit.git","clone_url":"https://github.com/shazino/ResearchKit.git","svn_url":"https://github.com/shazino/ResearchKit","homepage":"","size":15685,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ResearchKit:master","ref":"master","sha":"85384bbc1d6180ab628ff177e240eae6eb225806","user":{"login":"ResearchKit","id":11183179,"avatar_url":"https://avatars.githubusercontent.com/u/11183179?v=3","gravatar_id":"","url":"https://api.github.com/users/ResearchKit","html_url":"https://github.com/ResearchKit","followers_url":"https://api.github.com/users/ResearchKit/followers","following_url":"https://api.github.com/users/ResearchKit/following{/other_user}","gists_url":"https://api.github.com/users/ResearchKit/gists{/gist_id}","starred_url":"https://api.github.com/users/ResearchKit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ResearchKit/subscriptions","organizations_url":"https://api.github.com/users/ResearchKit/orgs","repos_url":"https://api.github.com/users/ResearchKit/repos","events_url":"https://api.github.com/users/ResearchKit/events{/privacy}","received_events_url":"https://api.github.com/users/ResearchKit/received_events","type":"Organization","site_admin":false},"repo":{"id":31979038,"name":"ResearchKit","full_name":"ResearchKit/ResearchKit","owner":{"login":"ResearchKit","id":11183179,"avatar_url":"https://avatars.githubusercontent.com/u/11183179?v=3","gravatar_id":"","url":"https://api.github.com/users/ResearchKit","html_url":"https://github.com/ResearchKit","followers_url":"https://api.github.com/users/ResearchKit/followers","following_url":"https://api.github.com/users/ResearchKit/following{/other_user}","gists_url":"https://api.github.com/users/ResearchKit/gists{/gist_id}","starred_url":"https://api.github.com/users/ResearchKit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ResearchKit/subscriptions","organizations_url":"https://api.github.com/users/ResearchKit/orgs","repos_url":"https://api.github.com/users/ResearchKit/repos","events_url":"https://api.github.com/users/ResearchKit/events{/privacy}","received_events_url":"https://api.github.com/users/ResearchKit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ResearchKit/ResearchKit","description":"ResearchKit is an open source software framework that makes it easy to create apps for medical research or for other research projects.","fork":false,"url":"https://api.github.com/repos/ResearchKit/ResearchKit","forks_url":"https://api.github.com/repos/ResearchKit/ResearchKit/forks","keys_url":"https://api.github.com/repos/ResearchKit/ResearchKit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ResearchKit/ResearchKit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ResearchKit/ResearchKit/teams","hooks_url":"https://api.github.com/repos/ResearchKit/ResearchKit/hooks","issue_events_url":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/events{/number}","events_url":"https://api.github.com/repos/ResearchKit/ResearchKit/events","assignees_url":"https://api.github.com/repos/ResearchKit/ResearchKit/assignees{/user}","branches_url":"https://api.github.com/repos/ResearchKit/ResearchKit/branches{/branch}","tags_url":"https://api.github.com/repos/ResearchKit/ResearchKit/tags","blobs_url":"https://api.github.com/repos/ResearchKit/ResearchKit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ResearchKit/ResearchKit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ResearchKit/ResearchKit/git/refs{/sha}","trees_url":"https://api.github.com/repos/ResearchKit/ResearchKit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ResearchKit/ResearchKit/statuses/{sha}","languages_url":"https://api.github.com/repos/ResearchKit/ResearchKit/languages","stargazers_url":"https://api.github.com/repos/ResearchKit/ResearchKit/stargazers","contributors_url":"https://api.github.com/repos/ResearchKit/ResearchKit/contributors","subscribers_url":"https://api.github.com/repos/ResearchKit/ResearchKit/subscribers","subscription_url":"https://api.github.com/repos/ResearchKit/ResearchKit/subscription","commits_url":"https://api.github.com/repos/ResearchKit/ResearchKit/commits{/sha}","git_commits_url":"https://api.github.com/repos/ResearchKit/ResearchKit/git/commits{/sha}","comments_url":"https://api.github.com/repos/ResearchKit/ResearchKit/comments{/number}","issue_comment_url":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/comments{/number}","contents_url":"https://api.github.com/repos/ResearchKit/ResearchKit/contents/{+path}","compare_url":"https://api.github.com/repos/ResearchKit/ResearchKit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ResearchKit/ResearchKit/merges","archive_url":"https://api.github.com/repos/ResearchKit/ResearchKit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ResearchKit/ResearchKit/downloads","issues_url":"https://api.github.com/repos/ResearchKit/ResearchKit/issues{/number}","pulls_url":"https://api.github.com/repos/ResearchKit/ResearchKit/pulls{/number}","milestones_url":"https://api.github.com/repos/ResearchKit/ResearchKit/milestones{/number}","notifications_url":"https://api.github.com/repos/ResearchKit/ResearchKit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ResearchKit/ResearchKit/labels{/name}","releases_url":"https://api.github.com/repos/ResearchKit/ResearchKit/releases{/id}","created_at":"2015-03-10T20:05:32Z","updated_at":"2015-08-23T05:52:09Z","pushed_at":"2015-08-23T19:13:58Z","git_url":"git://github.com/ResearchKit/ResearchKit.git","ssh_url":"git@github.com:ResearchKit/ResearchKit.git","clone_url":"https://github.com/ResearchKit/ResearchKit.git","svn_url":"https://github.com/ResearchKit/ResearchKit","homepage":"","size":24174,"stargazers_count":3921,"watchers_count":3921,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":521,"mirror_url":null,"open_issues_count":51,"forks":521,"open_issues":51,"watchers":3921,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ResearchKit/ResearchKit/pulls/373"},"html":{"href":"https://github.com/ResearchKit/ResearchKit/pull/373"},"issue":{"href":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/373"},"comments":{"href":"https://api.github.com/repos/ResearchKit/ResearchKit/issues/373/comments"},"review_comments":{"href":"https://api.github.com/repos/ResearchKit/ResearchKit/pulls/373/comments"},"review_comment":{"href":"https://api.github.com/repos/ResearchKit/ResearchKit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ResearchKit/ResearchKit/pulls/373/commits"},"statuses":{"href":"https://api.github.com/repos/ResearchKit/ResearchKit/statuses/9e45652356739839ebf7a9f061051e45dad983c4"}}}}