Skip to content

Commit

Permalink
Merge pull request #329 from fecgov/release/sprint-50
Browse files Browse the repository at this point in the history
Release/sprint 50
  • Loading branch information
toddlees authored Nov 13, 2024
2 parents d5bea21 + 3638581 commit 2a88253
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 20 deletions.
70 changes: 70 additions & 0 deletions fecfile_validate_python/tests/sample_independent_expenditure.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"children": [],
"transaction_id": "123",
"form_type": "SE",
"filer_committee_id_number": "C12345678",
"transaction_type_identifier": "INDEPENDENT_EXPENDITURE_CREDIT_CARD_PAYMENT",
"aggregation_group": "INDEPENDENT_EXPENDITURE",
"schema_name": "INDEPENDENT_EXPENDITURE_PARENTS",
"entity_type": "ORG",
"payee_organization_name": "1",
"payee_street_1": "1",
"payee_street_2": null,
"payee_city": "1",
"payee_state": "AZ",
"payee_zip": "1",
"election_code": "G1234",
"election_other_description": null,
"dissemination_date": "2024-10-01",
"expenditure_amount": 1,
"disbursement_date": null,
"expenditure_purpose_descrip": "Credit Card: See Below",
"category_code": null,
"support_oppose_code": "S",
"so_candidate_id_number": "P01234567",
"so_candidate_last_name": "last",
"so_candidate_first_name": "first",
"so_candidate_middle_name": null,
"so_candidate_prefix": null,
"so_candidate_suffix": null,
"so_candidate_office": "P",
"so_candidate_state": null,
"so_candidate_district": null,
"completing_last_name": "1",
"completing_first_name": "1",
"completing_middle_name": null,
"completing_prefix": null,
"completing_suffix": null,
"date_signed": "2024-10-23",
"memo_code": true,
"organization_name": null,
"street_1": null,
"street_2": null,
"city": null,
"state": null,
"zip": null,
"candidate_fec_id": null,
"candidate_last_name": null,
"candidate_first_name": null,
"candidate_middle_name": null,
"candidate_prefix": null,
"candidate_suffix": null,
"candidate_office": null,
"candidate_state": null,
"candidate_district": null,
"date": null,
"amount": null,
"purpose_description": null,
"text4000": null,
"signatory_1_last_name": null,
"signatory_1_first_name": null,
"signatory_1_middle_name": null,
"signatory_1_prefix": null,
"signatory_1_suffix": null,
"signatory_1_date": null,
"aggregate": null,
"date2": null,
"calendar_ytd": null,
"schedule_id": "E",
"calendar_ytd_per_election_office": 0
}
23 changes: 23 additions & 0 deletions fecfile_validate_python/tests/test_ie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import pytest
import json
import os
from fecfile_validate_python.src.fecfile_validate import validate


@pytest.fixture
def sample_ie():
with open(
os.path.join(os.path.dirname(__file__), "sample_independent_expenditure.json")
) as f:
form_data = json.load(f)
return form_data


