{"action":"created","comment":{"url":"https://api.github.com/repos/caciviclab/disclosure-backend/pulls/comments/49270584","id":49270584,"diff_hunk":"@@ -0,0 +1,93 @@\n+from __future__ import unicode_literals\n+from django.db import models\n+from django.utils.encoding import python_2_unicode_compatible\n+\n+from ballot_measure.models import BallotMeasureChoice\n+\n+\n+class SocialMediaModel(models.Model):\n+    class Meta:\n+        abstract = True\n+\n+    photo_url = models.ImageField(blank=True)\n+    website_url = models.URLField(\n+        help_text='URL for the official website.', blank=True)\n+    facebook_url = models.URLField(\n+        help_text='URL for the Facebook page.', blank=True)\n+    twitter_url = models.URLField(\n+        help_text='URL for the Twitter page.', blank=True)\n+\n+\n+@python_2_unicode_compatible\n+class Party(SocialMediaModel):\n+    \"\"\"\n+    \"\"\"\n+    name = models.CharField(\n+        max_length=255, help_text='The party name.')\n+\n+    def __str__(self):\n+        return \"The %s party\" % self.name\n+\n+\n+@python_2_unicode_compatible\n+class Person(SocialMediaModel):\n+    \"\"\"\n+    \"\"\"\n+    first_name = models.CharField(\n+        max_length=255, help_text='The candidate\\'s first name.')\n+    middle_name = models.CharField(\n+        max_length=255, blank=True, null=True,\n+        help_text='The candidate\\'s middle name.')\n+    last_name = models.CharField(\n+        max_length=255, blank=True, null=True,\n+        help_text='The candidate\\'s last name.')\n+    party = models.ForeignKey('Party', blank=True, null=True)\n+\n+    def __str__(self):\n+        return \"%s, %s%s\" % (\n+            self.last_name, self.first_name,\n+            '' if self.middle_name is None else ' %s.' % self.middle_name[0])\n+\n+\n+@python_2_unicode_compatible\n+class Office(models.Model):\n+    \"\"\"\n+    \"\"\"\n+    name = models.CharField(\n+        max_length=255, help_text='The office name.')\n+    description = models.CharField(\n+        max_length=1024, help_text='The office description.')\n+    locality = models.ForeignKey('locality.Locality')\n+\n+    def __str__(self):\n+        return \"Office for %s in %s\" % (\n+            self.name, self.locality.dereference())\n+\n+\n+@python_2_unicode_compatible\n+class Election(models.Model):","path":"candidate/models.py","position":68,"original_position":68,"commit_id":"39fdb31954e7371fbe0f464d8a0c82102f997497","original_commit_id":"aa73e375a2f31178488d87cc9535b76ed1407eac","user":{"login":"adborden","id":509703,"avatar_url":"https://avatars.githubusercontent.com/u/509703?v=3","gravatar_id":"","url":"https://api.github.com/users/adborden","html_url":"https://github.com/adborden","followers_url":"https://api.github.com/users/adborden/followers","following_url":"https://api.github.com/users/adborden/following{/other_user}","gists_url":"https://api.github.com/users/adborden/gists{/gist_id}","starred_url":"https://api.github.com/users/adborden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adborden/subscriptions","organizations_url":"https://api.github.com/users/adborden/orgs","repos_url":"https://api.github.com/users/adborden/repos","events_url":"https://api.github.com/users/adborden/events{/privacy}","received_events_url":"https://api.github.com/users/adborden/received_events","type":"User","site_admin":false},"body":"> As for Office vs. Election (as I'm using it here), I would prefer to keep them separate. Office exists independent of election or not. It's like a generic government object.\r\n\r\nThat makes sense for Office. I'm fine to have an Office entity representing something outside of the election. However, if Election means \"an office up for election on a ballot\", what term would you propose for the election day event?\r\n\r\nThe Voter Information Project is writing a [spec](http://vip-specification.readthedocs.org/en/vip5/xml/index.html#elements) to standardize ballot information across the country. IMHO, their terminology avoids a lot ambiguity which is why I would prefer to standardize on their terms (not necessarily their spec). At the very least, I found reading through it helpful to think about the domain space more. Like how they associate Elections with different authorities (city, county, state, federal), which made sense to me which sounded relevant with what we're doing.\r\n\r\nVIP is also representing [additional data](http://vip-specification.readthedocs.org/en/vip5/xml/elements/election.html) for their `Election` entity, like election type (city, state, federal) which I think will be relevant to how the contributions are reported (speculating).","created_at":"2016-01-10T01:53:18Z","updated_at":"2016-01-10T01:53:18Z","html_url":"https://github.com/caciviclab/disclosure-backend/pull/103#discussion_r49270584","pull_request_url":"https://api.github.com/repos/caciviclab/disclosure-backend/pulls/103","_links":{"self":{"href":"https://api.github.com/repos/caciviclab/disclosure-backend/pulls/comments/49270584"},"html":{"href":"https://github.com/caciviclab/disclosure-backend/pull/103#discussion_r49270584"},"pull_request":{"href":"https://api.github.com/repos/caciviclab/disclosure-backend/pulls/103"}}},"pull_request":{"url":"https://api.github.com/repos/caciviclab/disclosure-backend/pulls/103","id":54701609,"html_url":"https://github.com/caciviclab/disclosure-backend/pull/103","diff_url":"https://github.com/caciviclab/disclosure-backend/pull/103.diff","patch_url":"https://github.com/caciviclab/disclosure-backend/pull/103.patch","issue_url":"https://api.github.com/repos/caciviclab/disclosure-backend/issues/103","number":103,"state":"open","locked":false,"title":"Implement proposed database schema","user":{"login":"bcipolli","id":4072455,"avatar_url":"https://avatars.githubusercontent.com/u/4072455?v=3","gravatar_id":"","url":"https://api.github.com/users/bcipolli","html_url":"https://github.com/bcipolli","followers_url":"https://api.github.com/users/bcipolli/followers","following_url":"https://api.github.com/users/bcipolli/following{/other_user}","gists_url":"https://api.github.com/users/bcipolli/gists{/gist_id}","starred_url":"https://api.github.com/users/bcipolli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcipolli/subscriptions","organizations_url":"https://api.github.com/users/bcipolli/orgs","repos_url":"https://api.github.com/users/bcipolli/repos","events_url":"https://api.github.com/users/bcipolli/events{/privacy}","received_events_url":"https://api.github.com/users/bcipolli/received_events","type":"User","site_admin":false},"body":"This also works off of #101. This implements the database schema proposed here:\r\nhttps://github.com/caciviclab/caciviclab.github.io/wiki/Data-relationships---Database-schema\r\n\r\nWith a full schema such as this, we can begin to build the APIs required for the front-end apps, and start to fill the database with relevant data from `NetFile` and `CalAccess`.\r\n\r\nBesides implementing the schema above, this PR:\r\n* Renames `netfile` to `netfile_raw`. The idea is to have a stand-alone app that simply loads raw netfile data into a database table, so that data munging can happen in Python/Django rather than through csv/pandas.\r\n* Moves all of `zipcode_metro` into `locality`. Note that the management command for loading zip codes is temporarily broken.\r\n\r\nTo deal with lacking a globally unique ID, I've pushed the `Locality` model to contain such an ID. It'll be an arbitrary ID that can be used, app-wide, to refer to things. I don't know if it'll ever be needed, but it's in the doc :)\r\n\r\n@jnmarcus Really gotta run, but wanted to push this up for you & others to consider! May be hard to read without #101 merged, however...","created_at":"2015-12-29T04:28:11Z","updated_at":"2016-01-10T01:53:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"205120281d7b70578ae4c00bc1d9f45899a9b18d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/caciviclab/disclosure-backend/pulls/103/commits","review_comments_url":"https://api.github.com/repos/caciviclab/disclosure-backend/pulls/103/comments","review_comment_url":"https://api.github.com/repos/caciviclab/disclosure-backend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/caciviclab/disclosure-backend/issues/103/comments","statuses_url":"https://api.github.com/repos/caciviclab/disclosure-backend/statuses/39fdb31954e7371fbe0f464d8a0c82102f997497","head":{"label":"bcipolli:refactor","ref":"refactor","sha":"39fdb31954e7371fbe0f464d8a0c82102f997497","user":{"login":"bcipolli","id":4072455,"avatar_url":"https://avatars.githubusercontent.com/u/4072455?v=3","gravatar_id":"","url":"https://api.github.com/users/bcipolli","html_url":"https://github.com/bcipolli","followers_url":"https://api.github.com/users/bcipolli/followers","following_url":"https://api.github.com/users/bcipolli/following{/other_user}","gists_url":"https://api.github.com/users/bcipolli/gists{/gist_id}","starred_url":"https://api.github.com/users/bcipolli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcipolli/subscriptions","organizations_url":"https://api.github.com/users/bcipolli/orgs","repos_url":"https://api.github.com/users/bcipolli/repos","events_url":"https://api.github.com/users/bcipolli/events{/privacy}","received_events_url":"https://api.github.com/users/bcipolli/received_events","type":"User","site_admin":false},"repo":{"id":48266125,"name":"opendisclosure-backend","full_name":"bcipolli/opendisclosure-backend","owner":{"login":"bcipolli","id":4072455,"avatar_url":"https://avatars.githubusercontent.com/u/4072455?v=3","gravatar_id":"","url":"https://api.github.com/users/bcipolli","html_url":"https://github.com/bcipolli","followers_url":"https://api.github.com/users/bcipolli/followers","following_url":"https://api.github.com/users/bcipolli/following{/other_user}","gists_url":"https://api.github.com/users/bcipolli/gists{/gist_id}","starred_url":"https://api.github.com/users/bcipolli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcipolli/subscriptions","organizations_url":"https://api.github.com/users/bcipolli/orgs","repos_url":"https://api.github.com/users/bcipolli/repos","events_url":"https://api.github.com/users/bcipolli/events{/privacy}","received_events_url":"https://api.github.com/users/bcipolli/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bcipolli/opendisclosure-backend","description":"A Django app to download, extract and load campaign finance and lobbying activity data from the California Secretary of State's CAL-ACCESS database as well as local Netfile jurisdictions","fork":true,"url":"https://api.github.com/repos/bcipolli/opendisclosure-backend","forks_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/forks","keys_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/teams","hooks_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/hooks","issue_events_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/issues/events{/number}","events_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/events","assignees_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/assignees{/user}","branches_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/branches{/branch}","tags_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/tags","blobs_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/languages","stargazers_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/stargazers","contributors_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/contributors","subscribers_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/subscribers","subscription_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/subscription","commits_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/contents/{+path}","compare_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/merges","archive_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/downloads","issues_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/issues{/number}","pulls_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/labels{/name}","releases_url":"https://api.github.com/repos/bcipolli/opendisclosure-backend/releases{/id}","created_at":"2015-12-19T02:53:28Z","updated_at":"2015-12-19T02:53:33Z","pushed_at":"2016-01-10T01:38:46Z","git_url":"git://github.com/bcipolli/opendisclosure-backend.git","ssh_url":"git@github.com:bcipolli/opendisclosure-backend.git","clone_url":"https://github.com/bcipolli/opendisclosure-backend.git","svn_url":"https://github.com/bcipolli/opendisclosure-backend","homepage":"http://admin.caciviclab.org","size":8602,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"caciviclab:master","ref":"master","sha":"43ccf5eb9a6d2487b5ab9034f23de4fc01827497","user":{"login":"caciviclab","id":9602455,"avatar_url":"https://avatars.githubusercontent.com/u/9602455?v=3","gravatar_id":"","url":"https://api.github.com/users/caciviclab","html_url":"https://github.com/caciviclab","followers_url":"https://api.github.com/users/caciviclab/followers","following_url":"https://api.github.com/users/caciviclab/following{/other_user}","gists_url":"https://api.github.com/users/caciviclab/gists{/gist_id}","starred_url":"https://api.github.com/users/caciviclab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caciviclab/subscriptions","organizations_url":"https://api.github.com/users/caciviclab/orgs","repos_url":"https://api.github.com/users/caciviclab/repos","events_url":"https://api.github.com/users/caciviclab/events{/privacy}","received_events_url":"https://api.github.com/users/caciviclab/received_events","type":"Organization","site_admin":false},"repo":{"id":35735318,"name":"disclosure-backend","full_name":"caciviclab/disclosure-backend","owner":{"login":"caciviclab","id":9602455,"avatar_url":"https://avatars.githubusercontent.com/u/9602455?v=3","gravatar_id":"","url":"https://api.github.com/users/caciviclab","html_url":"https://github.com/caciviclab","followers_url":"https://api.github.com/users/caciviclab/followers","following_url":"https://api.github.com/users/caciviclab/following{/other_user}","gists_url":"https://api.github.com/users/caciviclab/gists{/gist_id}","starred_url":"https://api.github.com/users/caciviclab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caciviclab/subscriptions","organizations_url":"https://api.github.com/users/caciviclab/orgs","repos_url":"https://api.github.com/users/caciviclab/repos","events_url":"https://api.github.com/users/caciviclab/events{/privacy}","received_events_url":"https://api.github.com/users/caciviclab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/caciviclab/disclosure-backend","description":"A Django app to download, extract and load campaign finance and lobbying activity data from the California Secretary of State's CAL-ACCESS database as well as local Netfile jurisdictions","fork":false,"url":"https://api.github.com/repos/caciviclab/disclosure-backend","forks_url":"https://api.github.com/repos/caciviclab/disclosure-backend/forks","keys_url":"https://api.github.com/repos/caciviclab/disclosure-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caciviclab/disclosure-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caciviclab/disclosure-backend/teams","hooks_url":"https://api.github.com/repos/caciviclab/disclosure-backend/hooks","issue_events_url":"https://api.github.com/repos/caciviclab/disclosure-backend/issues/events{/number}","events_url":"https://api.github.com/repos/caciviclab/disclosure-backend/events","assignees_url":"https://api.github.com/repos/caciviclab/disclosure-backend/assignees{/user}","branches_url":"https://api.github.com/repos/caciviclab/disclosure-backend/branches{/branch}","tags_url":"https://api.github.com/repos/caciviclab/disclosure-backend/tags","blobs_url":"https://api.github.com/repos/caciviclab/disclosure-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caciviclab/disclosure-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caciviclab/disclosure-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/caciviclab/disclosure-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caciviclab/disclosure-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/caciviclab/disclosure-backend/languages","stargazers_url":"https://api.github.com/repos/caciviclab/disclosure-backend/stargazers","contributors_url":"https://api.github.com/repos/caciviclab/disclosure-backend/contributors","subscribers_url":"https://api.github.com/repos/caciviclab/disclosure-backend/subscribers","subscription_url":"https://api.github.com/repos/caciviclab/disclosure-backend/subscription","commits_url":"https://api.github.com/repos/caciviclab/disclosure-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/caciviclab/disclosure-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/caciviclab/disclosure-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/caciviclab/disclosure-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/caciviclab/disclosure-backend/contents/{+path}","compare_url":"https://api.github.com/repos/caciviclab/disclosure-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caciviclab/disclosure-backend/merges","archive_url":"https://api.github.com/repos/caciviclab/disclosure-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caciviclab/disclosure-backend/downloads","issues_url":"https://api.github.com/repos/caciviclab/disclosure-backend/issues{/number}","pulls_url":"https://api.github.com/repos/caciviclab/disclosure-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/caciviclab/disclosure-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/caciviclab/disclosure-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caciviclab/disclosure-backend/labels{/name}","releases_url":"https://api.github.com/repos/caciviclab/disclosure-backend/releases{/id}","created_at":"2015-05-16T18:30:44Z","updated_at":"2015-12-16T02:54:18Z","pushed_at":"2016-01-10T01:38:47Z","git_url":"git://github.com/caciviclab/disclosure-backend.git","ssh_url":"git@github.com:caciviclab/disclosure-backend.git","clone_url":"https://github.com/caciviclab/disclosure-backend.git","svn_url":"https://github.com/caciviclab/disclosure-backend","homepage":"http://admin.caciviclab.org","size":8614,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":37,"forks":12,"open_issues":37,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/caciviclab/disclosure-backend/pulls/103"},"html":{"href":"https://github.com/caciviclab/disclosure-backend/pull/103"},"issue":{"href":"https://api.github.com/repos/caciviclab/disclosure-backend/issues/103"},"comments":{"href":"https://api.github.com/repos/caciviclab/disclosure-backend/issues/103/comments"},"review_comments":{"href":"https://api.github.com/repos/caciviclab/disclosure-backend/pulls/103/comments"},"review_comment":{"href":"https://api.github.com/repos/caciviclab/disclosure-backend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/caciviclab/disclosure-backend/pulls/103/commits"},"statuses":{"href":"https://api.github.com/repos/caciviclab/disclosure-backend/statuses/39fdb31954e7371fbe0f464d8a0c82102f997497"}}}}