fech 1.6.4 → 1.7
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.
- checksums.yaml +4 -4
- data/CHANGELOG +11 -0
- data/Gemfile.lock +15 -20
- data/README.rdoc +4 -3
- data/Rakefile +3 -0
- data/fech.gemspec +19 -13
- data/lib/fech/default_translations.rb +2 -2
- data/lib/fech/fech_utils.rb +6 -4
- data/lib/fech/map_generator.rb +29 -24
- data/lib/fech/rendered_maps.rb +11 -4
- data/lib/fech/version.rb +1 -1
- data/sources/F3.csv +1 -1
- data/sources/F3Z.csv +1 -0
- data/sources/SchA3L.csv +1 -0
- data/spec/filing_spec.rb +64 -64
- data/spec/spec_helper.rb +0 -3
- metadata +35 -32
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f6e04ce5d91ac6847c295b5a406a5655b424a506
|
|
4
|
+
data.tar.gz: 8838778407bd9420407306c2f1e299180986ab42
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b485b90e6e021eeb1c244d7952899b1d2bd6a3eba1487ad150460cd5675b00f7edeb3da6ba25f656fd62ff2e0ebb28454e28f614c533baea13d9fb253a1ce72
|
|
7
|
+
data.tar.gz: 8867088559cead6e584dd72f3c9a574d57dcfcb8b928f7c10e7b6da6769ed61b9a474350fe0bc9dd0e88fa494626f50c0a60b85470b78e6af56b1186bbb0e3bb
|
data/CHANGELOG
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -9,40 +9,35 @@ PATH
|
|
|
9
9
|
GEM
|
|
10
10
|
remote: http://rubygems.org/
|
|
11
11
|
specs:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
debugger-ruby_core_source (~> 1.2.0)
|
|
17
|
-
debugger-linecache (1.1.2)
|
|
18
|
-
debugger-ruby_core_source (>= 1.1.1)
|
|
19
|
-
debugger-ruby_core_source (1.2.4)
|
|
20
|
-
diff-lcs (1.1.2)
|
|
12
|
+
byebug (4.0.4)
|
|
13
|
+
columnize (= 0.9.0)
|
|
14
|
+
columnize (0.9.0)
|
|
15
|
+
diff-lcs (1.2.5)
|
|
21
16
|
ensure-encoding (0.1)
|
|
22
17
|
fastercsv (1.5.5)
|
|
23
18
|
mocha (0.9.12)
|
|
24
19
|
people (0.2.1)
|
|
25
20
|
rake (0.8.7)
|
|
26
21
|
rdoc (3.9.2)
|
|
27
|
-
rspec (2.
|
|
28
|
-
rspec-core (~> 2.
|
|
29
|
-
rspec-expectations (~> 2.
|
|
30
|
-
rspec-mocks (~> 2.
|
|
31
|
-
rspec-core (2.
|
|
32
|
-
rspec-expectations (2.
|
|
33
|
-
diff-lcs (
|
|
34
|
-
rspec-mocks (2.
|
|
35
|
-
yard (0.7.
|
|
22
|
+
rspec (2.99.0)
|
|
23
|
+
rspec-core (~> 2.99.0)
|
|
24
|
+
rspec-expectations (~> 2.99.0)
|
|
25
|
+
rspec-mocks (~> 2.99.0)
|
|
26
|
+
rspec-core (2.99.2)
|
|
27
|
+
rspec-expectations (2.99.2)
|
|
28
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
|
29
|
+
rspec-mocks (2.99.3)
|
|
30
|
+
yard (0.8.7.6)
|
|
36
31
|
|
|
37
32
|
PLATFORMS
|
|
38
33
|
ruby
|
|
39
34
|
|
|
40
35
|
DEPENDENCIES
|
|
41
36
|
bundler
|
|
42
|
-
|
|
37
|
+
byebug
|
|
43
38
|
fech!
|
|
44
39
|
mocha
|
|
45
40
|
rake
|
|
46
41
|
rdoc
|
|
47
|
-
rspec
|
|
42
|
+
rspec
|
|
48
43
|
yard
|
data/README.rdoc
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
Fech makes it easy to parse electronic campaign finance filings[http://www.fec.gov/finance/disclosure/efile_search.shtml] by candidates, parties and political action committees from the Federal Election Commission. It lets you access filing attributes the same way regardless of filing version, and works as a framework for cleaning and filing data. Fech is an open source project of The New York Times, but contributions from anyone interested in working with F.E.C. filings are greatly appreciated.
|
|
8
8
|
|
|
9
|
-
Latest version: 1.
|
|
9
|
+
Latest version: 1.7. For details see the CHANGELOG.
|
|
10
10
|
|
|
11
|
-
Fech
|
|
11
|
+
Fech works best under Ruby version 2.x, and has been tested under Ruby versions 1.8.7, 1.9.2, 1.9.3 and 2.1.2. It also has been reported to run using Rubinius.
|
|
12
12
|
|
|
13
13
|
== Documentation
|
|
14
14
|
|
|
@@ -16,6 +16,7 @@ Can be found at Fech's Github page[http://nytimes.github.com/Fech/].
|
|
|
16
16
|
|
|
17
17
|
== News
|
|
18
18
|
|
|
19
|
+
* March 28, 2015: Version 1.7 released. Added support for Schedule SA3L and F3Z transactions, fixed some bugs and updated gems and specs.
|
|
19
20
|
* March 11, 2014: Version 1.6.4 released. Bugfix for Schedule E transactions to fix office state and district.
|
|
20
21
|
* Jan. 22, 2014: Version 1.6.3 released. Bugfix to ensure Translator object is available to any Filing object. Thanks to @abstrctn for fix.
|
|
21
22
|
* Jan. 15, 2014: Version 1.6.2 released. Bugfix to add dissemination date to SE mappings.
|
|
@@ -54,7 +55,7 @@ Can be found at Fech's Github page[http://nytimes.github.com/Fech/].
|
|
|
54
55
|
Install Fech as a gem:
|
|
55
56
|
|
|
56
57
|
gem install fech
|
|
57
|
-
|
|
58
|
+
|
|
58
59
|
For use in a Rails 3 application, put the following in your Gemfile:
|
|
59
60
|
|
|
60
61
|
gem 'fech'
|
data/Rakefile
CHANGED
data/fech.gemspec
CHANGED
|
@@ -19,24 +19,30 @@ Gem::Specification.new do |s|
|
|
|
19
19
|
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
|
20
20
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
21
21
|
s.require_paths = ["lib"]
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
s.add_dependency "fastercsv"
|
|
24
24
|
s.add_dependency "people"
|
|
25
25
|
s.add_dependency "ensure-encoding"
|
|
26
|
-
if
|
|
27
|
-
s.add_development_dependency
|
|
28
|
-
s.add_development_dependency
|
|
29
|
-
s.add_development_dependency
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
|
|
27
|
+
s.add_development_dependency 'rubinius-compiler'
|
|
28
|
+
s.add_development_dependency 'rubinius-debugger'
|
|
29
|
+
s.add_development_dependency 'rubysl'
|
|
30
|
+
s.add_development_dependency 'ffi'
|
|
31
|
+
s.add_development_dependency 'psych'
|
|
32
|
+
else
|
|
33
|
+
if RUBY_VERSION < "1.9"
|
|
34
|
+
s.add_development_dependency "linecache", "0.43"
|
|
35
|
+
s.add_development_dependency "ruby-debug"
|
|
36
|
+
s.add_development_dependency "iconv"
|
|
37
|
+
elsif RUBY_VERSION >= "2.0"
|
|
38
|
+
s.add_development_dependency "byebug"
|
|
39
|
+
elsif RUBY_VERSION >= "1.9" && RUBY_VERSION < '2.0'
|
|
40
|
+
s.add_development_dependency "ruby-debug19"
|
|
41
|
+
s.add_development_dependency "linecache19"
|
|
42
|
+
end
|
|
37
43
|
end
|
|
38
44
|
s.add_development_dependency "rake"
|
|
39
|
-
s.add_development_dependency "rspec"
|
|
45
|
+
s.add_development_dependency "rspec"
|
|
40
46
|
s.add_development_dependency "mocha"
|
|
41
47
|
s.add_development_dependency "bundler"
|
|
42
48
|
s.add_development_dependency "rdoc"
|
|
@@ -51,7 +51,7 @@ module Fech
|
|
|
51
51
|
{:row => :sc1, :version => /^[3-5]/, :field => [:treasurer, :authorized]},
|
|
52
52
|
{:row => :sc2, :version => /^[3-5]/, :field => :guarantor},
|
|
53
53
|
{:row => :sd, :version => /^[3-5]/, :field => :creditor},
|
|
54
|
-
{:row => :se, :version => /^[3-5]/, :field => [:payee, :
|
|
54
|
+
{:row => :se, :version => /^[3-5]/, :field => [:payee, :candidate]},
|
|
55
55
|
{:row => :sf, :version => /^[3-5]/, :field => [:payee, :payee_candidate]},
|
|
56
56
|
{:row => :f3p, :version => /^[3-5]/, :field => :treasurer},
|
|
57
57
|
{:row => :f3p31, :version => /^[3-5]/, :field => :contributor},
|
|
@@ -130,4 +130,4 @@ module Fech
|
|
|
130
130
|
|
|
131
131
|
end
|
|
132
132
|
|
|
133
|
-
end
|
|
133
|
+
end
|
data/lib/fech/fech_utils.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Contains helper functions and static variables used by various
|
|
2
2
|
# Fech classes.
|
|
3
3
|
module FechUtils
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
# All supported row types pointed to regular expressions that will correctly
|
|
6
6
|
# match that row type in the wild. If multiple matches exist, Fech will match
|
|
7
7
|
# the longest regex pattern found.
|
|
@@ -22,6 +22,7 @@ module FechUtils
|
|
|
22
22
|
:f3p31 => /^f3p31/i,
|
|
23
23
|
:f3ps => /^f3ps/i,
|
|
24
24
|
:f3x => /(^f3x$)|(^f3x[ant])/i,
|
|
25
|
+
:f3z => /^f3z[t]/i,
|
|
25
26
|
:f4 => /^f4[na]/i,
|
|
26
27
|
:f5 => /^f5[na]/i,
|
|
27
28
|
:f56 => /^f56/i,
|
|
@@ -43,6 +44,7 @@ module FechUtils
|
|
|
43
44
|
:h5 => /^h5/i,
|
|
44
45
|
:h6 => /^h6/i,
|
|
45
46
|
:sa => /^sa/i,
|
|
47
|
+
:sa3l => /^sa3l/i,
|
|
46
48
|
:sb => /^sb/i,
|
|
47
49
|
:sc => /^sc[^1-2]/i,
|
|
48
50
|
:sc1 => /^sc1/i,
|
|
@@ -53,7 +55,7 @@ module FechUtils
|
|
|
53
55
|
:sl => /^sl/i,
|
|
54
56
|
:text => /^text/i,
|
|
55
57
|
}
|
|
56
|
-
|
|
58
|
+
|
|
57
59
|
# Converts symbols and strings to Regexp objects for use in regex-keyed maps.
|
|
58
60
|
# Assumes that symbols should be matched literally, strings unanchored.
|
|
59
61
|
# @param [String,Symbol,Regexp] label the object to convert to a Regexp
|
|
@@ -70,7 +72,7 @@ module FechUtils
|
|
|
70
72
|
Regexp.new(Regexp.escape(label.to_s), Regexp::IGNORECASE)
|
|
71
73
|
end
|
|
72
74
|
end
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
|
|
76
|
+
|
|
75
77
|
|
|
76
78
|
end
|
data/lib/fech/map_generator.rb
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
module Fech
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
# Helper class to generate mapping hashes from source csv data.
|
|
4
4
|
# Needed to rebuild rendered_maps.rb with new source data, not used
|
|
5
5
|
# in main gem.
|
|
6
6
|
# rake fech:maps
|
|
7
7
|
class MapGenerator
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
attr_accessor :map
|
|
10
|
+
PAPER_FILING_VERSIONS = ["3.1", "3.0", "2.6", "2.4", "2.3", "2.2", "1.0"]
|
|
11
|
+
PAPER_BASE_ROW_TYPES = ["HDR", "F3", "F3X", "SchA", "SchB"]
|
|
12
|
+
|
|
10
13
|
FILING_VERSIONS = ["8.0", "7.0", "6.4", "6.3", "6.2", "6.1",
|
|
11
14
|
"5.3", "5.2", "5.1", "5.0", "3"]
|
|
12
|
-
BASE_ROW_TYPES = ["HDR", "F1", "F13", "F132", "F133", "F1M", "F1S", "F2", "F24", "F3", "F3L", "F3P", "F3P31", "F3PS",
|
|
13
|
-
"F3S", "F3X", "F4", "F5", "F56", "F57", "F6", "F65", "F7", "F76", "F9", "F91", "F92", "F93",
|
|
15
|
+
BASE_ROW_TYPES = ["HDR", "F1", "F13", "F132", "F133", "F1M", "F1S", "F2", "F24", "F3", "F3L", "F3P", "F3P31", "F3PS",
|
|
16
|
+
"F3S", "F3X", "F3Z", "F4", "F5", "F56", "F57", "F6", "F65", "F7", "F76", "F9", "F91", "F92", "F93",
|
|
14
17
|
"F94", "F99", "H1", "H2", "H3", "H4", "H5", "H6",
|
|
15
|
-
"SchA", "SchB", "SchC", "SchC1", "SchC2", "SchD", "SchE", "SchF", "SchL", "TEXT"]
|
|
18
|
+
"SchA", "SchA3L", "SchB", "SchC", "SchC1", "SchC2", "SchD", "SchE", "SchF", "SchL", "TEXT"]
|
|
16
19
|
ROW_TYPE_MATCHERS = {
|
|
17
20
|
"HDR" => FechUtils::ROW_TYPES[:hdr],
|
|
18
21
|
"F1" => FechUtils::ROW_TYPES[:f1],
|
|
@@ -30,6 +33,7 @@ module Fech
|
|
|
30
33
|
"F3P31" => FechUtils::ROW_TYPES[:f3p31],
|
|
31
34
|
"F3PS" => FechUtils::ROW_TYPES[:f3ps],
|
|
32
35
|
"F3X" => FechUtils::ROW_TYPES[:f3x],
|
|
36
|
+
"F3Z" => FechUtils::ROW_TYPES[:f3z],
|
|
33
37
|
"F4" => FechUtils::ROW_TYPES[:f4],
|
|
34
38
|
"F5" => FechUtils::ROW_TYPES[:f5],
|
|
35
39
|
"F56" => FechUtils::ROW_TYPES[:f56],
|
|
@@ -51,6 +55,7 @@ module Fech
|
|
|
51
55
|
"H5" => FechUtils::ROW_TYPES[:h5],
|
|
52
56
|
"H6" => FechUtils::ROW_TYPES[:h6],
|
|
53
57
|
"SchA" => FechUtils::ROW_TYPES[:sa],
|
|
58
|
+
"SchA3L" => FechUtils::ROW_TYPES[:sa3l],
|
|
54
59
|
"SchB" => FechUtils::ROW_TYPES[:sb],
|
|
55
60
|
"SchC" => FechUtils::ROW_TYPES[:sc],
|
|
56
61
|
"SchC1" => FechUtils::ROW_TYPES[:sc1],
|
|
@@ -61,15 +66,15 @@ module Fech
|
|
|
61
66
|
"SchL" => FechUtils::ROW_TYPES[:sl],
|
|
62
67
|
"TEXT" => FechUtils::ROW_TYPES[:text],
|
|
63
68
|
}
|
|
64
|
-
|
|
69
|
+
|
|
65
70
|
# Goes through all version header summary files and generates
|
|
66
71
|
# row map files for each type of row inside them.
|
|
67
72
|
def self.convert_header_file_to_row_files(source_dir)
|
|
68
73
|
data = {}
|
|
69
74
|
hybrid_data = {}
|
|
70
|
-
|
|
75
|
+
|
|
71
76
|
ignored_fields = File.open(ignored_fields_file(source_dir)).readlines.map { |l| l.strip }
|
|
72
|
-
|
|
77
|
+
|
|
73
78
|
# Create a hash of data with an entry for each row type found in the source
|
|
74
79
|
# version summary files. Each row has an entry for each version map that
|
|
75
80
|
# exists for it. If maps for two different versions are identical, they
|
|
@@ -101,12 +106,12 @@ module Fech
|
|
|
101
106
|
data[row.first][version] = row_version_data
|
|
102
107
|
data[row.first].each do |k, v|
|
|
103
108
|
# skip the row we just added
|
|
104
|
-
|
|
109
|
+
|
|
105
110
|
next if k == version
|
|
106
111
|
if v == row_version_data
|
|
107
112
|
# Create the new hybrid entry
|
|
108
113
|
hybrid_data[row.first]["#{k}|#{version}"] = row_version_data
|
|
109
|
-
|
|
114
|
+
|
|
110
115
|
# Delete the old entry, and the one for this version only
|
|
111
116
|
data[row.first].delete(k)
|
|
112
117
|
data[row.first].delete(version)
|
|
@@ -115,7 +120,7 @@ module Fech
|
|
|
115
120
|
data[row.first].update(hybrid_data[row.first])
|
|
116
121
|
end
|
|
117
122
|
end
|
|
118
|
-
|
|
123
|
+
|
|
119
124
|
# Go through each row type and create a base map management file that
|
|
120
125
|
# will serve as a template for organizing which fields are the same
|
|
121
126
|
# between versions. This file will need to then be arranged by hand to
|
|
@@ -126,18 +131,18 @@ module Fech
|
|
|
126
131
|
next unless File.exists?(file_path)
|
|
127
132
|
File.open(file_path, 'w') do |f|
|
|
128
133
|
f.write('canonical')
|
|
129
|
-
|
|
134
|
+
|
|
130
135
|
to_transpose = []
|
|
131
136
|
row_data.sort.reverse.each do |version, version_data|
|
|
132
137
|
to_transpose << ["^#{version}", version_data.each_with_index.collect {|x, idx| idx+1}].flatten
|
|
133
138
|
to_transpose << [nil, version_data].flatten
|
|
134
139
|
end
|
|
135
|
-
|
|
140
|
+
|
|
136
141
|
# standardize row size
|
|
137
142
|
max_size = to_transpose.max { |r1, r2| r1.size <=> r2.size }.size
|
|
138
143
|
to_transpose.each { |r| r[max_size - 1] ||= nil }
|
|
139
144
|
transposed = to_transpose.transpose
|
|
140
|
-
|
|
145
|
+
|
|
141
146
|
transposed.each do |transposed_data|
|
|
142
147
|
transposed_data.collect! {|x| x.to_s.gsub(/\r/, ' ')}
|
|
143
148
|
canonical = transposed_data[1] # first description
|
|
@@ -152,7 +157,7 @@ module Fech
|
|
|
152
157
|
end
|
|
153
158
|
|
|
154
159
|
end
|
|
155
|
-
|
|
160
|
+
|
|
156
161
|
# Generates the mapping for each row type in BASE_ROW_TYPES, writes them out
|
|
157
162
|
# to file for inclusion in the gem.
|
|
158
163
|
def self.dump_row_maps_to_ruby(source_dir, file_path)
|
|
@@ -194,44 +199,44 @@ module Fech
|
|
|
194
199
|
row.each_with_index {|x, ind| version_indexes << ind unless (x.nil? || x.empty?)}.slice!(1)
|
|
195
200
|
version_indexes.slice!(0, 1)
|
|
196
201
|
versions.each {|x| data[x] = [] }
|
|
197
|
-
|
|
202
|
+
|
|
198
203
|
elsif row.first.size > 0
|
|
199
204
|
canonical = row.first
|
|
200
|
-
|
|
205
|
+
|
|
201
206
|
versions.zip(version_indexes).each do |version, row_index|
|
|
202
207
|
index = row[row_index]
|
|
203
208
|
data[version][index.to_i - 1] = canonical.to_sym if index.to_i > 0
|
|
204
209
|
end
|
|
205
210
|
end
|
|
206
211
|
end
|
|
207
|
-
|
|
212
|
+
|
|
208
213
|
row_map = {}
|
|
209
214
|
data.each {|key, value| row_map[key] = value}
|
|
210
215
|
row_map
|
|
211
216
|
end
|
|
212
|
-
|
|
217
|
+
|
|
213
218
|
# Remove both the row type from the beginning of the row,
|
|
214
219
|
# and any fields marked as "ignore" in sources/headers/ignore.csv
|
|
215
220
|
def self.remove_ignored_fields(row, ignore)
|
|
216
221
|
data = row[1..-1].compact # strip off the row type
|
|
217
222
|
data.reject { |f| ignore.include?(f) }
|
|
218
223
|
end
|
|
219
|
-
|
|
224
|
+
|
|
220
225
|
def self.row_map_file(source_dir, row_type)
|
|
221
226
|
File.join(source_dir, row_type + '.csv')
|
|
222
227
|
end
|
|
223
|
-
|
|
228
|
+
|
|
224
229
|
def self.ignored_fields_file(source_dir)
|
|
225
230
|
File.join(source_dir, 'headers', 'ignore.csv')
|
|
226
231
|
end
|
|
227
|
-
|
|
232
|
+
|
|
228
233
|
def self.version_summary_file(source_dir, version)
|
|
229
234
|
File.join(source_dir, 'headers', version + '.csv')
|
|
230
235
|
end
|
|
231
|
-
|
|
236
|
+
|
|
232
237
|
def self.write_row_map_file(source_dir, row_type)
|
|
233
238
|
File.join(source_dir, 'rows', row_type + '.csv')
|
|
234
239
|
end
|
|
235
|
-
|
|
240
|
+
|
|
236
241
|
end
|
|
237
242
|
end
|
data/lib/fech/rendered_maps.rb
CHANGED
|
@@ -50,10 +50,10 @@ module Fech
|
|
|
50
50
|
'^3' => [:form_type, :filer_committee_id_number, :committee_name, :street_1, :street_2, :city, :state, :zip_code, nil, :date_signed],
|
|
51
51
|
},
|
|
52
52
|
"^f3[a|n|t]" => {
|
|
53
|
-
'^8.1|8.0|7.0|6.4' => [:form_type, :filer_committee_id_number, :committee_name, :change_of_address, :street_1, :street_2, :city, :state, :zip_code, :election_state, :election_district, :report_code, :election_code, :election_date, :state_of_election, :coverage_from_date, :coverage_through_date, :treasurer_last_name, :treasurer_first_name, :treasurer_middle_name, :treasurer_prefix, :treasurer_suffix, :date_signed, :col_a_total_contributions_no_loans, :col_a_total_contributions_refunds, :col_a_net_contributions, :col_a_total_operating_expenditures, :col_a_total_offset_to_operating_expenditures, :col_a_net_operating_expenditures, :col_a_cash_on_hand_close_of_period, :col_a_debts_to, :col_a_debts_by, :col_a_individual_contributions_itemized, :col_a_individual_contributions_unitemized, :col_a_total_individual_contributions, :col_a_political_party_contributions, :col_a_pac_contributions, :col_a_candidate_contributions, :col_a_total_contributions, :col_a_transfers_from_authorized, :col_a_candidate_loans, :col_a_other_loans, :col_a_total_loans, :col_a_offset_to_operating_expenditures, :col_a_other_receipts, :col_a_total_receipts, :col_a_operating_expenditures, :col_a_transfers_to_authorized, :col_a_candidate_loan_repayments, :col_a_other_loan_repayments, :col_a_total_loan_repayments, :col_a_refunds_to_individuals, :col_a_refunds_to_party_committees, :col_a_refunds_to_other_committees, :col_a_total_refunds, :col_a_other_disbursements, :col_a_total_disbursements, :col_a_cash_beginning_reporting_period, :
|
|
54
|
-
'^6.3|6.2|6.1' => [:form_type, :filer_committee_id_number, :committee_name, :change_of_address, :street_1, :street_2, :city, :state, :zip_code, :election_state, :election_district, :election_date, :election_code, nil, :state_of_election, :coverage_from_date, :coverage_through_date, :treasurer_last_name, :treasurer_first_name, :treasurer_middle_name, :treasurer_prefix, :treasurer_suffix, :date_signed, :candidate_id_number, :candidate_last_name, :candidate_first_name, :candidate_middle_name, :candidate_prefix, :candidate_suffix, :report_type, :col_a_total_contributions_no_loans, :col_a_total_contributions_refunds, :col_a_net_contributions, :col_a_total_operating_expenditures, :col_a_total_offset_to_operating_expenditures, :col_a_net_operating_expenditures, :col_a_cash_on_hand_close_of_period, :col_a_debts_to, :col_a_debts_by, :col_a_individual_contributions_itemized, :col_a_individual_contributions_unitemized, :col_a_total_individual_contributions, :col_a_political_party_contributions, :col_a_pac_contributions, :col_a_candidate_contributions, :col_a_total_contributions, :col_a_transfers_from_authorized, :col_a_candidate_loans, :col_a_other_loans, :col_a_total_loans, :col_a_offset_to_operating_expenditures, :col_a_other_receipts, :col_a_total_receipts, :col_a_operating_expenditures, :col_a_transfers_to_authorized, :col_a_candidate_loan_repayments, nil, :col_a_total_loan_repayments, :col_a_refunds_to_individuals, :col_a_refunds_to_party_committees, :col_a_refunds_to_other_committees, :col_a_total_refunds, :col_a_other_disbursements, :col_a_total_disbursements, :col_a_cash_beginning_reporting_period, :
|
|
55
|
-
'^5.3|5.2|5.1|5.0' => [:form_type, :filer_committee_id_number, :committee_name, :street_1, :street_2, :city, :state, :zip_code, :change_of_address, :election_state, :election_district, :report_code, :election_code, :election_date, :state_of_election, :primary_election, :general_election, :special_election, :runoff_election, :coverage_from_date, :coverage_through_date, :col_a_total_contributions_no_loans, :col_a_total_contributions_refunds, :col_a_net_contributions, :col_a_total_operating_expenditures, :col_a_total_offset_to_operating_expenditures, :col_a_net_operating_expenditures, :col_a_cash_on_hand_close_of_period, :col_a_debts_to, :col_a_debts_by, :col_a_individual_contributions_itemized, :col_a_individual_contributions_unitemized, :col_a_total_individual_contributions, :col_a_political_party_contributions, :col_a_pac_contributions, :col_a_candidate_contributions, :col_a_total_contributions, :col_a_transfers_from_authorized, :col_a_candidate_loans, :col_a_other_loans, :col_a_total_loans, :col_a_offset_to_operating_expenditures, :col_a_other_receipts, :col_a_total_receipts, :col_a_operating_expenditures, :col_a_transfers_to_authorized, :col_a_candidate_loan_repayments, nil, :col_a_total_loan_repayments, :col_a_refunds_to_individuals, :col_a_refunds_to_party_committees, :col_a_refunds_to_other_committees, :col_a_total_refunds, :col_a_other_disbursements, :col_a_total_disbursements, :col_a_cash_beginning_reporting_period, :
|
|
56
|
-
'^3.0' => [:form_type, :filer_committee_id_number, :committee_name, :street_1, :street_2, :city, :state, :zip_code, :change_of_address, :election_state, :election_district, :report_code, :election_code, :election_date, :state_of_election, :primary_election, :general_election, :special_election, :runoff_election, :coverage_from_date, :coverage_through_date, :col_a_total_contributions_no_loans, :col_a_total_contributions_refunds, :col_a_net_contributions, :col_a_total_operating_expenditures, :col_a_total_offset_to_operating_expenditures, :col_a_net_operating_expenditures, :col_a_cash_on_hand_close_of_period, :col_a_debts_to, :col_a_debts_by, :col_a_individual_contributions_itemized, :col_a_individual_contributions_unitemized, :col_a_total_individual_contributions, :col_a_political_party_contributions, :col_a_pac_contributions, :col_a_candidate_contributions, :col_a_total_contributions, :col_a_transfers_from_authorized, :col_a_candidate_loans, :col_a_other_loans, :col_a_total_loans, :col_a_offset_to_operating_expenditures, :col_a_other_receipts, :col_a_total_receipts, :col_a_operating_expenditures, :col_a_transfers_to_authorized, :col_a_candidate_loan_repayments, :col_a_other_loan_repayments, :col_a_total_loan_repayments, :col_a_refunds_to_individuals, :col_a_refunds_to_party_committees, :col_a_refunds_to_other_committees, :col_a_total_refunds, :col_a_other_disbursements, :col_a_total_disbursements, :col_a_cash_beginning_reporting_period, :
|
|
53
|
+
'^8.1|8.0|7.0|6.4' => [:form_type, :filer_committee_id_number, :committee_name, :change_of_address, :street_1, :street_2, :city, :state, :zip_code, :election_state, :election_district, :report_code, :election_code, :election_date, :state_of_election, :coverage_from_date, :coverage_through_date, :treasurer_last_name, :treasurer_first_name, :treasurer_middle_name, :treasurer_prefix, :treasurer_suffix, :date_signed, :col_a_total_contributions_no_loans, :col_a_total_contributions_refunds, :col_a_net_contributions, :col_a_total_operating_expenditures, :col_a_total_offset_to_operating_expenditures, :col_a_net_operating_expenditures, :col_a_cash_on_hand_close_of_period, :col_a_debts_to, :col_a_debts_by, :col_a_individual_contributions_itemized, :col_a_individual_contributions_unitemized, :col_a_total_individual_contributions, :col_a_political_party_contributions, :col_a_pac_contributions, :col_a_candidate_contributions, :col_a_total_contributions, :col_a_transfers_from_authorized, :col_a_candidate_loans, :col_a_other_loans, :col_a_total_loans, :col_a_offset_to_operating_expenditures, :col_a_other_receipts, :col_a_total_receipts, :col_a_operating_expenditures, :col_a_transfers_to_authorized, :col_a_candidate_loan_repayments, :col_a_other_loan_repayments, :col_a_total_loan_repayments, :col_a_refunds_to_individuals, :col_a_refunds_to_party_committees, :col_a_refunds_to_other_committees, :col_a_total_refunds, :col_a_other_disbursements, :col_a_total_disbursements, :col_a_cash_beginning_reporting_period, :col_a_total_receipts_period, :col_a_subtotals, :col_a_total_disbursements_period, :col_a_cash_on_hand_close, :col_b_total_contributions_no_loans, :col_b_total_contributions_refunds, :col_b_net_contributions, :col_b_total_operating_expenditures, :col_b_total_offset_to_operating_expenditures, :col_b_net_operating_expenditures, :col_b_individual_contributions_itemized, :col_b_individual_contributions_unitemized, :col_b_total_individual_contributions, :col_b_political_party_contributions, :col_b_pac_contributions, :col_b_candidate_contributions, :col_b_total_contributions, :col_b_transfers_from_authorized, :col_b_candidate_loans, :col_b_other_loans, :col_b_total_loans, :col_b_offset_to_operating_expenditures, :col_b_other_receipts, :col_b_total_receipts, :col_b_operating_expenditures, :col_b_transfers_to_authorized, :col_b_candidate_loan_repayments, :col_b_other_loan_repayments, :col_b_total_loan_repayments, :col_b_refunds_to_individuals, :col_b_refunds_to_party_committees, :col_b_refunds_to_other_committees, :col_b_total_refunds, :col_b_other_disbursements, :col_b_total_disbursements],
|
|
54
|
+
'^6.3|6.2|6.1' => [:form_type, :filer_committee_id_number, :committee_name, :change_of_address, :street_1, :street_2, :city, :state, :zip_code, :election_state, :election_district, :election_date, :election_code, nil, :state_of_election, :coverage_from_date, :coverage_through_date, :treasurer_last_name, :treasurer_first_name, :treasurer_middle_name, :treasurer_prefix, :treasurer_suffix, :date_signed, :candidate_id_number, :candidate_last_name, :candidate_first_name, :candidate_middle_name, :candidate_prefix, :candidate_suffix, :report_type, :col_a_total_contributions_no_loans, :col_a_total_contributions_refunds, :col_a_net_contributions, :col_a_total_operating_expenditures, :col_a_total_offset_to_operating_expenditures, :col_a_net_operating_expenditures, :col_a_cash_on_hand_close_of_period, :col_a_debts_to, :col_a_debts_by, :col_a_individual_contributions_itemized, :col_a_individual_contributions_unitemized, :col_a_total_individual_contributions, :col_a_political_party_contributions, :col_a_pac_contributions, :col_a_candidate_contributions, :col_a_total_contributions, :col_a_transfers_from_authorized, :col_a_candidate_loans, :col_a_other_loans, :col_a_total_loans, :col_a_offset_to_operating_expenditures, :col_a_other_receipts, :col_a_total_receipts, :col_a_operating_expenditures, :col_a_transfers_to_authorized, :col_a_candidate_loan_repayments, nil, :col_a_total_loan_repayments, :col_a_refunds_to_individuals, :col_a_refunds_to_party_committees, :col_a_refunds_to_other_committees, :col_a_total_refunds, :col_a_other_disbursements, :col_a_total_disbursements, :col_a_cash_beginning_reporting_period, :col_a_total_receipts_period, :col_a_subtotals, :col_a_total_disbursements_period, :col_a_cash_on_hand_close, :col_b_total_contributions_no_loans, :col_b_total_contributions_refunds, :col_b_net_contributions, :col_b_total_operating_expenditures, :col_b_total_offset_to_operating_expenditures, :col_b_net_operating_expenditures, :col_b_individual_contributions_itemized, :col_b_individual_contributions_unitemized, :col_b_total_individual_contributions, :col_b_political_party_contributions, :col_b_pac_contributions, :col_b_candidate_contributions, :col_b_total_contributions, :col_b_transfers_from_authorized, :col_b_candidate_loans, :col_b_other_loans, :col_b_total_loans, :col_b_offset_to_operating_expenditures, :col_b_other_receipts, :col_b_total_receipts, :col_b_operating_expenditures, :col_b_transfers_to_authorized, :col_b_candidate_loan_repayments, nil, :col_b_total_loan_repayments, :col_b_refunds_to_individuals, nil, nil, :col_b_total_refunds, :col_b_other_disbursements, :col_b_total_disbursements, :col_b_gross_receipts_authorized_primary, :col_b_aggregate_personal_funds_primary, :col_b_gross_receipts_minus_personal_funds_primary, :col_b_gross_receipts_authorized_general, :col_b_aggregate_personal_funds_general, :col_b_gross_receipts_minus_personal_funds_general],
|
|
55
|
+
'^5.3|5.2|5.1|5.0' => [:form_type, :filer_committee_id_number, :committee_name, :street_1, :street_2, :city, :state, :zip_code, :change_of_address, :election_state, :election_district, :report_code, :election_code, :election_date, :state_of_election, :primary_election, :general_election, :special_election, :runoff_election, :coverage_from_date, :coverage_through_date, :col_a_total_contributions_no_loans, :col_a_total_contributions_refunds, :col_a_net_contributions, :col_a_total_operating_expenditures, :col_a_total_offset_to_operating_expenditures, :col_a_net_operating_expenditures, :col_a_cash_on_hand_close_of_period, :col_a_debts_to, :col_a_debts_by, :col_a_individual_contributions_itemized, :col_a_individual_contributions_unitemized, :col_a_total_individual_contributions, :col_a_political_party_contributions, :col_a_pac_contributions, :col_a_candidate_contributions, :col_a_total_contributions, :col_a_transfers_from_authorized, :col_a_candidate_loans, :col_a_other_loans, :col_a_total_loans, :col_a_offset_to_operating_expenditures, :col_a_other_receipts, :col_a_total_receipts, :col_a_operating_expenditures, :col_a_transfers_to_authorized, :col_a_candidate_loan_repayments, nil, :col_a_total_loan_repayments, :col_a_refunds_to_individuals, :col_a_refunds_to_party_committees, :col_a_refunds_to_other_committees, :col_a_total_refunds, :col_a_other_disbursements, :col_a_total_disbursements, :col_a_cash_beginning_reporting_period, :col_a_total_receipts_period, :col_a_subtotals, :col_a_total_disbursements_period, :col_a_cash_on_hand_close, :col_b_total_contributions_no_loans, :col_b_total_contributions_refunds, :col_b_net_contributions, :col_b_total_operating_expenditures, :col_b_total_offset_to_operating_expenditures, :col_b_net_operating_expenditures, :col_b_individual_contributions_itemized, :col_b_individual_contributions_unitemized, :col_b_total_individual_contributions, :col_b_political_party_contributions, :col_b_pac_contributions, :col_b_candidate_contributions, :col_b_total_contributions, :col_b_transfers_from_authorized, :col_b_candidate_loans, :col_b_other_loans, :col_b_total_loans, :col_b_offset_to_operating_expenditures, :col_b_other_receipts, :col_b_total_receipts, :col_b_operating_expenditures, :col_b_transfers_to_authorized, :col_b_candidate_loan_repayments, nil, :col_b_total_loan_repayments, :col_b_refunds_to_individuals, nil, nil, :col_b_total_refunds, :col_b_other_disbursements, :col_b_total_disbursements, :treasurer_name, :date_signed, :candidate_id_number, :candidate_name, :report_type, :col_b_gross_receipts_authorized_primary, :col_b_aggregate_personal_funds_primary, :col_b_gross_receipts_minus_personal_funds_primary, :col_b_gross_receipts_authorized_general, :col_b_aggregate_personal_funds_general, :col_b_gross_receipts_minus_personal_funds_general],
|
|
56
|
+
'^3.0' => [:form_type, :filer_committee_id_number, :committee_name, :street_1, :street_2, :city, :state, :zip_code, :change_of_address, :election_state, :election_district, :report_code, :election_code, :election_date, :state_of_election, :primary_election, :general_election, :special_election, :runoff_election, :coverage_from_date, :coverage_through_date, :col_a_total_contributions_no_loans, :col_a_total_contributions_refunds, :col_a_net_contributions, :col_a_total_operating_expenditures, :col_a_total_offset_to_operating_expenditures, :col_a_net_operating_expenditures, :col_a_cash_on_hand_close_of_period, :col_a_debts_to, :col_a_debts_by, :col_a_individual_contributions_itemized, :col_a_individual_contributions_unitemized, :col_a_total_individual_contributions, :col_a_political_party_contributions, :col_a_pac_contributions, :col_a_candidate_contributions, :col_a_total_contributions, :col_a_transfers_from_authorized, :col_a_candidate_loans, :col_a_other_loans, :col_a_total_loans, :col_a_offset_to_operating_expenditures, :col_a_other_receipts, :col_a_total_receipts, :col_a_operating_expenditures, :col_a_transfers_to_authorized, :col_a_candidate_loan_repayments, :col_a_other_loan_repayments, :col_a_total_loan_repayments, :col_a_refunds_to_individuals, :col_a_refunds_to_party_committees, :col_a_refunds_to_other_committees, :col_a_total_refunds, :col_a_other_disbursements, :col_a_total_disbursements, :col_a_cash_beginning_reporting_period, :col_a_total_receipts_period, :col_a_subtotals, :col_a_total_disbursements_period, :col_a_cash_on_hand_close, :col_b_total_contributions_no_loans, :col_b_total_contributions_refunds, :col_b_net_contributions, :col_b_total_operating_expenditures, :col_b_total_offset_to_operating_expenditures, :col_b_net_operating_expenditures, :col_b_individual_contributions_itemized, :col_b_individual_contributions_unitemized, :col_b_total_individual_contributions, :col_b_political_party_contributions, :col_b_pac_contributions, :col_b_candidate_contributions, :col_b_total_contributions, :col_b_transfers_from_authorized, :col_b_candidate_loans, :col_b_other_loans, :col_b_total_loans, :col_b_offset_to_operating_expenditures, :col_b_other_receipts, :col_b_total_receipts, :col_b_operating_expenditures, :col_b_transfers_to_authorized, :col_b_candidate_loan_repayments, :col_b_other_loan_repayments, :col_b_total_loan_repayments, :col_b_refunds_to_individuals, :col_b_refunds_to_party_committees, :col_b_refunds_to_other_committees, :col_b_total_refunds, :col_b_other_disbursements, :col_b_total_disbursements, :treasurer_name, :date_signed],
|
|
57
57
|
},
|
|
58
58
|
"^f3l[a|n]" => {
|
|
59
59
|
'^8.1|8.0|7.0|6.4' => [:form_type, :filer_committee_id_number, :committee_name, :change_of_address, :street_1, :street_2, :city, :state, :zip_code, :election_state, :election_district, :report_code, :election_date, nil, :semi_annual_period, :coverage_from_date, :coverage_through_date, :semi_annual_period_jan_june, :semi_annual_period_jul_dec, :quarterly_monthly_bundled_contributions, :semi_annual_bundled_contributions, :treasurer_last_name, :treasurer_first_name, :treasurer_middle_name, :treasurer_prefix, :treasurer_suffix, :date_signed],
|
|
@@ -83,6 +83,9 @@ module Fech
|
|
|
83
83
|
'^5.3|5.2|5.1|5.0' => [:form_type, :filer_committee_id_number, :committee_name, :street_1, :street_2, :city, :state, :zip_code, :change_of_address, :qualified_committee, :report_code, :election_code, :date_of_election, :state_of_election, :coverage_from_date, :coverage_through_date, :col_a_cash_on_hand_beginning_period, :col_a_total_receipts, :col_b_cash_on_hand_jan_1, :col_a_total_disbursements, :col_a_cash_on_hand_close_of_period, :col_a_debts_to, :col_a_debts_by, :col_a_individuals_itemized, :col_a_individuals_unitemized, :col_a_individual_contribution_total, :col_a_political_party_committees, :col_a_other_political_committees_pacs, :col_a_total_contributions, :col_a_transfers_from_aff_other_party_cmttees, :col_a_total_loans, :col_a_total_loan_repayments_received, :col_a_offsets_to_expenditures, :col_a_total_contributions_refunds, :col_a_other_federal_receipts, :col_a_transfers_from_nonfederal_h3, :col_a_total_receipts, :col_a_total_federal_receipts, :col_a_shared_operating_expenditures_federal, :col_a_shared_operating_expenditures_nonfederal, :col_a_other_federal_operating_expenditures, :col_a_total_operating_expenditures, :col_a_transfers_to_affiliated, :col_a_contributions_to_candidates, :col_a_independent_expenditures, :col_a_coordinated_expenditures_by_party_committees, :col_a_total_loan_repayments_made, :col_a_loans_made, :col_a_refunds_to_individuals, :col_a_refunds_to_party_committees, :col_a_refunds_to_other_committees, :col_a_total_refunds, :col_a_other_disbursements, :col_a_total_disbursements, :col_a_total_federal_disbursements, :col_a_total_contributions, :col_a_total_contributions_refunds, :col_a_net_contributions, :col_a_total_federal_operating_expenditures, :col_a_total_offsets_to_expenditures, :col_a_net_operating_expenditures, nil, :col_b_year, :col_b_total_receipts, :col_b_subtotal, :col_b_total_disbursements, :col_b_cash_on_hand_close_of_period, :col_b_individuals_itemized, :col_b_individuals_unitemized, :col_b_individual_contribution_total, :col_b_political_party_committees, :col_b_other_political_committees_pacs, :col_b_total_contributions, :col_b_transfers_from_aff_other_party_cmttees, :col_b_total_loans, :col_b_total_loan_repayments_received, :col_b_offsets_to_expenditures, :col_b_total_contributions_refunds, :col_b_other_federal_receipts, :col_b_transfers_from_nonfederal_h3, :col_b_total_receipts, :col_b_total_federal_receipts, :col_b_shared_operating_expenditures_federal, :col_b_shared_operating_expenditures_nonfederal, :col_b_other_federal_operating_expenditures, :col_b_total_operating_expenditures, :col_b_transfers_to_affiliated, :col_b_contributions_to_candidates, :col_b_independent_expenditures, :col_b_coordinated_expenditures_by_party_committees, :col_b_total_loan_repayments_made, :col_b_loans_made, :col_b_refunds_to_individuals, :col_b_refunds_to_party_committees, :col_b_refunds_to_other_committees, :col_b_total_refunds, :col_b_other_disbursements, :col_b_total_disbursements, :col_b_total_federal_disbursements, :col_b_total_contributions, :col_b_total_contributions_refunds, :col_b_net_contributions, :col_b_total_federal_operating_expenditures, :col_b_total_offsets_to_expenditures, :col_b_net_operating_expenditures, :treasurer_name, :date_signed, :col_a_levin_funds, :col_a_total_nonfederal_transfers, :col_a_federal_election_activity_federal_share, :col_a_federal_election_activity_levin_share, :col_a_federal_election_activity_all_federal, :col_a_federal_election_activity_total, :col_b_levin_funds, :col_b_total_nonfederal_transfers, :col_b_federal_election_activity_federal_share, :col_b_federal_election_activity_levin_share, :col_b_federal_election_activity_all_federal, :col_b_federal_election_activity_total],
|
|
84
84
|
'^3' => [:form_type, :filer_committee_id_number, :committee_name, :street_1, :street_2, :col_b_cash_on_hand_jan_1, :state, :zip_code, :change_of_address, :qualified_committee, :report_code, :election_code, :date_of_election, :state_of_election, :coverage_from_date, :coverage_through_date, :col_a_cash_on_hand_beginning_period, :col_a_total_receipts, :col_a_subtotal, :col_a_total_disbursements, :col_a_cash_on_hand_close_of_period, :col_a_debts_to, :col_a_debts_by, :col_a_individuals_itemized, :col_a_individuals_unitemized, :col_a_individual_contribution_total, :col_a_political_party_committees, :col_a_other_political_committees_pacs, :col_a_total_contributions, :col_a_transfers_from_aff_other_party_cmttees, :col_a_total_loans, :col_a_total_loan_repayments_received, :col_a_offsets_to_expenditures, :col_a_total_contributions_refunds, :col_a_other_federal_receipts, :col_a_transfers_from_nonfederal_h3, :col_a_total_receipts, :col_a_total_federal_receipts, :col_a_shared_operating_expenditures_federal, :col_a_shared_operating_expenditures_nonfederal, :col_a_other_federal_operating_expenditures, :col_a_total_operating_expenditures, :col_a_transfers_to_affiliated, :col_a_contributions_to_candidates, :col_a_independent_expenditures, :col_a_coordinated_expenditures_by_party_committees, :col_a_total_loan_repayments_made, :col_a_loans_made, :col_a_refunds_to_individuals, :col_a_refunds_to_party_committees, :col_a_refunds_to_other_committees, :col_a_total_refunds, :col_a_other_disbursements, :col_a_total_disbursements, :col_a_total_federal_disbursements, :col_a_total_contributions, :col_a_total_contributions_refunds, :col_a_net_contributions, :col_a_total_federal_operating_expenditures, :col_a_total_offsets_to_expenditures, :col_a_net_operating_expenditures, nil, :col_b_year, :col_b_total_receipts, :col_b_subtotal, :col_b_total_disbursements, :col_b_cash_on_hand_close_of_period, :col_b_individuals_itemized, :col_b_individuals_unitemized, :col_b_individual_contribution_total, :col_b_political_party_committees, :col_b_other_political_committees_pacs, :col_b_total_contributions, :col_b_transfers_from_aff_other_party_cmttees, :col_b_total_loans, :col_b_total_loan_repayments_received, :col_b_offsets_to_expenditures, :col_b_total_contributions_refunds, :col_b_other_federal_receipts, :col_b_transfers_from_nonfederal_h3, :col_b_total_receipts, :col_b_total_federal_receipts, :col_b_shared_operating_expenditures_federal, :col_b_shared_operating_expenditures_nonfederal, :col_b_other_federal_operating_expenditures, :col_b_total_operating_expenditures, :col_b_transfers_to_affiliated, :col_b_contributions_to_candidates, :col_b_independent_expenditures, :col_b_coordinated_expenditures_by_party_committees, :col_b_total_loan_repayments_made, :col_b_loans_made, :col_b_refunds_to_individuals, :col_b_refunds_to_party_committees, :col_b_refunds_to_other_committees, :col_b_total_refunds, :col_b_other_disbursements, :col_b_total_disbursements, :col_b_total_federal_disbursements, :col_b_total_contributions, :col_b_total_contributions_refunds, :col_b_net_contributions, :col_b_total_federal_operating_expenditures, :col_b_total_offsets_to_expenditures, :col_b_net_operating_expenditures, :treasurer_name, :date_signed],
|
|
85
85
|
},
|
|
86
|
+
"^f3z[t]" => {
|
|
87
|
+
'^8.1|8.0|7.0|6.4' => [:form_type, :filer_committee_id_number, :principal_committee_name, :coverage_from_date, :coverage_through_date, :authorized_committee_id_number, :authorized_committee_name, :col_a_individual_contributions_itemized, :col_a_political_party_contributions, :col_a_pac_contributions, :col_a_candidate_contributions, :col_a_total_contributions, :col_a_transfers_from_authorized, :col_a_candidate_loans, :col_a_other_loans, :col_a_total_loans, :col_a_offset_to_operating_expenditures, :col_a_other_receipts, :col_a_total_receipts, :col_a_operating_expenditures, :col_a_transfers_to_authorized, :col_a_candidate_loan_repayments, :col_a_other_loan_repayments, :col_a_total_loan_repayments, :col_a_refunds_to_individuals, :col_a_refunds_to_party_committees, :col_a_refunds_to_other_committees, :col_a_total_refunds, :col_a_other_disbursements, :col_a_total_disbursements, :col_a_cash_beginning_reporting_period, :col_a_cash_on_hand_close, :col_a_debts_to, :col_a_debts_by, :col_a_net_contributions, :col_a_net_operating_expenditures],
|
|
88
|
+
},
|
|
86
89
|
"^f4[na]" => {
|
|
87
90
|
'^8.1|8.0|7.0|6.4|6.3|6.2|6.1' => [:form_type, :filer_committee_id_number, :committee_name, :street_1, :street_2, :city, :state, :zip_code, :committee_type, :committee_type_description, :report_code, :coverage_from_date, :coverage_through_date, :treasurer_last_name, :treasurer_first_name, :treasurer_middle_name, :treasurer_prefix, :treasurer_suffix, :date_signed, :col_a_cash_on_hand_beginning_reporting_period, :col_a_total_receipts, :col_a_subtotal, :col_a_total_disbursements, :col_a_cash_on_hand_close_of_period, :col_a_debts_to, :col_a_debts_by, :col_a_convention_expenditures, :col_a_convention_refunds, :col_a_expenditures_subject_to_limits, :col_a_prior_expenditures_subject_to_limits, :col_a_federal_funds, :col_a_contributions_itemized, :col_a_contributions_unitemized, :col_a_contributions_subtotal, :col_b_transfers_from_affiliated, :col_a_loans_received, :col_a_loan_repayments_received, :col_a_loan_receipts_subtotal, :col_a_convention_refunds_itemized, :col_a_convention_refunds_unitemized, :col_a_convention_refunds_subtotal, :col_a_other_refunds_itemized, :col_a_other_refunds_unitemized, :col_a_other_refunds_subtotal, :col_a_other_income_itemized, :col_a_other_income_unitemized, :col_a_other_income_subtotal, :col_a_total_receipts, :col_a_convention_expenses_itemized, :col_a_convention_expenses_unitemized, :col_a_convention_expenses_subtotal, :col_a_transfers_to_affiliated, :col_a_loans_made, :col_a_loan_repayments_made, :col_a_loan_disbursements_subtotal, :col_a_other_disbursements_itemized, :col_a_other_disbursements_unitemized, :col_a_other_disbursements_subtotal, :col_a_total_disbursements, :col_b_cash_on_hand_beginning_year, :col_b_beginning_year, :col_b_total_receipts, :col_b_subtotal, :col_b_total_disbursements, :col_b_cash_on_hand_close_of_period, :col_b_convention_expenditures, :col_b_convention_refunds, :col_b_expenditures_subject_to_limits, :col_b_prior_expendiutres_subject_to_limits, :col_b_total_expenditures_subject_to_limits, :col_b_federal_funds, :col_b_contributions_subtotal, :col_b_transfers_from_affiliated, :col_b_loan_receipts_subtotal, :col_b_convention_refunds_subtotal, :col_b_other_refunds_subtotal, :col_b_other_income_subtotal, :col_b_total_receipts, :col_b_convention_expenses_subtotal, :col_b_transfers_to_affiliated, :col_b_loan_disbursements_subtotal, :col_b_other_disbursements_subtotal, :col_b_total_disbursements],
|
|
88
91
|
'^5.3|5.2|5.1|5.0|3' => [:form_type, :filer_committee_id_number, :committee_name, :street_1, :street_2, :city, :state, :zip_code, :committee_type, :committee_type_description, :report_code, :coverage_from_date, :coverage_through_date, :col_a_cash_on_hand_beginning_reporting_period, :col_a_total_receipts, :col_a_subtotal, :col_a_total_disbursements, :col_a_cash_on_hand_close_of_period, :col_a_debts_to, :col_a_debts_by, :col_a_convention_expenditures, :col_a_convention_refunds, :col_a_expenditures_subject_to_limits, :col_a_prior_expenditures_subject_to_limits, :col_a_total_expenditures_subject_to_limits, :col_a_federal_funds, :col_a_contributions_itemized, :col_a_contributions_unitemized, :col_a_contributions_subtotal, :col_b_transfers_from_affiliated, :col_a_loans_received, :col_a_loan_repayments_received, :col_a_loan_receipts_subtotal, :col_a_convention_refunds_itemized, :col_a_convention_refunds_unitemized, :col_a_convention_refunds_subtotal, :col_a_other_refunds_itemized, :col_a_other_refunds_unitemized, :col_a_other_refunds_subtotal, :col_a_other_income_itemized, :col_a_other_income_unitemized, :col_a_other_income_subtotal, :col_a_total_receipts, :col_a_convention_expenses_itemized, :col_a_convention_expenses_unitemized, :col_a_convention_expenses_subtotal, :col_a_transfers_to_affiliated, :col_a_loans_made, :col_a_loan_repayments_made, :col_a_loan_disbursements_subtotal, :col_a_other_disbursements_itemized, :col_a_other_disbursements_unitemized, :col_a_other_disbursements_subtotal, :col_a_total_disbursements, :col_b_cash_on_hand_beginning_year, :col_b_beginning_year, :col_b_total_receipts, :col_b_subtotal, :col_b_total_disbursements, :col_b_cash_on_hand_close_of_period, :col_b_convention_expenditures, :col_b_convention_refunds, :col_b_expenditures_subject_to_limits, :col_b_prior_expendiutres_subject_to_limits, :col_b_total_expenditures_subject_to_limits, :col_b_federal_funds, :col_b_contributions_subtotal, :col_b_transfers_from_affiliated, :col_b_loan_receipts_subtotal, :col_b_convention_refunds_subtotal, :col_b_other_refunds_subtotal, :col_b_other_income_subtotal, :col_b_total_receipts, :col_b_convention_expenses_subtotal, :col_b_transfers_to_affiliated, :col_b_loan_disbursements_subtotal, :col_b_other_disbursements_subtotal, :col_b_total_disbursements, :treasurer_name, :date_signed],
|
|
@@ -195,6 +198,10 @@ module Fech
|
|
|
195
198
|
'^5.0' => [:form_type, :filer_committee_id_number, :entity_type, :contributor_name, :contributor_street_1, :contributor_street_2, :contributor_city, :contributor_state, :contributor_zip_code, :election_code, :election_other_description, :contributor_employer, :contributor_occupation, :contribution_aggregate, :contribution_date, :contribution_amount, :contribution_purpose_code, :contribution_purpose_descrip, :donor_committee_fec_id, :donor_candidate_fec_id, :donor_candidate_name, :donor_candidate_office, :donor_candidate_state, :donor_candidate_district, :conduit_name, :conduit_street1, :conduit_street2, :conduit_city, :conduit_state, :conduit_zip_code, :memo_code, :memo_text_description, nil, :transaction_id, :back_reference_tran_id_number, :back_reference_sched_name, :reference_code, :increased_limit_code],
|
|
196
199
|
'^3' => [:form_type, :filer_committee_id_number, :entity_type, :contributor_name, :contributor_street_1, :contributor_street_2, :contributor_city, :contributor_state, :contributor_zip_code, :election_code, :election_other_description, :contributor_employer, :contributor_occupation, :contribution_aggregate, :contribution_date, :contribution_amount, :contribution_purpose_code, :contribution_purpose_descrip, :donor_committee_fec_id, :donor_candidate_fec_id, :donor_candidate_name, :donor_candidate_office, :donor_candidate_state, :donor_candidate_district, :conduit_name, :conduit_street1, :conduit_street2, :conduit_city, :conduit_state, :conduit_zip_code, :memo_code, :memo_text_description, nil, :transaction_id, :back_reference_tran_id_number, :back_reference_sched_name, :reference_code],
|
|
197
200
|
},
|
|
201
|
+
"^sa3l" => {
|
|
202
|
+
'^8.1|8.0' => [:form_type, :filer_committee_id_number, :transaction_id, :back_reference_tran_id_number, :back_reference_sched_name, :entity_type, :lobbyist_registrant_organization_name, :lobbyist_registrant_last_name, :lobbyist_registrant_first_name, :lobbyist_registrant_middle_name, :lobbyist_registrant_prefix, :lobbyist_registrant_suffix, :lobbyist_registrant_street_1, :lobbyist_registrant_street_2, :lobbyist_registrant_city, :lobbyist_registrant_state, :lobbyist_registrant_zip_code, :election_code, :election_other_description, :contribution_date, :bundled_amount_period, :bundled_amount_semi_annual, :contribution_purpose_descrip, :lobbyist_registrant_employer, :lobbyist_registrant_occupation, :donor_committee_fec_id, :donor_committee_name, :donor_candidate_fec_id, :donor_candidate_last_name, :donor_candidate_first_name, :donor_candidate_middle_name, :donor_candidate_prefix, :donor_candidate_suffix, :donor_candidate_office, :donor_candidate_state, :donor_candidate_district, :conduit_name, :conduit_street1, :conduit_street2, :conduit_city, :conduit_state, :conduit_zip_code, :associated_text_record, :memo_text, :reference_code],
|
|
203
|
+
'^7.0|6.4' => [:form_type, :filer_committee_id_number, :transaction_id, :back_reference_tran_id_number, :back_reference_sched_name, :entity_type, :lobbyist_registrant_organization_name, :lobbyist_registrant_last_name, :lobbyist_registrant_first_name, :lobbyist_registrant_middle_name, :lobbyist_registrant_prefix, :lobbyist_registrant_suffix, :lobbyist_registrant_street_1, :lobbyist_registrant_street_2, :lobbyist_registrant_city, :lobbyist_registrant_state, :lobbyist_registrant_zip_code, :election_code, :election_other_description, :contribution_date, :bundled_amount_period, :bundled_amount_semi_annual, :contribution_purpose_code, :contribution_purpose_descrip, :lobbyist_registrant_employer, :lobbyist_registrant_occupation, :donor_committee_fec_id, :donor_committee_name, :donor_candidate_fec_id, :donor_candidate_last_name, :donor_candidate_first_name, :donor_candidate_middle_name, :donor_candidate_prefix, :donor_candidate_suffix, :donor_candidate_office, :donor_candidate_state, :donor_candidate_district, :conduit_name, :conduit_street1, :conduit_street2, :conduit_city, :conduit_state, :conduit_zip_code, :associated_text_record, :memo_text, :reference_code],
|
|
204
|
+
},
|
|
198
205
|
"^sb" => {
|
|
199
206
|
'^8.1|8.0' => [:form_type, :filer_committee_id_number, :transaction_id_number, :back_reference_tran_id_number, :back_reference_sched_name, :entity_type, :payee_organization_name, :payee_last_name, :payee_first_name, :payee_middle_name, :payee_prefix, :payee_suffix, :payee_street_1, :payee_street_2, :payee_city, :payee_state, :payee_zip_code, :election_code, :election_other_description, :expenditure_date, :expenditure_amount, :semi_annual_refunded_bundled_amt, :expenditure_purpose_descrip, :category_code, :beneficiary_committee_fec_id, :beneficiary_committee_name, :beneficiary_candidate_fec_id, :beneficiary_candidate_last_name, :beneficiary_candidate_first_name, :beneficiary_candidate_middle_name, :beneficiary_candidate_prefix, :beneficiary_candidate_suffix, :beneficiary_candidate_office, :beneficiary_candidate_state, :beneficiary_candidate_district, :conduit_name, :conduit_street_1, :conduit_street_2, :conduit_city, :conduit_state, :conduit_zip_code, :memo_code, :memo_text_description, :reference_to_si_or_sl_system_code_that_identifies_the_account],
|
|
200
207
|
'^7.0|6.4' => [:form_type, :filer_committee_id_number, :transaction_id_number, :back_reference_tran_id_number, :back_reference_sched_name, :entity_type, :payee_organization_name, :payee_last_name, :payee_first_name, :payee_middle_name, :payee_prefix, :payee_suffix, :payee_street_1, :payee_street_2, :payee_city, :payee_state, :payee_zip_code, :election_code, :election_other_description, :expenditure_date, :expenditure_amount, :semi_annual_refunded_bundled_amt, :expenditure_purpose_code, :expenditure_purpose_descrip, :category_code, :beneficiary_committee_fec_id, :beneficiary_committee_name, :beneficiary_candidate_fec_id, :beneficiary_candidate_last_name, :beneficiary_candidate_first_name, :beneficiary_candidate_middle_name, :beneficiary_candidate_prefix, :beneficiary_candidate_suffix, :beneficiary_candidate_office, :beneficiary_candidate_state, :beneficiary_candidate_district, :conduit_name, :conduit_street_1, :conduit_street_2, :conduit_city, :conduit_state, :conduit_zip_code, :memo_code, :memo_text_description, :reference_to_si_or_sl_system_code_that_identifies_the_account],
|
data/lib/fech/version.rb
CHANGED
data/sources/F3.csv
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
canonical,^8.1|8.0|7.0|6.4,,^6.3|6.2|6.1,,^5.3|5.2|5.1|5.0,,^3.0,
|
|
1
|
+
canonical,^8.1|8.0|7.0|6.4,,^6.3|6.2|6.1,,^5.3|5.2|5.1|5.0,,^3.0,
|
data/sources/F3Z.csv
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
canonical,^8.1|8.0|7.0|6.4,
|
data/sources/SchA3L.csv
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
canonical,^8.1|8.0,,^7.0|6.4,
|
data/spec/filing_spec.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Fech::Filing do
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
before do
|
|
6
6
|
@filing = Fech::Filing.new(723604)
|
|
7
7
|
@filing.stubs(:file_path).returns(File.join(File.dirname(__FILE__), 'data', '723604.fec'))
|
|
@@ -28,9 +28,9 @@ describe Fech::Filing do
|
|
|
28
28
|
@filing_f99 = Fech::Filing.new(862554)
|
|
29
29
|
@filing_f99.stubs(:file_path).returns(File.join(File.dirname(__FILE__), 'data', '862554.fec'))
|
|
30
30
|
end
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
describe "#filing_version" do
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
it "should return the correct filing version" do
|
|
35
35
|
@filing.send(:filing_version).should == "7.0"
|
|
36
36
|
@filing8.send(:filing_version).should == "8.0"
|
|
@@ -39,28 +39,28 @@ describe Fech::Filing do
|
|
|
39
39
|
@filing_f3.send(:filing_version).should == "5.00"
|
|
40
40
|
@filing_special_character.send(:filing_version).should == "8.0"
|
|
41
41
|
end
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
it "should parse the file only once" do
|
|
44
44
|
@filing.expects(:parse_filing_version).once.returns("7.0")
|
|
45
45
|
@filing.send(:filing_version)
|
|
46
46
|
@filing.send(:filing_version)
|
|
47
47
|
end
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
end
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
describe ".hash_zip" do
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
it "should zip the given keys and values into a hash" do
|
|
54
54
|
@filing = Fech::Filing.new(723604)
|
|
55
55
|
keys = [:one,:three,:two]
|
|
56
56
|
values = [1, 3, 2]
|
|
57
57
|
@filing.hash_zip(keys, values).should == {:one => 1, :two => 2, :three => 3}
|
|
58
58
|
end
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
end
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
describe "#summary" do
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
it "should return the mapped summary row" do
|
|
65
65
|
sum = @filing.summary
|
|
66
66
|
sum.should be_a_kind_of(Hash)
|
|
@@ -78,37 +78,37 @@ describe Fech::Filing do
|
|
|
78
78
|
sum_f1m = @filing_f1m.summary
|
|
79
79
|
sum_f1m[:form_type].should == "F1MA"
|
|
80
80
|
sum_f7 = @filing_f7.summary
|
|
81
|
-
sum_f7[:form_type].should == 'F7N'
|
|
81
|
+
sum_f7[:form_type].should == 'F7N'
|
|
82
82
|
sum_f13 = @filing_f13.summary
|
|
83
83
|
sum_f13[:form_type].should == 'F13N'
|
|
84
84
|
sum_filing_special_character = @filing_special_character.summary
|
|
85
85
|
sum_filing_special_character[:form_type].should == "F3XN"
|
|
86
86
|
end
|
|
87
87
|
end
|
|
88
|
-
|
|
88
|
+
|
|
89
89
|
describe "#mappings" do
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
it "should create a new Mappings instance with correct version" do
|
|
92
92
|
@filing.send(:mappings).version.should == "7.0"
|
|
93
93
|
end
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
it "should memoize itself" do
|
|
96
96
|
mapping = Fech::Mappings.new
|
|
97
97
|
Fech::Mappings.expects(:new).once.returns(mapping)
|
|
98
98
|
@filing.send(:mappings)
|
|
99
99
|
@filing.send(:mappings)
|
|
100
100
|
end
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
end
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
describe 'miscelleanous filings' do
|
|
105
105
|
it "should handle invalid encoding" do
|
|
106
|
-
@filing_f99.rows_like(/f99/).first.
|
|
106
|
+
expect{@filing_f99.rows_like(/f99/).first}.to_not raise_error
|
|
107
107
|
end
|
|
108
108
|
end
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
describe "#rows_like" do
|
|
111
|
-
|
|
111
|
+
|
|
112
112
|
it "should return only rows matching the specified regex" do
|
|
113
113
|
@filing.rows_like(/^sa/).size.should == 1
|
|
114
114
|
@filing.rows_like(/^s/).size.should == 2
|
|
@@ -122,60 +122,60 @@ describe Fech::Filing do
|
|
|
122
122
|
@filing_f7.rows_like(/^f76/).size.should == 2
|
|
123
123
|
@filing_special_character.rows_like(/^sa/).size.should == 13
|
|
124
124
|
end
|
|
125
|
-
|
|
125
|
+
|
|
126
126
|
it "should return an array if no block is given" do
|
|
127
127
|
@filing.rows_like(/^s/).class.should == Array
|
|
128
128
|
end
|
|
129
|
-
|
|
129
|
+
|
|
130
130
|
it "should return empty array if no matches found" do
|
|
131
131
|
@filing.rows_like(/^sc/).should == []
|
|
132
132
|
end
|
|
133
|
-
|
|
133
|
+
|
|
134
134
|
it "should yield hashes of row values if passed a block" do
|
|
135
135
|
@filing.rows_like(/^sa/) do |c|
|
|
136
136
|
c.should be_a_kind_of(Hash)
|
|
137
137
|
end
|
|
138
138
|
end
|
|
139
|
-
|
|
139
|
+
|
|
140
140
|
it "should allow case-insensitive string input" do
|
|
141
141
|
@filing.rows_like("Sa17a").size.should be > 0
|
|
142
142
|
end
|
|
143
|
-
|
|
143
|
+
|
|
144
144
|
end
|
|
145
|
-
|
|
145
|
+
|
|
146
146
|
describe "#parse_row?" do
|
|
147
|
-
|
|
147
|
+
|
|
148
148
|
before do
|
|
149
149
|
f = open(@filing.file_path, 'r')
|
|
150
150
|
f.readline
|
|
151
151
|
@row = f.readline.split(@filing.delimiter)
|
|
152
152
|
f.close
|
|
153
153
|
end
|
|
154
|
-
|
|
154
|
+
|
|
155
155
|
it "should return the mapped row" do
|
|
156
156
|
@filing.send(:parse_row?, @row).should be_a_kind_of(Hash)
|
|
157
157
|
end
|
|
158
|
-
|
|
158
|
+
|
|
159
159
|
describe "when :parse_if is specified" do
|
|
160
|
-
|
|
160
|
+
|
|
161
161
|
it "should return the mapped row if :parse_if matches row type" do
|
|
162
162
|
@filing.send(:parse_row?, @row, {:parse_if => /^f3p/}).should be_a_kind_of(Hash)
|
|
163
163
|
end
|
|
164
|
-
|
|
164
|
+
|
|
165
165
|
it "should return false if row was skipped" do
|
|
166
166
|
@filing.send(:parse_row?, @row, {:parse_if => /^sa/}).should == false
|
|
167
167
|
end
|
|
168
|
-
|
|
168
|
+
|
|
169
169
|
end
|
|
170
|
-
|
|
170
|
+
|
|
171
171
|
it "should return the raw row data if :raw is true" do
|
|
172
172
|
@filing.send(:parse_row?, @row, {:raw => true}).class.should == Array
|
|
173
173
|
end
|
|
174
|
-
|
|
174
|
+
|
|
175
175
|
end
|
|
176
|
-
|
|
176
|
+
|
|
177
177
|
describe "#map_for" do
|
|
178
|
-
|
|
178
|
+
|
|
179
179
|
it "should return the correct map for given row type" do
|
|
180
180
|
map = @filing.map_for(/sa/)
|
|
181
181
|
map.class.should == Array
|
|
@@ -185,32 +185,32 @@ describe Fech::Filing do
|
|
|
185
185
|
map_pac = @filing_pac.map_for(/f3x/)
|
|
186
186
|
map_pac[15].should == :qualified_committee
|
|
187
187
|
end
|
|
188
|
-
|
|
188
|
+
|
|
189
189
|
it "should raise error if no map is found" do
|
|
190
190
|
lambda { @filing.map_for(/sz/) }.should raise_error
|
|
191
191
|
lambda { @filing_pac.map_for(/sz/) }.should raise_error
|
|
192
192
|
end
|
|
193
|
-
|
|
193
|
+
|
|
194
194
|
end
|
|
195
|
-
|
|
195
|
+
|
|
196
196
|
describe ".map_for" do
|
|
197
|
-
|
|
197
|
+
|
|
198
198
|
it "should return the correct map for given row type" do
|
|
199
199
|
map = Fech::Filing.map_for(/sa/)
|
|
200
200
|
map.class.should == Array
|
|
201
201
|
map.first.should == :form_type
|
|
202
202
|
end
|
|
203
|
-
|
|
203
|
+
|
|
204
204
|
it "should raise error if no map is found" do
|
|
205
205
|
lambda { Fech::Filing.map_for(/sz/) }.should raise_error
|
|
206
206
|
end
|
|
207
|
-
|
|
207
|
+
|
|
208
208
|
it "should allow choice of version" do
|
|
209
209
|
v7 = Fech::Filing.map_for(/sa/, :version => 7.0)
|
|
210
210
|
v6 = Fech::Filing.map_for(/sa/, :version => 6.1)
|
|
211
211
|
v6.should_not == v7
|
|
212
212
|
end
|
|
213
|
-
|
|
213
|
+
|
|
214
214
|
end
|
|
215
215
|
|
|
216
216
|
describe "#translator" do
|
|
@@ -244,9 +244,9 @@ describe Fech::Filing do
|
|
|
244
244
|
end
|
|
245
245
|
|
|
246
246
|
end
|
|
247
|
-
|
|
247
|
+
|
|
248
248
|
describe "#map" do
|
|
249
|
-
|
|
249
|
+
|
|
250
250
|
before do
|
|
251
251
|
f = open(@filing.file_path, 'r')
|
|
252
252
|
f.readline
|
|
@@ -266,23 +266,23 @@ describe Fech::Filing do
|
|
|
266
266
|
@sa11_row = f_pac.readline.split(@filing_pac.delimiter)
|
|
267
267
|
f_pac.close
|
|
268
268
|
end
|
|
269
|
-
|
|
269
|
+
|
|
270
270
|
it "should map the data in row to named values according to row_map" do
|
|
271
271
|
row_map = @filing.send(:mappings).for_row(@sa_row.first)
|
|
272
272
|
mapped = @filing.send(:map, @sa_row)
|
|
273
273
|
mapped.should be_a_kind_of(Hash)
|
|
274
|
-
|
|
274
|
+
|
|
275
275
|
mapped[:form_type].should == "SA17A"
|
|
276
276
|
mapped[:contributor_state].should == "SC"
|
|
277
277
|
|
|
278
278
|
row_map_ie = @filing_ie.send(:mappings).for_row(@se_row.first)
|
|
279
279
|
mapped_ie = @filing_ie.send(:map, @se_row)
|
|
280
280
|
mapped_ie.should be_a_kind_of(Hash)
|
|
281
|
-
|
|
281
|
+
|
|
282
282
|
mapped_ie[:form_type].should == "SE"
|
|
283
283
|
mapped_ie[:candidate_id_number].should == "P00003608"
|
|
284
284
|
end
|
|
285
|
-
|
|
285
|
+
|
|
286
286
|
it "should perform conversion translations" do
|
|
287
287
|
row_map = @filing.send(:mappings).for_row(@sa_row.first)
|
|
288
288
|
@filing.translate do |t|
|
|
@@ -293,7 +293,7 @@ describe Fech::Filing do
|
|
|
293
293
|
mapped = @filing.send(:map, @sa_row)
|
|
294
294
|
mapped[:contribution_date].should == Date.parse("20110322")
|
|
295
295
|
end
|
|
296
|
-
|
|
296
|
+
|
|
297
297
|
it "should perform combination translations" do
|
|
298
298
|
@filing.translate do |t|
|
|
299
299
|
t.combine(:row => @f3p_row.first, :field => :net_individual_contributions) do |row|
|
|
@@ -303,7 +303,7 @@ describe Fech::Filing do
|
|
|
303
303
|
mapped = @filing.send(:map, @f3p_row)
|
|
304
304
|
mapped[:net_individual_contributions].should == mapped[:col_a_17_a_iii_individual_contribution_total].to_f - mapped[:col_a_28_a_individuals].to_f
|
|
305
305
|
end
|
|
306
|
-
|
|
306
|
+
|
|
307
307
|
it "should return only field asked for if :include was specified" do
|
|
308
308
|
fields = [:form_type, :filer_committee_id_number, :transaction_id]
|
|
309
309
|
mapped = @filing.send(:map, @sa_row, :include => fields)
|
|
@@ -312,53 +312,53 @@ describe Fech::Filing do
|
|
|
312
312
|
end
|
|
313
313
|
mapped.size.should == 3
|
|
314
314
|
end
|
|
315
|
-
|
|
315
|
+
|
|
316
316
|
end
|
|
317
|
-
|
|
317
|
+
|
|
318
318
|
describe "amendments" do
|
|
319
|
-
|
|
319
|
+
|
|
320
320
|
before do
|
|
321
321
|
@filing = Fech::Filing.new(723604)
|
|
322
322
|
@filing.stubs(:file_path).returns(File.join(File.dirname(__FILE__), 'data', '723604.fec'))
|
|
323
323
|
end
|
|
324
|
-
|
|
324
|
+
|
|
325
325
|
describe "for non-amending filings" do
|
|
326
|
-
|
|
326
|
+
|
|
327
327
|
describe "#amendment?" do
|
|
328
328
|
it "should return false" do
|
|
329
329
|
@filing.stubs(:header).returns({:report_id => nil})
|
|
330
330
|
@filing.amendment?.should == false
|
|
331
331
|
end
|
|
332
332
|
end
|
|
333
|
-
|
|
333
|
+
|
|
334
334
|
end
|
|
335
|
-
|
|
335
|
+
|
|
336
336
|
describe "#amends" do
|
|
337
|
-
|
|
337
|
+
|
|
338
338
|
it "should return nil for filings without a report_id in HDR" do
|
|
339
339
|
@filing.stubs(:header).returns({:report_id => nil})
|
|
340
340
|
@filing.amends.should == nil
|
|
341
341
|
end
|
|
342
|
-
|
|
342
|
+
|
|
343
343
|
it "should return a filing_id for filings with a report_id in HDR" do
|
|
344
344
|
@filing.stubs(:header).returns({:report_id => "723603"})
|
|
345
345
|
@filing.amends.should == "723603"
|
|
346
346
|
end
|
|
347
|
-
|
|
347
|
+
|
|
348
348
|
end
|
|
349
|
-
|
|
349
|
+
|
|
350
350
|
describe "#amendment?" do
|
|
351
|
-
|
|
351
|
+
|
|
352
352
|
it "should return false for filings without a report_id in HDR" do
|
|
353
353
|
@filing.stubs(:header).returns({:report_id => nil})
|
|
354
354
|
@filing.amendment?.should == false
|
|
355
355
|
end
|
|
356
|
-
|
|
356
|
+
|
|
357
357
|
it "should return true for filings with a report_id in HDR" do
|
|
358
358
|
@filing.stubs(:header).returns({:report_id => "723603"})
|
|
359
359
|
@filing.amendment?.should == true
|
|
360
360
|
end
|
|
361
|
-
|
|
361
|
+
|
|
362
362
|
end
|
|
363
363
|
end
|
|
364
364
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fech
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: '1.7'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Strickland
|
|
@@ -11,146 +11,146 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date:
|
|
14
|
+
date: 2015-03-28 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: fastercsv
|
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
|
19
19
|
requirements:
|
|
20
|
-
- -
|
|
20
|
+
- - ">="
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
22
|
version: '0'
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
26
|
requirements:
|
|
27
|
-
- -
|
|
27
|
+
- - ">="
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
29
|
version: '0'
|
|
30
30
|
- !ruby/object:Gem::Dependency
|
|
31
31
|
name: people
|
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
|
33
33
|
requirements:
|
|
34
|
-
- -
|
|
34
|
+
- - ">="
|
|
35
35
|
- !ruby/object:Gem::Version
|
|
36
36
|
version: '0'
|
|
37
37
|
type: :runtime
|
|
38
38
|
prerelease: false
|
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
|
40
40
|
requirements:
|
|
41
|
-
- -
|
|
41
|
+
- - ">="
|
|
42
42
|
- !ruby/object:Gem::Version
|
|
43
43
|
version: '0'
|
|
44
44
|
- !ruby/object:Gem::Dependency
|
|
45
45
|
name: ensure-encoding
|
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
|
47
47
|
requirements:
|
|
48
|
-
- -
|
|
48
|
+
- - ">="
|
|
49
49
|
- !ruby/object:Gem::Version
|
|
50
50
|
version: '0'
|
|
51
51
|
type: :runtime
|
|
52
52
|
prerelease: false
|
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
|
54
54
|
requirements:
|
|
55
|
-
- -
|
|
55
|
+
- - ">="
|
|
56
56
|
- !ruby/object:Gem::Version
|
|
57
57
|
version: '0'
|
|
58
58
|
- !ruby/object:Gem::Dependency
|
|
59
|
-
name:
|
|
59
|
+
name: byebug
|
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
|
61
61
|
requirements:
|
|
62
|
-
- -
|
|
62
|
+
- - ">="
|
|
63
63
|
- !ruby/object:Gem::Version
|
|
64
|
-
version:
|
|
64
|
+
version: '0'
|
|
65
65
|
type: :development
|
|
66
66
|
prerelease: false
|
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
|
68
68
|
requirements:
|
|
69
|
-
- -
|
|
69
|
+
- - ">="
|
|
70
70
|
- !ruby/object:Gem::Version
|
|
71
|
-
version:
|
|
71
|
+
version: '0'
|
|
72
72
|
- !ruby/object:Gem::Dependency
|
|
73
73
|
name: rake
|
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
|
75
75
|
requirements:
|
|
76
|
-
- -
|
|
76
|
+
- - ">="
|
|
77
77
|
- !ruby/object:Gem::Version
|
|
78
78
|
version: '0'
|
|
79
79
|
type: :development
|
|
80
80
|
prerelease: false
|
|
81
81
|
version_requirements: !ruby/object:Gem::Requirement
|
|
82
82
|
requirements:
|
|
83
|
-
- -
|
|
83
|
+
- - ">="
|
|
84
84
|
- !ruby/object:Gem::Version
|
|
85
85
|
version: '0'
|
|
86
86
|
- !ruby/object:Gem::Dependency
|
|
87
87
|
name: rspec
|
|
88
88
|
requirement: !ruby/object:Gem::Requirement
|
|
89
89
|
requirements:
|
|
90
|
-
- -
|
|
90
|
+
- - ">="
|
|
91
91
|
- !ruby/object:Gem::Version
|
|
92
|
-
version: '
|
|
92
|
+
version: '0'
|
|
93
93
|
type: :development
|
|
94
94
|
prerelease: false
|
|
95
95
|
version_requirements: !ruby/object:Gem::Requirement
|
|
96
96
|
requirements:
|
|
97
|
-
- -
|
|
97
|
+
- - ">="
|
|
98
98
|
- !ruby/object:Gem::Version
|
|
99
|
-
version: '
|
|
99
|
+
version: '0'
|
|
100
100
|
- !ruby/object:Gem::Dependency
|
|
101
101
|
name: mocha
|
|
102
102
|
requirement: !ruby/object:Gem::Requirement
|
|
103
103
|
requirements:
|
|
104
|
-
- -
|
|
104
|
+
- - ">="
|
|
105
105
|
- !ruby/object:Gem::Version
|
|
106
106
|
version: '0'
|
|
107
107
|
type: :development
|
|
108
108
|
prerelease: false
|
|
109
109
|
version_requirements: !ruby/object:Gem::Requirement
|
|
110
110
|
requirements:
|
|
111
|
-
- -
|
|
111
|
+
- - ">="
|
|
112
112
|
- !ruby/object:Gem::Version
|
|
113
113
|
version: '0'
|
|
114
114
|
- !ruby/object:Gem::Dependency
|
|
115
115
|
name: bundler
|
|
116
116
|
requirement: !ruby/object:Gem::Requirement
|
|
117
117
|
requirements:
|
|
118
|
-
- -
|
|
118
|
+
- - ">="
|
|
119
119
|
- !ruby/object:Gem::Version
|
|
120
120
|
version: '0'
|
|
121
121
|
type: :development
|
|
122
122
|
prerelease: false
|
|
123
123
|
version_requirements: !ruby/object:Gem::Requirement
|
|
124
124
|
requirements:
|
|
125
|
-
- -
|
|
125
|
+
- - ">="
|
|
126
126
|
- !ruby/object:Gem::Version
|
|
127
127
|
version: '0'
|
|
128
128
|
- !ruby/object:Gem::Dependency
|
|
129
129
|
name: rdoc
|
|
130
130
|
requirement: !ruby/object:Gem::Requirement
|
|
131
131
|
requirements:
|
|
132
|
-
- -
|
|
132
|
+
- - ">="
|
|
133
133
|
- !ruby/object:Gem::Version
|
|
134
134
|
version: '0'
|
|
135
135
|
type: :development
|
|
136
136
|
prerelease: false
|
|
137
137
|
version_requirements: !ruby/object:Gem::Requirement
|
|
138
138
|
requirements:
|
|
139
|
-
- -
|
|
139
|
+
- - ">="
|
|
140
140
|
- !ruby/object:Gem::Version
|
|
141
141
|
version: '0'
|
|
142
142
|
- !ruby/object:Gem::Dependency
|
|
143
143
|
name: yard
|
|
144
144
|
requirement: !ruby/object:Gem::Requirement
|
|
145
145
|
requirements:
|
|
146
|
-
- -
|
|
146
|
+
- - ">="
|
|
147
147
|
- !ruby/object:Gem::Version
|
|
148
148
|
version: '0'
|
|
149
149
|
type: :development
|
|
150
150
|
prerelease: false
|
|
151
151
|
version_requirements: !ruby/object:Gem::Requirement
|
|
152
152
|
requirements:
|
|
153
|
-
- -
|
|
153
|
+
- - ">="
|
|
154
154
|
- !ruby/object:Gem::Version
|
|
155
155
|
version: '0'
|
|
156
156
|
description: A Ruby library for interacting with electronic filings from the Federal
|
|
@@ -161,8 +161,8 @@ executables: []
|
|
|
161
161
|
extensions: []
|
|
162
162
|
extra_rdoc_files: []
|
|
163
163
|
files:
|
|
164
|
-
- .gitignore
|
|
165
|
-
- .rspec
|
|
164
|
+
- ".gitignore"
|
|
165
|
+
- ".rspec"
|
|
166
166
|
- CHANGELOG
|
|
167
167
|
- Gemfile
|
|
168
168
|
- Gemfile.lock
|
|
@@ -199,6 +199,7 @@ files:
|
|
|
199
199
|
- sources/F3PS.csv
|
|
200
200
|
- sources/F3S.csv
|
|
201
201
|
- sources/F3X.csv
|
|
202
|
+
- sources/F3Z.csv
|
|
202
203
|
- sources/F4.csv
|
|
203
204
|
- sources/F5.csv
|
|
204
205
|
- sources/F56.csv
|
|
@@ -221,6 +222,7 @@ files:
|
|
|
221
222
|
- sources/H6.csv
|
|
222
223
|
- sources/HDR.csv
|
|
223
224
|
- sources/SchA.csv
|
|
225
|
+
- sources/SchA3L.csv
|
|
224
226
|
- sources/SchB.csv
|
|
225
227
|
- sources/SchC.csv
|
|
226
228
|
- sources/SchC1.csv
|
|
@@ -298,18 +300,19 @@ require_paths:
|
|
|
298
300
|
- lib
|
|
299
301
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
300
302
|
requirements:
|
|
301
|
-
- -
|
|
303
|
+
- - ">="
|
|
302
304
|
- !ruby/object:Gem::Version
|
|
303
305
|
version: '0'
|
|
304
306
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
305
307
|
requirements:
|
|
306
|
-
- -
|
|
308
|
+
- - ">="
|
|
307
309
|
- !ruby/object:Gem::Version
|
|
308
310
|
version: '0'
|
|
309
311
|
requirements: []
|
|
310
312
|
rubyforge_project: fech
|
|
311
|
-
rubygems_version: 2.2.
|
|
313
|
+
rubygems_version: 2.2.2
|
|
312
314
|
signing_key:
|
|
313
315
|
specification_version: 4
|
|
314
316
|
summary: Ruby library for parsing FEC filings.
|
|
315
317
|
test_files: []
|
|
318
|
+
has_rdoc:
|