catobills 0.4 → 0.5
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/lib/catobills/bill.rb +15 -8
- data/lib/catobills/version.rb +1 -1
- metadata +1 -1
data/lib/catobills/bill.rb
CHANGED
|
@@ -3,6 +3,10 @@ module Catobills
|
|
|
3
3
|
|
|
4
4
|
attr_reader :bill_number, :bill_body, :version, :congress, :bill_type, :federal_bodies, :acts
|
|
5
5
|
|
|
6
|
+
FILTER_LIST = ['Commission', 'Board', 'Secretary', 'Department', 'Administrator', 'Administration', 'House', 'Senate', 'Director', 'Advisory Committee', 'Task Force',
|
|
7
|
+
"Secretary's", "Under Secretary", "Administrator's", "Board's", "Service", "Department of State's", "CSCC's", "Bureau", "Inspector General of the Office", "Office",
|
|
8
|
+
"Commissioner", "Assistant Secretary"]
|
|
9
|
+
|
|
6
10
|
def initialize(params={})
|
|
7
11
|
params.each_pair do |k,v|
|
|
8
12
|
instance_variable_set("@#{k}", v)
|
|
@@ -20,13 +24,16 @@ module Catobills
|
|
|
20
24
|
response = HTTParty.get(url)
|
|
21
25
|
bill = Oj.load(response.body)
|
|
22
26
|
bill_body = Ox.load(bill['billbody'])
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
|
|
28
|
+
self.new(
|
|
29
|
+
bill_number: bill['billnumber'],
|
|
30
|
+
bill_body: bill_body,
|
|
31
|
+
version: bill['billversion'],
|
|
32
|
+
congress: bill['congress'],
|
|
33
|
+
bill_type: bill['billtype'],
|
|
34
|
+
federal_bodies: self.populate_federal_bodies(bill_body),
|
|
35
|
+
acts: self.populate_acts(bill_body)
|
|
36
|
+
)
|
|
30
37
|
end
|
|
31
38
|
|
|
32
39
|
def self.populate_acts(bill_body)
|
|
@@ -37,7 +44,7 @@ module Catobills
|
|
|
37
44
|
# collects mentions of federal bodies, removing 'Congress', leadership offices, 'Commission', 'Board' and offices within agencies.
|
|
38
45
|
def self.populate_federal_bodies(bill_body)
|
|
39
46
|
results = bill_body.locate('legis-body/*/cato:entity-ref').select{|ref| ref['entity-type'] == 'federal-body'}
|
|
40
|
-
array_count(results.flatten.reject{|ref| ref['entity-id'] == "0001"}.reject{|ref| ref['entity-parent-id'] == '0050'}.reject{|ref| ref['entity-parent-id'] == '0010'}.map{|ref| ref.text.gsub(/\s+/, " ").strip}.compact.reject{|x|
|
|
47
|
+
array_count(results.flatten.reject{|ref| ref['entity-id'] == "0001"}.reject{|ref| ref['entity-parent-id'] == '0050'}.reject{|ref| ref['entity-parent-id'] == '0010'}.map{|ref| ref.text.gsub(/\s+/, " ").strip}.compact.reject{|x| FILTER_LIST.include?(x)})
|
|
41
48
|
end
|
|
42
49
|
|
|
43
50
|
def self.array_count(array)
|
data/lib/catobills/version.rb
CHANGED