fech 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +13 -2
- data/lib/fech.rb +1 -1
- data/lib/fech/fech_utils.rb +5 -1
- data/lib/fech/map_generator.rb +7 -2
- data/lib/fech/rendered_maps.rb +22 -0
- data/lib/fech/version.rb +1 -1
- data/sources/F24.csv +18 -0
- data/sources/F5.csv +39 -0
- data/sources/F56.csv +33 -0
- data/sources/F57.csv +44 -0
- data/spec/data/752356.fec +5 -0
- data/spec/filing_spec.rb +21 -0
- data/spec/mappings_spec.rb +1 -1
- data/spec/sources/F24.csv +18 -0
- metadata +12 -6
data/README.rdoc
CHANGED
@@ -4,7 +4,14 @@
|
|
4
4
|
\ \_\ \ \_____\ \ \_____\ \ \_\ \_\
|
5
5
|
\/_/ \/_____/ \/_____/ \/_/\/_/
|
6
6
|
|
7
|
-
Fech makes it easy to parse electronic presidential campaign filings 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.
|
7
|
+
Fech makes it easy to parse electronic presidential campaign filings[http://query.nictusa.com/pres/] and independent expenditure filings[http://www.fec.gov/finance/disclosure/ie_reports.shtml] 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.
|
8
|
+
|
9
|
+
Fech supports several FEC form types, including all F3P (presidential filings), F5 (independent expenditures), F24 (24/48 hour notices of independent expenditures), F56 (contributions to independent expenditure committees) and F57 (expenditures by independent expenditure committees).
|
10
|
+
|
11
|
+
== News
|
12
|
+
|
13
|
+
* Nov. 13, 2011: Version 0.3.0 released. Layouts for forms 24, 5, 56 and 57 added, for parsing independent expenditure filings.
|
14
|
+
* Nov. 4, 2011: Version 0.2.1 released. Bug-fix release to address a problem with the :include option for selecting only certain columns. Thanks to Aaron Bycoffe for the report and patch.
|
8
15
|
|
9
16
|
== Installation
|
10
17
|
|
@@ -16,7 +23,7 @@ For use in a Rails 3 application, put the following in your Gemfile:
|
|
16
23
|
|
17
24
|
gem 'fech'
|
18
25
|
|
19
|
-
then issue the 'bundle install' command. Fech has been tested under Ruby 1.8.7
|
26
|
+
then issue the 'bundle install' command. Fech has been tested under Ruby 1.8.7, 1.9.2 and JRuby 1.6.3.
|
20
27
|
|
21
28
|
== Getting Started
|
22
29
|
|
@@ -157,6 +164,10 @@ The following row types are currently supported from filing version 3 through 8.
|
|
157
164
|
* F3PS
|
158
165
|
* F3S
|
159
166
|
* F3P31 (Items to be Liquidated)
|
167
|
+
* F24 (24/48 Hour Notice of Independent Expenditure)
|
168
|
+
* F5 (Report of Independent Expenditures Made and Contributions Received)
|
169
|
+
* F56 (Contributions for Independent Expenditures)
|
170
|
+
* F57 (Independent Expenditures)
|
160
171
|
* SA (Contributions)
|
161
172
|
* SB (Expenditures)
|
162
173
|
* SC (Loans)
|
data/lib/fech.rb
CHANGED
data/lib/fech/fech_utils.rb
CHANGED
@@ -6,10 +6,14 @@ module FechUtils
|
|
6
6
|
# match that row type in the wild.
|
7
7
|
ROW_TYPES = {
|
8
8
|
:hdr => /^hdr$/i,
|
9
|
+
:f24 => /^f24/i,
|
9
10
|
:f3p => /(^f3p$)|(^f3p[^s|3])/i,
|
10
11
|
:f3s => /^f3s/i,
|
11
12
|
:f3p31 => /^f3p31/i,
|
12
13
|
:f3ps => /^f3ps/i,
|
14
|
+
:f5 => /^f5[na]/i,
|
15
|
+
:f56 => /^f56/i,
|
16
|
+
:f57 => /^f57/i,
|
13
17
|
:sa => /^sa/i,
|
14
18
|
:sb => /^sb/i,
|
15
19
|
:sc => /^sc[^1-2]/i,
|
@@ -38,4 +42,4 @@ module FechUtils
|
|
38
42
|
end
|
39
43
|
end
|
40
44
|
|
41
|
-
end
|
45
|
+
end
|
data/lib/fech/map_generator.rb
CHANGED
@@ -9,14 +9,19 @@ module Fech
|
|
9
9
|
attr_accessor :map
|
10
10
|
FILING_VERSIONS = ["8.0", "7.0", "6.4", "6.3", "6.2", "6.1",
|
11
11
|
"5.3", "5.2", "5.1", "5.0", "3"]
|
12
|
-
BASE_ROW_TYPES = ["HDR", "F3P", "F3P31", "F3PS", "F3S", "
|
13
|
-
"
|
12
|
+
BASE_ROW_TYPES = ["HDR", "F24", "F3P", "F3P31", "F3PS", "F3S", "F5", "F56", "F57",
|
13
|
+
"SchA", "SchB", "SchC", "SchC1", "SchC2", "SchD", "SchE",
|
14
|
+
"SchF", "TEXT"]
|
14
15
|
ROW_TYPE_MATCHERS = {
|
15
16
|
"HDR" => FechUtils::ROW_TYPES[:hdr],
|
17
|
+
"F24" => FechUtils::ROW_TYPES[:f24],
|
16
18
|
"F3P" => FechUtils::ROW_TYPES[:f3p],
|
17
19
|
"F3S" => FechUtils::ROW_TYPES[:f3s],
|
18
20
|
"F3P31" => FechUtils::ROW_TYPES[:f3p31],
|
19
21
|
"F3PS" => FechUtils::ROW_TYPES[:f3ps],
|
22
|
+
"F5" => FechUtils::ROW_TYPES[:f5],
|
23
|
+
"F56" => FechUtils::ROW_TYPES[:f56],
|
24
|
+
"F57" => FechUtils::ROW_TYPES[:f57],
|
20
25
|
"SchA" => FechUtils::ROW_TYPES[:sa],
|
21
26
|
"SchB" => FechUtils::ROW_TYPES[:sb],
|
22
27
|
"SchC" => FechUtils::ROW_TYPES[:sc],
|
data/lib/fech/rendered_maps.rb
CHANGED
@@ -9,6 +9,12 @@ module Fech
|
|
9
9
|
'^[6-8]' => [:record_type, :ef_type, :fec_version, :soft_name, :soft_ver, :report_id, :report_number, :comment],
|
10
10
|
'^[3-5]' => [:record_type, :ef_type, :fec_version, :soft_name, :soft_ver, :name_delim, :report_id, :report_number, :comment],
|
11
11
|
},
|
12
|
+
"^f24" => {
|
13
|
+
'^8.0' => [:form_type, :filer_committee_id_number, :report_type, :original_amendment_date, :committee_name, :street_1, :street_2, :city, :state, :zip, :treasurer_last_name, :treasurer_first_name, :treasurer_middle_name, :treasurer_prefix, :treasurer_suffix, :date_signed],
|
14
|
+
'^7.0|6.4|6.3|6.2|6.1' => [:form_type, :filer_committee_id_number, :report_type, :committee_name, :street_1, :street_2, :city, :state, :zip, :treasurer_last_name, :treasurer_first_name, :treasurer_middle_name, :treasurer_prefix, :treasurer_suffix, :date_signed],
|
15
|
+
'^5.0|5.1|5.2|5.3' => [:form_type, :filer_committee_id_number, :committee_name, :street_1, :street_2, :city, :state, :zip, nil, :date_signed, :report_type],
|
16
|
+
'^3' => [:form_type, :filer_committee_id_number, :committee_name, :street_1, :street_2, :city, :state, :zip, nil, :date_signed],
|
17
|
+
},
|
12
18
|
"(^f3p$)|(^f3p[^s|3])" => {
|
13
19
|
'^7.0|8.0' => [:form_type, :filer_committee_id_number, :committee_name, :change_of_address, :street_1, :street_2, :city, :state, :zip, :activity_primary, :activity_general, :report_code, :election_code, :date_of_election, :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_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_expenditures_subject_to_limits, :col_a_net_contributions, :col_a_net_operating_expenditures, :col_a_federal_funds, :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_the_candidate, :col_a_total_contributions, :col_a_transfers_from_aff_other_party_cmttees, :col_a_received_from_or_guaranteed_by_cand, :col_a_other_loans, :col_a_total_loans, :col_a_operating, :col_a_fundraising, :col_a_legal_and_accounting, :col_a_total_offsets_to_expenditures, :col_a_other_receipts, :col_a_total_receipts, :col_a_operating_expenditures, :col_a_transfers_to_other_authorized_committees, :col_a_fundraising_disbursements, :col_a_exempt_legal_accounting_disbursement, :col_a_made_or_guaranteed_by_candidate, :col_a_other_repayments, :col_a_total_loan_repayments_made, :col_a_individuals, :col_a_political_party_committees, :col_a_other_political_committees, :col_a_total_contributions_refunds, :col_a_other_disbursements, :col_a_total_disbursements, :col_a_items_on_hand_to_be_liquidated, :col_a_alabama, :col_a_alaska, :col_a_arizona, :col_a_arkansas, :col_a_california, :col_a_colorado, :col_a_connecticut, :col_a_delaware, :col_a_dist_of_columbia, :col_a_florida, :col_a_georgia, :col_a_hawaii, :col_a_idaho, :col_a_illinois, :col_a_indiana, :col_a_iowa, :col_a_kansas, :col_a_kentucky, :col_a_louisiana, :col_a_maine, :col_a_maryland, :col_a_massachusetts, :col_a_michigan, :col_a_minnesota, :col_a_mississippi, :col_a_missouri, :col_a_montana, :col_a_nebraska, :col_a_nevada, :col_a_new_hampshire, :col_a_new_jersey, :col_a_new_mexico, :col_a_new_york, :col_a_north_carolina, :col_a_north_dakota, :col_a_ohio, :col_a_oklahoma, :col_a_oregon, :col_a_pennsylvania, :col_a_rhode_island, :col_a_south_carolina, :col_a_south_dakota, :col_a_tennessee, :col_a_texas, :col_a_utah, :col_a_vermont, :col_a_virginia, :col_a_washington, :col_a_west_virginia, :col_a_wisconsin, :col_a_wyoming, :col_a_puerto_rico, :col_a_guam, :col_a_virgin_islands, :col_a_totals, :col_b_federal_funds, :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_the_candidate, :col_b_total_contributions_other_than_loans, :col_b_transfers_from_aff_other_party_cmttees, :col_b_received_from_or_guaranteed_by_cand, :col_b_other_loans, :col_b_total_loans, :col_b_operating, :col_b_fundraising, :col_b_legal_and_accounting, :col_b_total_offsets_to_operating_expenditures, :col_b_other_receipts, :col_b_total_receipts, :col_b_operating_expenditures, :col_b_transfers_to_other_authorized_committees, :col_b_fundraising_disbursements, :col_b_exempt_legal_accounting_disbursement, :col_b_made_or_guaranteed_by_the_candidate, :col_b_other_repayments, :col_b_total_loan_repayments_made, :col_b_individuals, :col_b_political_party_committees, :col_b_other_political_committees, :col_b_total_contributions_refunds, :col_b_other_disbursements, :col_b_total_disbursements, :col_b_alabama, :col_b_alaska, :col_b_arizona, :col_b_arkansas, :col_b_california, :col_b_colorado, :col_b_connecticut, :col_b_delaware, :col_b_dist_of_columbia, :col_b_florida, :col_b_georgia, :col_b_hawaii, :col_b_idaho, :col_b_illinois, :col_b_indiana, :col_b_iowa, :col_b_kansas, :col_b_kentucky, :col_b_louisiana, :col_b_maine, :col_b_maryland, :col_b_massachusetts, :col_b_michigan, :col_b_minnesota, :col_b_mississippi, :col_b_missouri, :col_b_montana, :col_b_nebraska, :col_b_nevada, :col_b_new_hampshire, :col_b_new_jersey, :col_b_new_mexico, :col_b_new_york, :col_b_north_carolina, :col_b_north_dakota, :col_b_ohio, :col_b_oklahoma, :col_b_oregon, :col_b_pennsylvania, :col_b_rhode_island, :col_b_south_carolina, :col_b_south_dakota, :col_b_tennessee, :col_b_texas, :col_b_utah, :col_b_vermont, :col_b_virginia, :col_b_washington, :col_b_west_virginia, :col_b_wisconsin, :col_b_wyoming, :col_b_puerto_rico, :col_b_guam, :col_b_virgin_islands, :col_b_totals],
|
14
20
|
'^6.4|6.3|6.2|6.1' => [:form_type, :filer_committee_id_number, :committee_name, :change_of_address, :street_1, :street_2, :city, :state, :zip, :activity_primary, :activity_general, :report_code, :election_code, :date_of_election, :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_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_expenditures_subject_to_limits, :col_a_net_contributions, :col_a_net_operating_expenditures, :col_a_federal_funds, :col_a_individual_contribution_total, :col_a_political_party_committees, :col_a_other_political_committees_pacs, :col_a_the_candidate, :col_a_total_contributions, :col_a_transfers_from_aff_other_party_cmttees, :col_a_received_from_or_guaranteed_by_cand, :col_a_other_loans, :col_a_total_loans, :col_a_operating, :col_a_fundraising, :col_a_legal_and_accounting, :col_a_total_offsets_to_expenditures, :col_a_other_receipts, :col_a_total_receipts, :col_a_operating_expenditures, :col_a_transfers_to_other_authorized_committees, :col_a_fundraising_disbursements, :col_a_exempt_legal_accounting_disbursement, :col_a_made_or_guaranteed_by_candidate, :col_a_other_repayments, :col_a_total_loan_repayments_made, :col_a_individuals, :col_a_political_party_committees, :col_a_other_political_committees, :col_a_total_contributions_refunds, :col_a_other_disbursements, :col_a_total_disbursements, :col_a_items_on_hand_to_be_liquidated, :col_a_alabama, :col_a_alaska, :col_a_arizona, :col_a_arkansas, :col_a_california, :col_a_colorado, :col_a_connecticut, :col_a_delaware, :col_a_dist_of_columbia, :col_a_florida, :col_a_georgia, :col_a_hawaii, :col_a_idaho, :col_a_illinois, :col_a_indiana, :col_a_iowa, :col_a_kansas, :col_a_kentucky, :col_a_louisiana, :col_a_maine, :col_a_maryland, :col_a_massachusetts, :col_a_michigan, :col_a_minnesota, :col_a_mississippi, :col_a_missouri, :col_a_montana, :col_a_nebraska, :col_a_nevada, :col_a_new_hampshire, :col_a_new_jersey, :col_a_new_mexico, :col_a_new_york, :col_a_north_carolina, :col_a_north_dakota, :col_a_ohio, :col_a_oklahoma, :col_a_oregon, :col_a_pennsylvania, :col_a_rhode_island, :col_a_south_carolina, :col_a_south_dakota, :col_a_tennessee, :col_a_texas, :col_a_utah, :col_a_vermont, :col_a_virginia, :col_a_washington, :col_a_west_virginia, :col_a_wisconsin, :col_a_wyoming, :col_a_puerto_rico, :col_a_guam, :col_a_virgin_islands, :col_a_totals, :col_b_federal_funds, :col_b_individual_contribution_total, :col_b_political_party_committees, :col_b_other_political_committees_pacs, :col_b_the_candidate, :col_b_total_contributions_other_than_loans, :col_b_transfers_from_aff_other_party_cmttees, :col_b_received_from_or_guaranteed_by_cand, :col_b_other_loans, :col_b_total_loans, :col_b_operating, :col_b_fundraising, :col_b_legal_and_accounting, :col_b_total_offsets_to_operating_expenditures, :col_b_other_receipts, :col_b_total_receipts, :col_b_operating_expenditures, :col_b_transfers_to_other_authorized_committees, :col_b_fundraising_disbursements, :col_b_exempt_legal_accounting_disbursement, :col_b_made_or_guaranteed_by_the_candidate, :col_b_other_repayments, :col_b_total_loan_repayments_made, :col_b_individuals, :col_b_political_party_committees, :col_b_other_political_committees, :col_b_total_contributions_refunds, :col_b_other_disbursements, :col_b_total_disbursements, :col_b_alabama, :col_b_alaska, :col_b_arizona, :col_b_arkansas, :col_b_california, :col_b_colorado, :col_b_connecticut, :col_b_delaware, :col_b_dist_of_columbia, :col_b_florida, :col_b_georgia, :col_b_hawaii, :col_b_idaho, :col_b_illinois, :col_b_indiana, :col_b_iowa, :col_b_kansas, :col_b_kentucky, :col_b_louisiana, :col_b_maine, :col_b_maryland, :col_b_massachusetts, :col_b_michigan, :col_b_minnesota, :col_b_mississippi, :col_b_missouri, :col_b_montana, :col_b_nebraska, :col_b_nevada, :col_b_new_hampshire, :col_b_new_jersey, :col_b_new_mexico, :col_b_new_york, :col_b_north_carolina, :col_b_north_dakota, :col_b_ohio, :col_b_oklahoma, :col_b_oregon, :col_b_pennsylvania, :col_b_rhode_island, :col_b_south_carolina, :col_b_south_dakota, :col_b_tennessee, :col_b_texas, :col_b_utah, :col_b_vermont, :col_b_virginia, :col_b_washington, :col_b_west_virginia, :col_b_wisconsin, :col_b_wyoming, :col_b_puerto_rico, :col_b_guam, :col_b_virgin_islands, :col_b_totals],
|
@@ -29,6 +35,22 @@ module Fech
|
|
29
35
|
'^8.0|7.0|6.4|6.3|6.2|6.1' => [:form_type, :filer_committee_id_number, :date_general_election, :date_day_after_general_election, :a_total_contributions_no_loans, :b_total_contribution_refunds, :c_net_contributions, :a_total_operating_expenditures, :b_total_offsets_to_operating_expenditures, :c_net_operating_expenditures, :a_i_individuals_itemized, :a_ii_individuals_unitemized, :a_iii_individuals_total, :b_political_party_committees, :c_all_other_political_committees_pacs, :d_the_candidate, :e_total_contributions, :transfers_from_other_auth_committees, :a_loans_made_or_guarn_by_the_candidate, :b_all_other_loans, :c_total_loans, :offsets_to_operating_expenditures, :other_receipts, :total_receipts, :operating_expenditures, :transfers_to_other_auth_committees, :a_loan_repayment_by_candidate, :b_loan_repayments_all_other_loans, :c_total_loan_repayments, :a_refund_individuals_other_than_pol_cmtes, :b_refund_political_party_committees, :c_refund_other_political_committees, :d_total_contributions_refunds, :other_disbursements, :total_disbursements],
|
30
36
|
'^5.3|5.2|5.1|5.0|3' => [:form_type, :filer_committee_id_number, :a_total_contributions_no_loans, :b_total_contribution_refunds, :c_net_contributions, :a_total_operating_expenditures, :b_total_offsets_to_operating_expenditures, :c_net_operating_expenditures, :a_i_individuals_itemized, :a_ii_individuals_unitemized, :a_iii_individuals_total, :b_political_party_committees, :c_all_other_political_committees_pacs, :d_the_candidate, :e_total_contributions, :transfers_from_other_auth_committees, :a_loans_made_or_guarn_by_the_candidate, :b_all_other_loans, :c_total_loans, :offsets_to_operating_expenditures, :other_receipts, :total_receipts, :operating_expenditures, :transfers_to_other_auth_committees, :a_loan_repayment_by_candidate, nil, :c_total_loan_repayments, :a_refund_individuals_other_than_pol_cmtes, nil, nil, :d_total_contributions_refunds, :other_disbursements, :total_disbursements, :date_general_election, :date_day_after_general_election],
|
31
37
|
},
|
38
|
+
"^f5[na]" => {
|
39
|
+
'^8.0|7.0|6.4|6.3' => [:form_type, :filer_committee_id_number, :entity_type, :organization_name, :individual_last_name, :individual_first_name, :individual_middle_name, :individual_prefix, :individual_suffix, :change_of_address, :street_1, :street_2, :city, :state, :zip, :qualified_nonprofit, :individual_employer, :individual_occupation, :report_code, :report_type, :coverage_from_date, :coverage_through_date, :total_contribution, :total_independent_expenditure, :person_completing_last_name, :person_completing_first_name, :person_completing_middle_name, :person_completing_prefix, :person_completing_suffix, :date_signed],
|
40
|
+
'^5.3' => [:form_type, :filer_committee_id_number, :committee_name, :street_1, :street_2, :city, :state, :zip, :change_of_address, :qualified_nonprofit, :individual_employer, nil, :report_code, nil, nil, nil, :coverage_from_date, :coverage_through_date, :total_contribution, :total_independent_expenditure, :person_completing_name, :date_signed, nil, nil, nil, :report_type],
|
41
|
+
'^5.2|5.1|5.0' => [:form_type, :filer_committee_id_number, :committee_name, :street_1, :street_2, :city, :state, :zip, :change_of_address, :qualified_nonprofit, :individual_employer, :individual_occupation, :report_code, :report_pgi, :election_date, :election_state, :coverage_from_date, :coverage_through_date, :total_contribution, :total_independent_expenditure, :person_completing_name, :date_signed, :date_notarized, :date_notary_commission_expires, :notary_name, :report_type],
|
42
|
+
'^3' => [:form_type, :filer_committee_id_number, :committee_name, :street_1, :street_2, :city, :state, :zip, :change_of_address, :qualified_nonprofit, :individual_employer, :individual_occupation, :report_code, :report_pgi, :election_date, :election_state, :coverage_from_date, :coverage_through_date, :total_contribution, :total_independent_expenditure, :person_completing_name, :date_signed, :date_notarized, :date_notary_commission_expires, :notary_name],
|
43
|
+
},
|
44
|
+
"^f56" => {
|
45
|
+
'^8.0|7.0|6.4|6.3|6.2' => [:form_type, :filer_committee_id_number, :transaction_id, :entity_type, :contributor_organization_name, :contributor_last_name, :contributor_first_name, :contributor_middle_name, :contributor_prefix, :contributor_suffix, :contributor_street_1, :contributor_street_2, :contributor_city, :contributor_state, :contributor_zip, :contributor_fec_id, :contribution_date, :contribution_amount, :contributor_employer, :contributor_occupation],
|
46
|
+
'^5.3|5.2|5.1|5.0|3.0' => [:form_type, :filer_committee_id_number, :entity_type, :contributor_name, :contributor_street_1, :contributor_street_2, :contributor_city, :contributor_state, :contributor_zip, :contributor_employer, :contributor_occupation, :contribution_date, :contribution_amount, :contributor_fec_id, :candidate_id, :candidate_name, :candidate_office, :candidate_state, :candidate_district, :conduit_name, :conduit_street_1, :conduit_street_2, :conduit_city, :conduit_state, :conduit_zip, nil, :transaction_id],
|
47
|
+
},
|
48
|
+
"^f57" => {
|
49
|
+
'^8.0' => [:form_type, :filer_committee_id_number, :transaction_id_number, :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, :election_code, :election_other_description, :expenditure_date, :expenditure_amount, :calendar_y_t_d_per_election_office, :expenditure_purpose_descrip, :category_code, :payee_cmtte_fec_id_number, :support_oppose_code, :candidate_id_number, :candidate_last_name, :candidate_first_name, :candidate_middle_name, :candidate_prefix, :candidate_suffix, :candidate_office, :candidate_state, :candidate_district],
|
50
|
+
'^7.0|6.4|6.3|6.2|6.1' => [:form_type, :filer_committee_id_number, :transaction_id_number, :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, :election_code, :election_other_description, :expenditure_date, :expenditure_amount, :calendar_y_t_d_per_election_office, :expenditure_purpose_code, :expenditure_purpose_descrip, :category_code, :payee_cmtte_fec_id_number, :support_oppose_code, :candidate_id_number, :candidate_last_name, :candidate_first_name, :candidate_middle_name, :candidate_prefix, :candidate_suffix, :candidate_office, :candidate_state, :candidate_district],
|
51
|
+
'^5.3|5.2|5.1|5.0' => [:form_type, :filer_committee_id_number, :entity_type, :payee_name, :payee_street_1, :payee_street_2, :payee_city, :payee_state, :payee_zip, :expenditure_purpose_descrip, :expenditure_date, :expenditure_amount, :support_oppose_code, :candidate_id_number, :candidate_name, :candidate_office, :candidate_state, :candidate_district, nil, nil, nil, nil, nil, nil, :conduit_name, :conduit_street_1, :conduit_street_2, :conduit_city, :conduit_state, :conduit_zip, nil, :transaction_id_number, :category_code, :expenditure_purpose_code, :calendar_y_t_d_per_election_office, :election_code, :election_other_description],
|
52
|
+
'^3' => [:form_type, :filer_committee_id_number, :entity_type, :payee_name, :payee_street_2, nil, :payee_city, :payee_state, :payee_zip, :expenditure_purpose_descrip, :expenditure_date, :expenditure_amount, :support_oppose_code, :candidate_id_number, :candidate_name, :candidate_office, :candidate_state, :candidate_district, nil, nil, nil, nil, nil, nil, :conduit_name, :conduit_street_1, :conduit_street_2, :conduit_city, :conduit_state, :conduit_zip, :amended_code],
|
53
|
+
},
|
32
54
|
"^sa" => {
|
33
55
|
'^8.0' => [:form_type, :filer_committee_id_number, :transaction_id, :back_reference_tran_id_number, :back_reference_sched_name, :entity_type, :contributor_organization_name, :contributor_last_name, :contributor_first_name, :contributor_middle_name, :contributor_prefix, :contributor_suffix, :contributor_street_1, :contributor_street_2, :contributor_city, :contributor_state, :contributor_zip, :election_code, :election_other_description, :contribution_date, :contribution_amount, :contribution_aggregate, :contribution_purpose_descrip, :contributor_employer, :contributor_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, :memo_code, :memo_text_description, :reference_code],
|
34
56
|
'^7.0|6.4' => [:form_type, :filer_committee_id_number, :transaction_id, :back_reference_tran_id_number, :back_reference_sched_name, :entity_type, :contributor_organization_name, :contributor_last_name, :contributor_first_name, :contributor_middle_name, :contributor_prefix, :contributor_suffix, :contributor_street_1, :contributor_street_2, :contributor_city, :contributor_state, :contributor_zip, :election_code, :election_other_description, :contribution_date, :contribution_amount, :contribution_aggregate, :contribution_purpose_code, :contribution_purpose_descrip, :contributor_employer, :contributor_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, :memo_code, :memo_text_description, :reference_code],
|
data/lib/fech/version.rb
CHANGED
data/sources/F24.csv
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
canonical,^8.0,,^7.0|6.4|6.3|6.2|6.1,,^5.0|5.1|5.2|5.3,,^3,
|
2
|
+
form_type,1,FORM TYPE,1,FORM TYPE,1,FORM TYPE,1,FORM TYPE
|
3
|
+
filer_committee_id_number,2,FILER COMMITTEE ID NUMBER,2,FILER COMMITTEE ID NUMBER,2,FILER COMMITTEE ID NUMBER,2,FILER FEC CMTE ID
|
4
|
+
report_type,3,REPORT TYPE {24/48 Hour},3,REPORT TYPE {24/48 Hour},11,REPORT TYPE,,
|
5
|
+
original_amendment_date,4,ORIGINAL AMENDMENT DATE,,
|
6
|
+
committee_name,5,COMMITTEE NAME,4,COMMITTEE NAME,3,COMMITTEE NAME,3,COMMITTEE NAME
|
7
|
+
street_1,6,STREET 1,5,STREET 1,4,STREET 1,4,STREET 1
|
8
|
+
street_2,7,STREET 1,6,STREET 2,5,STREET 2,5,STREET 2
|
9
|
+
city,8,CITY,7,CITY,6,CITY,6,CITY
|
10
|
+
state,9,STATE,8,STATE,7,STATE,7,STATE
|
11
|
+
zip,10,ZIP,9,ZIP,8,ZIP,8,ZIP
|
12
|
+
treasurer_name,,,,9,NAME/TREASURER (as signed),9,NAME/TREASURER (as signed)
|
13
|
+
treasurer_last_name,11,TREASURER LAST NAME,10,TREASURER LAST NAME,,,,
|
14
|
+
treasurer_first_name,12,TREASURER FIRST NAME,11,TREASURER FIRST NAME,,,,
|
15
|
+
treasurer_middle_name,13,TREASURER MIDDLE NAME,12,TREASURER MIDDLE NAME,,,,
|
16
|
+
treasurer_prefix,14,TREASURER PREFIX,13,TREASURER PREFIX,,,,
|
17
|
+
treasurer_suffix,15,TREASURER SUFFIX,14,TREASURER SUFFIX,,,,
|
18
|
+
date_signed,16,DATE SIGNED,15,DATE SIGNED,10,DATE (Signed),10,DATE (Signed)
|
data/sources/F5.csv
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
canonical,^8.0|7.0|6.4|6.3,,^5.3,,^5.2|5.1|5.0,,^3,
|
2
|
+
form_type,1,FORM TYPE,1,FORM TYPE,1,FORM TYPE,1,FORM TYPE
|
3
|
+
filer_committee_id_number,2,FILER COMMITTEE ID NUMBER,2,FILER FEC CMTE ID,2,FILER FEC CMTE ID,2,FILER FEC CMTE ID
|
4
|
+
entity_type,3,ENTITY TYPE,,,,,,
|
5
|
+
committee_name,,,3,COMMITTEE NAME,3,COMMITTEE NAME,3,COMMITTEE NAME
|
6
|
+
organization_name,4,ORGANIZATION NAME,,,,,,
|
7
|
+
individual_last_name,5,INDIVIDUAL LAST NAME,,,,,,
|
8
|
+
individual_first_name,6,INDIVIDUAL FIRST NAME,,,,,,
|
9
|
+
individual_middle_name,7,INDIVIDUAL MIDDLE NAME,,,,,,
|
10
|
+
individual_prefix,8,INDIVIDUAL PREFIX,,,,,,
|
11
|
+
individual_suffix,9,INDIVIDUAL SUFFIX,,,,,,
|
12
|
+
change_of_address,10,CHANGE OF ADDRESS,9,CHG OF ADDRESS,9,CHG OF ADDRESS,9,CHG OF ADDRESS
|
13
|
+
street_1,11,STREET 1,4,STREET 1,4,STREET 1,4,STREET 1
|
14
|
+
street_2,12,STREET 2,5,STREET 2,5,STREET 2,5,STREET 2
|
15
|
+
city,13,CITY,6,CITY,6,CITY,6,CITY
|
16
|
+
state,14,STATE,7,STATE,7,STATE,7,STATE
|
17
|
+
zip,15,ZIP,8,ZIP,8,ZIP,8,ZIP
|
18
|
+
qualified_nonprofit,16,YES/NO (Qualified Non-Profit Corporation),10,YESNO (Qual/Non Q),10,YESNO (Qual/Non Q),10,YESNO (Qual/Non Q)
|
19
|
+
individual_employer,17,INDIVIDUAL EMPLOYER,11,INDEMP,11,INDEMP,11,INDEMP
|
20
|
+
individual_occupation,18,INDIVIDUAL OCCUPATION,18,INDOCC,12,INDOCC,12,INDOCC
|
21
|
+
report_code,19,REPORT CODE,13,RPTCODE,13,RPTCODE,13,RPTCODE
|
22
|
+
report_type,20,24HOUR 48HOUR CODE,26,24HOUR 48HOUR CODE,26,24HOUR 48HOUR CODE,,
|
23
|
+
report_pgi,,,,,14,RPTPGI,14,RPTPGI
|
24
|
+
coverage_from_date,21,COVERAGE FROM DATE,17,DATE (Coverage From),17,DATE (Coverage From),17,DATE (Coverage From)
|
25
|
+
coverage_through_date,22,COVERAGE THROUGH DATE,18,DATE (Coverage To),18,DATE (Coverage To),18,DATE (Coverage To)
|
26
|
+
election_date,,,,,15,DATE (Of Election),15,DATE (Of Election)
|
27
|
+
election_state,,,,,16,STATE (Of Election),16,STATE (Of Election)
|
28
|
+
total_contribution,23,TOTAL CONTRIBUTION,19,TOTAL CONTRIBUTION,19,TOTAL CONTRIBUTION,19,TOTAL CONTRIBUTION
|
29
|
+
total_independent_expenditure,24,TOTAL INDEPENDENT EXPENDITURE,20,TOTAL INDEP. EXPEND,20,TOTAL INDEP. EXPEND,20,TOTAL INDEP. EXPEND
|
30
|
+
person_completing_name,,,21,IND/NAME (Person Completing Form),21,IND/NAME (Person Completing Form),21,IND/NAME (Person Completing Form)
|
31
|
+
person_completing_last_name,25,PERSON COMPLETING LAST NAME,,,,,,
|
32
|
+
person_completing_first_name,26,PERSON COMPLETING FIRST NAME,,,,,,
|
33
|
+
person_completing_middle_name,27,PERSON COMPLETING MIDDLE NAME,,,,,,
|
34
|
+
person_completing_prefix,28,PERSON COMPLETING PREFIX,,,,,,
|
35
|
+
person_completing_suffix,29,PERSON COMPLETING SUFFIX,,,,,,
|
36
|
+
date_signed,30,DATE SIGNED,22,DATE (Signed),22,DATE (Signed),22,DATE (Signed)
|
37
|
+
date_notarized,,,,,23,DATE (Notarized),23,DATE (Notarized)
|
38
|
+
date_notary_commission_expires,,,,,24,DATE (Notary Commission Expires),24,DATE (Notary Commission Expires)
|
39
|
+
notary_name,,,,,25,IND/NAME (Notary),25,IND/NAME (Notary)
|
data/sources/F56.csv
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
canonical,^8.0|7.0|6.4|6.3|6.2,,^5.3|5.2|5.1|5.0|3.0,
|
2
|
+
form_type,1,FORM TYPE,1,FORM TYPE
|
3
|
+
filer_committee_id_number,2,FILER COMMITTEE ID NUMBER,2,FILER FEC CMTE ID
|
4
|
+
transaction_id,3,TRANSACTION ID NUMBER,27,TRAN ID
|
5
|
+
entity_type,4,ENTITY TYPE,3,ENTITY TYPE
|
6
|
+
contributor_organization_name,5,CONTRIBUTOR ORGANIZATION NAME,,
|
7
|
+
contributor_name,,,4,NAME (Contributor/Lender)
|
8
|
+
contributor_last_name,6,CONTRIBUTOR LAST NAME,,
|
9
|
+
contributor_first_name,7,CONTRIBUTOR FIRST NAME,,
|
10
|
+
contributor_middle_name,8,CONTRIBUTOR MIDDLE NAME,,
|
11
|
+
contributor_prefix,9,CONTRIBUTOR PREFIX,,
|
12
|
+
contributor_suffix,10,CONTRIBUTOR SUFFIX,,
|
13
|
+
contributor_street_1,11,CONTRIBUTOR STREET 1,5,STREET 1
|
14
|
+
contributor_street_2,12,CONTRIBUTOR STREET 2,6,STREET 2
|
15
|
+
contributor_city,13,CONTRIBUTOR CITY,7,CITY
|
16
|
+
contributor_state,14,CONTRIBUTOR STATE,8,STATE
|
17
|
+
contributor_zip,15,CONTRIBUTOR ZIP,9,ZIP
|
18
|
+
contributor_fec_id,16,CONTRIBUTOR COMMITTEE FEC ID,14,FEC COMMITTEE ID NUMBER
|
19
|
+
contribution_date,17,CONTRIBUTION DATE,12,DATE (Of Contribution)
|
20
|
+
contribution_amount,18,CONTRIBUTION AMOUNT,13,AMOUNT
|
21
|
+
contributor_employer,19,CONTRIBUTOR EMPLOYER,10,INDEMP
|
22
|
+
contributor_occupation,20,CONTRIBUTOR_OCCUPATION,11,INDOCC
|
23
|
+
candidate_id,,,15,FEC CANDIDATE ID NUMBER
|
24
|
+
candidate_name,,,16,CANDIDATE NAME
|
25
|
+
candidate_office,,,17,CAN/OFFICE
|
26
|
+
candidate_state,,,18,CAN/STATE
|
27
|
+
candidate_district,,,19,CAN/DIST
|
28
|
+
conduit_name,,,20,CONDUIT NAME
|
29
|
+
conduit_street_1,,,21,CONDUIT STREET 1
|
30
|
+
conduit_street_2,,,22,CONDUIT STREET 2
|
31
|
+
conduit_city,,,23,CONDUIT CITY
|
32
|
+
conduit_state,,,24,CONDUIT STATE
|
33
|
+
conduit_zip,,,25,CONDUIT ZIP
|
data/sources/F57.csv
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
canonical,^8.0,,^7.0|6.4|6.3|6.2|6.1,,^5.3|5.2|5.1|5.0,,^3,
|
2
|
+
form_type,1,FORM TYPE,1,FORM TYPE,1,FORM TYPE,1,FORM TYPE
|
3
|
+
filer_committee_id_number,2,FILER COMMITTEE ID NUMBER,2,FILER COMMITTEE ID NUMBER,2,FILER FEC CMTE ID,2,FILER FEC CMTE ID
|
4
|
+
transaction_id_number,3,TRANSACTION ID NUMBER,3,TRANSACTION ID NUMBER,32,TRAN ID
|
5
|
+
entity_type,4,ENTITY TYPE,4,ENTITY TYPE,3,ENTITY TYPE,3,ENTITY TYPE
|
6
|
+
payee_organization_name,5,PAYEE ORGANIZATION NAME,5,PAYEE ORGANIZATION NAME,,
|
7
|
+
payee_name,,,,,4,NAME (Payee),4,NAME (Payee)
|
8
|
+
payee_last_name,6,PAYEE LAST NAME,6,PAYEE LAST NAME,,
|
9
|
+
payee_first_name,7,PAYEE FIRST NAME,7,PAYEE FIRST NAME,,
|
10
|
+
payee_middle_name,8,PAYEE MIDDLE NAME,8,PAYEE MIDDLE NAME,,
|
11
|
+
payee_prefix,9,PAYEE PREFIX,9,PAYEE PREFIX,,
|
12
|
+
payee_suffix,10,PAYEE SUFFIX,10,PAYEE SUFFIX,,
|
13
|
+
payee_street_1,11,PAYEE STREET 1,11,PAYEE STREET 1,5,STREET 1,5,STREET 1
|
14
|
+
payee_street_2,12,PAYEE STREET 2,12,PAYEE STREET 2,6,STREET 2,5,STREET 2
|
15
|
+
payee_city,13,PAYEE CITY,13,PAYEE CITY,7,CITY,7,CITY
|
16
|
+
payee_state,14,PAYEE STATE,14,PAYEE STATE,8,STATE,8,STATE
|
17
|
+
payee_zip,15,PAYEE ZIP,15,PAYEE ZIP,9,ZIP,9,ZIP
|
18
|
+
election_code,16,ELECTION CODE,16,ELECTION CODE,36,ITEM ELECT CD
|
19
|
+
election_other_description,17,ELECTION OTHER DESCRIPTION,17,ELECTION OTHER DESCRIPTION,37,ITEM ELECT OTHER
|
20
|
+
expenditure_date,18,EXPENDITURE DATE,18,EXPENDITURE DATE,11,DATE (Of Expenditure),11,DATE (Of Expenditure)
|
21
|
+
expenditure_amount,19,EXPENDITURE AMOUNT,19,EXPENDITURE AMOUNT,12,AMOUNT,12,AMOUNT
|
22
|
+
calendar_y_t_d_per_election_office,20,CALENDAR Y-T-D (per election/office),20,CALENDAR Y-T-D (per election/office),35,Calendar YTD for election/office sought
|
23
|
+
expenditure_purpose_code,,,21,EXPENDITURE PURPOSE CODE,34,TRANS {Purpose} CODE
|
24
|
+
expenditure_purpose_descrip,21,EXPENDITURE PURPOSE DESCRIP,22,EXPENDITURE PURPOSE DESCRIP,10,TRANS {Purpose} DESCRIP,10,TRANSDESC
|
25
|
+
category_code,22,CATEGORY CODE,23,CATEGORY CODE,33,CATEGORY CODE
|
26
|
+
payee_cmtte_fec_id_number,23,PAYEE CMTTE FEC ID NUMBER,24,PAYEE CMTTE FEC ID NUMBER
|
27
|
+
support_oppose_code,24,SUPPORT/OPPOSE CODE,25,SUPPORT/OPPOSE CODE,13,SUPPORT/OPPOSE,13,SUPPORT/OPPOSE
|
28
|
+
candidate_id_number,25,S/O CANDIDATE ID NUMBER,26,S/O CANDIDATE ID NUMBER,14,S/O FEC CAN ID NUMBER,14,S/O FEC CAN ID NUMBER
|
29
|
+
candidate_name,,,,,15,S/O CAN/NAME,15,S/O CAN/NAME
|
30
|
+
candidate_last_name,26,S/O CANDIDATE LAST NAME,27,S/O CANDIDATE LAST NAME,,,,
|
31
|
+
candidate_first_name,27,S/O CANDIDATE FIRST NAME,28,S/O CANDIDATE FIRST NAME,,,,
|
32
|
+
candidate_middle_name,28,S/O CANDINATE MIDDLE NAME,29,S/O CANDINATE MIDDLE NAME,,,,
|
33
|
+
candidate_prefix,29,S/O CANDIDATE PREFIX,30,S/O CANDIDATE PREFIX,,,,
|
34
|
+
candidate_suffix,30,S/O CANDIDATE SUFFIX,31,S/O CANDIDATE SUFFIX,,,,
|
35
|
+
candidate_office,31,S/O CANDIDATE OFFICE,32,S/O CANDIDATE OFFICE,16,S/O CAN/OFFICE,16,S/O CAN/OFFICE
|
36
|
+
candidate_state,32,S/O CANDIDATE STATE,33,S/O CANDIDATE STATE,17,S/O CAN/STATE,17,S/O CAN/STATE
|
37
|
+
candidate_district,33,S/O CANDIDATE DISTRICT,34,S/O CANDIDATE DISTRICT,18,S/O CAN/DIST,18,S/O CAN/DIST
|
38
|
+
conduit_name,,,,,25,CONDUIT NAME,25,CONDUIT NAME
|
39
|
+
conduit_street_1,,,,,26,CONDUIT STREET 1,26,CONDUIT STREET 1
|
40
|
+
conduit_street_2,,,,,27,CONDUIT STREET 2,27,CONDUIT STREET 2
|
41
|
+
conduit_city,,,,,28,CONDUIT CITY,28,CONDUIT CITY
|
42
|
+
conduit_state,,,,,29,CONDUIT STATE,29,CONDUIT STATE
|
43
|
+
conduit_zip,,,,,30,CONDUIT ZIP,30,CONDUIT ZIP
|
44
|
+
amended_code,,,,,,,31,AMENDED CD
|
@@ -0,0 +1,5 @@
|
|
1
|
+
HDRFEC8.0FECfile8.0.1.0(f28)
|
2
|
+
F24NC00504241489-9-9 FUND2776 S ARLINGTON MILL DRIVE #806ARLINGTONVA22206MACKENZIESCOTT B20111112
|
3
|
+
SEC00504241SE.4174ORGAINSLEY SHEA1295 BANDANA BLVD N #240ST PAULMN55108P20122011111225000.003915.00IOWA CABLE TV BUY 004C00504241SP00003608CAINHERMANP00MACKENZIESCOTT B20111112
|
4
|
+
SEC00504241SE.4173ORGINFOCISION MANAGEMENT CORP325 SPRINGSIDE DRIVEAKRONOH44333P2012201111123915.003915.00VOTER CONTACT & ID (EST. COST)004C00504241SP00003608CAINHERMANP00MACKENZIESCOTT B20111112
|
5
|
+
SEC00504241SE.4175ORGINTERMARKETS INC11911 FREEDOM DRIVESUITE 1140RESTONVA20190P2012201111125000.003915.00ONLINE ADS004C00504241SP00003608CAINHERMANP00MACKENZIESCOTT B20111112
|
data/spec/filing_spec.rb
CHANGED
@@ -7,6 +7,8 @@ describe Fech::Filing do
|
|
7
7
|
@filing.stubs(:file_path).returns(File.join(File.dirname(__FILE__), 'data', '723604.fec'))
|
8
8
|
@filing8 = Fech::Filing.new(748730)
|
9
9
|
@filing8.stubs(:file_path).returns(File.join(File.dirname(__FILE__), 'data', '748730.fec'))
|
10
|
+
@filing_ie = Fech::Filing.new(752356)
|
11
|
+
@filing_ie.stubs(:file_path).returns(File.join(File.dirname(__FILE__), 'data', '752356.fec'))
|
10
12
|
end
|
11
13
|
|
12
14
|
describe "#filing_version" do
|
@@ -14,6 +16,7 @@ describe Fech::Filing do
|
|
14
16
|
it "should return the correct filing version" do
|
15
17
|
@filing.send(:filing_version).should == "7.0"
|
16
18
|
@filing8.send(:filing_version).should == "8.0"
|
19
|
+
@filing_ie.send(:filing_version).should == "8.0"
|
17
20
|
end
|
18
21
|
|
19
22
|
it "should parse the file only once" do
|
@@ -41,6 +44,8 @@ describe Fech::Filing do
|
|
41
44
|
sum = @filing.summary
|
42
45
|
sum.should be_a_kind_of(Hash)
|
43
46
|
sum[:form_type].should == "F3PN"
|
47
|
+
sum_ie = @filing_ie.summary
|
48
|
+
sum_ie[:form_type].should == "F24N"
|
44
49
|
end
|
45
50
|
end
|
46
51
|
|
@@ -65,6 +70,7 @@ describe Fech::Filing do
|
|
65
70
|
@filing.rows_like(/^sa/).size.should == 1
|
66
71
|
@filing.rows_like(/^s/).size.should == 2
|
67
72
|
@filing.rows_like(/^sc/).size.should == 0
|
73
|
+
@filing_ie.rows_like(/^se/).size.should == 3
|
68
74
|
end
|
69
75
|
|
70
76
|
it "should return an array if no block is given" do
|
@@ -124,6 +130,8 @@ describe Fech::Filing do
|
|
124
130
|
map = @filing.map_for(/sa/)
|
125
131
|
map.class.should == Array
|
126
132
|
map.first.should == :form_type
|
133
|
+
map_ie = @filing_ie.map_for(/se/)
|
134
|
+
map_ie[21].should == :calendar_y_t_d_per_election_office
|
127
135
|
end
|
128
136
|
|
129
137
|
it "should raise error if no map is found" do
|
@@ -160,6 +168,12 @@ describe Fech::Filing do
|
|
160
168
|
@f3p_row = f.readline.split(@filing.delimiter)
|
161
169
|
@sa_row = f.readline.split(@filing.delimiter)
|
162
170
|
f.close
|
171
|
+
|
172
|
+
f_ie = open(@filing_ie.file_path, 'r')
|
173
|
+
f_ie.readline
|
174
|
+
@f24_row = f_ie.readline.split(@filing_ie.delimiter)
|
175
|
+
@se_row = f_ie.readline.split(@filing_ie.delimiter)
|
176
|
+
f_ie.close
|
163
177
|
end
|
164
178
|
|
165
179
|
it "should map the data in row to named values according to row_map" do
|
@@ -169,6 +183,13 @@ describe Fech::Filing do
|
|
169
183
|
|
170
184
|
mapped[:form_type].should == "SA17A"
|
171
185
|
mapped[:contributor_state].should == "SC"
|
186
|
+
|
187
|
+
row_map_ie = @filing_ie.send(:mappings).for_row(@se_row.first)
|
188
|
+
mapped_ie = @filing_ie.send(:map, @se_row)
|
189
|
+
mapped_ie.should be_a_kind_of(Hash)
|
190
|
+
|
191
|
+
mapped_ie[:form_type].should == "SE"
|
192
|
+
mapped_ie[:candidate_id_number].should == "P00003608"
|
172
193
|
end
|
173
194
|
|
174
195
|
it "should perform conversion translations" do
|
data/spec/mappings_spec.rb
CHANGED
@@ -9,7 +9,7 @@ describe Fech::Mappings do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should return the correct row_map" do
|
12
|
-
@mappings.for_row("sa").should == @mappings.map["^sa"]["^
|
12
|
+
@mappings.for_row("sa").should == @mappings.map["^sa"]["^8.0"]
|
13
13
|
@mappings.for_row("f3p31").should_not == @mappings.for_row("f3p")
|
14
14
|
end
|
15
15
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
canonical,^8.0,,^7.0|6.4|6.3|6.2|6.1,,^5.0|5.1|5.2|5.3,,^3,
|
2
|
+
form_type,1,FORM TYPE,1,FORM TYPE,1,FORM TYPE,1,FORM TYPE
|
3
|
+
filer_committee_id_number,2,FILER COMMITTEE ID NUMBER,2,FILER COMMITTEE ID NUMBER,2,FILER COMMITTEE ID NUMBER,2,FILER FEC CMTE ID
|
4
|
+
report_type,3,REPORT TYPE {24/48 Hour},3,REPORT TYPE {24/48 Hour},11,REPORT TYPE,,
|
5
|
+
original_amendment_date,4,ORIGINAL AMENDMENT DATE,,
|
6
|
+
committee_name,5,COMMITTEE NAME,4,COMMITTEE NAME,3,COMMITTEE NAME,3,COMMITTEE NAME
|
7
|
+
street_1,6,STREET 1,5,STREET 1,4,STREET 1,4,STREET 1
|
8
|
+
street_2,7,STREET 1,6,STREET 2,5,STREET 2,5,STREET 2
|
9
|
+
city,8,CITY,7,CITY,6,CITY,6,CITY
|
10
|
+
state,9,STATE,8,STATE,7,STATE,7,STATE
|
11
|
+
zip,10,ZIP,9,ZIP,8,ZIP,8,ZIP
|
12
|
+
treasurer_name,,,,9,NAME/TREASURER (as signed),9,NAME/TREASURER (as signed)
|
13
|
+
treasurer_last_name,11,TREASURER LAST NAME,10,TREASURER LAST NAME,,,,
|
14
|
+
treasurer_first_name,12,TREASURER FIRST NAME,11,TREASURER FIRST NAME,,,,
|
15
|
+
treasurer_middle_name,13,TREASURER MIDDLE NAME,12,TREASURER MIDDLE NAME,,,,
|
16
|
+
treasurer_prefix,14,TREASURER PREFIX,13,TREASURER PREFIX,,,,
|
17
|
+
treasurer_suffix,15,TREASURER SUFFIX,14,TREASURER SUFFIX,,,,
|
18
|
+
date_signed,16,DATE SIGNED,15,DATE SIGNED,10,DATE (Signed),10,DATE (Signed)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fech
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Strickland
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-11-
|
20
|
+
date: 2011-11-13 00:00:00 -05:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -177,10 +177,14 @@ files:
|
|
177
177
|
- lib/fech/rendered_maps.rb
|
178
178
|
- lib/fech/translator.rb
|
179
179
|
- lib/fech/version.rb
|
180
|
+
- sources/F24.csv
|
180
181
|
- sources/F3P.csv
|
181
182
|
- sources/F3P31.csv
|
182
183
|
- sources/F3PS.csv
|
183
184
|
- sources/F3S.csv
|
185
|
+
- sources/F5.csv
|
186
|
+
- sources/F56.csv
|
187
|
+
- sources/F57.csv
|
184
188
|
- sources/HDR.csv
|
185
189
|
- sources/SchA.csv
|
186
190
|
- sources/SchB.csv
|
@@ -205,6 +209,7 @@ files:
|
|
205
209
|
- sources/headers/ignore.csv
|
206
210
|
- spec/data/723604.fec
|
207
211
|
- spec/data/748730.fec
|
212
|
+
- spec/data/752356.fec
|
208
213
|
- spec/data/97405.fec
|
209
214
|
- spec/default_translations_spec.rb
|
210
215
|
- spec/fech_utils_spec.rb
|
@@ -212,6 +217,7 @@ files:
|
|
212
217
|
- spec/map_generator_spec.rb
|
213
218
|
- spec/mapped_spec.rb
|
214
219
|
- spec/mappings_spec.rb
|
220
|
+
- spec/sources/F24.csv
|
215
221
|
- spec/sources/F3P.csv
|
216
222
|
- spec/sources/F3P31.csv
|
217
223
|
- spec/sources/SchA.csv
|
@@ -263,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
263
269
|
requirements: []
|
264
270
|
|
265
271
|
rubyforge_project: fech
|
266
|
-
rubygems_version: 1.
|
272
|
+
rubygems_version: 1.6.2
|
267
273
|
signing_key:
|
268
274
|
specification_version: 3
|
269
275
|
summary: Ruby library for parsing FEC filings.
|