{"action":"created","issue":{"url":"https://api.github.com/repos/freelawproject/juriscraper/issues/29","repository_url":"https://api.github.com/repos/freelawproject/juriscraper","labels_url":"https://api.github.com/repos/freelawproject/juriscraper/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/freelawproject/juriscraper/issues/29/comments","events_url":"https://api.github.com/repos/freelawproject/juriscraper/issues/29/events","html_url":"https://github.com/freelawproject/juriscraper/issues/29","id":42424417,"number":29,"title":"Return meta-data to caller as plain Python objects","user":{"login":"janderse","id":4052572,"avatar_url":"https://avatars.githubusercontent.com/u/4052572?v=3","gravatar_id":"","url":"https://api.github.com/users/janderse","html_url":"https://github.com/janderse","followers_url":"https://api.github.com/users/janderse/followers","following_url":"https://api.github.com/users/janderse/following{/other_user}","gists_url":"https://api.github.com/users/janderse/gists{/gist_id}","starred_url":"https://api.github.com/users/janderse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janderse/subscriptions","organizations_url":"https://api.github.com/users/janderse/orgs","repos_url":"https://api.github.com/users/janderse/repos","events_url":"https://api.github.com/users/janderse/events{/privacy}","received_events_url":"https://api.github.com/users/janderse/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2014-09-10T15:19:30Z","updated_at":"2017-02-02T22:43:52Z","closed_at":null,"body":"The current way of returning opinions from scrapers complicates the callers.  While the meta-data may be scraped column-by-column, it generally isn't used that way.  \n\nPossible simplification:\n\n``` python\n    # Returns all the scraped cases.  Call after parse().\n    # Returns a list of dictionaries, one for each case.\n    def get_cases(self)\n```\n\nThis could also be used to implement to_csv(), to_html(), to_xml(), to_json() generically.\n\nReturns data like:\n\n```\n[OrderedDict([\n    ('case_dates', '2014-06-30'), \n    ('case_names', u'93-06 994'), \n    ('download_urls', 'http://www.va.gov/vetapp14/Files4/1429545.txt'), \n    ('precedential_statuses', u'Unpublished'), \n    ('docket_numbers', u'93-06 994'), \n    ('neutral_citations', u'1429545')]),\n OrderedDict([\n    ('case_dates', '2014-06-30'), \n    ('case_names', u'13-34 313'), \n        ...\n    ('neutral_citations', u'1429590')]),\n]\n```\n\nFor existing scrapers this would suffice:\n\n``` python\n    def get_cases(self):\n        cases = []\n        for attr in self._all_attrs:\n            values = getattr(self, attr)\n            if (values is None):\n                continue\n            i = 0\n            for value in values:\n                if (len(cases) <= i):\n                    cases.append(collections.OrderedDict())\n                if (isinstance(value, datetime.date)):\n                    value = value.isoformat()\n                cases[i][attr] = value\n                i += 1\n        return cases\n```\n"},"comment":{"url":"https://api.github.com/repos/freelawproject/juriscraper/issues/comments/277108828","html_url":"https://github.com/freelawproject/juriscraper/issues/29#issuecomment-277108828","issue_url":"https://api.github.com/repos/freelawproject/juriscraper/issues/29","id":277108828,"user":{"login":"voutilad","id":9891346,"avatar_url":"https://avatars.githubusercontent.com/u/9891346?v=3","gravatar_id":"","url":"https://api.github.com/users/voutilad","html_url":"https://github.com/voutilad","followers_url":"https://api.github.com/users/voutilad/followers","following_url":"https://api.github.com/users/voutilad/following{/other_user}","gists_url":"https://api.github.com/users/voutilad/gists{/gist_id}","starred_url":"https://api.github.com/users/voutilad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voutilad/subscriptions","organizations_url":"https://api.github.com/users/voutilad/orgs","repos_url":"https://api.github.com/users/voutilad/repos","events_url":"https://api.github.com/users/voutilad/events{/privacy}","received_events_url":"https://api.github.com/users/voutilad/received_events","type":"User","site_admin":false},"created_at":"2017-02-02T22:43:52Z","updated_at":"2017-02-02T22:43:52Z","body":"Not sure if this is still open, but in Python 3.6 this is a natural property (orderedness?) of `dict`s if I'm correct: https://mail.python.org/pipermail/python-dev/2016-September/146327.html"}}
{"actor":{"display_login":"voutilad"}}