{"action":"created","comment":{"url":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/comments/28981845","id":28981845,"diff_hunk":"@@ -0,0 +1,47 @@\n+(ns vip.data-processor.output.referendum\n+  (:require [vip.data-processor.output.xml-helpers :refer :all]\n+            [korma.core :as korma]))\n+\n+(defn ballot-response->xml [ballot-response]\n+  (let [xml {:tag :ballot_response_id\n+             :content [(str (:id ballot-response))]}\n+        sort-order (:sort_order ballot-response)]\n+    (if sort-order\n+      (assoc-in xml [:attrs :sort_order] sort-order)\n+      xml)))\n+\n+(defn ->xml [referendum ballot-responses]\n+  (let [{:keys [id\n+                title\n+                subtitle\n+                brief\n+                text\n+                pro_statement\n+                con_statement\n+                passage_threshold\n+                effect_of_abstain]} referendum\n+        children (concat [(xml-node title)\n+                          (xml-node subtitle)\n+                          (xml-node brief)\n+                          (xml-node text)\n+                          (xml-node pro_statement)\n+                          (xml-node con_statement)\n+                          (xml-node passage_threshold)\n+                          (xml-node effect_of_abstain)]\n+                         (map ballot-response->xml ballot-responses))]\n+    (simple-xml :referendum id children)))\n+\n+(defn ballot-responses [ctx referendum]\n+  (let [referendum-ballot-responses-table (get-in ctx [:tables :referendum-ballot-responses])","path":"src/vip/data_processor/output/referendum.clj","position":35,"original_position":35,"commit_id":"3d26e2b8696e51e7da2036f8d780ec83e04c9fb0","original_commit_id":"3d26e2b8696e51e7da2036f8d780ec83e04c9fb0","user":{"login":"bwreid","id":1316902,"avatar_url":"https://avatars.githubusercontent.com/u/1316902?v=3","gravatar_id":"","url":"https://api.github.com/users/bwreid","html_url":"https://github.com/bwreid","followers_url":"https://api.github.com/users/bwreid/followers","following_url":"https://api.github.com/users/bwreid/following{/other_user}","gists_url":"https://api.github.com/users/bwreid/gists{/gist_id}","starred_url":"https://api.github.com/users/bwreid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bwreid/subscriptions","organizations_url":"https://api.github.com/users/bwreid/orgs","repos_url":"https://api.github.com/users/bwreid/repos","events_url":"https://api.github.com/users/bwreid/events{/privacy}","received_events_url":"https://api.github.com/users/bwreid/received_events","type":"User","site_admin":false},"body":"We do this a lot. Could we create a helper fn?\r\n\r\n```\r\n(defn get-table [ctx table-key]\r\n  (get-in ctx [:tables table-key]))\r\n```","created_at":"2015-04-23T17:03:09Z","updated_at":"2015-04-23T17:03:09Z","html_url":"https://github.com/votinginfoproject/data-processor/pull/47#discussion_r28981845","pull_request_url":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/47","_links":{"self":{"href":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/comments/28981845"},"html":{"href":"https://github.com/votinginfoproject/data-processor/pull/47#discussion_r28981845"},"pull_request":{"href":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/47"}}},"pull_request":{"url":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/47","id":33904378,"html_url":"https://github.com/votinginfoproject/data-processor/pull/47","diff_url":"https://github.com/votinginfoproject/data-processor/pull/47.diff","patch_url":"https://github.com/votinginfoproject/data-processor/pull/47.patch","issue_url":"https://api.github.com/repos/votinginfoproject/data-processor/issues/47","number":47,"state":"open","locked":false,"title":"More xml output","user":{"login":"tie-rack","id":3526,"avatar_url":"https://avatars.githubusercontent.com/u/3526?v=3","gravatar_id":"","url":"https://api.github.com/users/tie-rack","html_url":"https://github.com/tie-rack","followers_url":"https://api.github.com/users/tie-rack/followers","following_url":"https://api.github.com/users/tie-rack/following{/other_user}","gists_url":"https://api.github.com/users/tie-rack/gists{/gist_id}","starred_url":"https://api.github.com/users/tie-rack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tie-rack/subscriptions","organizations_url":"https://api.github.com/users/tie-rack/orgs","repos_url":"https://api.github.com/users/tie-rack/repos","events_url":"https://api.github.com/users/tie-rack/events{/privacy}","received_events_url":"https://api.github.com/users/tie-rack/received_events","type":"User","site_admin":false},"body":"This PR encompasses multiple Pivotal stories:\r\n\r\n* [91989430](https://www.pivotaltracker.com/story/show/91989430): Create `<referendum>` elements in XML export\r\n* [91989372](https://www.pivotaltracker.com/story/show/91989372): Create `<election_official>` elements in XML export\r\n* [91988708](https://www.pivotaltracker.com/story/show/91988708): Create `<ballot>` elements in XML export\r\n* [91986578](https://www.pivotaltracker.com/story/show/91986578): Create `<election>` elements in XML export\r\n* [91986474](https://www.pivotaltracker.com/story/show/91986474): Create `<source>` elements in XML export\r\n* [91987784](https://www.pivotaltracker.com/story/show/91987784): Create `<precinct>` elements in XML export","created_at":"2015-04-22T21:42:13Z","updated_at":"2015-04-23T17:03:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d1633f310a7f432ee5ed42e9408fc9bab39aa984","assignee":{"login":"bwreid","id":1316902,"avatar_url":"https://avatars.githubusercontent.com/u/1316902?v=3","gravatar_id":"","url":"https://api.github.com/users/bwreid","html_url":"https://github.com/bwreid","followers_url":"https://api.github.com/users/bwreid/followers","following_url":"https://api.github.com/users/bwreid/following{/other_user}","gists_url":"https://api.github.com/users/bwreid/gists{/gist_id}","starred_url":"https://api.github.com/users/bwreid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bwreid/subscriptions","organizations_url":"https://api.github.com/users/bwreid/orgs","repos_url":"https://api.github.com/users/bwreid/repos","events_url":"https://api.github.com/users/bwreid/events{/privacy}","received_events_url":"https://api.github.com/users/bwreid/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/47/commits","review_comments_url":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/47/comments","review_comment_url":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/votinginfoproject/data-processor/issues/47/comments","statuses_url":"https://api.github.com/repos/votinginfoproject/data-processor/statuses/3d26e2b8696e51e7da2036f8d780ec83e04c9fb0","head":{"label":"votinginfoproject:more-xml-output","ref":"more-xml-output","sha":"3d26e2b8696e51e7da2036f8d780ec83e04c9fb0","user":{"login":"votinginfoproject","id":317805,"avatar_url":"https://avatars.githubusercontent.com/u/317805?v=3","gravatar_id":"","url":"https://api.github.com/users/votinginfoproject","html_url":"https://github.com/votinginfoproject","followers_url":"https://api.github.com/users/votinginfoproject/followers","following_url":"https://api.github.com/users/votinginfoproject/following{/other_user}","gists_url":"https://api.github.com/users/votinginfoproject/gists{/gist_id}","starred_url":"https://api.github.com/users/votinginfoproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/votinginfoproject/subscriptions","organizations_url":"https://api.github.com/users/votinginfoproject/orgs","repos_url":"https://api.github.com/users/votinginfoproject/repos","events_url":"https://api.github.com/users/votinginfoproject/events{/privacy}","received_events_url":"https://api.github.com/users/votinginfoproject/received_events","type":"Organization","site_admin":false},"repo":{"id":29880296,"name":"data-processor","full_name":"votinginfoproject/data-processor","owner":{"login":"votinginfoproject","id":317805,"avatar_url":"https://avatars.githubusercontent.com/u/317805?v=3","gravatar_id":"","url":"https://api.github.com/users/votinginfoproject","html_url":"https://github.com/votinginfoproject","followers_url":"https://api.github.com/users/votinginfoproject/followers","following_url":"https://api.github.com/users/votinginfoproject/following{/other_user}","gists_url":"https://api.github.com/users/votinginfoproject/gists{/gist_id}","starred_url":"https://api.github.com/users/votinginfoproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/votinginfoproject/subscriptions","organizations_url":"https://api.github.com/users/votinginfoproject/orgs","repos_url":"https://api.github.com/users/votinginfoproject/repos","events_url":"https://api.github.com/users/votinginfoproject/events{/privacy}","received_events_url":"https://api.github.com/users/votinginfoproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/votinginfoproject/data-processor","description":"VIP data processing","fork":false,"url":"https://api.github.com/repos/votinginfoproject/data-processor","forks_url":"https://api.github.com/repos/votinginfoproject/data-processor/forks","keys_url":"https://api.github.com/repos/votinginfoproject/data-processor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/votinginfoproject/data-processor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/votinginfoproject/data-processor/teams","hooks_url":"https://api.github.com/repos/votinginfoproject/data-processor/hooks","issue_events_url":"https://api.github.com/repos/votinginfoproject/data-processor/issues/events{/number}","events_url":"https://api.github.com/repos/votinginfoproject/data-processor/events","assignees_url":"https://api.github.com/repos/votinginfoproject/data-processor/assignees{/user}","branches_url":"https://api.github.com/repos/votinginfoproject/data-processor/branches{/branch}","tags_url":"https://api.github.com/repos/votinginfoproject/data-processor/tags","blobs_url":"https://api.github.com/repos/votinginfoproject/data-processor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/votinginfoproject/data-processor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/votinginfoproject/data-processor/git/refs{/sha}","trees_url":"https://api.github.com/repos/votinginfoproject/data-processor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/votinginfoproject/data-processor/statuses/{sha}","languages_url":"https://api.github.com/repos/votinginfoproject/data-processor/languages","stargazers_url":"https://api.github.com/repos/votinginfoproject/data-processor/stargazers","contributors_url":"https://api.github.com/repos/votinginfoproject/data-processor/contributors","subscribers_url":"https://api.github.com/repos/votinginfoproject/data-processor/subscribers","subscription_url":"https://api.github.com/repos/votinginfoproject/data-processor/subscription","commits_url":"https://api.github.com/repos/votinginfoproject/data-processor/commits{/sha}","git_commits_url":"https://api.github.com/repos/votinginfoproject/data-processor/git/commits{/sha}","comments_url":"https://api.github.com/repos/votinginfoproject/data-processor/comments{/number}","issue_comment_url":"https://api.github.com/repos/votinginfoproject/data-processor/issues/comments{/number}","contents_url":"https://api.github.com/repos/votinginfoproject/data-processor/contents/{+path}","compare_url":"https://api.github.com/repos/votinginfoproject/data-processor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/votinginfoproject/data-processor/merges","archive_url":"https://api.github.com/repos/votinginfoproject/data-processor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/votinginfoproject/data-processor/downloads","issues_url":"https://api.github.com/repos/votinginfoproject/data-processor/issues{/number}","pulls_url":"https://api.github.com/repos/votinginfoproject/data-processor/pulls{/number}","milestones_url":"https://api.github.com/repos/votinginfoproject/data-processor/milestones{/number}","notifications_url":"https://api.github.com/repos/votinginfoproject/data-processor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/votinginfoproject/data-processor/labels{/name}","releases_url":"https://api.github.com/repos/votinginfoproject/data-processor/releases{/id}","created_at":"2015-01-26T20:34:26Z","updated_at":"2015-04-21T20:19:30Z","pushed_at":"2015-04-22T21:42:13Z","git_url":"git://github.com/votinginfoproject/data-processor.git","ssh_url":"git@github.com:votinginfoproject/data-processor.git","clone_url":"https://github.com/votinginfoproject/data-processor.git","svn_url":"https://github.com/votinginfoproject/data-processor","homepage":null,"size":1520,"stargazers_count":0,"watchers_count":0,"language":"Clojure","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"votinginfoproject:master","ref":"master","sha":"fc156a54966a7b9b76dc1cea46e6bfacc46e7382","user":{"login":"votinginfoproject","id":317805,"avatar_url":"https://avatars.githubusercontent.com/u/317805?v=3","gravatar_id":"","url":"https://api.github.com/users/votinginfoproject","html_url":"https://github.com/votinginfoproject","followers_url":"https://api.github.com/users/votinginfoproject/followers","following_url":"https://api.github.com/users/votinginfoproject/following{/other_user}","gists_url":"https://api.github.com/users/votinginfoproject/gists{/gist_id}","starred_url":"https://api.github.com/users/votinginfoproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/votinginfoproject/subscriptions","organizations_url":"https://api.github.com/users/votinginfoproject/orgs","repos_url":"https://api.github.com/users/votinginfoproject/repos","events_url":"https://api.github.com/users/votinginfoproject/events{/privacy}","received_events_url":"https://api.github.com/users/votinginfoproject/received_events","type":"Organization","site_admin":false},"repo":{"id":29880296,"name":"data-processor","full_name":"votinginfoproject/data-processor","owner":{"login":"votinginfoproject","id":317805,"avatar_url":"https://avatars.githubusercontent.com/u/317805?v=3","gravatar_id":"","url":"https://api.github.com/users/votinginfoproject","html_url":"https://github.com/votinginfoproject","followers_url":"https://api.github.com/users/votinginfoproject/followers","following_url":"https://api.github.com/users/votinginfoproject/following{/other_user}","gists_url":"https://api.github.com/users/votinginfoproject/gists{/gist_id}","starred_url":"https://api.github.com/users/votinginfoproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/votinginfoproject/subscriptions","organizations_url":"https://api.github.com/users/votinginfoproject/orgs","repos_url":"https://api.github.com/users/votinginfoproject/repos","events_url":"https://api.github.com/users/votinginfoproject/events{/privacy}","received_events_url":"https://api.github.com/users/votinginfoproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/votinginfoproject/data-processor","description":"VIP data processing","fork":false,"url":"https://api.github.com/repos/votinginfoproject/data-processor","forks_url":"https://api.github.com/repos/votinginfoproject/data-processor/forks","keys_url":"https://api.github.com/repos/votinginfoproject/data-processor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/votinginfoproject/data-processor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/votinginfoproject/data-processor/teams","hooks_url":"https://api.github.com/repos/votinginfoproject/data-processor/hooks","issue_events_url":"https://api.github.com/repos/votinginfoproject/data-processor/issues/events{/number}","events_url":"https://api.github.com/repos/votinginfoproject/data-processor/events","assignees_url":"https://api.github.com/repos/votinginfoproject/data-processor/assignees{/user}","branches_url":"https://api.github.com/repos/votinginfoproject/data-processor/branches{/branch}","tags_url":"https://api.github.com/repos/votinginfoproject/data-processor/tags","blobs_url":"https://api.github.com/repos/votinginfoproject/data-processor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/votinginfoproject/data-processor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/votinginfoproject/data-processor/git/refs{/sha}","trees_url":"https://api.github.com/repos/votinginfoproject/data-processor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/votinginfoproject/data-processor/statuses/{sha}","languages_url":"https://api.github.com/repos/votinginfoproject/data-processor/languages","stargazers_url":"https://api.github.com/repos/votinginfoproject/data-processor/stargazers","contributors_url":"https://api.github.com/repos/votinginfoproject/data-processor/contributors","subscribers_url":"https://api.github.com/repos/votinginfoproject/data-processor/subscribers","subscription_url":"https://api.github.com/repos/votinginfoproject/data-processor/subscription","commits_url":"https://api.github.com/repos/votinginfoproject/data-processor/commits{/sha}","git_commits_url":"https://api.github.com/repos/votinginfoproject/data-processor/git/commits{/sha}","comments_url":"https://api.github.com/repos/votinginfoproject/data-processor/comments{/number}","issue_comment_url":"https://api.github.com/repos/votinginfoproject/data-processor/issues/comments{/number}","contents_url":"https://api.github.com/repos/votinginfoproject/data-processor/contents/{+path}","compare_url":"https://api.github.com/repos/votinginfoproject/data-processor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/votinginfoproject/data-processor/merges","archive_url":"https://api.github.com/repos/votinginfoproject/data-processor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/votinginfoproject/data-processor/downloads","issues_url":"https://api.github.com/repos/votinginfoproject/data-processor/issues{/number}","pulls_url":"https://api.github.com/repos/votinginfoproject/data-processor/pulls{/number}","milestones_url":"https://api.github.com/repos/votinginfoproject/data-processor/milestones{/number}","notifications_url":"https://api.github.com/repos/votinginfoproject/data-processor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/votinginfoproject/data-processor/labels{/name}","releases_url":"https://api.github.com/repos/votinginfoproject/data-processor/releases{/id}","created_at":"2015-01-26T20:34:26Z","updated_at":"2015-04-21T20:19:30Z","pushed_at":"2015-04-22T21:42:13Z","git_url":"git://github.com/votinginfoproject/data-processor.git","ssh_url":"git@github.com:votinginfoproject/data-processor.git","clone_url":"https://github.com/votinginfoproject/data-processor.git","svn_url":"https://github.com/votinginfoproject/data-processor","homepage":null,"size":1520,"stargazers_count":0,"watchers_count":0,"language":"Clojure","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/47"},"html":{"href":"https://github.com/votinginfoproject/data-processor/pull/47"},"issue":{"href":"https://api.github.com/repos/votinginfoproject/data-processor/issues/47"},"comments":{"href":"https://api.github.com/repos/votinginfoproject/data-processor/issues/47/comments"},"review_comments":{"href":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/47/comments"},"review_comment":{"href":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/47/commits"},"statuses":{"href":"https://api.github.com/repos/votinginfoproject/data-processor/statuses/3d26e2b8696e51e7da2036f8d780ec83e04c9fb0"}}}}