{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleChrome/experience-sampling/pulls/comments/27889496","id":27889496,"diff_hunk":"@@ -52,12 +62,52 @@ def ProcessResults(json_in_file, csv_prefix):\n       # due to lack of data for a condition.\n       print 'Exception in %s: %s' % (c, e.value)\n \n+\n def _ParseSurveyResults(in_file):\n   with open(in_file, 'r') as json_file:\n     parsed = json.load(json_file)\n+  demographic = filter(lambda x: x['survey_type'] == 'setup.js', parsed)\n   events = filter(lambda x: x['survey_type'] != 'setup.js', parsed)\n-  return events\n+  return demographic, events\n+  \n+\n+def _FilterDemographicResults(demo_res, discard_before_date):\n+  \"\"\"Return a list of results that occur after the given date.\n+\n+  Args:\n+    parsed_demo: Results from demographic survey parsed from a raw JSON\n+      file into list of dicts\n+    discard_before_date: A date of type datetime.datetime; demographic\n+      survey results before this date will be discarded\n+    \n+  Returns:\n+    Integer index into the results list indicating which list\n+    element's questions can be considered canonical and complete.\n+    Also modifies the input results to filter out results with\n+    PLACEHOLDER for every question or whose date_taken comes\n+    before the given date.\n+  \"\"\"\n+  demo_res[:] = _DiscardResultsBeforeDate(demo_res, discard_before_date)\n+\n+  # Find responses that didn't use 'PLACEHOLDER' as the text for every question\n+  demo_res[:] = [\n+      r for r in demo_res\n+      if r['responses'][0]['question'] != 'PLACEHOLDER']","path":"tools/processresults.py","position":68,"original_position":68,"commit_id":"551fe9815790a17a9bfc13c1eefa323546cec175","original_commit_id":"551fe9815790a17a9bfc13c1eefa323546cec175","user":{"login":"moduloprime","id":5904096,"avatar_url":"https://avatars.githubusercontent.com/u/5904096?v=3","gravatar_id":"","url":"https://api.github.com/users/moduloprime","html_url":"https://github.com/moduloprime","followers_url":"https://api.github.com/users/moduloprime/followers","following_url":"https://api.github.com/users/moduloprime/following{/other_user}","gists_url":"https://api.github.com/users/moduloprime/gists{/gist_id}","starred_url":"https://api.github.com/users/moduloprime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moduloprime/subscriptions","organizations_url":"https://api.github.com/users/moduloprime/orgs","repos_url":"https://api.github.com/users/moduloprime/repos","events_url":"https://api.github.com/users/moduloprime/events{/privacy}","received_events_url":"https://api.github.com/users/moduloprime/received_events","type":"User","site_admin":false},"body":"Same as above; will change to not modify the input, but make modified list a return value.","created_at":"2015-04-07T15:36:49Z","updated_at":"2015-04-07T15:36:49Z","html_url":"https://github.com/GoogleChrome/experience-sampling/pull/186#discussion_r27889496","pull_request_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/pulls/186","_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/experience-sampling/pulls/comments/27889496"},"html":{"href":"https://github.com/GoogleChrome/experience-sampling/pull/186#discussion_r27889496"},"pull_request":{"href":"https://api.github.com/repos/GoogleChrome/experience-sampling/pulls/186"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleChrome/experience-sampling/pulls/186","id":32725262,"html_url":"https://github.com/GoogleChrome/experience-sampling/pull/186","diff_url":"https://github.com/GoogleChrome/experience-sampling/pull/186.diff","patch_url":"https://github.com/GoogleChrome/experience-sampling/pull/186.patch","issue_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/issues/186","number":186,"state":"open","locked":false,"title":"processing for demographic questions, with new tests passing","user":{"login":"moduloprime","id":5904096,"avatar_url":"https://avatars.githubusercontent.com/u/5904096?v=3","gravatar_id":"","url":"https://api.github.com/users/moduloprime","html_url":"https://github.com/moduloprime","followers_url":"https://api.github.com/users/moduloprime/followers","following_url":"https://api.github.com/users/moduloprime/following{/other_user}","gists_url":"https://api.github.com/users/moduloprime/gists{/gist_id}","starred_url":"https://api.github.com/users/moduloprime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moduloprime/subscriptions","organizations_url":"https://api.github.com/users/moduloprime/orgs","repos_url":"https://api.github.com/users/moduloprime/repos","events_url":"https://api.github.com/users/moduloprime/events{/privacy}","received_events_url":"https://api.github.com/users/moduloprime/received_events","type":"User","site_admin":false},"body":"@felt Had to add some new processing functions for demographic questions; PTAL","created_at":"2015-04-07T00:55:11Z","updated_at":"2015-04-07T15:36:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"47c1890deff2960d620662d05f0c43e8f917afa1","assignee":{"login":"meacer","id":1571579,"avatar_url":"https://avatars.githubusercontent.com/u/1571579?v=3","gravatar_id":"","url":"https://api.github.com/users/meacer","html_url":"https://github.com/meacer","followers_url":"https://api.github.com/users/meacer/followers","following_url":"https://api.github.com/users/meacer/following{/other_user}","gists_url":"https://api.github.com/users/meacer/gists{/gist_id}","starred_url":"https://api.github.com/users/meacer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meacer/subscriptions","organizations_url":"https://api.github.com/users/meacer/orgs","repos_url":"https://api.github.com/users/meacer/repos","events_url":"https://api.github.com/users/meacer/events{/privacy}","received_events_url":"https://api.github.com/users/meacer/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/pulls/186/commits","review_comments_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/pulls/186/comments","review_comment_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/issues/186/comments","statuses_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/statuses/551fe9815790a17a9bfc13c1eefa323546cec175","head":{"label":"moduloprime:processdemoqs","ref":"processdemoqs","sha":"551fe9815790a17a9bfc13c1eefa323546cec175","user":{"login":"moduloprime","id":5904096,"avatar_url":"https://avatars.githubusercontent.com/u/5904096?v=3","gravatar_id":"","url":"https://api.github.com/users/moduloprime","html_url":"https://github.com/moduloprime","followers_url":"https://api.github.com/users/moduloprime/followers","following_url":"https://api.github.com/users/moduloprime/following{/other_user}","gists_url":"https://api.github.com/users/moduloprime/gists{/gist_id}","starred_url":"https://api.github.com/users/moduloprime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moduloprime/subscriptions","organizations_url":"https://api.github.com/users/moduloprime/orgs","repos_url":"https://api.github.com/users/moduloprime/repos","events_url":"https://api.github.com/users/moduloprime/events{/privacy}","received_events_url":"https://api.github.com/users/moduloprime/received_events","type":"User","site_admin":false},"repo":{"id":26832452,"name":"experience-sampling","full_name":"moduloprime/experience-sampling","owner":{"login":"moduloprime","id":5904096,"avatar_url":"https://avatars.githubusercontent.com/u/5904096?v=3","gravatar_id":"","url":"https://api.github.com/users/moduloprime","html_url":"https://github.com/moduloprime","followers_url":"https://api.github.com/users/moduloprime/followers","following_url":"https://api.github.com/users/moduloprime/following{/other_user}","gists_url":"https://api.github.com/users/moduloprime/gists{/gist_id}","starred_url":"https://api.github.com/users/moduloprime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moduloprime/subscriptions","organizations_url":"https://api.github.com/users/moduloprime/orgs","repos_url":"https://api.github.com/users/moduloprime/repos","events_url":"https://api.github.com/users/moduloprime/events{/privacy}","received_events_url":"https://api.github.com/users/moduloprime/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/moduloprime/experience-sampling","description":"","fork":true,"url":"https://api.github.com/repos/moduloprime/experience-sampling","forks_url":"https://api.github.com/repos/moduloprime/experience-sampling/forks","keys_url":"https://api.github.com/repos/moduloprime/experience-sampling/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moduloprime/experience-sampling/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moduloprime/experience-sampling/teams","hooks_url":"https://api.github.com/repos/moduloprime/experience-sampling/hooks","issue_events_url":"https://api.github.com/repos/moduloprime/experience-sampling/issues/events{/number}","events_url":"https://api.github.com/repos/moduloprime/experience-sampling/events","assignees_url":"https://api.github.com/repos/moduloprime/experience-sampling/assignees{/user}","branches_url":"https://api.github.com/repos/moduloprime/experience-sampling/branches{/branch}","tags_url":"https://api.github.com/repos/moduloprime/experience-sampling/tags","blobs_url":"https://api.github.com/repos/moduloprime/experience-sampling/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moduloprime/experience-sampling/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moduloprime/experience-sampling/git/refs{/sha}","trees_url":"https://api.github.com/repos/moduloprime/experience-sampling/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moduloprime/experience-sampling/statuses/{sha}","languages_url":"https://api.github.com/repos/moduloprime/experience-sampling/languages","stargazers_url":"https://api.github.com/repos/moduloprime/experience-sampling/stargazers","contributors_url":"https://api.github.com/repos/moduloprime/experience-sampling/contributors","subscribers_url":"https://api.github.com/repos/moduloprime/experience-sampling/subscribers","subscription_url":"https://api.github.com/repos/moduloprime/experience-sampling/subscription","commits_url":"https://api.github.com/repos/moduloprime/experience-sampling/commits{/sha}","git_commits_url":"https://api.github.com/repos/moduloprime/experience-sampling/git/commits{/sha}","comments_url":"https://api.github.com/repos/moduloprime/experience-sampling/comments{/number}","issue_comment_url":"https://api.github.com/repos/moduloprime/experience-sampling/issues/comments{/number}","contents_url":"https://api.github.com/repos/moduloprime/experience-sampling/contents/{+path}","compare_url":"https://api.github.com/repos/moduloprime/experience-sampling/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moduloprime/experience-sampling/merges","archive_url":"https://api.github.com/repos/moduloprime/experience-sampling/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moduloprime/experience-sampling/downloads","issues_url":"https://api.github.com/repos/moduloprime/experience-sampling/issues{/number}","pulls_url":"https://api.github.com/repos/moduloprime/experience-sampling/pulls{/number}","milestones_url":"https://api.github.com/repos/moduloprime/experience-sampling/milestones{/number}","notifications_url":"https://api.github.com/repos/moduloprime/experience-sampling/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moduloprime/experience-sampling/labels{/name}","releases_url":"https://api.github.com/repos/moduloprime/experience-sampling/releases{/id}","created_at":"2014-11-18T22:09:47Z","updated_at":"2015-01-29T15:40:52Z","pushed_at":"2015-04-07T00:53:51Z","git_url":"git://github.com/moduloprime/experience-sampling.git","ssh_url":"git@github.com:moduloprime/experience-sampling.git","clone_url":"https://github.com/moduloprime/experience-sampling.git","svn_url":"https://github.com/moduloprime/experience-sampling","homepage":null,"size":3773,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"GoogleChrome:master","ref":"master","sha":"65a86eb3c611a0aa0c226f9d7524a6588a7698ba","user":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"repo":{"id":22887014,"name":"experience-sampling","full_name":"GoogleChrome/experience-sampling","owner":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleChrome/experience-sampling","description":"","fork":false,"url":"https://api.github.com/repos/GoogleChrome/experience-sampling","forks_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/forks","keys_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/teams","hooks_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/hooks","issue_events_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/events","assignees_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/tags","blobs_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/languages","stargazers_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/stargazers","contributors_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/contributors","subscribers_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/subscribers","subscription_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/subscription","commits_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/merges","archive_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/downloads","issues_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/labels{/name}","releases_url":"https://api.github.com/repos/GoogleChrome/experience-sampling/releases{/id}","created_at":"2014-08-12T18:02:09Z","updated_at":"2015-04-04T01:27:21Z","pushed_at":"2015-04-07T00:55:11Z","git_url":"git://github.com/GoogleChrome/experience-sampling.git","ssh_url":"git@github.com:GoogleChrome/experience-sampling.git","clone_url":"https://github.com/GoogleChrome/experience-sampling.git","svn_url":"https://github.com/GoogleChrome/experience-sampling","homepage":null,"size":5459,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/experience-sampling/pulls/186"},"html":{"href":"https://github.com/GoogleChrome/experience-sampling/pull/186"},"issue":{"href":"https://api.github.com/repos/GoogleChrome/experience-sampling/issues/186"},"comments":{"href":"https://api.github.com/repos/GoogleChrome/experience-sampling/issues/186/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleChrome/experience-sampling/pulls/186/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleChrome/experience-sampling/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleChrome/experience-sampling/pulls/186/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleChrome/experience-sampling/statuses/551fe9815790a17a9bfc13c1eefa323546cec175"}}}}