{"action":"created","comment":{"url":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/comments/32679517","id":32679517,"diff_hunk":"@@ -46,6 +47,26 @@\n                                              :complete false}))]\n     (assoc ctx :import-id (:id results))))\n \n+(defn generate-public-id [{:keys [import-id] :as ctx}]\n+  (let [state (-> ctx\n+                 (get-in [:tables :states])\n+                 (korma/select (korma/fields :name))\n+                 first\n+                 :name)\n+        {:keys [date election_type]} (-> ctx\n+                                         (get-in [:tables :elections])\n+                                         (korma/select (korma/fields :date :election_type))\n+                                         first)]\n+    (str/join \"-\" [date election_type state import-id])))","path":"src/vip/data_processor/db/postgres.clj","position":21,"original_position":21,"commit_id":"b9f8e0dce600be1ea4edfefa845a2806e17dda29","original_commit_id":"b9f8e0dce600be1ea4edfefa845a2806e17dda29","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":"Good call. It would end up looking like (if the election-type were missing): \"2014-04-10--Ohio-10\", with two adjacent hyphens. I can collapse the hyphens around missing parts (Fortunately, the final piece _cannot_ be missing, so there will _always_ be a unique public_id.)","created_at":"2015-06-17T21:55:27Z","updated_at":"2015-06-17T21:55:27Z","html_url":"https://github.com/votinginfoproject/data-processor/pull/62#discussion_r32679517","pull_request_url":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/62","_links":{"self":{"href":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/comments/32679517"},"html":{"href":"https://github.com/votinginfoproject/data-processor/pull/62#discussion_r32679517"},"pull_request":{"href":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/62"}}},"pull_request":{"url":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/62","id":37950854,"html_url":"https://github.com/votinginfoproject/data-processor/pull/62","diff_url":"https://github.com/votinginfoproject/data-processor/pull/62.diff","patch_url":"https://github.com/votinginfoproject/data-processor/pull/62.patch","issue_url":"https://api.github.com/repos/votinginfoproject/data-processor/issues/62","number":62,"state":"open","locked":false,"title":"Create \"public_id\" for each run","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":"Pivotal story: [96666240](https://www.pivotaltracker.com/story/show/96666240)\r\n\r\nCreates a new column inside of the results table that contains a more readable _unique_ ID that's generated based on the election date, the election type, and the state. The unique identifier ends with the row's id itself.","created_at":"2015-06-17T21:48:22Z","updated_at":"2015-06-17T21:55:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"067c9f6ebcf3e2e6f42dbb22818997ff6a2f1163","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/62/commits","review_comments_url":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/62/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/62/comments","statuses_url":"https://api.github.com/repos/votinginfoproject/data-processor/statuses/b9f8e0dce600be1ea4edfefa845a2806e17dda29","head":{"label":"votinginfoproject:public-id","ref":"public-id","sha":"b9f8e0dce600be1ea4edfefa845a2806e17dda29","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-05-08T19:59:05Z","pushed_at":"2015-06-17T21:48:24Z","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":1576,"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":"bc317e54ff9b4cc06af54140f12cbdf83259ff73","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-05-08T19:59:05Z","pushed_at":"2015-06-17T21:48:24Z","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":1576,"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/62"},"html":{"href":"https://github.com/votinginfoproject/data-processor/pull/62"},"issue":{"href":"https://api.github.com/repos/votinginfoproject/data-processor/issues/62"},"comments":{"href":"https://api.github.com/repos/votinginfoproject/data-processor/issues/62/comments"},"review_comments":{"href":"https://api.github.com/repos/votinginfoproject/data-processor/pulls/62/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/62/commits"},"statuses":{"href":"https://api.github.com/repos/votinginfoproject/data-processor/statuses/b9f8e0dce600be1ea4edfefa845a2806e17dda29"}}}}