{"action":"created","issue":{"url":"https://api.github.com/repos/inveniosoftware/dojson/issues/24","labels_url":"https://api.github.com/repos/inveniosoftware/dojson/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/inveniosoftware/dojson/issues/24/comments","events_url":"https://api.github.com/repos/inveniosoftware/dojson/issues/24/events","html_url":"https://github.com/inveniosoftware/dojson/issues/24","id":93713004,"number":24,"title":"Allow local fields, subfields and indicators","user":{"login":"fjorba","id":1407473,"avatar_url":"https://avatars.githubusercontent.com/u/1407473?v=3","gravatar_id":"","url":"https://api.github.com/users/fjorba","html_url":"https://github.com/fjorba","followers_url":"https://api.github.com/users/fjorba/followers","following_url":"https://api.github.com/users/fjorba/following{/other_user}","gists_url":"https://api.github.com/users/fjorba/gists{/gist_id}","starred_url":"https://api.github.com/users/fjorba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fjorba/subscriptions","organizations_url":"https://api.github.com/users/fjorba/orgs","repos_url":"https://api.github.com/users/fjorba/repos","events_url":"https://api.github.com/users/fjorba/events{/privacy}","received_events_url":"https://api.github.com/users/fjorba/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/inveniosoftware/dojson/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-08T06:53:54Z","updated_at":"2015-07-09T11:36:13Z","closed_at":null,"body":"Marc21 makes room for a local installation to define its own local field with the convention that they contain a 9, either as a tag (typically 9XX tags, but also like 59X), indicators or subfields.\r\n\r\nInvenio should make it easy to follow this convention without resorting to tortuous modifications of internal syntax rules.\r\n"},"comment":{"url":"https://api.github.com/repos/inveniosoftware/dojson/issues/comments/119922507","html_url":"https://github.com/inveniosoftware/dojson/issues/24#issuecomment-119922507","issue_url":"https://api.github.com/repos/inveniosoftware/dojson/issues/24","id":119922507,"user":{"login":"egabancho","id":582735,"avatar_url":"https://avatars.githubusercontent.com/u/582735?v=3","gravatar_id":"","url":"https://api.github.com/users/egabancho","html_url":"https://github.com/egabancho","followers_url":"https://api.github.com/users/egabancho/followers","following_url":"https://api.github.com/users/egabancho/following{/other_user}","gists_url":"https://api.github.com/users/egabancho/gists{/gist_id}","starred_url":"https://api.github.com/users/egabancho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egabancho/subscriptions","organizations_url":"https://api.github.com/users/egabancho/orgs","repos_url":"https://api.github.com/users/egabancho/repos","events_url":"https://api.github.com/users/egabancho/events{/privacy}","received_events_url":"https://api.github.com/users/egabancho/received_events","type":"User","site_admin":false},"created_at":"2015-07-09T11:36:13Z","updated_at":"2015-07-09T11:36:13Z","body":"There are many ways that you can do it __already__, this is how I am do it for CDS so far (keep in mind this is work in progress).\r\n\r\nFirst I define my own \"model\" (in my case it contains all the marc21 rules by default)\r\n```python\r\nfrom dojson.overdo import Overdo\r\nfrom dojson.contrib.marc21 import marc21\r\n\r\nclass CDSMarc21(Overdo):\r\n\r\n    \"\"\"Translation Index for CDS specific MARC21.\"\"\"\r\n\r\n    def __init__(self):\r\n        \"\"\"Constructor.\r\n\r\n        Initializes the list of rules with the default ones from doJSON.\r\n        \"\"\"\r\n        super(CDSMarc21, self).__init__()\r\n        self.rules.extend(marc21.rules)\r\n\r\n\r\ncds_marc21 = CDSMarc21()\r\n```\r\n\r\nAnd then I add new fields to it\r\n\r\n```python\r\nfrom dojson import utils\r\nfrom ..model import cds_marc21\r\n\r\n@cds_marc21.over('subject_indicator', '^690C_')\r\n@utils.for_each_value\r\ndef subject_indicator(self, key, value):\r\n    \"\"\"Subject Indicator.\"\"\"\r\n    return value.get('a')\r\n```\r\n\r\nThis is also somehow related with https://github.com/inveniosoftware/invenio-records/pull/3, it allows to use different processors, i.e. `cds_marc21` instead of `marc21`."}}