{"action":"created","comment":{"url":"https://api.github.com/repos/codeforgso/GoVote/pulls/comments/177292028","pull_request_review_id":107135530,"id":177292028,"diff_hunk":"@@ -1,130 +1,120 @@\n #!/usr/bin/env node\n-'use strict';\n-const { Client } = require('pg');\n-const copyFrom = require('pg-copy-streams').from;\n-const http = require('http');\n-const path = require(\"path\");\n+/* eslint-disable no-console */\n+\n const fs = require('fs');\n+const request = require('request');\n const unzip = require('unzip');\n-const copyTo = require('pg-copy-streams').to;\n-const { exec } = require('child_process');\n const iconv = require('iconv-lite');\n+const copyFrom = require('pg-copy-streams').from;\n+const { Client } = require('pg');\n \n+const downloadFile = (url, fileName) =>\n+  new Promise((resolve, reject) => {\n+    console.log('Downloading file');\n+    request(url)\n+      .on('error', (err) => {\n+        console.log(err);\n+        reject(err);\n+      })\n+        .pipe(fs.createWriteStream(fileName))\n+        .on('close', () => {\n+          resolve('success');\n+        });\n+  });\n \n-// Ensure environment variables are read.\n-require('../config/env');\n+const unzipFile = (pathToZip, pathToExtract) =>\n+ new Promise((resolve, reject) => {\n+   console.log('Extracting file from zip');\n+   fs.createReadStream(pathToZip)\n+      .pipe(unzip.Extract({ path: pathToExtract }))\n+      .on('error', (error) => {\n+        console.log(error);\n+        reject(error);\n+      })\n+      .on('close', () => {\n+        resolve();\n+      });\n+ });\n \n-if (process.env.NODE_ENV !== 'production') {\n-  let dotenv = require('dotenv');\n-  dotenv.config();\n-}\n+const truncateTable = async () => {","path":"bin/etl.js","position":52,"original_position":52,"commit_id":"a474d929df04e04c2b259e7c8b93dc80713a9f54","original_commit_id":"a474d929df04e04c2b259e7c8b93dc80713a9f54","user":{"login":"BlakeGuilloud","id":14660993,"avatar_url":"https://avatars3.githubusercontent.com/u/14660993?v=4","gravatar_id":"","url":"https://api.github.com/users/BlakeGuilloud","html_url":"https://github.com/BlakeGuilloud","followers_url":"https://api.github.com/users/BlakeGuilloud/followers","following_url":"https://api.github.com/users/BlakeGuilloud/following{/other_user}","gists_url":"https://api.github.com/users/BlakeGuilloud/gists{/gist_id}","starred_url":"https://api.github.com/users/BlakeGuilloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BlakeGuilloud/subscriptions","organizations_url":"https://api.github.com/users/BlakeGuilloud/orgs","repos_url":"https://api.github.com/users/BlakeGuilloud/repos","events_url":"https://api.github.com/users/BlakeGuilloud/events{/privacy}","received_events_url":"https://api.github.com/users/BlakeGuilloud/received_events","type":"User","site_admin":false},"body":"This does not need the `async` prefix nor the `await` in the return  since you are returning a promise that you are awaiting on the invocation of this function. [Here](https://jakearchibald.com/2017/await-vs-return-vs-return-await/) is an article describing the only use case I can think of for returning an awaited function.","created_at":"2018-03-27T02:39:09Z","updated_at":"2018-03-27T02:44:12Z","html_url":"https://github.com/codeforgso/GoVote/pull/53#discussion_r177292028","pull_request_url":"https://api.github.com/repos/codeforgso/GoVote/pulls/53","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/codeforgso/GoVote/pulls/comments/177292028"},"html":{"href":"https://github.com/codeforgso/GoVote/pull/53#discussion_r177292028"},"pull_request":{"href":"https://api.github.com/repos/codeforgso/GoVote/pulls/53"}}},"pull_request":{"url":"https://api.github.com/repos/codeforgso/GoVote/pulls/53","id":177615828,"html_url":"https://github.com/codeforgso/GoVote/pull/53","diff_url":"https://github.com/codeforgso/GoVote/pull/53.diff","patch_url":"https://github.com/codeforgso/GoVote/pull/53.patch","issue_url":"https://api.github.com/repos/codeforgso/GoVote/issues/53","number":53,"state":"open","locked":false,"title":"Move project to docker","user":{"login":"SchaeStewart","id":9397068,"avatar_url":"https://avatars3.githubusercontent.com/u/9397068?v=4","gravatar_id":"","url":"https://api.github.com/users/SchaeStewart","html_url":"https://github.com/SchaeStewart","followers_url":"https://api.github.com/users/SchaeStewart/followers","following_url":"https://api.github.com/users/SchaeStewart/following{/other_user}","gists_url":"https://api.github.com/users/SchaeStewart/gists{/gist_id}","starred_url":"https://api.github.com/users/SchaeStewart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SchaeStewart/subscriptions","organizations_url":"https://api.github.com/users/SchaeStewart/orgs","repos_url":"https://api.github.com/users/SchaeStewart/repos","events_url":"https://api.github.com/users/SchaeStewart/events{/privacy}","received_events_url":"https://api.github.com/users/SchaeStewart/received_events","type":"User","site_admin":false},"body":"<!--- Provide a general summary of your changes in the Title above -->\r\nAdded Dockerfile, docker-compose.yml, create-tables.js, and rewrote etl.js. Updated Contributing.md with examples of how to run the project.\r\n\r\n## Description\r\n<!--- Describe your changes in detail -->\r\nThe Dockerfile creates the govote image.  \r\ndocker-compose.yml defines how the govote service and the database interact.  \r\ncreate-tables.js. uses a query (which I generated from the aws database) to create the guilfordvoters table.\r\nThe etl script now uses async/await and promises and is no longer throwing errors.\r\n\r\n## Related Issue\r\n#46 Move project to docker\r\n\r\n## Motivation and Context\r\nThis standardizes our dev environments and moves contributors away from sharing aws keys to access the database.  \r\nIt will also make it easier for other brigades/organizations to run and use the project.\r\n\r\n## How Has This Been Tested?\r\nI've tested it locally on my Mac. Further testing should be done before merging. We also need to test the etl script in prod to ensure everything works properly, since I completely rewrote it.\r\n\r\n## Checklist:\r\n<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->\r\n- [x] My code follows the code style of this project.\r\n- [x] My change requires a change to the documentation.\r\n- [x] I have updated the documentation accordingly.\r\n- [x] I have read the **CONTRIBUTING** document.\r\n- [ ] I have added tests to cover my changes.\r\n- [ ] All new and existing tests passed.\r\n","created_at":"2018-03-27T02:29:01Z","updated_at":"2018-03-27T02:44:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ca2c97a1ebcf2aa36e2517874b2396a374c3ed8b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/codeforgso/GoVote/pulls/53/commits","review_comments_url":"https://api.github.com/repos/codeforgso/GoVote/pulls/53/comments","review_comment_url":"https://api.github.com/repos/codeforgso/GoVote/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codeforgso/GoVote/issues/53/comments","statuses_url":"https://api.github.com/repos/codeforgso/GoVote/statuses/a474d929df04e04c2b259e7c8b93dc80713a9f54","head":{"label":"SchaeStewart:dev","ref":"dev","sha":"a474d929df04e04c2b259e7c8b93dc80713a9f54","user":{"login":"SchaeStewart","id":9397068,"avatar_url":"https://avatars3.githubusercontent.com/u/9397068?v=4","gravatar_id":"","url":"https://api.github.com/users/SchaeStewart","html_url":"https://github.com/SchaeStewart","followers_url":"https://api.github.com/users/SchaeStewart/followers","following_url":"https://api.github.com/users/SchaeStewart/following{/other_user}","gists_url":"https://api.github.com/users/SchaeStewart/gists{/gist_id}","starred_url":"https://api.github.com/users/SchaeStewart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SchaeStewart/subscriptions","organizations_url":"https://api.github.com/users/SchaeStewart/orgs","repos_url":"https://api.github.com/users/SchaeStewart/repos","events_url":"https://api.github.com/users/SchaeStewart/events{/privacy}","received_events_url":"https://api.github.com/users/SchaeStewart/received_events","type":"User","site_admin":false},"repo":{"id":101492659,"name":"GoVote","full_name":"SchaeStewart/GoVote","owner":{"login":"SchaeStewart","id":9397068,"avatar_url":"https://avatars3.githubusercontent.com/u/9397068?v=4","gravatar_id":"","url":"https://api.github.com/users/SchaeStewart","html_url":"https://github.com/SchaeStewart","followers_url":"https://api.github.com/users/SchaeStewart/followers","following_url":"https://api.github.com/users/SchaeStewart/following{/other_user}","gists_url":"https://api.github.com/users/SchaeStewart/gists{/gist_id}","starred_url":"https://api.github.com/users/SchaeStewart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SchaeStewart/subscriptions","organizations_url":"https://api.github.com/users/SchaeStewart/orgs","repos_url":"https://api.github.com/users/SchaeStewart/repos","events_url":"https://api.github.com/users/SchaeStewart/events{/privacy}","received_events_url":"https://api.github.com/users/SchaeStewart/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/SchaeStewart/GoVote","description":"Local voter registration and election candidate application.","fork":true,"url":"https://api.github.com/repos/SchaeStewart/GoVote","forks_url":"https://api.github.com/repos/SchaeStewart/GoVote/forks","keys_url":"https://api.github.com/repos/SchaeStewart/GoVote/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SchaeStewart/GoVote/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SchaeStewart/GoVote/teams","hooks_url":"https://api.github.com/repos/SchaeStewart/GoVote/hooks","issue_events_url":"https://api.github.com/repos/SchaeStewart/GoVote/issues/events{/number}","events_url":"https://api.github.com/repos/SchaeStewart/GoVote/events","assignees_url":"https://api.github.com/repos/SchaeStewart/GoVote/assignees{/user}","branches_url":"https://api.github.com/repos/SchaeStewart/GoVote/branches{/branch}","tags_url":"https://api.github.com/repos/SchaeStewart/GoVote/tags","blobs_url":"https://api.github.com/repos/SchaeStewart/GoVote/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SchaeStewart/GoVote/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SchaeStewart/GoVote/git/refs{/sha}","trees_url":"https://api.github.com/repos/SchaeStewart/GoVote/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SchaeStewart/GoVote/statuses/{sha}","languages_url":"https://api.github.com/repos/SchaeStewart/GoVote/languages","stargazers_url":"https://api.github.com/repos/SchaeStewart/GoVote/stargazers","contributors_url":"https://api.github.com/repos/SchaeStewart/GoVote/contributors","subscribers_url":"https://api.github.com/repos/SchaeStewart/GoVote/subscribers","subscription_url":"https://api.github.com/repos/SchaeStewart/GoVote/subscription","commits_url":"https://api.github.com/repos/SchaeStewart/GoVote/commits{/sha}","git_commits_url":"https://api.github.com/repos/SchaeStewart/GoVote/git/commits{/sha}","comments_url":"https://api.github.com/repos/SchaeStewart/GoVote/comments{/number}","issue_comment_url":"https://api.github.com/repos/SchaeStewart/GoVote/issues/comments{/number}","contents_url":"https://api.github.com/repos/SchaeStewart/GoVote/contents/{+path}","compare_url":"https://api.github.com/repos/SchaeStewart/GoVote/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SchaeStewart/GoVote/merges","archive_url":"https://api.github.com/repos/SchaeStewart/GoVote/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SchaeStewart/GoVote/downloads","issues_url":"https://api.github.com/repos/SchaeStewart/GoVote/issues{/number}","pulls_url":"https://api.github.com/repos/SchaeStewart/GoVote/pulls{/number}","milestones_url":"https://api.github.com/repos/SchaeStewart/GoVote/milestones{/number}","notifications_url":"https://api.github.com/repos/SchaeStewart/GoVote/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SchaeStewart/GoVote/labels{/name}","releases_url":"https://api.github.com/repos/SchaeStewart/GoVote/releases{/id}","deployments_url":"https://api.github.com/repos/SchaeStewart/GoVote/deployments","created_at":"2017-08-26T14:57:00Z","updated_at":"2018-03-20T23:18:53Z","pushed_at":"2018-03-27T02:15:34Z","git_url":"git://github.com/SchaeStewart/GoVote.git","ssh_url":"git@github.com:SchaeStewart/GoVote.git","clone_url":"https://github.com/SchaeStewart/GoVote.git","svn_url":"https://github.com/SchaeStewart/GoVote","homepage":null,"size":1579,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"codeforgso:dev","ref":"dev","sha":"a8e4a98aede07443b71104266c34eb31ddb0979e","user":{"login":"codeforgso","id":11655503,"avatar_url":"https://avatars0.githubusercontent.com/u/11655503?v=4","gravatar_id":"","url":"https://api.github.com/users/codeforgso","html_url":"https://github.com/codeforgso","followers_url":"https://api.github.com/users/codeforgso/followers","following_url":"https://api.github.com/users/codeforgso/following{/other_user}","gists_url":"https://api.github.com/users/codeforgso/gists{/gist_id}","starred_url":"https://api.github.com/users/codeforgso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codeforgso/subscriptions","organizations_url":"https://api.github.com/users/codeforgso/orgs","repos_url":"https://api.github.com/users/codeforgso/repos","events_url":"https://api.github.com/users/codeforgso/events{/privacy}","received_events_url":"https://api.github.com/users/codeforgso/received_events","type":"Organization","site_admin":false},"repo":{"id":98736940,"name":"GoVote","full_name":"codeforgso/GoVote","owner":{"login":"codeforgso","id":11655503,"avatar_url":"https://avatars0.githubusercontent.com/u/11655503?v=4","gravatar_id":"","url":"https://api.github.com/users/codeforgso","html_url":"https://github.com/codeforgso","followers_url":"https://api.github.com/users/codeforgso/followers","following_url":"https://api.github.com/users/codeforgso/following{/other_user}","gists_url":"https://api.github.com/users/codeforgso/gists{/gist_id}","starred_url":"https://api.github.com/users/codeforgso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codeforgso/subscriptions","organizations_url":"https://api.github.com/users/codeforgso/orgs","repos_url":"https://api.github.com/users/codeforgso/repos","events_url":"https://api.github.com/users/codeforgso/events{/privacy}","received_events_url":"https://api.github.com/users/codeforgso/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codeforgso/GoVote","description":"Local voter registration and election candidate application.","fork":false,"url":"https://api.github.com/repos/codeforgso/GoVote","forks_url":"https://api.github.com/repos/codeforgso/GoVote/forks","keys_url":"https://api.github.com/repos/codeforgso/GoVote/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codeforgso/GoVote/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codeforgso/GoVote/teams","hooks_url":"https://api.github.com/repos/codeforgso/GoVote/hooks","issue_events_url":"https://api.github.com/repos/codeforgso/GoVote/issues/events{/number}","events_url":"https://api.github.com/repos/codeforgso/GoVote/events","assignees_url":"https://api.github.com/repos/codeforgso/GoVote/assignees{/user}","branches_url":"https://api.github.com/repos/codeforgso/GoVote/branches{/branch}","tags_url":"https://api.github.com/repos/codeforgso/GoVote/tags","blobs_url":"https://api.github.com/repos/codeforgso/GoVote/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codeforgso/GoVote/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codeforgso/GoVote/git/refs{/sha}","trees_url":"https://api.github.com/repos/codeforgso/GoVote/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codeforgso/GoVote/statuses/{sha}","languages_url":"https://api.github.com/repos/codeforgso/GoVote/languages","stargazers_url":"https://api.github.com/repos/codeforgso/GoVote/stargazers","contributors_url":"https://api.github.com/repos/codeforgso/GoVote/contributors","subscribers_url":"https://api.github.com/repos/codeforgso/GoVote/subscribers","subscription_url":"https://api.github.com/repos/codeforgso/GoVote/subscription","commits_url":"https://api.github.com/repos/codeforgso/GoVote/commits{/sha}","git_commits_url":"https://api.github.com/repos/codeforgso/GoVote/git/commits{/sha}","comments_url":"https://api.github.com/repos/codeforgso/GoVote/comments{/number}","issue_comment_url":"https://api.github.com/repos/codeforgso/GoVote/issues/comments{/number}","contents_url":"https://api.github.com/repos/codeforgso/GoVote/contents/{+path}","compare_url":"https://api.github.com/repos/codeforgso/GoVote/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codeforgso/GoVote/merges","archive_url":"https://api.github.com/repos/codeforgso/GoVote/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codeforgso/GoVote/downloads","issues_url":"https://api.github.com/repos/codeforgso/GoVote/issues{/number}","pulls_url":"https://api.github.com/repos/codeforgso/GoVote/pulls{/number}","milestones_url":"https://api.github.com/repos/codeforgso/GoVote/milestones{/number}","notifications_url":"https://api.github.com/repos/codeforgso/GoVote/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codeforgso/GoVote/labels{/name}","releases_url":"https://api.github.com/repos/codeforgso/GoVote/releases{/id}","deployments_url":"https://api.github.com/repos/codeforgso/GoVote/deployments","created_at":"2017-07-29T14:16:48Z","updated_at":"2018-03-24T03:28:37Z","pushed_at":"2018-03-27T02:29:02Z","git_url":"git://github.com/codeforgso/GoVote.git","ssh_url":"git@github.com:codeforgso/GoVote.git","clone_url":"https://github.com/codeforgso/GoVote.git","svn_url":"https://github.com/codeforgso/GoVote","homepage":"http://govotegso.org/","size":1714,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"archived":false,"open_issues_count":12,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":20,"open_issues":12,"watchers":7,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/codeforgso/GoVote/pulls/53"},"html":{"href":"https://github.com/codeforgso/GoVote/pull/53"},"issue":{"href":"https://api.github.com/repos/codeforgso/GoVote/issues/53"},"comments":{"href":"https://api.github.com/repos/codeforgso/GoVote/issues/53/comments"},"review_comments":{"href":"https://api.github.com/repos/codeforgso/GoVote/pulls/53/comments"},"review_comment":{"href":"https://api.github.com/repos/codeforgso/GoVote/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codeforgso/GoVote/pulls/53/commits"},"statuses":{"href":"https://api.github.com/repos/codeforgso/GoVote/statuses/a474d929df04e04c2b259e7c8b93dc80713a9f54"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"BlakeGuilloud"}}