{"action":"closed","issue":{"url":"https://api.github.com/repos/california-civic-data-coalition/django-calaccess-raw-data/issues/1235","repository_url":"https://api.github.com/repos/california-civic-data-coalition/django-calaccess-raw-data","labels_url":"https://api.github.com/repos/california-civic-data-coalition/django-calaccess-raw-data/issues/1235/labels{/name}","comments_url":"https://api.github.com/repos/california-civic-data-coalition/django-calaccess-raw-data/issues/1235/comments","events_url":"https://api.github.com/repos/california-civic-data-coalition/django-calaccess-raw-data/issues/1235/events","html_url":"https://github.com/california-civic-data-coalition/django-calaccess-raw-data/issues/1235","id":140415047,"number":1235,"title":"Adding document references to choice fields in \"campaign\" models","user":{"login":"gordonje","id":4304548,"avatar_url":"https://avatars.githubusercontent.com/u/4304548?v=3","gravatar_id":"","url":"https://api.github.com/users/gordonje","html_url":"https://github.com/gordonje","followers_url":"https://api.github.com/users/gordonje/followers","following_url":"https://api.github.com/users/gordonje/following{/other_user}","gists_url":"https://api.github.com/users/gordonje/gists{/gist_id}","starred_url":"https://api.github.com/users/gordonje/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gordonje/subscriptions","organizations_url":"https://api.github.com/users/gordonje/orgs","repos_url":"https://api.github.com/users/gordonje/repos","events_url":"https://api.github.com/users/gordonje/events{/privacy}","received_events_url":"https://api.github.com/users/gordonje/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/california-civic-data-coalition/django-calaccess-raw-data/labels/documentation","name":"documentation","color":"eb6420"},{"url":"https://api.github.com/repos/california-civic-data-coalition/django-calaccess-raw-data/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/california-civic-data-coalition/django-calaccess-raw-data/labels/small","name":"small","color":"207de5"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/california-civic-data-coalition/django-calaccess-raw-data/milestones/6","html_url":"https://github.com/california-civic-data-coalition/django-calaccess-raw-data/milestones/California%20Code%20Rush%204","labels_url":"https://api.github.com/repos/california-civic-data-coalition/django-calaccess-raw-data/milestones/6/labels","id":1623298,"number":6,"title":"California Code Rush 4","description":"","creator":{"login":"palewire","id":9993,"avatar_url":"https://avatars.githubusercontent.com/u/9993?v=3","gravatar_id":"","url":"https://api.github.com/users/palewire","html_url":"https://github.com/palewire","followers_url":"https://api.github.com/users/palewire/followers","following_url":"https://api.github.com/users/palewire/following{/other_user}","gists_url":"https://api.github.com/users/palewire/gists{/gist_id}","starred_url":"https://api.github.com/users/palewire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palewire/subscriptions","organizations_url":"https://api.github.com/users/palewire/orgs","repos_url":"https://api.github.com/users/palewire/repos","events_url":"https://api.github.com/users/palewire/events{/privacy}","received_events_url":"https://api.github.com/users/palewire/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":6,"state":"open","created_at":"2016-03-04T23:28:40Z","updated_at":"2016-05-06T18:28:45Z","due_on":"2016-03-14T07:00:00Z","closed_at":null},"comments":3,"created_at":"2016-03-12T20:33:54Z","updated_at":"2016-05-06T18:28:45Z","closed_at":"2016-05-06T18:28:45Z","body":"## Your mission\r\n\r\nAdd a ``documentcloud_pages`` attribute to a model for one of the choice fields on the campaign tables. \r\n\r\nThis will connect our code with [the official government documentation](http://django-calaccess-raw-data.californiacivicdata.org/en/latest/officialdocumentation.html) so we can incorporate it as part of [our expanded version](http://django-calaccess-raw-data.californiacivicdata.org/en/latest/models.html).\r\n\r\n## To-do list\r\n\r\nAccording to [our documentation unit tests](https://github.com/california-civic-data-coalition/django-calaccess-raw-data/blob/master/calaccess_raw/tests/test_docs.py), the following choice fields in [`campaign.py`](https://github.com/california-civic-data-coalition/django-calaccess-raw-data/blob/master/calaccess_raw/models/campaign.py) lack any reference to [official CAL-ACCESS documentation](http://django-calaccess-raw-data.californiacivicdata.org/en/latest/officialdocumentation.html). \r\n\r\n- [ ] Cvr2SoCd.form_type\r\n- [ ] CvrCampaignDisclosureCd.form_type\r\n- [ ] Cvr2CampaignDisclosureCd.form_type\r\n- [ ] RcptCd.form_type\r\n- [ ] Cvr3VerificationInfoCd.form_type\r\n- [ ] LoanCd.form_type\r\n- [ ] S401Cd.form_type\r\n- [ ] ExpnCd.form_type\r\n- [ ] F495P2Cd.form_type\r\n- [ ] DebtCd.form_type\r\n- [ ] S496Cd.form_type\r\n- [ ] S497Cd.form_type\r\n- [ ] F501502Cd.form_type\r\n- [ ] S498Cd.form_type\r\n- [ ] CvrF470Cd.form_type\r\n- [ ] Cvr2SoCd.off_s_h_c\r\n- [ ] CvrCampaignDisclosureCd.off_s_h_c\r\n- [ ] Cvr2CampaignDisclosureCd.off_s_h_c\r\n- [ ] RcptCd.off_s_h_c\r\n- [ ] S401Cd.off_s_h_c\r\n- [ ] ExpnCd.off_s_h_c\r\n- [ ] S497Cd.off_s_h_c\r\n- [ ] S498Cd.off_s_h_c\r\n- [ ] CvrF470Cd.off_s_h_c\r\n- [ ] CvrSoCd.rec_type \r\n- [ ] Cvr2SoCd.rec_type \r\n- [ ] CvrCampaignDisclosureCd.rec_type \r\n- [ ] Cvr2CampaignDisclosureCd.rec_type \r\n- [ ] RcptCd.rec_type \r\n- [ ] Cvr3VerificationInfoCd.rec_type \r\n- [ ] LoanCd.rec_type \r\n- [ ] S401Cd.rec_type \r\n- [ ] ExpnCd.rec_type \r\n- [ ] F495P2Cd.rec_type \r\n- [ ] DebtCd.rec_type \r\n- [ ] S496Cd.rec_type \r\n- [ ] S497Cd.rec_type \r\n- [ ] F501502Cd.rec_type \r\n- [ ] S498Cd.rec_type \r\n- [ ] CvrF470Cd.rec_type \r\n- [ ] F501502Cd.party_cd \r\n- [ ] Cvr2SoCd.sup_opp_c\r\n- [ ] CvrCampaignDisclosureCd.sup_opp_c\r\n- [ ] Cvr2CampaignDisclosureCd.sup_opp_c\r\n- [ ] RcptCd.sup_opp_c\r\n- [ ] S401Cd.sup_opp_c\r\n- [ ] ExpnCd.sup_opp_c\r\n- [ ] S497Cd.sup_opp_c\r\n- [ ] S498Cd.sup_opp_c\r\n- [ ] F501502Cd.elec_type\r\n- [ ] CvrCampaignDisclosureCd.reportnam\r\n- [ ] ExpnCd.expn_code\r\n- [ ] DebtCd.expn_code\r\n\r\n## Here's how\r\n\r\n**Step 1:** Claim a field from the to-do list above by leaving a comment below. Tell everyone you're ON IT!\r\n\r\n**Step 2**: Open up the file that contains this model. It should be in [calaccess_raw.models.campaign.py](https://github.com/california-civic-data-coalition/django-calaccess-raw-data/blob/master/calaccess_raw/models/campaign.py).\r\n\r\n**Step 3**: Hit the little pencil button in the upper-right corner of the code box to begin editing the file.\r\n\r\n![Edit](https://dl.dropboxusercontent.com/u/3640647/ScreenCloud/1440367320.67.png)\r\n\r\n**Step 4**: Find the your field in the file. It will be under the specific model (aka, data table) specified above (Clicking into the box and searching with CTRL-F can help you here.) Once you find it, we expect the field to lack the ``documentcloud_pages`` attribute we want to ensure every model has attached. If it's already there it would look something like this:\r\n\r\n```python\r\n@python_2_unicode_compatible\r\nclass MyFakeModel(CalAccessBaseModel):\r\n    \"\"\"\r\n    Blah blah blah.\r\n    \"\"\"\r\n    UNIQUE_KEY = (\r\n        \"WHATEVER\",\r\n    )\r\n    # other attributes, including other fields on the model / data table\r\n    your_field = fields.CharField(\r\n        max_length=4,\r\n        db_column=\"YOUR_FIELD\",\r\n        choices=YOUR_FIELDS_CHOICES,\r\n        help_text='Blah blah blah',\r\n        documentcloud_pages=[\r\n            DocumentCloud(id='2756977-Lookup-Codes-Cd', start_page=21, end_page=22),\r\n        ]\r\n    )\r\n```\r\n\r\nA properly configured ``documentcloud_pages`` attribute will contain one or more ``DocumentCloud`` items that specify where this table is explained in the state's official documentation. The links draw their name from the documentcloud.org hosting service where we are republishing the state's source documents, which were provided in PDF format.\r\n\r\nIf it's already there, the work is already done and you need to pick another field. If it's not, it's going to be your job to add it.\r\n\r\n**Step 5:** In a separate tab, open up the <a href=\"https://www.documentcloud.org/documents/2756977-Lookup-Codes-Cd.html\">official state documentation</a>.\r\n\r\n**Step 6:** Find the pages with useful info about the look-up values.\r\n\r\n**Step 7:** Note the document's start and end pages as well as the id in the DocumentCloud URL (Hint: It's probably ``'2756977-Lookup-Codes-Cd'``).\r\n\r\n**Step 7**: Return to the GitHub tab.\r\n\r\n**Step 8**: Add a ``documentcloud_pages`` list that includes points to the pages you just found. If your model is found on pages 200 and 201 of the state documentation linked above, you'd fill add these three lines:\r\n\r\n```python\r\n    documentcloud_pages = [\r\n        DocumentCloud(id='2756977-Lookup-Codes-Cd', start_page=200, end_page=201),\r\n    ]\r\n```\r\n\r\nBut indented below the field's model and name (as seen in the above example).\r\n\r\n**Step 9**: Scroll down below the code box and describe the change you've made in the commit message. Press the button below.\r\n\r\n![Commit](https://dl.dropboxusercontent.com/u/3640647/ScreenCloud/1440367511.66.png)\r\n\r\n**Step 10**:  Review your changes and create a pull request submitting them to the core team for inclusion.\r\n\r\n![Pull request](https://dl.dropboxusercontent.com/u/3640647/ScreenCloud/1440368058.52.png)\r\n\r\nThat's it! Mission accomplished!"}}