def test_ie(sample_ie):
validation_result = validate.validate("INDEPENDENT_EXPENDITURE_PARENTS", sample_ie)
# pass if election code is Gxxxx without candidate state
assert validation_result.errors == []
sample_ie["election_code"] = "P2020"
validation_result = validate.validate("INDEPENDENT_EXPENDITURE_PARENTS", sample_ie)
# faile if election code is Pxxxx without candidate state
assert validation_result.errors[0].path == "so_candidate_state"
12 changes: 6 additions & 6 deletions schema/F1M.json
Original file line number Diff line number Diff line change
Expand Up @@ -1211,16 +1211,16 @@
"FIELD_FORM_ASSOCIATION": null
}
},
"date_of_original_registration": {
"title": "DATE OF ORIGINAL REGISTRATION",
"date_of_51st_contributor": {
"title": "DATE OF 51ST CONTRIBUTOR",
"description": "",
"type": ["string", "null"],
"minLength": 0,
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
"examples": [20120729],
"fec_spec": {
"COL_SEQ": 63,
"FIELD_DESCRIPTION": "DATE OF ORIGINAL REGISTRATION",
"FIELD_DESCRIPTION": "DATE OF 51ST CONTRIBUTOR",
"TYPE": "NUM-8",
"REQUIRED": "X (conditional error)",
"SAMPLE_DATA": 20120729,
Expand All @@ -1229,16 +1229,16 @@
"FIELD_FORM_ASSOCIATION": null
}
},
"date_of_51st_contributor": {
"title": "DATE OF 51ST CONTRIBUTOR",
"date_of_original_registration": {
"title": "DATE OF ORIGINAL REGISTRATION",
"description": "",
"type": ["string", "null"],
"minLength": 0,
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
"examples": [20120729],
"fec_spec": {
"COL_SEQ": 64,
"FIELD_DESCRIPTION": "DATE OF 51ST CONTRIBUTOR",
"FIELD_DESCRIPTION": "DATE OF ORIGINAL REGISTRATION",
"TYPE": "NUM-8",
"REQUIRED": "X (conditional error)",
"SAMPLE_DATA": 20120729,
Expand Down
5 changes: 4 additions & 1 deletion schema/INDEPENDENT_EXPENDITURE_PARENTS.json
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,10 @@
"so_candidate_state": {
"title": "S/O CANDIDATE STATE",
"description": "",
"type": "string",
"type": [
"string",
"null"
],
"minLength": 1,
"maxLength": 2,
"pattern": "^[ -~]{0,2}$",
Expand Down
80 changes: 67 additions & 13 deletions schema/SchC2.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,60 @@
"FIELD_FORM_ASSOCIATION": null
}
},
"guarantor_entity": {
"title": "GUARANTOR ENTITY",
"description": "",
"type": "string",
"minLength": 1,
"maxLength": 3,
"pattern": "^[ -~]{0,3}$",
"examples": ["CCM"],
"fec_spec": {
"COL_SEQ": 5,
"FIELD_DESCRIPTION": "ENTITY TYPE",
"TYPE": "A/N-3",
"REQUIRED": "X (error)",
"SAMPLE_DATA": "IND",
"VALUE_REFERENCE": "CAN,CCM,...",
"RULE_REFERENCE": "CAN | CCM | COM | IND | ORG | PAC | PTY"
}
},
"guarantor_organization_name": {
"title": "GUARANTOR ORGANIZATION NAME",
"description": "",
"type": "string",
"minLength": 1,
"maxLength": 200,
"pattern": "^[ -~]{0,200}$",
"examples": ["The Bank of Banks"],
"fec_spec": {
"COL_SEQ": 6,
"FIELD_DESCRIPTION": "GUARANTOR ORGANIZATION NAME",
"TYPE": "A/N-200",
"REQUIRED": "X (conditional error)",
"SAMPLE_DATA": "The Bank of Banks",
"VALUE_REFERENCE": null,
"RULE_REFERENCE": "Required if NOT [IND|CAN]"
}
},
"guarantor_committee_fec_id": {
"title": "GUARANTOR COMMITTEE FEC ID",
"description": "",
"type": "string",
"minLength": 9,
"maxLength": 9,
"pattern": "^(?:[PC][0-9]{8}|[HS][0-9]{1}[A-Z]{2}[0-9]{5})$",
"fec_spec": {
"COL_SEQ": 7,
"FIELD_DESCRIPTION": "GUARANTOR COMMITTEE FEC ID",
"TYPE": "A/N-9",
"REQUIRED": "X (error)",
"SAMPLE_DATA": "C00123456",
"VALUE_REFERENCE": "CCM,PAC,PTY",
"RULE_REFERENCE": "Required if CCM, PAC, or PTY",
"FIELD_FORM_ASSOCIATION": null
}
},
"guarantor_last_name": {
"title": "GUARANTOR LAST NAME",
"description": "",
Expand All @@ -122,7 +176,7 @@
"pattern": "^[ -~]{0,30}$",
"examples": ["Smith"],
"fec_spec": {
"COL_SEQ": 5,
"COL_SEQ": 8,
"FIELD_DESCRIPTION": "GUARANTOR LAST NAME",
"TYPE": "A/N-30",
"REQUIRED": "X (error)",
Expand All @@ -141,7 +195,7 @@
"pattern": "^[ -~]{0,20}$",
"examples": ["John"],
"fec_spec": {
"COL_SEQ": 6,
"COL_SEQ": 9,
"FIELD_DESCRIPTION": "GUARANTOR FIRST NAME",
"TYPE": "A/N-20",
"REQUIRED": "X (error)",
Expand All @@ -160,7 +214,7 @@
"pattern": "^[ -~]{0,20}$",
"examples": ["W"],
"fec_spec": {
"COL_SEQ": 7,
"COL_SEQ": 10,
"FIELD_DESCRIPTION": "GUARANTOR MIDDLE NAME",
"TYPE": "A/N-20",
"REQUIRED": null,
Expand All @@ -179,7 +233,7 @@
"pattern": "^[ -~]{0,10}$",
"examples": ["Dr"],
"fec_spec": {
"COL_SEQ": 8,
"COL_SEQ": 11,
"FIELD_DESCRIPTION": "GUARANTOR PREFIX",
"TYPE": "A/N-10",
"REQUIRED": null,
Expand All @@ -198,7 +252,7 @@
"pattern": "^[ -~]{0,10}$",
"examples": ["Jr"],
"fec_spec": {
"COL_SEQ": 9,
"COL_SEQ": 12,
"FIELD_DESCRIPTION": "GUARANTOR SUFFIX",
"TYPE": "A/N-10",
"REQUIRED": null,
Expand All @@ -217,7 +271,7 @@
"pattern": "^[ -~]{0,34}$",
"examples": ["123 Main Street"],
"fec_spec": {
"COL_SEQ": 10,
"COL_SEQ": 13,
"FIELD_DESCRIPTION": "GUARANTOR STREET 1",
"TYPE": "A/N-34",
"REQUIRED": "X (error)",
Expand All @@ -235,7 +289,7 @@
"maxLength": 34,
"pattern": "^[ -~]{0,34}$",
"fec_spec": {
"COL_SEQ": 11,
"COL_SEQ": 14,
"FIELD_DESCRIPTION": "GUARANTOR STREET 2",
"TYPE": "A/N-34",
"REQUIRED": null,
Expand All @@ -254,7 +308,7 @@
"pattern": "^[ -~]{0,30}$",
"examples": ["Anytown"],
"fec_spec": {
"COL_SEQ": 12,
"COL_SEQ": 15,
"FIELD_DESCRIPTION": "GUARANTOR CITY",
"TYPE": "A/N-30",
"REQUIRED": "X (error)",
Expand All @@ -273,7 +327,7 @@
"pattern": "^[ -~]{0,2}$",
"examples": ["WA"],
"fec_spec": {
"COL_SEQ": 13,
"COL_SEQ": 16,
"FIELD_DESCRIPTION": "GUARANTOR STATE",
"TYPE": "A-2",
"REQUIRED": "X (error)",
Expand All @@ -292,7 +346,7 @@
"pattern": "^[ -~]{0,9}$",
"examples": [981110123],
"fec_spec": {
"COL_SEQ": 14,
"COL_SEQ": 17,
"FIELD_DESCRIPTION": "GUARANTOR ZIP",
"TYPE": "A/N-9",
"REQUIRED": "X (error)",
Expand All @@ -311,7 +365,7 @@
"pattern": "^[ -~]{0,38}$",
"examples": ["XYZ Company"],
"fec_spec": {
"COL_SEQ": 15,
"COL_SEQ": 18,
"FIELD_DESCRIPTION": "GUARANTOR EMPLOYER",
"TYPE": "A/N-38",
"REQUIRED": "X(conditional error)",
Expand All @@ -330,7 +384,7 @@
"pattern": "^[ -~]{0,38}$",
"examples": ["QC Inspector"],
"fec_spec": {
"COL_SEQ": 16,
"COL_SEQ": 19,
"FIELD_DESCRIPTION": "GUARANTOR OCCUPATION",
"TYPE": "A/N-38",
"REQUIRED": "X(conditional error)",
Expand All @@ -348,7 +402,7 @@
"maximum": 999999999.99,
"examples": [250],
"fec_spec": {
"COL_SEQ": 17,
"COL_SEQ": 20,
"FIELD_DESCRIPTION": "GUARANTEED AMOUNT",
"TYPE": "AMT-12",
"REQUIRED": "X(error)",
Expand Down

0 comments on commit 2a88253

Please sign in to comment.