hdo-storting-importer 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +1 -1
 - data/Rakefile +0 -1
 - data/features/convert.feature +97 -79
 - data/hdo-storting-importer.gemspec +5 -0
 - data/lib/hdo/storting_importer/category.rb +16 -56
 - data/lib/hdo/storting_importer/cli.rb +6 -34
 - data/lib/hdo/storting_importer/committee.rb +13 -24
 - data/lib/hdo/storting_importer/converter.rb +4 -9
 - data/lib/hdo/storting_importer/district.rb +12 -24
 - data/lib/hdo/storting_importer/fusion_table.rb +52 -0
 - data/lib/hdo/storting_importer/has_json_schema.rb +85 -0
 - data/lib/hdo/storting_importer/issue.rb +29 -60
 - data/lib/hdo/storting_importer/party.rb +13 -24
 - data/lib/hdo/storting_importer/promise.rb +60 -55
 - data/lib/hdo/storting_importer/proposition.rb +61 -0
 - data/lib/hdo/storting_importer/representative.rb +37 -70
 - data/lib/hdo/storting_importer/schema/category.json +28 -0
 - data/lib/hdo/storting_importer/schema/committee.json +21 -0
 - data/lib/hdo/storting_importer/schema/district.json +21 -0
 - data/lib/hdo/storting_importer/schema/issue.json +62 -0
 - data/lib/hdo/storting_importer/schema/party.json +21 -0
 - data/lib/hdo/storting_importer/schema/promise.json +42 -0
 - data/lib/hdo/storting_importer/schema/proposition.json +34 -0
 - data/lib/hdo/storting_importer/schema/representative.json +61 -0
 - data/lib/hdo/storting_importer/schema/vote.json +64 -0
 - data/lib/hdo/storting_importer/schema.json +5 -0
 - data/lib/hdo/storting_importer/util.rb +13 -11
 - data/lib/hdo/storting_importer/version.rb +1 -1
 - data/lib/hdo/storting_importer/vote.rb +46 -143
 - data/lib/hdo/storting_importer.rb +12 -3
 - data/spec/fixtures/output/categories.json +1 -0
 - data/spec/fixtures/output/committees.json +1 -0
 - data/spec/fixtures/output/districts.json +1 -0
 - data/spec/fixtures/output/issues.json +1 -0
 - data/spec/fixtures/output/parties.json +1 -0
 - data/spec/fixtures/output/representatives.json +1 -0
 - data/spec/fixtures/output/votes.json +1 -0
 - data/spec/hdo/storting_importer/category_spec.rb +29 -33
 - data/spec/hdo/storting_importer/committee_spec.rb +29 -16
 - data/spec/hdo/storting_importer/converter_spec.rb +3 -3
 - data/spec/hdo/storting_importer/district_spec.rb +27 -18
 - data/spec/hdo/storting_importer/issue_spec.rb +44 -27
 - data/spec/hdo/storting_importer/party_spec.rb +25 -16
 - data/spec/hdo/storting_importer/promise_spec.rb +54 -40
 - data/spec/hdo/storting_importer/proposition_spec.rb +44 -0
 - data/spec/hdo/storting_importer/representative_spec.rb +73 -26
 - data/spec/hdo/storting_importer/vote_spec.rb +73 -75
 - data/spec/spec_helper.rb +21 -1
 - metadata +95 -3
 - data/.gitmodules +0 -3
 
| 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {
         
     | 
| 
      
 2 
     | 
    
         
            +
              "id": "hdo#party",
         
     | 
| 
      
 3 
     | 
    
         
            +
              "description": "a political party",
         
     | 
| 
      
 4 
     | 
    
         
            +
              "type":"object",
         
     | 
| 
      
 5 
     | 
    
         
            +
              "properties": {
         
     | 
| 
      
 6 
     | 
    
         
            +
                "kind": {
         
     | 
| 
      
 7 
     | 
    
         
            +
                    "type": "string",
         
     | 
| 
      
 8 
     | 
    
         
            +
                    "description": "This is always 'hdo#party'",
         
     | 
| 
      
 9 
     | 
    
         
            +
                    "default": "hdo#party",
         
     | 
| 
      
 10 
     | 
    
         
            +
                    "required": true
         
     | 
| 
      
 11 
     | 
    
         
            +
                },
         
     | 
| 
      
 12 
     | 
    
         
            +
                "externalId": {
         
     | 
| 
      
 13 
     | 
    
         
            +
                  "type": "string"
         
     | 
| 
      
 14 
     | 
    
         
            +
                },
         
     | 
| 
      
 15 
     | 
    
         
            +
                "name": {
         
     | 
| 
      
 16 
     | 
    
         
            +
                  "description": "The name of the party",
         
     | 
| 
      
 17 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 18 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 19 
     | 
    
         
            +
                }
         
     | 
| 
      
 20 
     | 
    
         
            +
              }
         
     | 
| 
      
 21 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,42 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {
         
     | 
| 
      
 2 
     | 
    
         
            +
              "id": "hdo#promise",
         
     | 
| 
      
 3 
     | 
    
         
            +
              "description": "a party promise",
         
     | 
| 
      
 4 
     | 
    
         
            +
              "type":"object",
         
     | 
| 
      
 5 
     | 
    
         
            +
              "properties": {
         
     | 
| 
      
 6 
     | 
    
         
            +
                "kind": {
         
     | 
| 
      
 7 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 8 
     | 
    
         
            +
                  "description": "This is always 'hdo#promise'",
         
     | 
| 
      
 9 
     | 
    
         
            +
                  "default": "hdo#promise",
         
     | 
| 
      
 10 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 11 
     | 
    
         
            +
                },
         
     | 
| 
      
 12 
     | 
    
         
            +
                "externalId": {
         
     | 
| 
      
 13 
     | 
    
         
            +
                  "type": "string"
         
     | 
| 
      
 14 
     | 
    
         
            +
                },
         
     | 
| 
      
 15 
     | 
    
         
            +
                "party": {
         
     | 
| 
      
 16 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 17 
     | 
    
         
            +
                  "description": "The external id of the party.",
         
     | 
| 
      
 18 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 19 
     | 
    
         
            +
                },
         
     | 
| 
      
 20 
     | 
    
         
            +
                "general": {
         
     | 
| 
      
 21 
     | 
    
         
            +
                  "type": "boolean",
         
     | 
| 
      
 22 
     | 
    
         
            +
                  "description": "Whether this is considered a general promise (i.e. can be ambigious whether it has been fulfilled).",
         
     | 
| 
      
 23 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 24 
     | 
    
         
            +
                },
         
     | 
| 
      
 25 
     | 
    
         
            +
                "categories": {
         
     | 
| 
      
 26 
     | 
    
         
            +
                  "type": "array",
         
     | 
| 
      
 27 
     | 
    
         
            +
                  "description": "List of category names.",
         
     | 
| 
      
 28 
     | 
    
         
            +
                  "items": { "type": "string" },
         
     | 
| 
      
 29 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 30 
     | 
    
         
            +
                },
         
     | 
| 
      
 31 
     | 
    
         
            +
                "source": {
         
     | 
| 
      
 32 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 33 
     | 
    
         
            +
                  "description": "The source of the promise. (TODO: this should always be a URL)",
         
     | 
| 
      
 34 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 35 
     | 
    
         
            +
                },
         
     | 
| 
      
 36 
     | 
    
         
            +
                "body": {
         
     | 
| 
      
 37 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 38 
     | 
    
         
            +
                  "description": "The body text of the promise.",
         
     | 
| 
      
 39 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 40 
     | 
    
         
            +
                }
         
     | 
| 
      
 41 
     | 
    
         
            +
              }
         
     | 
| 
      
 42 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {
         
     | 
| 
      
 2 
     | 
    
         
            +
              "id": "hdo#proposition",
         
     | 
| 
      
 3 
     | 
    
         
            +
              "description": "a proposition being voted over",
         
     | 
| 
      
 4 
     | 
    
         
            +
              "type":"object",
         
     | 
| 
      
 5 
     | 
    
         
            +
              "properties": {
         
     | 
| 
      
 6 
     | 
    
         
            +
                "kind": {
         
     | 
| 
      
 7 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 8 
     | 
    
         
            +
                  "description": "This is always 'hdo#proposition'",
         
     | 
| 
      
 9 
     | 
    
         
            +
                  "default": "hdo#proposition",
         
     | 
| 
      
 10 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 11 
     | 
    
         
            +
                },
         
     | 
| 
      
 12 
     | 
    
         
            +
                "externalId": {
         
     | 
| 
      
 13 
     | 
    
         
            +
                  "type": "string"
         
     | 
| 
      
 14 
     | 
    
         
            +
                },
         
     | 
| 
      
 15 
     | 
    
         
            +
                "description": {
         
     | 
| 
      
 16 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 17 
     | 
    
         
            +
                  "description": "A short description of the proposition.",
         
     | 
| 
      
 18 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 19 
     | 
    
         
            +
                },
         
     | 
| 
      
 20 
     | 
    
         
            +
                "onBehalfOf": {
         
     | 
| 
      
 21 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 22 
     | 
    
         
            +
                  "description": "Description of who is behind the proposition.",
         
     | 
| 
      
 23 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 24 
     | 
    
         
            +
                },
         
     | 
| 
      
 25 
     | 
    
         
            +
                "body": {
         
     | 
| 
      
 26 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 27 
     | 
    
         
            +
                  "description": "The full text of the proposition.",
         
     | 
| 
      
 28 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 29 
     | 
    
         
            +
                },
         
     | 
| 
      
 30 
     | 
    
         
            +
                "deliveredBy": {
         
     | 
| 
      
 31 
     | 
    
         
            +
                  "$ref": "hdo#representative"
         
     | 
| 
      
 32 
     | 
    
         
            +
                }
         
     | 
| 
      
 33 
     | 
    
         
            +
              }
         
     | 
| 
      
 34 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,61 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {
         
     | 
| 
      
 2 
     | 
    
         
            +
              "id": "hdo#representative",
         
     | 
| 
      
 3 
     | 
    
         
            +
              "description": "a member of parliament",
         
     | 
| 
      
 4 
     | 
    
         
            +
              "type":"object",
         
     | 
| 
      
 5 
     | 
    
         
            +
              "properties": {
         
     | 
| 
      
 6 
     | 
    
         
            +
                "kind": {
         
     | 
| 
      
 7 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 8 
     | 
    
         
            +
                  "description": "This is always 'hdo#representative'",
         
     | 
| 
      
 9 
     | 
    
         
            +
                  "default": "hdo#representative",
         
     | 
| 
      
 10 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 11 
     | 
    
         
            +
                },
         
     | 
| 
      
 12 
     | 
    
         
            +
                "externalId": {
         
     | 
| 
      
 13 
     | 
    
         
            +
                  "type": "string"
         
     | 
| 
      
 14 
     | 
    
         
            +
                },
         
     | 
| 
      
 15 
     | 
    
         
            +
                "firstName": {
         
     | 
| 
      
 16 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 17 
     | 
    
         
            +
                  "description": "The first name of the representative",
         
     | 
| 
      
 18 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 19 
     | 
    
         
            +
                },
         
     | 
| 
      
 20 
     | 
    
         
            +
                "lastName": {
         
     | 
| 
      
 21 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 22 
     | 
    
         
            +
                  "description": "The first name of the representative",
         
     | 
| 
      
 23 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 24 
     | 
    
         
            +
                },
         
     | 
| 
      
 25 
     | 
    
         
            +
                "period": {
         
     | 
| 
      
 26 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 27 
     | 
    
         
            +
                  "description": "An identifier for the period the representative is elected for.",
         
     | 
| 
      
 28 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 29 
     | 
    
         
            +
                },
         
     | 
| 
      
 30 
     | 
    
         
            +
                "district": {
         
     | 
| 
      
 31 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 32 
     | 
    
         
            +
                  "description": "The electoral district the representative belongs to. Must match the 'name' field of the district type.",
         
     | 
| 
      
 33 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 34 
     | 
    
         
            +
                },
         
     | 
| 
      
 35 
     | 
    
         
            +
                "party": {
         
     | 
| 
      
 36 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 37 
     | 
    
         
            +
                  "description": "The name of the representative's party.",
         
     | 
| 
      
 38 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 39 
     | 
    
         
            +
                },
         
     | 
| 
      
 40 
     | 
    
         
            +
                "committees": {
         
     | 
| 
      
 41 
     | 
    
         
            +
                  "type": "array",
         
     | 
| 
      
 42 
     | 
    
         
            +
                  "description": "A list of committees the representative is a member of. This should match the 'name' field of the committee type.",
         
     | 
| 
      
 43 
     | 
    
         
            +
                  "items": { "type": "string"},
         
     | 
| 
      
 44 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 45 
     | 
    
         
            +
                },
         
     | 
| 
      
 46 
     | 
    
         
            +
                "dateOfBirth": {
         
     | 
| 
      
 47 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 48 
     | 
    
         
            +
                  "description": "The representative's birth date.",
         
     | 
| 
      
 49 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 50 
     | 
    
         
            +
                },
         
     | 
| 
      
 51 
     | 
    
         
            +
                "dateOfDeath": {
         
     | 
| 
      
 52 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 53 
     | 
    
         
            +
                  "description": "The representative's death date."
         
     | 
| 
      
 54 
     | 
    
         
            +
                },
         
     | 
| 
      
 55 
     | 
    
         
            +
                "voteResult": {
         
     | 
| 
      
 56 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 57 
     | 
    
         
            +
                  "description": "If this representative object is part of a hdo#vote, this property describes how the representative voted. Valid values are for|against|absent.",
         
     | 
| 
      
 58 
     | 
    
         
            +
                  "format": "for|against|absent"
         
     | 
| 
      
 59 
     | 
    
         
            +
                }
         
     | 
| 
      
 60 
     | 
    
         
            +
              }
         
     | 
| 
      
 61 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,64 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {
         
     | 
| 
      
 2 
     | 
    
         
            +
              "id": "hdo#vote",
         
     | 
| 
      
 3 
     | 
    
         
            +
              "description": "a vote in parliament, including results and propositions",
         
     | 
| 
      
 4 
     | 
    
         
            +
              "type":"object",
         
     | 
| 
      
 5 
     | 
    
         
            +
              "properties": {
         
     | 
| 
      
 6 
     | 
    
         
            +
                "kind": {
         
     | 
| 
      
 7 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 8 
     | 
    
         
            +
                  "description": "This is always 'hdo#vote'",
         
     | 
| 
      
 9 
     | 
    
         
            +
                  "default": "hdo#vote",
         
     | 
| 
      
 10 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 11 
     | 
    
         
            +
                },
         
     | 
| 
      
 12 
     | 
    
         
            +
                "externalId": {
         
     | 
| 
      
 13 
     | 
    
         
            +
                  "type": "string"
         
     | 
| 
      
 14 
     | 
    
         
            +
                },
         
     | 
| 
      
 15 
     | 
    
         
            +
                "externalIssueId": {
         
     | 
| 
      
 16 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 17 
     | 
    
         
            +
                  "description": "External ID of the issue being voted on (TODO: this is an 'append', since one vote may have multiple issues).",
         
     | 
| 
      
 18 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 19 
     | 
    
         
            +
                },
         
     | 
| 
      
 20 
     | 
    
         
            +
                "counts": {
         
     | 
| 
      
 21 
     | 
    
         
            +
                  "type": "object",
         
     | 
| 
      
 22 
     | 
    
         
            +
                  "description": "Count of for, against or absent representatives.",
         
     | 
| 
      
 23 
     | 
    
         
            +
                  "required": true,
         
     | 
| 
      
 24 
     | 
    
         
            +
                  "properties": {
         
     | 
| 
      
 25 
     | 
    
         
            +
                    "for": { "type": "number" },
         
     | 
| 
      
 26 
     | 
    
         
            +
                    "against": { "type": "number" },
         
     | 
| 
      
 27 
     | 
    
         
            +
                    "absent": { "type": "number" }
         
     | 
| 
      
 28 
     | 
    
         
            +
                  }
         
     | 
| 
      
 29 
     | 
    
         
            +
                },
         
     | 
| 
      
 30 
     | 
    
         
            +
                "personal": {
         
     | 
| 
      
 31 
     | 
    
         
            +
                  "type": "boolean",
         
     | 
| 
      
 32 
     | 
    
         
            +
                  "description": "Whether the vote was done using the voting system. If not, we attempt to infer the representative list from other votes on the same day.",
         
     | 
| 
      
 33 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 34 
     | 
    
         
            +
                },
         
     | 
| 
      
 35 
     | 
    
         
            +
                "enacted": {
         
     | 
| 
      
 36 
     | 
    
         
            +
                  "type": "boolean",
         
     | 
| 
      
 37 
     | 
    
         
            +
                  "description": "Whether the proposal was enacted.",
         
     | 
| 
      
 38 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 39 
     | 
    
         
            +
                },
         
     | 
| 
      
 40 
     | 
    
         
            +
                "subject": {
         
     | 
| 
      
 41 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 42 
     | 
    
         
            +
                  "description": "The subject of the vote.",
         
     | 
| 
      
 43 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 44 
     | 
    
         
            +
                },
         
     | 
| 
      
 45 
     | 
    
         
            +
                "time": {
         
     | 
| 
      
 46 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 47 
     | 
    
         
            +
                  "description": "The timestamp for the vote.",
         
     | 
| 
      
 48 
     | 
    
         
            +
                  "required": true
         
     | 
| 
      
 49 
     | 
    
         
            +
                },
         
     | 
| 
      
 50 
     | 
    
         
            +
                "method": {
         
     | 
| 
      
 51 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 52 
     | 
    
         
            +
                  "description": "Not entirely what sure this is at the moment."
         
     | 
| 
      
 53 
     | 
    
         
            +
                },
         
     | 
| 
      
 54 
     | 
    
         
            +
                "resultType": {
         
     | 
| 
      
 55 
     | 
    
         
            +
                  "type": "string",
         
     | 
| 
      
 56 
     | 
    
         
            +
                  "description": "Not entirely what sure this is at the moment."
         
     | 
| 
      
 57 
     | 
    
         
            +
                },
         
     | 
| 
      
 58 
     | 
    
         
            +
                "representatives": {
         
     | 
| 
      
 59 
     | 
    
         
            +
                  "type": "array",
         
     | 
| 
      
 60 
     | 
    
         
            +
                  "description": "An element with each representative's vote. The object should contain a set of <a href='#input-format-representative'><representative></a> objects with the property 'voteResult', for which valid values are 'for', 'against', 'absent'.",
         
     | 
| 
      
 61 
     | 
    
         
            +
                  "items": { "$ref": "hdo#representative" }
         
     | 
| 
      
 62 
     | 
    
         
            +
                }
         
     | 
| 
      
 63 
     | 
    
         
            +
              }
         
     | 
| 
      
 64 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -5,17 +5,6 @@ module Hdo 
     | 
|
| 
       5 
5 
     | 
    
         
             
                module Util
         
     | 
| 
       6 
6 
     | 
    
         
             
                  module_function
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
                  def builder
         
     | 
| 
       9 
     | 
    
         
            -
                    xml = Builder::XmlMarkup.new :indent => 2
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                    if block_given?
         
     | 
| 
       12 
     | 
    
         
            -
                      yield xml
         
     | 
| 
       13 
     | 
    
         
            -
                      return xml.target!
         
     | 
| 
       14 
     | 
    
         
            -
                    end
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                    xml
         
     | 
| 
       17 
     | 
    
         
            -
                  end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
8 
     | 
    
         
             
                  def remove_newlines(str)
         
     | 
| 
       20 
9 
     | 
    
         
             
                    str.gsub(/\r?\n/, '')
         
     | 
| 
       21 
10 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -37,6 +26,19 @@ module Hdo 
     | 
|
| 
       37 
26 
     | 
    
         
             
                    q
         
     | 
| 
       38 
27 
     | 
    
         
             
                  end
         
     | 
| 
       39 
28 
     | 
    
         | 
| 
      
 29 
     | 
    
         
            +
                  def json_pretty(obj)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    case obj
         
     | 
| 
      
 31 
     | 
    
         
            +
                    when Array
         
     | 
| 
      
 32 
     | 
    
         
            +
                      obj.map! { |e| e.respond_to?(:to_hash) ? e.to_hash : e }
         
     | 
| 
      
 33 
     | 
    
         
            +
                    when Hash
         
     | 
| 
      
 34 
     | 
    
         
            +
                      # do nothing
         
     | 
| 
      
 35 
     | 
    
         
            +
                    else
         
     | 
| 
      
 36 
     | 
    
         
            +
                      obj = obj.to_hash if obj.respond_to?(:to_hash)
         
     | 
| 
      
 37 
     | 
    
         
            +
                    end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                    Yajl::Encoder.encode obj, :pretty => true, :indent => "  "
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
       40 
42 
     | 
    
         
             
                end
         
     | 
| 
       41 
43 
     | 
    
         
             
              end
         
     | 
| 
       42 
44 
     | 
    
         
             
            end
         
     | 
| 
         @@ -3,6 +3,7 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Hdo
         
     | 
| 
       4 
4 
     | 
    
         
             
              module StortingImporter
         
     | 
| 
       5 
5 
     | 
    
         
             
                class Vote
         
     | 
| 
      
 6 
     | 
    
         
            +
                  include HasJsonSchema
         
     | 
| 
       6 
7 
     | 
    
         
             
                  include IvarEquality
         
     | 
| 
       7 
8 
     | 
    
         
             
                  include Inspectable
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
         @@ -13,29 +14,7 @@ module Hdo 
     | 
|
| 
       13 
14 
     | 
    
         
             
                  alias_method :personal?, :personal
         
     | 
| 
       14 
15 
     | 
    
         
             
                  alias_method :enacted?, :enacted
         
     | 
| 
       15 
16 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
                   
     | 
| 
       17 
     | 
    
         
            -
                    'vote'
         
     | 
| 
       18 
     | 
    
         
            -
                  end
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
                  def self.description
         
     | 
| 
       21 
     | 
    
         
            -
                    'a parliamentary vote'
         
     | 
| 
       22 
     | 
    
         
            -
                  end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                  def self.fields
         
     | 
| 
       25 
     | 
    
         
            -
                    [
         
     | 
| 
       26 
     | 
    
         
            -
                      EXTERNAL_ID_FIELD,
         
     | 
| 
       27 
     | 
    
         
            -
                      Field.new(:externalIssueId, true, :string, "The id (matching the issue's externalId) of the issue being voted on."),
         
     | 
| 
       28 
     | 
    
         
            -
                      Field.new(:counts, true, :element, "An element with <for>, <against> and <absent> counts (see example)."),
         
     | 
| 
       29 
     | 
    
         
            -
                      Field.new(:enacted, true, :boolean, "Whether the proposal was enacted."),
         
     | 
| 
       30 
     | 
    
         
            -
                      Field.new(:personal, true, :boolean, "Whether the vote was done using the voting system. If not, we attempt to infer the representative list from other votes on the same day."),
         
     | 
| 
       31 
     | 
    
         
            -
                      Field.new(:subject, true, :string, "The subject of the vote."),
         
     | 
| 
       32 
     | 
    
         
            -
                      Field.new(:method, true, :string, "??"),
         
     | 
| 
       33 
     | 
    
         
            -
                      Field.new(:resultType, true, :string, "??"),
         
     | 
| 
       34 
     | 
    
         
            -
                      Field.new(:time, true, :string, "The timestamp for the vote."),
         
     | 
| 
       35 
     | 
    
         
            -
                      Field.new(:representatives, true, :element, "An element with each representative's vote. The element should contain a set of <a href='#input-format-representative'><representative></a> elements with an extra subnode 'voteResult', where valid values are 'for', 'against', 'absent'. See example."),
         
     | 
| 
       36 
     | 
    
         
            -
                      Field.new(:propositions, false, :element, "An element with each proposition being voted over. The element should contain a set of <a href='#input-format-proposition'><proposition></a> elements. See example."),
         
     | 
| 
       37 
     | 
    
         
            -
                    ]
         
     | 
| 
       38 
     | 
    
         
            -
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
                  schema_path StortingImporter.lib.join("hdo/storting_importer/schema/vote.json").to_s
         
     | 
| 
       39 
18 
     | 
    
         | 
| 
       40 
19 
     | 
    
         
             
                  def self.example
         
     | 
| 
       41 
20 
     | 
    
         
             
                    vote = new('2175', '51448', true, false, 'Forslag 24 - 26 på vegne av Per Olaf Lundteigen', 'ikke_spesifisert', 'ikke_spesifisert', '2012-04-12T16:37:27.053', 2, 96, 71)
         
     | 
| 
         @@ -44,15 +23,15 @@ module Hdo 
     | 
|
| 
       44 
23 
     | 
    
         
             
                    rep.vote_result = 'for'
         
     | 
| 
       45 
24 
     | 
    
         
             
                    vote.representatives << rep
         
     | 
| 
       46 
25 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
                    prop =  
     | 
| 
      
 26 
     | 
    
         
            +
                    prop = Proposition.example
         
     | 
| 
       48 
27 
     | 
    
         | 
| 
       49 
28 
     | 
    
         
             
                    vote.propositions << prop
         
     | 
| 
       50 
29 
     | 
    
         | 
| 
       51 
30 
     | 
    
         
             
                    vote
         
     | 
| 
       52 
31 
     | 
    
         
             
                  end
         
     | 
| 
       53 
32 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
                  def self. 
     | 
| 
       55 
     | 
    
         
            -
                    example 
     | 
| 
      
 33 
     | 
    
         
            +
                  def self.json_example
         
     | 
| 
      
 34 
     | 
    
         
            +
                    Util.json_pretty example
         
     | 
| 
       56 
35 
     | 
    
         
             
                  end
         
     | 
| 
       57 
36 
     | 
    
         | 
| 
       58 
37 
     | 
    
         
             
                  def self.from_storting_doc(doc)
         
     | 
| 
         @@ -80,26 +59,26 @@ module Hdo 
     | 
|
| 
       80 
59 
     | 
    
         
             
                    end
         
     | 
| 
       81 
60 
     | 
    
         
             
                  end
         
     | 
| 
       82 
61 
     | 
    
         | 
| 
       83 
     | 
    
         
            -
                  def self. 
     | 
| 
       84 
     | 
    
         
            -
                     
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
                     
     | 
| 
      
 62 
     | 
    
         
            +
                  def self.from_hash(hash)
         
     | 
| 
      
 63 
     | 
    
         
            +
                    counts = hash.fetch("counts")
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                    args = [
         
     | 
| 
      
 66 
     | 
    
         
            +
                      hash.fetch("externalId"),
         
     | 
| 
      
 67 
     | 
    
         
            +
                      hash.fetch("externalIssueId"),
         
     | 
| 
      
 68 
     | 
    
         
            +
                      hash.fetch("personal"),
         
     | 
| 
      
 69 
     | 
    
         
            +
                      hash.fetch("enacted"),
         
     | 
| 
      
 70 
     | 
    
         
            +
                      hash.fetch("subject"),
         
     | 
| 
      
 71 
     | 
    
         
            +
                      hash.fetch("method"),
         
     | 
| 
      
 72 
     | 
    
         
            +
                      hash.fetch("resultType"),
         
     | 
| 
      
 73 
     | 
    
         
            +
                      hash.fetch("time"),
         
     | 
| 
      
 74 
     | 
    
         
            +
                      counts.fetch("for"),
         
     | 
| 
      
 75 
     | 
    
         
            +
                      counts.fetch("against"),
         
     | 
| 
      
 76 
     | 
    
         
            +
                      counts.fetch("absent")
         
     | 
| 
      
 77 
     | 
    
         
            +
                    ]
         
     | 
| 
       99 
78 
     | 
    
         | 
| 
       100 
     | 
    
         
            -
                    vote = new 
     | 
| 
       101 
     | 
    
         
            -
                    vote. 
     | 
| 
       102 
     | 
    
         
            -
                    vote. 
     | 
| 
      
 79 
     | 
    
         
            +
                    vote = new(*args)
         
     | 
| 
      
 80 
     | 
    
         
            +
                    vote.representatives = hash.fetch('representatives').map { |e| Representative.from_hash(e) }
         
     | 
| 
      
 81 
     | 
    
         
            +
                    vote.propositions    = hash.fetch('propositions').map { |e| Proposition.from_hash(e) }
         
     | 
| 
       103 
82 
     | 
    
         | 
| 
       104 
83 
     | 
    
         
             
                    vote
         
     | 
| 
       105 
84 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -159,108 +138,32 @@ module Hdo 
     | 
|
| 
       159 
138 
     | 
    
         
             
                    end
         
     | 
| 
       160 
139 
     | 
    
         
             
                  end
         
     | 
| 
       161 
140 
     | 
    
         | 
| 
       162 
     | 
    
         
            -
                  def  
     | 
| 
       163 
     | 
    
         
            -
                     
     | 
| 
       164 
     | 
    
         
            -
                       
     | 
| 
       165 
     | 
    
         
            -
                       
     | 
| 
       166 
     | 
    
         
            -
                       
     | 
| 
       167 
     | 
    
         
            -
             
     | 
| 
       168 
     | 
    
         
            -
             
     | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
       170 
     | 
    
         
            -
                       
     | 
| 
       171 
     | 
    
         
            -
                       
     | 
| 
       172 
     | 
    
         
            -
                       
     | 
| 
       173 
     | 
    
         
            -
                       
     | 
| 
       174 
     | 
    
         
            -
                       
     | 
| 
       175 
     | 
    
         
            -
                       
     | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
       177 
     | 
    
         
            -
             
     | 
| 
       178 
     | 
    
         
            -
                      vote.representatives do |reps|
         
     | 
| 
       179 
     | 
    
         
            -
                        representatives.each do |rep|
         
     | 
| 
       180 
     | 
    
         
            -
                          rep.to_hdo_xml(reps)
         
     | 
| 
       181 
     | 
    
         
            -
                        end
         
     | 
| 
       182 
     | 
    
         
            -
                      end
         
     | 
| 
       183 
     | 
    
         
            -
             
     | 
| 
       184 
     | 
    
         
            -
                      vote.propositions do |props|
         
     | 
| 
       185 
     | 
    
         
            -
                        propositions.each do |prop|
         
     | 
| 
       186 
     | 
    
         
            -
                          prop.to_hdo_xml(props)
         
     | 
| 
       187 
     | 
    
         
            -
                        end
         
     | 
| 
       188 
     | 
    
         
            -
                      end
         
     | 
| 
       189 
     | 
    
         
            -
                    end
         
     | 
| 
      
 141 
     | 
    
         
            +
                  def to_hash
         
     | 
| 
      
 142 
     | 
    
         
            +
                    {
         
     | 
| 
      
 143 
     | 
    
         
            +
                      :kind             => self.class.kind,
         
     | 
| 
      
 144 
     | 
    
         
            +
                      :externalId       => @external_id,
         
     | 
| 
      
 145 
     | 
    
         
            +
                      :externalIssueId  => @external_issue_id,
         
     | 
| 
      
 146 
     | 
    
         
            +
                      :counts           => @counts.to_hash,
         
     | 
| 
      
 147 
     | 
    
         
            +
                      :personal         => @personal,
         
     | 
| 
      
 148 
     | 
    
         
            +
                      :enacted          => @enacted,
         
     | 
| 
      
 149 
     | 
    
         
            +
                      :subject          => @subject,
         
     | 
| 
      
 150 
     | 
    
         
            +
                      :method           => @method,
         
     | 
| 
      
 151 
     | 
    
         
            +
                      :resultType       => @result_type,
         
     | 
| 
      
 152 
     | 
    
         
            +
                      :time             => @time,
         
     | 
| 
      
 153 
     | 
    
         
            +
                      :representatives  => @representatives.map(&:to_hash),
         
     | 
| 
      
 154 
     | 
    
         
            +
                      :propositions     => @propositions.map(&:to_hash)
         
     | 
| 
      
 155 
     | 
    
         
            +
                    }
         
     | 
| 
       190 
156 
     | 
    
         
             
                  end
         
     | 
| 
       191 
157 
     | 
    
         | 
| 
       192 
158 
     | 
    
         
             
                  class Counts < Struct.new(:for, :against, :absent)
         
     | 
| 
       193 
     | 
    
         
            -
             
     | 
| 
       194 
     | 
    
         
            -
             
     | 
| 
       195 
     | 
    
         
            -
             
     | 
| 
       196 
     | 
    
         
            -
             
     | 
| 
       197 
     | 
    
         
            -
             
     | 
| 
       198 
     | 
    
         
            -
             
     | 
| 
       199 
     | 
    
         
            -
                    attr_reader :external_id, :description, :on_behalf_of, :body, :delivered_by
         
     | 
| 
       200 
     | 
    
         
            -
             
     | 
| 
       201 
     | 
    
         
            -
                    def self.type_name
         
     | 
| 
       202 
     | 
    
         
            -
                      'proposition'
         
     | 
| 
       203 
     | 
    
         
            -
                    end
         
     | 
| 
       204 
     | 
    
         
            -
             
     | 
| 
       205 
     | 
    
         
            -
                    def self.example
         
     | 
| 
       206 
     | 
    
         
            -
                      new('1234', 'description', 'on behalf of', 'body', Representative.example)
         
     | 
| 
       207 
     | 
    
         
            -
                    end
         
     | 
| 
       208 
     | 
    
         
            -
             
     | 
| 
       209 
     | 
    
         
            -
                    def self.description
         
     | 
| 
       210 
     | 
    
         
            -
                      'a proposition being voted over'
         
     | 
| 
       211 
     | 
    
         
            -
                    end
         
     | 
| 
       212 
     | 
    
         
            -
             
     | 
| 
       213 
     | 
    
         
            -
                    def self.fields
         
     | 
| 
       214 
     | 
    
         
            -
                      [
         
     | 
| 
       215 
     | 
    
         
            -
                        EXTERNAL_ID_FIELD,
         
     | 
| 
       216 
     | 
    
         
            -
                        Field.new(:description, true, :string, 'A short description of the proposition.'),
         
     | 
| 
       217 
     | 
    
         
            -
                        Field.new(:deliveredBy, true, :string, "The representative that delivered the proposition. The element should contain a <a href='#input-format-representative'><representative></a> element."),
         
     | 
| 
       218 
     | 
    
         
            -
                        Field.new(:onBehalfOf, true, :string, "Description of who is behind the proposition."),
         
     | 
| 
       219 
     | 
    
         
            -
                        Field.new(:body, true, :string, "The full text of the proposition."),
         
     | 
| 
       220 
     | 
    
         
            -
                      ]
         
     | 
| 
       221 
     | 
    
         
            -
                    end
         
     | 
| 
       222 
     | 
    
         
            -
             
     | 
| 
       223 
     | 
    
         
            -
                    def self.xml_example(builder = Util.builder)
         
     | 
| 
       224 
     | 
    
         
            -
                      example.to_hdo_xml(builder)
         
     | 
| 
       225 
     | 
    
         
            -
                    end
         
     | 
| 
       226 
     | 
    
         
            -
             
     | 
| 
       227 
     | 
    
         
            -
                    def self.from_hdo_node(node)
         
     | 
| 
       228 
     | 
    
         
            -
                      external_id  = node.css("externalId").first.text
         
     | 
| 
       229 
     | 
    
         
            -
                      description  = node.css("description").first.text
         
     | 
| 
       230 
     | 
    
         
            -
                      on_behalf_of = node.css("onBehalfOf").first.text
         
     | 
| 
       231 
     | 
    
         
            -
                      body         = node.css("body").first.text
         
     | 
| 
       232 
     | 
    
         
            -
             
     | 
| 
       233 
     | 
    
         
            -
                      delivered_by_node = node.css("deliveredBy representative").first
         
     | 
| 
       234 
     | 
    
         
            -
                      delivered_by = Representative.from_hdo_node(delivered_by_node) if delivered_by_node
         
     | 
| 
       235 
     | 
    
         
            -
             
     | 
| 
       236 
     | 
    
         
            -
                      new external_id, description, on_behalf_of, body, delivered_by
         
     | 
| 
       237 
     | 
    
         
            -
                    end
         
     | 
| 
       238 
     | 
    
         
            -
             
     | 
| 
       239 
     | 
    
         
            -
                    def initialize(external_id, description, on_behalf_of, body, delivered_by)
         
     | 
| 
       240 
     | 
    
         
            -
                      @external_id  = external_id
         
     | 
| 
       241 
     | 
    
         
            -
                      @description  = description
         
     | 
| 
       242 
     | 
    
         
            -
                      @on_behalf_of = on_behalf_of
         
     | 
| 
       243 
     | 
    
         
            -
                      @body         = body
         
     | 
| 
       244 
     | 
    
         
            -
                      @delivered_by = delivered_by
         
     | 
| 
       245 
     | 
    
         
            -
                    end
         
     | 
| 
       246 
     | 
    
         
            -
             
     | 
| 
       247 
     | 
    
         
            -
                    def short_inspect
         
     | 
| 
       248 
     | 
    
         
            -
                      short_inspect_string :include => [:external_id, :description, :on_behalf_of]
         
     | 
| 
      
 159 
     | 
    
         
            +
                    def to_hash
         
     | 
| 
      
 160 
     | 
    
         
            +
                      {
         
     | 
| 
      
 161 
     | 
    
         
            +
                        :for     => self.for,
         
     | 
| 
      
 162 
     | 
    
         
            +
                        :against => against,
         
     | 
| 
      
 163 
     | 
    
         
            +
                        :absent  => absent
         
     | 
| 
      
 164 
     | 
    
         
            +
                      }
         
     | 
| 
       249 
165 
     | 
    
         
             
                    end
         
     | 
| 
       250 
     | 
    
         
            -
             
     | 
| 
       251 
     | 
    
         
            -
                    def to_hdo_xml(builder)
         
     | 
| 
       252 
     | 
    
         
            -
                      builder.proposition do |pr|
         
     | 
| 
       253 
     | 
    
         
            -
                        pr.externalId external_id
         
     | 
| 
       254 
     | 
    
         
            -
                        pr.description description
         
     | 
| 
       255 
     | 
    
         
            -
                        pr.onBehalfOf on_behalf_of
         
     | 
| 
       256 
     | 
    
         
            -
                        pr.body body
         
     | 
| 
       257 
     | 
    
         
            -
             
     | 
| 
       258 
     | 
    
         
            -
                        pr.deliveredBy do |db|
         
     | 
| 
       259 
     | 
    
         
            -
                          delivered_by.to_hdo_xml(db) if delivered_by
         
     | 
| 
       260 
     | 
    
         
            -
                        end
         
     | 
| 
       261 
     | 
    
         
            -
                      end
         
     | 
| 
       262 
     | 
    
         
            -
                    end
         
     | 
| 
       263 
     | 
    
         
            -
                  end # Proposition
         
     | 
| 
      
 166 
     | 
    
         
            +
                  end
         
     | 
| 
       264 
167 
     | 
    
         | 
| 
       265 
168 
     | 
    
         
             
                end # Vote
         
     | 
| 
       266 
169 
     | 
    
         
             
              end
         
     | 
| 
         @@ -9,11 +9,17 @@ require 'builder' 
     | 
|
| 
       9 
9 
     | 
    
         
             
            require 'unicode_utils'
         
     | 
| 
       10 
10 
     | 
    
         
             
            require 'uri'
         
     | 
| 
       11 
11 
     | 
    
         
             
            require 'multi_json'
         
     | 
| 
      
 12 
     | 
    
         
            +
            require 'yajl/json_gem'
         
     | 
| 
      
 13 
     | 
    
         
            +
            require 'jschematic'
         
     | 
| 
       12 
14 
     | 
    
         | 
| 
       13 
15 
     | 
    
         
             
            module Hdo
         
     | 
| 
       14 
16 
     | 
    
         
             
              module StortingImporter
         
     | 
| 
       15 
17 
     | 
    
         
             
                def self.root
         
     | 
| 
       16 
     | 
    
         
            -
                  @root ||= File.expand_path("../../..", __FILE__)
         
     | 
| 
      
 18 
     | 
    
         
            +
                  @root ||= Pathname.new(File.expand_path("../../..", __FILE__))
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                def self.lib
         
     | 
| 
      
 22 
     | 
    
         
            +
                  @lib ||= Pathname.new(File.expand_path("../..", __FILE__))
         
     | 
| 
       17 
23 
     | 
    
         
             
                end
         
     | 
| 
       18 
24 
     | 
    
         | 
| 
       19 
25 
     | 
    
         
             
                def self.types
         
     | 
| 
         @@ -25,7 +31,7 @@ module Hdo 
     | 
|
| 
       25 
31 
     | 
    
         
             
                    Category,
         
     | 
| 
       26 
32 
     | 
    
         
             
                    Issue,
         
     | 
| 
       27 
33 
     | 
    
         
             
                    Vote,
         
     | 
| 
       28 
     | 
    
         
            -
                     
     | 
| 
      
 34 
     | 
    
         
            +
                    Proposition,
         
     | 
| 
       29 
35 
     | 
    
         
             
                    Promise
         
     | 
| 
       30 
36 
     | 
    
         
             
                  ]
         
     | 
| 
       31 
37 
     | 
    
         
             
                end
         
     | 
| 
         @@ -51,7 +57,7 @@ module Hdo 
     | 
|
| 
       51 
57 
     | 
    
         
             
                  end
         
     | 
| 
       52 
58 
     | 
    
         | 
| 
       53 
59 
     | 
    
         
             
                  types.each_with_index do |type, type_idx|
         
     | 
| 
       54 
     | 
    
         
            -
                    out.puts "\x1b[1m#{type. 
     | 
| 
      
 60 
     | 
    
         
            +
                    out.puts "\x1b[1m#{type.kind}\x1b[0m\n"
         
     | 
| 
       55 
61 
     | 
    
         | 
| 
       56 
62 
     | 
    
         
             
                    type.fields.each_with_index do |field, field_idx|
         
     | 
| 
       57 
63 
     | 
    
         | 
| 
         @@ -100,7 +106,9 @@ end 
     | 
|
| 
       100 
106 
     | 
    
         
             
            require 'hdo/storting_importer/core_ext/enumerable'
         
     | 
| 
       101 
107 
     | 
    
         
             
            require 'hdo/storting_importer/ivar_equality'
         
     | 
| 
       102 
108 
     | 
    
         
             
            require 'hdo/storting_importer/inspectable'
         
     | 
| 
      
 109 
     | 
    
         
            +
            require 'hdo/storting_importer/has_json_schema'
         
     | 
| 
       103 
110 
     | 
    
         
             
            require 'hdo/storting_importer/util'
         
     | 
| 
      
 111 
     | 
    
         
            +
            require 'hdo/storting_importer/fusion_table'
         
     | 
| 
       104 
112 
     | 
    
         | 
| 
       105 
113 
     | 
    
         
             
            require 'hdo/storting_importer/data_source'
         
     | 
| 
       106 
114 
     | 
    
         
             
            require 'hdo/storting_importer/disk_data_source'
         
     | 
| 
         @@ -114,6 +122,7 @@ require 'hdo/storting_importer/issue' 
     | 
|
| 
       114 
122 
     | 
    
         
             
            require 'hdo/storting_importer/party'
         
     | 
| 
       115 
123 
     | 
    
         
             
            require 'hdo/storting_importer/promise'
         
     | 
| 
       116 
124 
     | 
    
         
             
            require 'hdo/storting_importer/representative'
         
     | 
| 
      
 125 
     | 
    
         
            +
            require 'hdo/storting_importer/proposition'
         
     | 
| 
       117 
126 
     | 
    
         
             
            require 'hdo/storting_importer/vote'
         
     | 
| 
       118 
127 
     | 
    
         | 
| 
       119 
128 
     | 
    
         
             
            require 'hdo/storting_importer/converter'
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            [{"kind":"hdo#category","externalId":"5","name":"ARBEIDSLIV","subCategories":[{"kind":"hdo#category","externalId":"205","name":"ARBEIDSMILJØ"},{"kind":"hdo#category","externalId":"94","name":"ARBEIDSVILKÅR"},{"kind":"hdo#category","externalId":"95","name":"LØNN"},{"kind":"hdo#category","externalId":"7","name":"SYSSELSETTING"}]},{"kind":"hdo#category","externalId":"173","name":"EFTA/EU","subCategories":[{"kind":"hdo#category","externalId":"173","name":"EFTA/EU"},{"kind":"hdo#category","externalId":"170","name":"EUROPARÅDET"},{"kind":"hdo#category","externalId":"168","name":"FN"},{"kind":"hdo#category","externalId":"169","name":"FN-STYRKER"},{"kind":"hdo#category","externalId":"180","name":"FREDSARBEID"},{"kind":"hdo#category","externalId":"165","name":"GRENSESPØRSMÅL"},{"kind":"hdo#category","externalId":"200","name":"INTERNASJONAL RETT"},{"kind":"hdo#category","externalId":"22","name":"INTERNASJONALT SAMARBEID"},{"kind":"hdo#category","externalId":"167","name":"MENNESKERETTIGHETER"},{"kind":"hdo#category","externalId":"177","name":"NATO"},{"kind":"hdo#category","externalId":"171","name":"NORDISK SAMARBEID"},{"kind":"hdo#category","externalId":"175","name":"POLAROMRÅDER"},{"kind":"hdo#category","externalId":"176","name":"SVALBARD"},{"kind":"hdo#category","externalId":"166","name":"TRAKTATER"},{"kind":"hdo#category","externalId":"174","name":"UTVIKLINGSHJELP"},{"kind":"hdo#category","externalId":"172","name":"ØKONOMISK SAMARBEID"}]},{"kind":"hdo#category","externalId":"4","name":"ENERGI","subCategories":[{"kind":"hdo#category","externalId":"72","name":"ATOMKRAFT"},{"kind":"hdo#category","externalId":"71","name":"ELEKTRISITET"},{"kind":"hdo#category","externalId":"74","name":"OLJE"},{"kind":"hdo#category","externalId":"75","name":"OLJEOMSETNING"},{"kind":"hdo#category","externalId":"190","name":"OLJEUTVINNING"},{"kind":"hdo#category","externalId":"178","name":"STATOIL ASA"},{"kind":"hdo#category","externalId":"73","name":"VASSDRAGSREGULERING"}]},{"kind":"hdo#category","externalId":"40","name":"FAMILIE","subCategories":[{"kind":"hdo#category","externalId":"41","name":"BARN"},{"kind":"hdo#category","externalId":"42","name":"BARNEHAGER"},{"kind":"hdo#category","externalId":"43","name":"BARNEVERN"},{"kind":"hdo#category","externalId":"24","name":"LIKESTILLING"}]},{"kind":"hdo#category","externalId":"187","name":"FINANSER","subCategories":[{"kind":"hdo#category","externalId":"192","name":"AKSJER"},{"kind":"hdo#category","externalId":"80","name":"AVGIFTER"},{"kind":"hdo#category","externalId":"87","name":"BANKER"},{"kind":"hdo#category","externalId":"50","name":"FORSIKRING"},{"kind":"hdo#category","externalId":"81","name":"MERVERDIAVGIFT"},{"kind":"hdo#category","externalId":"88","name":"NORGES BANK"},{"kind":"hdo#category","externalId":"83","name":"PRISER OG KONKURRANSEFORHOLD"},{"kind":"hdo#category","externalId":"53","name":"SKATTEADMINISTRASJON"},{"kind":"hdo#category","externalId":"54","name":"SKATTEAVTALER"},{"kind":"hdo#category","externalId":"57","name":"SKATTEFRADRAG"},{"kind":"hdo#category","externalId":"58","name":"SKATTER"},{"kind":"hdo#category","externalId":"89","name":"STATSBANKER"},{"kind":"hdo#category","externalId":"185","name":"STATSBUDSJETTET"},{"kind":"hdo#category","externalId":"86","name":"STATSLÅN"},{"kind":"hdo#category","externalId":"191","name":"SÆRAVGIFTER"},{"kind":"hdo#category","externalId":"82","name":"TOLL"}]},{"kind":"hdo#category","externalId":"8","name":"FISKERIER","subCategories":[{"kind":"hdo#category","externalId":"9","name":"FANGST"},{"kind":"hdo#category","externalId":"91","name":"FISKEOMSETNING"},{"kind":"hdo#category","externalId":"92","name":"HAVBRUK"}]},{"kind":"hdo#category","externalId":"45","name":"FORSKNING"},{"kind":"hdo#category","externalId":"59","name":"FORSVAR","subCategories":[{"kind":"hdo#category","externalId":"93","name":"ATOMVÅPEN"},{"kind":"hdo#category","externalId":"60","name":"FORSVARSMATERIELL"},{"kind":"hdo#category","externalId":"193","name":"MILITÆRT PERSONELL"}]},{"kind":"hdo#category","externalId":"61","name":"HELSEVESEN","subCategories":[{"kind":"hdo#category","externalId":"188","name":"FOLKEHELSE"},{"kind":"hdo#category","externalId":"49","name":"FUNKSJONSHEMMEDE"},{"kind":"hdo#category","externalId":"62","name":"HELSEINSTITUSJONER"},{"kind":"hdo#category","externalId":"64","name":"HELSEPERSONELL"},{"kind":"hdo#category","externalId":"65","name":"SVANGERSKAP"},{"kind":"hdo#category","externalId":"66","name":"SYKDOMMER"},{"kind":"hdo#category","externalId":"63","name":"SYKEHUS"}]},{"kind":"hdo#category","externalId":"2","name":"KOMMUNIKASJON","subCategories":[{"kind":"hdo#category","externalId":"111","name":"FERGER"},{"kind":"hdo#category","externalId":"107","name":"JERNBANER"},{"kind":"hdo#category","externalId":"109","name":"LUFTFART"},{"kind":"hdo#category","externalId":"3","name":"POST"},{"kind":"hdo#category","externalId":"106","name":"SAMFERDSEL"},{"kind":"hdo#category","externalId":"179","name":"TELEKOMMUNIKASJONER"},{"kind":"hdo#category","externalId":"47","name":"VEGTRAFIKK"},{"kind":"hdo#category","externalId":"189","name":"VEGVESEN"}]},{"kind":"hdo#category","externalId":"6","name":"KULTUR","subCategories":[{"kind":"hdo#category","externalId":"67","name":"BIBLIOTEK OG LITTERATUR"},{"kind":"hdo#category","externalId":"127","name":"IDRETT"},{"kind":"hdo#category","externalId":"70","name":"KRINGKASTING"},{"kind":"hdo#category","externalId":"121","name":"KULTURVERN"},{"kind":"hdo#category","externalId":"68","name":"KUNST"},{"kind":"hdo#category","externalId":"142","name":"LOTTERI OG SPILL"},{"kind":"hdo#category","externalId":"122","name":"MASSEMEDIER"},{"kind":"hdo#category","externalId":"126","name":"NORSK RIKSKRINGKASTING"},{"kind":"hdo#category","externalId":"124","name":"SPRÅK"},{"kind":"hdo#category","externalId":"125","name":"UNGDOMSARBEID"}]},{"kind":"hdo#category","externalId":"46","name":"LANDBRUK","subCategories":[{"kind":"hdo#category","externalId":"129","name":"HUSDYR"},{"kind":"hdo#category","externalId":"128","name":"JORDBRUK"},{"kind":"hdo#category","externalId":"69","name":"LANDBRUKSPRODUKTER"},{"kind":"hdo#category","externalId":"132","name":"REINDRIFT"},{"kind":"hdo#category","externalId":"196","name":"SKOGBRUK"},{"kind":"hdo#category","externalId":"133","name":"VETERINÆRVESEN"}]},{"kind":"hdo#category","externalId":"184","name":"LOKALFORVALTNING","subCategories":[{"kind":"hdo#category","externalId":"38","name":"BOLIGSAKER"},{"kind":"hdo#category","externalId":"136","name":"BYGNINGSVESEN"},{"kind":"hdo#category","externalId":"220","name":"DISTRIKTSPOLITIKK"},{"kind":"hdo#category","externalId":"37","name":"FYLKER"},{"kind":"hdo#category","externalId":"134","name":"FYLKESKOMMUNENES ØKONOMI"},{"kind":"hdo#category","externalId":"138","name":"HUSBANKEN"},{"kind":"hdo#category","externalId":"18","name":"INNVANDRERE"},{"kind":"hdo#category","externalId":"135","name":"KOMMUNENES ØKONOMI"},{"kind":"hdo#category","externalId":"52","name":"KOMMUNER"},{"kind":"hdo#category","externalId":"39","name":"SAMER"}]},{"kind":"hdo#category","externalId":"139","name":"MILJØVERN","subCategories":[{"kind":"hdo#category","externalId":"21","name":"FORURENSNING"},{"kind":"hdo#category","externalId":"140","name":"KARTVERK"},{"kind":"hdo#category","externalId":"131","name":"NATURSKADER"},{"kind":"hdo#category","externalId":"23","name":"NATURVERN"}]},{"kind":"hdo#category","externalId":"113","name":"NÆRINGSLIV","subCategories":[{"kind":"hdo#category","externalId":"115","name":"BERGVERK"},{"kind":"hdo#category","externalId":"98","name":"FORBRUKERSAKER"},{"kind":"hdo#category","externalId":"20","name":"HANDEL"},{"kind":"hdo#category","externalId":"223","name":"INDUSTRI"},{"kind":"hdo#category","externalId":"114","name":"NÆRINGSUTVIKLING"},{"kind":"hdo#category","externalId":"112","name":"REISELIVSNÆRING"},{"kind":"hdo#category","externalId":"119","name":"STATSBEDRIFTER"},{"kind":"hdo#category","externalId":"99","name":"UTENRIKSHANDEL"},{"kind":"hdo#category","externalId":"97","name":"VAREHANDEL"},{"kind":"hdo#category","externalId":"195","name":"VERFTSINDUSTRI"}]},{"kind":"hdo#category","externalId":"11","name":"RETTSVESEN","subCategories":[{"kind":"hdo#category","externalId":"12","name":"DOMSTOLER"},{"kind":"hdo#category","externalId":"19","name":"FENGSLER"},{"kind":"hdo#category","externalId":"16","name":"KRIMINALOMSORG"},{"kind":"hdo#category","externalId":"17","name":"PERSONVERN"},{"kind":"hdo#category","externalId":"141","name":"POLITI OG PÅTALEMYNDIGHET"},{"kind":"hdo#category","externalId":"15","name":"REDNINGSTJENESTE"},{"kind":"hdo#category","externalId":"181","name":"SIVIL BEREDSKAP"},{"kind":"hdo#category","externalId":"198","name":"SIVILE VERNEPLIKTIGE"},{"kind":"hdo#category","externalId":"13","name":"SIVILRETT"},{"kind":"hdo#category","externalId":"14","name":"STRAFFERETT"}]},{"kind":"hdo#category","externalId":"143","name":"SJØFART","subCategories":[{"kind":"hdo#category","externalId":"147","name":"HAVNER"},{"kind":"hdo#category","externalId":"146","name":"SIKKERHET TIL SJØS"},{"kind":"hdo#category","externalId":"145","name":"SJØFOLK"}]},{"kind":"hdo#category","externalId":"10","name":"SOSIALVESEN","subCategories":[{"kind":"hdo#category","externalId":"148","name":"BARNETRYGD"},{"kind":"hdo#category","externalId":"48","name":"ELDREOMSORG"},{"kind":"hdo#category","externalId":"211","name":"RUSMIDLER"},{"kind":"hdo#category","externalId":"186","name":"TRYGDER"}]},{"kind":"hdo#category","externalId":"151","name":"STATSFORFATNING","subCategories":[{"kind":"hdo#category","externalId":"221","name":"GRUNNLOVEN"},{"kind":"hdo#category","externalId":"182","name":"KONGEN"},{"kind":"hdo#category","externalId":"154","name":"POLITISKE PARTIER"},{"kind":"hdo#category","externalId":"25","name":"REGJERINGEN"},{"kind":"hdo#category","externalId":"28","name":"RETTFERDSVEDERLAG"},{"kind":"hdo#category","externalId":"29","name":"RIKSREVISJONEN"},{"kind":"hdo#category","externalId":"203","name":"STORTINGET"},{"kind":"hdo#category","externalId":"222","name":"STORTINGETS FORRETNINGSORDEN"},{"kind":"hdo#category","externalId":"153","name":"STORTINGETS OMBUDSMANN FOR FORVALTNINGEN"},{"kind":"hdo#category","externalId":"26","name":"STORTINGSREPRESENTANTER"},{"kind":"hdo#category","externalId":"30","name":"VALG"}]},{"kind":"hdo#category","externalId":"155","name":"STATSFORVALTNING","subCategories":[{"kind":"hdo#category","externalId":"51","name":"DEPARTEMENTER"},{"kind":"hdo#category","externalId":"44","name":"STATENS PERSONALPOLITIKK"},{"kind":"hdo#category","externalId":"157","name":"STATSEIENDOMMER"}]},{"kind":"hdo#category","externalId":"105","name":"TROSSAMFUNN","subCategories":[{"kind":"hdo#category","externalId":"1","name":"DEN NORSKE KIRKE"}]},{"kind":"hdo#category","externalId":"32","name":"UTDANNING","subCategories":[{"kind":"hdo#category","externalId":"183","name":"GRUNNSKOLE"},{"kind":"hdo#category","externalId":"160","name":"HØGSKOLER"},{"kind":"hdo#category","externalId":"159","name":"HØYERE UTDANNING"},{"kind":"hdo#category","externalId":"33","name":"PRIVATSKOLER"},{"kind":"hdo#category","externalId":"31","name":"SKOLER"},{"kind":"hdo#category","externalId":"34","name":"SPESIALUNDERVISNING"},{"kind":"hdo#category","externalId":"36","name":"STUDIEFINANSIERING"},{"kind":"hdo#category","externalId":"35","name":"UNIVERSITETER"},{"kind":"hdo#category","externalId":"158","name":"VIDEREGÅENDE SKOLER"},{"kind":"hdo#category","externalId":"212","name":"VOKSENOPPLÆRING"}]},{"kind":"hdo#category","externalId":"163","name":"UTENRIKSSAKER","subCategories":[{"kind":"hdo#category","externalId":"173","name":"EFTA/EU"},{"kind":"hdo#category","externalId":"170","name":"EUROPARÅDET"},{"kind":"hdo#category","externalId":"168","name":"FN"},{"kind":"hdo#category","externalId":"169","name":"FN-STYRKER"},{"kind":"hdo#category","externalId":"180","name":"FREDSARBEID"},{"kind":"hdo#category","externalId":"165","name":"GRENSESPØRSMÅL"},{"kind":"hdo#category","externalId":"200","name":"INTERNASJONAL RETT"},{"kind":"hdo#category","externalId":"22","name":"INTERNASJONALT SAMARBEID"},{"kind":"hdo#category","externalId":"167","name":"MENNESKERETTIGHETER"},{"kind":"hdo#category","externalId":"177","name":"NATO"},{"kind":"hdo#category","externalId":"171","name":"NORDISK SAMARBEID"},{"kind":"hdo#category","externalId":"175","name":"POLAROMRÅDER"},{"kind":"hdo#category","externalId":"176","name":"SVALBARD"},{"kind":"hdo#category","externalId":"166","name":"TRAKTATER"},{"kind":"hdo#category","externalId":"174","name":"UTVIKLINGSHJELP"},{"kind":"hdo#category","externalId":"172","name":"ØKONOMISK SAMARBEID"}]}]
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            [{"kind":"hdo#committee","externalId":"ARBSOS","name":"Arbeids- og sosialkomiteen"},{"kind":"hdo#committee","externalId":"SÆRKOM","name":"Den særskilte komité til å behandle redegjørelse fra justisministeren og forsvarsministeren i Stortingets møte 10. november 2011 om angrepene 22. juli"},{"kind":"hdo#committee","externalId":"UUFK","name":"Den utvidede utenriks- og forsvarskomité"},{"kind":"hdo#committee","externalId":"ENERGI","name":"Energi- og miljøkomiteen"},{"kind":"hdo#committee","externalId":"FAMKULT","name":"Familie- og kulturkomiteen"},{"kind":"hdo#committee","externalId":"FINANS","name":"Finanskomiteen"},{"kind":"hdo#committee","externalId":"FULLMAKT","name":"Fullmaktskomiteen"},{"kind":"hdo#committee","externalId":"HELSEOMS","name":"Helse- og omsorgskomiteen"},{"kind":"hdo#committee","externalId":"JUSTIS","name":"Justiskomiteen"},{"kind":"hdo#committee","externalId":"KIRKE","name":"Kirke-, utdannings- og forskningskomiteen"},{"kind":"hdo#committee","externalId":"KOMMFORV","name":"Kommunal- og forvaltningskomiteen"},{"kind":"hdo#committee","externalId":"KONTROLL","name":"Kontroll- og konstitusjonskomiteen"},{"kind":"hdo#committee","externalId":"NÆRING","name":"Næringskomiteen"},{"kind":"hdo#committee","externalId":"PRES","name":"Stortingets presidentskap"},{"kind":"hdo#committee","externalId":"TRANSKOM","name":"Transport- og kommunikasjonskomiteen"},{"kind":"hdo#committee","externalId":"UFK","name":"Utenriks- og forsvarskomiteen"},{"kind":"hdo#committee","externalId":"VALG","name":"Valgkomiteen"}]
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            [{"kind":"hdo#district","externalId":"Ak","name":"Akershus"},{"kind":"hdo#district","externalId":"AA","name":"Aust-Agder"},{"kind":"hdo#district","externalId":"Bu","name":"Buskerud"},{"kind":"hdo#district","externalId":"Fi","name":"Finnmark"},{"kind":"hdo#district","externalId":"He","name":"Hedmark"},{"kind":"hdo#district","externalId":"Ho","name":"Hordaland"},{"kind":"hdo#district","externalId":"MR","name":"Møre og Romsdal"},{"kind":"hdo#district","externalId":"NT","name":"Nord-Trøndelag"},{"kind":"hdo#district","externalId":"No","name":"Nordland"},{"kind":"hdo#district","externalId":"Op","name":"Oppland"},{"kind":"hdo#district","externalId":"Os","name":"Oslo"},{"kind":"hdo#district","externalId":"Ro","name":"Rogaland"},{"kind":"hdo#district","externalId":"SF","name":"Sogn og Fjordane"},{"kind":"hdo#district","externalId":"ST","name":"Sør-Trøndelag"},{"kind":"hdo#district","externalId":"Te","name":"Telemark"},{"kind":"hdo#district","externalId":"Tr","name":"Troms"},{"kind":"hdo#district","externalId":"VA","name":"Vest-Agder"},{"kind":"hdo#district","externalId":"Ve","name":"Vestfold"},{"kind":"hdo#district","externalId":"Øs","name":"Østfold"}]
         
     |