From d2d443d527f47c155a9ca1ddac51347bf0ec22e8 Mon Sep 17 00:00:00 2001 From: Mo Sohani Date: Mon, 4 Dec 2023 11:50:54 -0500 Subject: [PATCH 1/6] linting and cleaning errors --- .../tdpservice/parsers/schema_defs/ssp/m2.py | 5 ++--- .../tdpservice/parsers/schema_defs/ssp/m3.py | 8 ++++---- .../tdpservice/parsers/schema_defs/ssp/m5.py | 4 ++-- .../tdpservice/parsers/schema_defs/ssp/m6.py | 6 +++--- .../tdpservice/parsers/schema_defs/ssp/m7.py | 2 +- .../tdpservice/parsers/schema_defs/tanf/t1.py | 2 +- .../tdpservice/parsers/schema_defs/tanf/t2.py | 12 ++++++------ .../tdpservice/parsers/schema_defs/tanf/t3.py | 8 ++++---- .../tdpservice/parsers/schema_defs/tanf/t5.py | 4 ++-- .../tdpservice/parsers/schema_defs/tanf/t7.py | 2 +- 10 files changed, 26 insertions(+), 27 deletions(-) diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py index 25e377e84..d2fdacb80 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py @@ -118,16 +118,15 @@ ]), TransformField(transform_func=ssp_ssn_decryption_func, item="29", name='SSN', type='string', startIndex=29, endIndex=38, required=True, validators=[validators.validateSSN()], - friendly_name="social security number - ssn", is_encrypted=False), + friendly_name="social security number", is_encrypted=False), Field(item="30A", name='RACE_HISPANIC', type='number', startIndex=38, endIndex=39, required=False, friendly_name="race hispanic", validators=[ validators.isInLimits(0, 2) ]), Field(item="30B", name='RACE_AMER_INDIAN', type='number', startIndex=39, endIndex=40, - friendly_name="race american indian", required=False, validators=[ + friendly_name="race american-indian", required=False, validators=[ validators.isInLimits(0, 2) ]), - Field(item="30C", name='RACE_ASIAN', type='number', startIndex=40, endIndex=41, friendly_name="race asian", required=False, validators=[ validators.isInLimits(0, 2) ]), diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m3.py b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m3.py index fa41e5de8..3ae40faa5 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m3.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m3.py @@ -85,7 +85,7 @@ validators.dateMonthIsValid(), ]), TransformField(transform_func=ssp_ssn_decryption_func, item="62", name='SSN', type='string', startIndex=28, - friendly_name="social security number - ssn", endIndex=37, required=True, is_encrypted=False, + friendly_name="social security number", endIndex=37, required=True, is_encrypted=False, validators=[ validators.validateSSN() ]), @@ -94,7 +94,7 @@ validators.isInLimits(0, 2) ]), Field(item="63B", name='RACE_AMER_INDIAN', type='number', startIndex=38, endIndex=39, - friendly_name="race american indian", required=False, validators=[ + friendly_name="race american-indian", required=False, validators=[ validators.isInLimits(0, 2) ]), Field(item="63C", name='RACE_ASIAN', type='number', startIndex=39, endIndex=40, @@ -233,7 +233,7 @@ validators.dateMonthIsValid(), ]), TransformField(transform_func=ssp_ssn_decryption_func, item="62", name='SSN', type='string', startIndex=69, - endIndex=78, required=True, is_encrypted=False, friendly_name="social security number - ssn", + endIndex=78, required=True, is_encrypted=False, friendly_name="social security number", validators=[ validators.validateSSN() ]), @@ -242,7 +242,7 @@ validators.isInLimits(0, 2) ]), Field(item="63B", name='RACE_AMER_INDIAN', type='number', startIndex=79, endIndex=80, - friendly_name="race american indian", required=False, validators=[ + friendly_name="race american-indian", required=False, validators=[ validators.isInLimits(0, 2) ]), Field(item="63C", name='RACE_ASIAN', type='number', startIndex=80, endIndex=81, diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m5.py b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m5.py index 4449c142f..c9c72c3cb 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m5.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m5.py @@ -161,7 +161,7 @@ transform_func=ssp_ssn_decryption_func, item="15", name="SSN", - friendly_name="social security number - ssn", + friendly_name="social security number", type="string", startIndex=28, endIndex=37, @@ -182,7 +182,7 @@ Field( item="16B", name="RACE_AMER_INDIAN", - friendly_name="race american indian", + friendly_name="race american-indian", type="number", startIndex=38, endIndex=39, diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m6.py b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m6.py index 9a7caaebe..7096ace8e 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m6.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m6.py @@ -26,7 +26,7 @@ friendly_name='calendar quarter', required=True, validators=[validators.dateYearIsLargerThan(1998), validators.quarterIsValid()]), TransformField(calendar_quarter_to_rpt_month_year(0), item="2B", name='RPT_MONTH_YEAR', type='number', - friendly_name='reporting month year', + friendly_name='reporting month and year', startIndex=2, endIndex=7, required=True, validators=[validators.dateYearIsLargerThan(1998), validators.dateMonthIsValid()]), Field(item="3A", name='SSPMOE_FAMILIES', type='number', startIndex=7, endIndex=15, @@ -82,7 +82,7 @@ required=True, validators=[validators.dateYearIsLargerThan(1998), validators.quarterIsValid()]), TransformField(calendar_quarter_to_rpt_month_year(1), item="2B", name='RPT_MONTH_YEAR', type='number', - friendly_name='reporting month year', + friendly_name='reporting month and year', startIndex=2, endIndex=7, required=True, validators=[validators.dateYearIsLargerThan(1998), validators.dateMonthIsValid()]), Field(item="3B", name='SSPMOE_FAMILIES', type='number', startIndex=15, endIndex=23, @@ -138,7 +138,7 @@ required=True, validators=[validators.dateYearIsLargerThan(1998), validators.quarterIsValid()]), TransformField(calendar_quarter_to_rpt_month_year(2), item="2B", name='RPT_MONTH_YEAR', type='number', - friendly_name='reporting month year', + friendly_name='reporting month and year', startIndex=2, endIndex=7, required=True, validators=[validators.dateYearIsLargerThan(1998), validators.dateMonthIsValid()]), Field(item="3C", name='SSPMOE_FAMILIES', type='number', startIndex=23, endIndex=31, diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m7.py b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m7.py index b2ec5e21e..cde0c1fc3 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m7.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m7.py @@ -56,7 +56,7 @@ transform_func=calendar_quarter_to_rpt_month_year((i - 1) % 3), item="2A", name="RPT_MONTH_YEAR", - friendly_name="reporting month year", + friendly_name="reporting month and year", type="number", startIndex=2, endIndex=7, diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py index 851ef0792..1bf37e3ce 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py @@ -132,7 +132,7 @@ Field( item="4", name="RPT_MONTH_YEAR", - friendly_name="reporting month year", + friendly_name="reporting month and year", type="number", startIndex=2, endIndex=8, diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py index 0e827e953..2725af62c 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py @@ -127,7 +127,7 @@ Field( item="0", name="RecordType", - friendly_name="record tsype", + friendly_name="record type", type="string", startIndex=0, endIndex=2, @@ -194,7 +194,7 @@ transform_func=tanf_ssn_decryption_func, item="33", name="SSN", - friendly_name="social security number - ssn", + friendly_name="social security number", type="string", startIndex=29, endIndex=38, @@ -297,8 +297,8 @@ Field( item="36C", name="DISABLED_TITLE_XIVAPDT", - friendly_name="Receives Aid to the Permanently and Totally Disabled" + - " Under Title XIV-APDT of the Social Security Act", + friendly_name="receives aid to the permanently and totally disabled" + + " under title xiv-apdt of the social security act", type="string", startIndex=47, endIndex=48, @@ -546,7 +546,7 @@ Field( item="53A", name="WORK_EXPERIENCE_HOP", - friendly_name="work experience hours of participation", + friendly_name="work experience - hours of participation", type="string", startIndex=76, endIndex=78, @@ -558,7 +558,7 @@ Field( item="53B", name="WORK_EXPERIENCE_EA", - friendly_name="work experience excused absence", + friendly_name="work experience - excused absence", type="string", startIndex=78, endIndex=80, diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t3.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t3.py index 6b18652b9..ea5d65e6c 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t3.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t3.py @@ -146,7 +146,7 @@ transform_func=tanf_ssn_decryption_func, item="69", name="SSN", - friendly_name="social security number - ssn", + friendly_name="social security number", type="string", startIndex=28, endIndex=37, @@ -167,7 +167,7 @@ Field( item="70B", name="RACE_AMER_INDIAN", - friendly_name="race american indian", + friendly_name="race american-indian", type="number", startIndex=38, endIndex=39, @@ -450,7 +450,7 @@ transform_func=tanf_ssn_decryption_func, item="69", name="SSN", - friendly_name="social security number - ssn", + friendly_name="social security number", type="string", startIndex=69, endIndex=78, @@ -471,7 +471,7 @@ Field( item="70B", name="RACE_AMER_INDIAN", - friendly_name="race american indian", + friendly_name="race american-indian", type="number", startIndex=79, endIndex=80, diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t5.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t5.py index 8049684a9..1112f6d6b 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t5.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t5.py @@ -162,7 +162,7 @@ transform_func=tanf_ssn_decryption_func, item="16", name="SSN", - friendly_name="social security number - ssn", + friendly_name="social security number", type="string", startIndex=28, endIndex=37, @@ -183,7 +183,7 @@ Field( item="17B", name="RACE_AMER_INDIAN", - friendly_name="race american indian", + friendly_name="race american-indian", type="number", startIndex=38, endIndex=39, diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t7.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t7.py index 9d0aa6056..e6a05bb9a 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t7.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t7.py @@ -56,7 +56,7 @@ transform_func=calendar_quarter_to_rpt_month_year(month_index), item="3A", name="RPT_MONTH_YEAR", - friendly_name="reporting month year", + friendly_name="reporting month and year", type="number", startIndex=2, endIndex=7, From 573a05610b5e22ca6b477a5ac8a8c36334be0360 Mon Sep 17 00:00:00 2001 From: Mo Sohani Date: Mon, 4 Dec 2023 11:51:03 -0500 Subject: [PATCH 2/6] linting --- tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py index d2fdacb80..fe3295e11 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py @@ -127,6 +127,7 @@ friendly_name="race american-indian", required=False, validators=[ validators.isInLimits(0, 2) ]), + Field(item="30C", name='RACE_ASIAN', type='number', startIndex=40, endIndex=41, friendly_name="race asian", required=False, validators=[ validators.isInLimits(0, 2) ]), From b1be7bb9e3849b4c90403968995e1cc9bd7ed52e Mon Sep 17 00:00:00 2001 From: Mo Sohani Date: Mon, 4 Dec 2023 12:00:08 -0500 Subject: [PATCH 3/6] correction on friendly_names --- .../tdpservice/parsers/schema_defs/tanf/t5.py | 2 +- .../tdpservice/parsers/schema_defs/tanf/t6.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t5.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t5.py index 1112f6d6b..63250181c 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t5.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t5.py @@ -392,7 +392,7 @@ Field( item="29", name="AMOUNT_EARNED_INCOME", - friendly_name="amount earnedof income", + friendly_name="amount of earned income", type="string", startIndex=63, endIndex=67, diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t6.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t6.py index 018241fe4..215039fa4 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t6.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t6.py @@ -114,7 +114,7 @@ Field( item="9A", name="NUM_2_PARENTS", - friendly_name="total number of two-parent families", + friendly_name="number of two-parent families", type="number", startIndex=139, endIndex=147, @@ -313,7 +313,7 @@ Field( item="9B", name="NUM_2_PARENTS", - friendly_name="total number of two-parent families", + friendly_name="number of two-parent families", type="number", startIndex=147, endIndex=155, @@ -333,7 +333,7 @@ Field( item="11B", name="NUM_NO_PARENTS", - friendly_name="total number of no-parent family", + friendly_name="total number of no-parent families", type="number", startIndex=195, endIndex=203, @@ -393,7 +393,7 @@ Field( item="17B", name="NUM_OUTWEDLOCK_BIRTHS", - friendly_name="total number of out wedlock births", + friendly_name="total number of out-of-wedlock births", type="number", startIndex=339, endIndex=347, @@ -512,7 +512,7 @@ Field( item="9C", name="NUM_2_PARENTS", - friendly_name="total number of two parents families", + friendly_name="number of two-parent families", type="number", startIndex=155, endIndex=163, @@ -592,7 +592,7 @@ Field( item="17C", name="NUM_OUTWEDLOCK_BIRTHS", - friendly_name="total number of out wedlock births", + friendly_name="total number of out-of-wedlock births", type="number", startIndex=347, endIndex=355, From cad917361bb403c621434b5207fc1a5fef80646b Mon Sep 17 00:00:00 2001 From: Mo Sohani Date: Mon, 4 Dec 2023 12:06:03 -0500 Subject: [PATCH 4/6] corrected friendly_name for test_util --- tdrs-backend/tdpservice/parsers/test/test_util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tdrs-backend/tdpservice/parsers/test/test_util.py b/tdrs-backend/tdpservice/parsers/test/test_util.py index 32584b64a..d029e1c84 100644 --- a/tdrs-backend/tdpservice/parsers/test/test_util.py +++ b/tdrs-backend/tdpservice/parsers/test/test_util.py @@ -407,7 +407,7 @@ def test_multi_record_schema_parses_and_validates(): Field( item=2, name='second', - friendly_name='first', + friendly_name='second', type='string', startIndex=2, endIndex=4, @@ -426,7 +426,7 @@ def test_multi_record_schema_parses_and_validates(): Field( item=3, name='third', - friendly_name='first', + friendly_name='third', type='string', startIndex=4, endIndex=5, @@ -446,7 +446,7 @@ def test_multi_record_schema_parses_and_validates(): Field( item=4, name='fourth', - friendly_name='first', + friendly_name='fourth', type='string', startIndex=4, endIndex=5, From 4bce93dd33bfe430b31b7073da1c070eea06c0b6 Mon Sep 17 00:00:00 2001 From: Mo Sohani Date: Mon, 4 Dec 2023 13:26:14 -0500 Subject: [PATCH 5/6] correction child care - number of months --- tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py index 1bf37e3ce..64c750a22 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py @@ -395,7 +395,7 @@ Field( item="22C", name="CC_NBR_MONTHS", - friendly_name="child care number of months", + friendly_name="child care - number of months", type="number", startIndex=68, endIndex=71, From bd29c099ba6e437a8f7761c04c3986994d88739e Mon Sep 17 00:00:00 2001 From: George Hudson Date: Tue, 5 Dec 2023 10:05:04 -0700 Subject: [PATCH 6/6] fixed a few more typos and some spacing. (#2767) * fixed a few more typos and some spacing. * fixed linting issues * missed a spot. --------- Co-authored-by: George Hudson --- .../tdpservice/parsers/schema_defs/ssp/m1.py | 747 +++++++---- .../tdpservice/parsers/schema_defs/ssp/m2.py | 1093 ++++++++++++----- .../tdpservice/parsers/schema_defs/ssp/m3.py | 767 ++++++++---- .../tdpservice/parsers/schema_defs/ssp/m4.py | 3 +- .../tdpservice/parsers/schema_defs/ssp/m5.py | 3 +- .../tdpservice/parsers/schema_defs/ssp/m6.py | 571 +++++++-- .../tdpservice/parsers/schema_defs/tanf/t1.py | 13 +- .../tdpservice/parsers/schema_defs/tanf/t2.py | 37 +- .../tdpservice/parsers/schema_defs/tanf/t3.py | 3 +- .../tdpservice/parsers/schema_defs/tanf/t4.py | 3 +- .../tdpservice/parsers/schema_defs/tanf/t5.py | 3 +- .../tdpservice/parsers/schema_defs/tanf/t6.py | 60 +- 12 files changed, 2350 insertions(+), 953 deletions(-) diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m1.py b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m1.py index 877ac5518..ea0aaf189 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m1.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m1.py @@ -10,238 +10,525 @@ m1 = SchemaManager( schemas=[ RowSchema( - model=SSP_M1, - preparsing_validators=[ - validators.hasLength(150), - ], - postparsing_validators=[ - validators.if_then_validator( - condition_field='CASH_AMOUNT', condition_function=validators.isLargerThan(0), - result_field='NBR_MONTHS', result_function=validators.isLargerThan(0), - ), - validators.if_then_validator( - condition_field='CC_AMOUNT', condition_function=validators.isLargerThan(0), - result_field='CHILDREN_COVERED', result_function=validators.isLargerThan(0), - ), - validators.if_then_validator( - condition_field='CC_AMOUNT', condition_function=validators.isLargerThan(0), - result_field='CC_NBR_MONTHS', result_function=validators.isLargerThan(0), - ), - validators.if_then_validator( - condition_field='TRANSP_AMOUNT', condition_function=validators.isLargerThan(0), - result_field='TRANSP_NBR_MONTHS', result_function=validators.isLargerThan(0), - ), - validators.if_then_validator( - condition_field='SANC_REDUCTION_AMT', condition_function=validators.isLargerThan(0), - result_field='WORK_REQ_SANCTION', result_function=validators.oneOf((1, 2)), - ), - validators.if_then_validator( - condition_field='SANC_REDUCTION_AMT', condition_function=validators.isLargerThan(0), - result_field='SANC_TEEN_PARENT', result_function=validators.oneOf((1, 2)), - ), - validators.if_then_validator( - condition_field='SANC_REDUCTION_AMT', condition_function=validators.isLargerThan(0), - result_field='NON_COOPERATION_CSE', result_function=validators.oneOf((1, 2)), - ), - validators.if_then_validator( - condition_field='SANC_REDUCTION_AMT', condition_function=validators.isLargerThan(0), - result_field='FAILURE_TO_COMPLY', result_function=validators.oneOf((1, 2)), - ), - validators.if_then_validator( - condition_field='SANC_REDUCTION_AMT', condition_function=validators.isLargerThan(0), - result_field='OTHER_SANCTION', result_function=validators.oneOf((1, 2)), - ), - validators.if_then_validator( - condition_field='OTHER_TOTAL_REDUCTIONS', condition_function=validators.isLargerThan(0), - result_field='FAMILY_CAP', result_function=validators.oneOf((1, 2)), - ), - validators.if_then_validator( - condition_field='OTHER_TOTAL_REDUCTIONS', condition_function=validators.isLargerThan(0), - result_field='REDUCTIONS_ON_RECEIPTS', result_function=validators.oneOf((1, 2)), - ), - validators.if_then_validator( - condition_field='OTHER_TOTAL_REDUCTIONS', condition_function=validators.isLargerThan(0), - result_field='OTHER_NON_SANCTION', result_function=validators.oneOf((1, 2)), - ), - validators.sumIsLarger([ - "AMT_FOOD_STAMP_ASSISTANCE", - "AMT_SUB_CC", - "CASH_AMOUNT", - "CC_AMOUNT", - "CC_NBR_MONTHS" - ], 0) - ], - fields=[ - Field(item="0", name='RecordType', type='string', startIndex=0, endIndex=2, - friendly_name="record type", required=True, validators=[]), - Field(item="3", name='RPT_MONTH_YEAR', type='number', startIndex=2, endIndex=8, - friendly_name="reporting month and year", required=True, validators=[ + model=SSP_M1, + preparsing_validators=[ + validators.hasLength(150), + ], + postparsing_validators=[ + validators.if_then_validator( + condition_field='CASH_AMOUNT', + condition_function=validators.isLargerThan(0), + result_field='NBR_MONTHS', + result_function=validators.isLargerThan(0), + ), + validators.if_then_validator( + condition_field='CC_AMOUNT', + condition_function=validators.isLargerThan(0), + result_field='CHILDREN_COVERED', + result_function=validators.isLargerThan(0), + ), + validators.if_then_validator( + condition_field='CC_AMOUNT', + condition_function=validators.isLargerThan(0), + result_field='CC_NBR_MONTHS', + result_function=validators.isLargerThan(0), + ), + validators.if_then_validator( + condition_field='TRANSP_AMOUNT', + condition_function=validators.isLargerThan(0), + result_field='TRANSP_NBR_MONTHS', + result_function=validators.isLargerThan(0), + ), + validators.if_then_validator( + condition_field='SANC_REDUCTION_AMT', + condition_function=validators.isLargerThan(0), + result_field='WORK_REQ_SANCTION', + result_function=validators.oneOf((1, 2)), + ), + validators.if_then_validator( + condition_field='SANC_REDUCTION_AMT', + condition_function=validators.isLargerThan(0), + result_field='SANC_TEEN_PARENT', + result_function=validators.oneOf((1, 2)), + ), + validators.if_then_validator( + condition_field='SANC_REDUCTION_AMT', + condition_function=validators.isLargerThan(0), + result_field='NON_COOPERATION_CSE', + result_function=validators.oneOf((1, 2)), + ), + validators.if_then_validator( + condition_field='SANC_REDUCTION_AMT', + condition_function=validators.isLargerThan(0), + result_field='FAILURE_TO_COMPLY', + result_function=validators.oneOf((1, 2)), + ), + validators.if_then_validator( + condition_field='SANC_REDUCTION_AMT', + condition_function=validators.isLargerThan(0), + result_field='OTHER_SANCTION', + result_function=validators.oneOf((1, 2)), + ), + validators.if_then_validator( + condition_field='OTHER_TOTAL_REDUCTIONS', + condition_function=validators.isLargerThan(0), + result_field='FAMILY_CAP', + result_function=validators.oneOf((1, 2)), + ), + validators.if_then_validator( + condition_field='OTHER_TOTAL_REDUCTIONS', + condition_function=validators.isLargerThan(0), + result_field='REDUCTIONS_ON_RECEIPTS', + result_function=validators.oneOf((1, 2)), + ), + validators.if_then_validator( + condition_field='OTHER_TOTAL_REDUCTIONS', + condition_function=validators.isLargerThan(0), + result_field='OTHER_NON_SANCTION', + result_function=validators.oneOf((1, 2)), + ), + validators.sumIsLarger([ + "AMT_FOOD_STAMP_ASSISTANCE", + "AMT_SUB_CC", + "CASH_AMOUNT", + "CC_AMOUNT", + "CC_NBR_MONTHS"], 0) + ], + fields=[ + Field( + item="0", + name='RecordType', + friendly_name="record type", + type='string', + startIndex=0, + endIndex=2, + required=True, + validators=[] + ), + Field( + item="3", + name='RPT_MONTH_YEAR', + friendly_name="reporting month and year", + type='number', + startIndex=2, + endIndex=8, + required=True, + validators=[ validators.dateYearIsLargerThan(1998), validators.dateMonthIsValid(), - ]), - Field(item="5", name='CASE_NUMBER', type='string', startIndex=8, endIndex=19, - friendly_name="case number", required=True, validators=[ - validators.isAlphaNumeric() - ]), - Field(item="2", name='COUNTY_FIPS_CODE', type='string', startIndex=19, endIndex=22, - friendly_name="county fips code", required=True, validators=[ - validators.isNumber(), - ]), - Field(item="4", name='STRATUM', type='string', startIndex=22, endIndex=24, - friendly_name="stratum", required=False, validators=[ - validators.isInStringRange(0, 99), - ]), - Field(item="6", name='ZIP_CODE', type='string', startIndex=24, endIndex=29, - friendly_name="zip code", required=True, validators=[ - validators.isNumber(), - ]), - Field(item="7", name='DISPOSITION', type='number', startIndex=29, endIndex=30, - friendly_name="disposition", required=True, validators=[ - validators.oneOf([1, 2]), - ]), - Field(item="8", name='NBR_FAMILY_MEMBERS', type='number', startIndex=30, endIndex=32, - friendly_name="number of family members", required=True, validators=[ - validators.isInLimits(1, 99), - ]), - Field(item="9", name='FAMILY_TYPE', type='number', startIndex=32, endIndex=33, - friendly_name="family type", required=True, validators=[ - validators.isInLimits(1, 3), - ]), - Field(item="10", name='TANF_ASST_IN_6MONTHS', type='number', startIndex=33, endIndex=34, - friendly_name="tanf assistance in 6 months", required=True, validators=[ - validators.isInLimits(1, 3), - ]), - Field(item="11", name='RECEIVES_SUB_HOUSING', type='number', startIndex=34, endIndex=35, - friendly_name="receives subsidized housing", required=True, validators=[ - validators.isInLimits(1, 2), - ]), - Field(item="12", name='RECEIVES_MED_ASSISTANCE', type='number', startIndex=35, endIndex=36, - friendly_name="receives medical assistance", required=True, validators=[ - validators.isInLimits(1, 2), - ]), - Field(item="13", name='RECEIVES_FOOD_STAMPS', type='number', startIndex=36, endIndex=37, - friendly_name="receives food assistance", required=False, validators=[ - validators.isInLimits(0, 2), - ]), - Field(item="14", name='AMT_FOOD_STAMP_ASSISTANCE', type='number', startIndex=37, endIndex=41, - friendly_name="amount of food stamp assistance/stamps", required=True, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="15", name='RECEIVES_SUB_CC', type='number', startIndex=41, endIndex=42, - friendly_name="receives subsidized child care", required=False, validators=[ - validators.isInLimits(0, 2), - ]), - Field(item="16", name='AMT_SUB_CC', type='number', startIndex=42, endIndex=46, - friendly_name="amount of subsidized child care", required=True, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="17", name='CHILD_SUPPORT_AMT', type='number', startIndex=46, endIndex=50, - friendly_name="child support amount", required=True, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="18", name='FAMILY_CASH_RESOURCES', type='number', startIndex=50, endIndex=54, - friendly_name="family cash resources", required=True, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="19A", name='CASH_AMOUNT', type='number', startIndex=54, endIndex=58, - friendly_name="cash amount", required=True, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="19B", name='NBR_MONTHS', type='number', startIndex=58, endIndex=61, - friendly_name="number of months", required=True, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="20A", name='CC_AMOUNT', type='number', startIndex=61, endIndex=65, - friendly_name="child care amount", required=True, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="20B", name='CHILDREN_COVERED', type='number', startIndex=65, endIndex=67, - friendly_name="children covered", required=True, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="20C", name='CC_NBR_MONTHS', type='number', startIndex=67, endIndex=70, - friendly_name="child care - number of months", required=True, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="21A", name='TRANSP_AMOUNT', type='number', startIndex=70, endIndex=74, - friendly_name="transportation amount", required=True, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="21B", name='TRANSP_NBR_MONTHS', type='number', startIndex=74, endIndex=77, - friendly_name="transportation number of months", required=True, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="22A", name='TRANSITION_SERVICES_AMOUNT', type='number', startIndex=77, endIndex=81, - friendly_name="transition services amount", required=False, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="22B", name='TRANSITION_NBR_MONTHS', type='number', startIndex=81, endIndex=84, - friendly_name="transition services number of months", required=False, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="23A", name='OTHER_AMOUNT', type='number', startIndex=84, endIndex=88, - friendly_name="other amount", required=False, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="23B", name='OTHER_NBR_MONTHS', type='number', startIndex=88, endIndex=91, - friendly_name="other number of months", required=False, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="24AI", name='SANC_REDUCTION_AMT', type='number', startIndex=91, endIndex=95, - friendly_name="sanction reduction amount", required=True, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="24AII", name='WORK_REQ_SANCTION', type='number', startIndex=95, endIndex=96, - friendly_name="work requirements sanction", required=True, validators=[ - validators.oneOf([1, 2]), - ]), - Field(item="24AIII", name='FAMILY_SANC_ADULT', type='number', startIndex=96, endIndex=97, - friendly_name="family sanction for adult", required=False, validators=[ - validators.isInLimits(0, 9), - ]), - Field(item="24AIV", name='SANC_TEEN_PARENT', type='number', startIndex=97, endIndex=98, - friendly_name="sanction for teen parent", required=True, validators=[ - validators.oneOf([1, 2]), - ]), - Field(item="24AV", name='NON_COOPERATION_CSE', type='number', startIndex=98, endIndex=99, - friendly_name="non-cooperation with child support", required=True, validators=[ - validators.oneOf([1, 2]), - ]), - Field(item="24AVI", name='FAILURE_TO_COMPLY', type='number', startIndex=99, endIndex=100, - friendly_name="failure to comply", required=True, validators=[ - validators.oneOf([1, 2]), - ]), - Field(item="24AVII", name='OTHER_SANCTION', type='number', startIndex=100, endIndex=101, - friendly_name="other sanction", required=True, validators=[ - validators.oneOf([1, 2]), - ]), - Field(item="24B", name='RECOUPMENT_PRIOR_OVRPMT', type='number', startIndex=101, endIndex=105, - friendly_name="recoupment prior overpayment", required=True, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="24CI", name='OTHER_TOTAL_REDUCTIONS', type='number', startIndex=105, endIndex=109, - friendly_name="other total reductions", required=True, validators=[ - validators.isLargerThanOrEqualTo(0), - ]), - Field(item="24CII", name='FAMILY_CAP', type='number', startIndex=109, endIndex=110, - friendly_name="family cap", required=True, validators=[ - validators.oneOf([1, 2]), - ]), - Field(item="24CIII", name='REDUCTIONS_ON_RECEIPTS', type='number', startIndex=110, endIndex=111, - friendly_name="reductions on receipts", required=True, validators=[ - validators.oneOf([1, 2]), - ]), - Field(item="24CIV", name='OTHER_NON_SANCTION', type='number', startIndex=111, endIndex=112, - friendly_name="other, non sanction", required=True, validators=[ - validators.oneOf([1, 2]), - ]), - Field(item="25", name='WAIVER_EVAL_CONTROL_GRPS', type='number', startIndex=112, endIndex=113, - friendly_name="waiver evaluation experimental and control groups", required=False, validators=[ - validators.isInLimits(0, 9), - ]), - Field(item="-1", name='BLANK', type='string', startIndex=113, endIndex=150, - friendly_name="blank", required=False, validators=[]), - ] + ] + ), + Field( + item="5", + name='CASE_NUMBER', + friendly_name="case number", + type='string', + startIndex=8, + endIndex=19, + required=True, + validators=[validators.isAlphaNumeric()] + ), + Field( + item="2", + name='COUNTY_FIPS_CODE', + friendly_name="county fips code", + type='string', + startIndex=19, + endIndex=22, + required=True, + validators=[validators.isNumber(),] + ), + Field( + item="4", + name='STRATUM', + friendly_name="stratum", + type='string', + startIndex=22, + endIndex=24, + required=False, + validators=[validators.isInStringRange(0, 99),] + ), + Field( + item="6", + name='ZIP_CODE', + friendly_name="zip code", + type='string', + startIndex=24, + endIndex=29, + required=True, + validators=[validators.isNumber(),] + ), + Field( + item="7", + name='DISPOSITION', + friendly_name="disposition", + type='number', + startIndex=29, + endIndex=30, + required=True, + validators=[validators.oneOf([1, 2]),] + ), + Field( + item="8", + name='NBR_FAMILY_MEMBERS', + friendly_name="number of family members", + type='number', + startIndex=30, + endIndex=32, + required=True, + validators=[validators.isInLimits(1, 99),] + ), + Field( + item="9", + name='FAMILY_TYPE', + friendly_name="family type", + type='number', + startIndex=32, + endIndex=33, + required=True, + validators=[validators.isInLimits(1, 3),] + ), + Field( + item="10", + name='TANF_ASST_IN_6MONTHS', + friendly_name="tanf assistance in 6 months", + type='number', + startIndex=33, + endIndex=34, + required=True, + validators=[validators.isInLimits(1, 3),] + ), + Field( + item="11", + name='RECEIVES_SUB_HOUSING', + friendly_name="receives subsidized housing", + type='number', + startIndex=34, + endIndex=35, + required=True, + validators=[validators.isInLimits(1, 2),] + ), + Field( + item="12", + name='RECEIVES_MED_ASSISTANCE', + friendly_name="receives medical assistance", + type='number', + startIndex=35, + endIndex=36, + required=True, + validators=[validators.isInLimits(1, 2),] + ), + Field( + item="13", + name='RECEIVES_FOOD_STAMPS', + friendly_name="receives food assistance", + type='number', + startIndex=36, + endIndex=37, + required=False, + validators=[validators.isInLimits(0, 2),] + ), + Field( + item="14", + name='AMT_FOOD_STAMP_ASSISTANCE', + friendly_name="amount of food stamp assistance/stamps", + type='number', + startIndex=37, + endIndex=41, + required=True, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="15", + name='RECEIVES_SUB_CC', + friendly_name="receives subsidized child care", + type='number', + startIndex=41, + endIndex=42, + required=False, + validators=[validators.isInLimits(0, 2),] + ), + Field( + item="16", + name='AMT_SUB_CC', + friendly_name="amount of subsidized child care", + type='number', + startIndex=42, + endIndex=46, + required=True, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="17", + name='CHILD_SUPPORT_AMT', + friendly_name="child support amount", + type='number', + startIndex=46, + endIndex=50, + required=True, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="18", + name='FAMILY_CASH_RESOURCES', + friendly_name="family cash resources", + type='number', + startIndex=50, + endIndex=54, + required=True, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="19A", + name='CASH_AMOUNT', + friendly_name="cash amount", + type='number', + startIndex=54, + endIndex=58, + required=True, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="19B", + name='NBR_MONTHS', + friendly_name="number of months", + type='number', + startIndex=58, + endIndex=61, + required=True, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="20A", + name='CC_AMOUNT', + friendly_name="child care amount", + type='number', + startIndex=61, + endIndex=65, + required=True, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="20B", + name='CHILDREN_COVERED', + friendly_name="children covered", + type='number', + startIndex=65, + endIndex=67, + required=True, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="20C", + name='CC_NBR_MONTHS', + friendly_name="child care - number of months", + type='number', + startIndex=67, + endIndex=70, + required=True, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="21A", + name='TRANSP_AMOUNT', + friendly_name="transportation amount", + type='number', + startIndex=70, + endIndex=74, + required=True, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="21B", + name='TRANSP_NBR_MONTHS', + friendly_name="transportation - number of months", + type='number', + startIndex=74, + endIndex=77, + required=True, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="22A", + name='TRANSITION_SERVICES_AMOUNT', + friendly_name="transition services amount", + type='number', + startIndex=77, + endIndex=81, + required=False, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="22B", + name='TRANSITION_NBR_MONTHS', + friendly_name="transition services - number of months", + type='number', + startIndex=81, + endIndex=84, + required=False, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="23A", + name='OTHER_AMOUNT', + friendly_name="other amount", + type='number', + startIndex=84, + endIndex=88, + required=False, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="23B", + name='OTHER_NBR_MONTHS', + friendly_name="other - number of months", + type='number', + startIndex=88, + endIndex=91, + required=False, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="24AI", + name='SANC_REDUCTION_AMT', + friendly_name="sanction reduction amount", + type='number', + startIndex=91, + endIndex=95, + required=True, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="24AII", + name='WORK_REQ_SANCTION', + friendly_name="work requirements sanction", + type='number', + startIndex=95, + endIndex=96, + required=True, + validators=[validators.oneOf([1, 2]),] + ), + Field( + item="24AIII", + name='FAMILY_SANC_ADULT', + friendly_name="family sanction for adult", + type='number', + startIndex=96, + endIndex=97, + required=False, + validators=[validators.isInLimits(0, 9),] + ), + Field( + item="24AIV", + name='SANC_TEEN_PARENT', + friendly_name="sanction for teen parent", + type='number', + startIndex=97, + endIndex=98, + required=True, + validators=[validators.oneOf([1, 2]),] + ), + Field( + item="24AV", + name='NON_COOPERATION_CSE', + friendly_name="non-cooperation with child support", + type='number', + startIndex=98, + endIndex=99, + required=True, + validators=[validators.oneOf([1, 2]),] + ), + Field( + item="24AVI", + name='FAILURE_TO_COMPLY', + friendly_name="failure to comply", + type='number', + startIndex=99, + endIndex=100, + required=True, + validators=[validators.oneOf([1, 2]),] + ), + Field( + item="24AVII", + name='OTHER_SANCTION', + friendly_name="other sanction", + type='number', + startIndex=100, + endIndex=101, + required=True, + validators=[validators.oneOf([1, 2]),] + ), + Field( + item="24B", + name='RECOUPMENT_PRIOR_OVRPMT', + friendly_name="recoupment prior overpayment", + type='number', + startIndex=101, + endIndex=105, + required=True, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="24CI", + name='OTHER_TOTAL_REDUCTIONS', + friendly_name="other total reductions", + type='number', + startIndex=105, + endIndex=109, + required=True, + validators=[validators.isLargerThanOrEqualTo(0),] + ), + Field( + item="24CII", + name='FAMILY_CAP', + friendly_name="family cap", + type='number', + startIndex=109, + endIndex=110, + required=True, + validators=[validators.oneOf([1, 2]),] + ), + Field( + item="24CIII", + name='REDUCTIONS_ON_RECEIPTS', + friendly_name="reductions on receipts", + type='number', + startIndex=110, + endIndex=111, + required=True, + validators=[validators.oneOf([1, 2]),] + ), + Field( + item="24CIV", + name='OTHER_NON_SANCTION', + friendly_name="other non-sanction", + type='number', + startIndex=111, + endIndex=112, + required=True, + validators=[validators.oneOf([1, 2]),] + ), + Field( + item="25", + name='WAIVER_EVAL_CONTROL_GRPS', + friendly_name="waiver evaluation experimental and control groups", + type='number', + startIndex=112, + endIndex=113, + required=False, + validators=[validators.isInLimits(0, 9),] + ), + Field( + item="-1", + name='BLANK', + friendly_name="blank", + type='string', + startIndex=113, + endIndex=150, + required=False, + validators=[] + ), + ] ) ] ) diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py index fe3295e11..eebfa9e0c 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py @@ -12,361 +12,794 @@ m2 = SchemaManager( schemas=[ RowSchema( - model=SSP_M2, - preparsing_validators=[ - validators.hasLength(150), - ], - postparsing_validators=[ - validators.validate__FAM_AFF__SSN(), - validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.matches(1), - result_field='SSN', result_function=validators.validateSSN(), - ), - validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.isInLimits(1, 3), - result_field='RACE_HISPANIC', result_function=validators.isInLimits(1, 2), - ), - validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.isInLimits(1, 3), - result_field='RACE_AMER_INDIAN', result_function=validators.isInLimits(1, 2), - ), - validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.isInLimits(1, 3), - result_field='RACE_ASIAN', result_function=validators.isInLimits(1, 2), - ), - validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.isInLimits(1, 3), - result_field='RACE_BLACK', result_function=validators.isInLimits(1, 2), - ), - validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.isInLimits(1, 3), - result_field='RACE_HAWAIIAN', result_function=validators.isInLimits(1, 2), - ), - validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.isInLimits(1, 3), - result_field='RACE_WHITE', result_function=validators.isInLimits(1, 2), - ), - validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.isInLimits(1, 3), - result_field='MARITAL_STATUS', result_function=validators.isInLimits(1, 5), - ), - validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.isInLimits(1, 2), - result_field='PARENT_MINOR_CHILD', result_function=validators.isInLimits(1, 3), - ), - validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.isInLimits(1, 3), - result_field='EDUCATION_LEVEL', result_function=validators.or_validators( + model=SSP_M2, + preparsing_validators=[ + validators.hasLength(150), + ], + postparsing_validators=[ + validators.validate__FAM_AFF__SSN(), + validators.if_then_validator( + condition_field='FAMILY_AFFILIATION', + condition_function=validators.matches(1), + result_field='SSN', + result_function=validators.validateSSN(), + ), + validators.if_then_validator( + condition_field='FAMILY_AFFILIATION', + condition_function=validators.isInLimits(1, 3), + result_field='RACE_HISPANIC', + result_function=validators.isInLimits(1, 2), + ), + validators.if_then_validator( + condition_field='FAMILY_AFFILIATION', + condition_function=validators.isInLimits(1, 3), + result_field='RACE_AMER_INDIAN', + result_function=validators.isInLimits(1, 2), + ), + validators.if_then_validator( + condition_field='FAMILY_AFFILIATION', + condition_function=validators.isInLimits(1, 3), + result_field='RACE_ASIAN', + result_function=validators.isInLimits(1, 2), + ), + validators.if_then_validator( + condition_field='FAMILY_AFFILIATION', + condition_function=validators.isInLimits(1, 3), + result_field='RACE_BLACK', + result_function=validators.isInLimits(1, 2), + ), + validators.if_then_validator( + condition_field='FAMILY_AFFILIATION', + condition_function=validators.isInLimits(1, 3), + result_field='RACE_HAWAIIAN', + result_function=validators.isInLimits(1, 2), + ), + validators.if_then_validator( + condition_field='FAMILY_AFFILIATION', + condition_function=validators.isInLimits(1, 3), + result_field='RACE_WHITE', + result_function=validators.isInLimits(1, 2), + ), + validators.if_then_validator( + condition_field='FAMILY_AFFILIATION', + condition_function=validators.isInLimits(1, 3), + result_field='MARITAL_STATUS', + result_function=validators.isInLimits(1, 5), + ), + validators.if_then_validator( + condition_field='FAMILY_AFFILIATION', + condition_function=validators.isInLimits(1, 2), + result_field='PARENT_MINOR_CHILD', + result_function=validators.isInLimits(1, 3), + ), + validators.if_then_validator( + condition_field='FAMILY_AFFILIATION', + condition_function=validators.isInLimits(1, 3), + result_field='EDUCATION_LEVEL', + result_function=validators.or_validators( validators.isInStringRange(1, 16), validators.isInStringRange(98, 99) ), ), - validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.matches(1), - result_field='CITIZENSHIP_STATUS', result_function=validators.oneOf((1, 2)), + validators.if_then_validator( + condition_field='FAMILY_AFFILIATION', + condition_function=validators.matches(1), + result_field='CITIZENSHIP_STATUS', + result_function=validators.oneOf((1, 2)), ), - validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.isInLimits(1, 3), - result_field='COOPERATION_CHILD_SUPPORT', result_function=validators.oneOf((1, 2, 9)), + validators.if_then_validator( + condition_field='FAMILY_AFFILIATION', + condition_function=validators.isInLimits(1, 3), + result_field='COOPERATION_CHILD_SUPPORT', + result_function=validators.oneOf((1, 2, 9)), ), - validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.isInLimits(1, 3), - result_field='EMPLOYMENT_STATUS', result_function=validators.isInLimits(1, 3), + validators.if_then_validator( + condition_field='FAMILY_AFFILIATION', + condition_function=validators.isInLimits(1, 3), + result_field='EMPLOYMENT_STATUS', + result_function=validators.isInLimits(1, 3), ), - validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='WORK_ELIGIBLE_INDICATOR', result_function=validators.or_validators( + validators.if_then_validator( + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='WORK_ELIGIBLE_INDICATOR', + result_function=validators.or_validators( validators.isInLimits(1, 9), validators.oneOf((11, 12)) ), ), - validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='WORK_PART_STATUS', result_function=validators.oneOf([ - 1, 2, 5, 7, 9, - 15, 16, 17, 18, 99 - ]), - ), - validators.if_then_validator( - condition_field='WORK_ELIGIBLE_INDICATOR', condition_function=validators.isInLimits(1, 5), - result_field='WORK_PART_STATUS', result_function=validators.notMatches(99), - ), - ], - fields=[ - Field(item="0", name='RecordType', type='string', startIndex=0, endIndex=2, - friendly_name="record type", required=True, validators=[]), - Field(item="3", name='RPT_MONTH_YEAR', type='number', startIndex=2, endIndex=8, - friendly_name="reporting month and year", required=True, validators=[ + validators.if_then_validator( + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='WORK_PART_STATUS', + result_function=validators.oneOf([1, 2, 5, 7, 9, 15, 16, 17, 18, 99]), + ), + validators.if_then_validator( + condition_field='WORK_ELIGIBLE_INDICATOR', + condition_function=validators.isInLimits(1, 5), + result_field='WORK_PART_STATUS', + result_function=validators.notMatches(99), + ), + ], + fields=[ + Field( + item="0", + name='RecordType', + friendly_name="record type", + type='string', + startIndex=0, + endIndex=2, + required=True, + validators=[] + ), + Field( + item="3", + name='RPT_MONTH_YEAR', + friendly_name="reporting month and year", + type='number', + startIndex=2, + endIndex=8, + required=True, + validators=[ validators.dateYearIsLargerThan(1998), validators.dateMonthIsValid(), - ]), - Field(item="5", name='CASE_NUMBER', type='string', startIndex=8, endIndex=19, - friendly_name="case number", required=True, validators=[ - validators.isAlphaNumeric() - ]), - Field(item="26", name='FAMILY_AFFILIATION', type='number', startIndex=19, endIndex=20, - friendly_name="family affiliation", required=True, validators=[ - validators.oneOf([1, 2, 3, 5]) - ]), - Field(item="27", name='NONCUSTODIAL_PARENT', type='number', startIndex=20, endIndex=21, - friendly_name="noncustodial parent", required=True, validators=[ - validators.oneOf([1, 2]) - ]), - Field(item="28", name='DATE_OF_BIRTH', type='number', startIndex=21, endIndex=29, - friendly_name="date of birth", required=True, validators=[ - validators.isLargerThan(0) - ]), - TransformField(transform_func=ssp_ssn_decryption_func, item="29", name='SSN', type='string', - startIndex=29, endIndex=38, required=True, validators=[validators.validateSSN()], - friendly_name="social security number", is_encrypted=False), - Field(item="30A", name='RACE_HISPANIC', type='number', startIndex=38, endIndex=39, required=False, - friendly_name="race hispanic", validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="30B", name='RACE_AMER_INDIAN', type='number', startIndex=39, endIndex=40, - friendly_name="race american-indian", required=False, validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="30C", name='RACE_ASIAN', type='number', startIndex=40, endIndex=41, - friendly_name="race asian", required=False, validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="30D", name='RACE_BLACK', type='number', startIndex=41, endIndex=42, - friendly_name="race black", required=False, validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="30E", name='RACE_HAWAIIAN', type='number', startIndex=42, endIndex=43, - friendly_name="race hawaiian", required=False, validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="30F", name='RACE_WHITE', type='number', startIndex=43, endIndex=44, - friendly_name="race white", required=False, validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="31", name='GENDER', type='number', startIndex=44, endIndex=45, - friendly_name="gender", required=True, validators=[ - validators.isLargerThanOrEqualTo(0) - ]), - Field(item="32A", name='FED_OASDI_PROGRAM', type='number', startIndex=45, endIndex=46, - friendly_name="federal old-age survivors and disability insurance program", required=True, - validators=[ - validators.oneOf([1, 2]) - ]), - Field(item="32B", name='FED_DISABILITY_STATUS', type='number', startIndex=46, endIndex=47, - friendly_name="federal disability status", required=True, validators=[ - validators.oneOf([1, 2]) - ]), - Field(item="32C", name='DISABLED_TITLE_XIVAPDT', type='number', startIndex=47, endIndex=48, + ] + ), + Field( + item="5", + name='CASE_NUMBER', + friendly_name="case number", + type='string', + startIndex=8, + endIndex=19, + required=True, + validators=[validators.isAlphaNumeric()] + ), + Field( + item="26", + name='FAMILY_AFFILIATION', + friendly_name="family affiliation", + type='number', + startIndex=19, + endIndex=20, + required=True, + validators=[validators.oneOf([1, 2, 3, 5])] + ), + Field( + item="27", + name='NONCUSTODIAL_PARENT', + friendly_name="noncustodial parent", + type='number', + startIndex=20, + endIndex=21, + required=True, + validators=[validators.oneOf([1, 2])] + ), + Field( + item="28", + name='DATE_OF_BIRTH', + friendly_name="date of birth", + type='number', + startIndex=21, + endIndex=29, + required=True, + validators=[validators.isLargerThan(0)] + ), + TransformField( + transform_func=ssp_ssn_decryption_func, + item="29", + name='SSN', + friendly_name="social security number", + type='string', + startIndex=29, + endIndex=38, + required=True, + validators=[validators.validateSSN()], + is_encrypted=False + ), + Field( + item="30A", + name='RACE_HISPANIC', + type='number', + friendly_name="race hispanic", + startIndex=38, + endIndex=39, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="30B", + name='RACE_AMER_INDIAN', + friendly_name="race american-indian", + type='number', + startIndex=39, + endIndex=40, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="30C", + name='RACE_ASIAN', + friendly_name="race asian", + type='number', + startIndex=40, + endIndex=41, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="30D", + name='RACE_BLACK', + friendly_name="race black", + type='number', + startIndex=41, + endIndex=42, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="30E", + name='RACE_HAWAIIAN', + friendly_name="race hawaiian", + type='number', + startIndex=42, + endIndex=43, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="30F", + name='RACE_WHITE', + friendly_name="race white", + type='number', + startIndex=43, + endIndex=44, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="31", + name='GENDER', + friendly_name="gender", + type='number', + startIndex=44, + endIndex=45, + required=True, + validators=[validators.isLargerThanOrEqualTo(0)] + ), + Field( + item="32A", + name='FED_OASDI_PROGRAM', + friendly_name="federal old-age survivors and disability insurance program", + type='number', + startIndex=45, + endIndex=46, + required=True, + validators=[validators.oneOf([1, 2])] + ), + Field( + item="32B", + name='FED_DISABILITY_STATUS', + friendly_name="federal disability status", + type='number', + startIndex=46, + endIndex=47, + required=True, + validators=[validators.oneOf([1, 2])] + ), + Field( + item="32C", + name='DISABLED_TITLE_XIVAPDT', friendly_name="receives aid to the permanently and totally disabled" + - " under title xiv-apdt of the social security act", required=True, validators=[ - validators.oneOf([1, 2]) - ]), - Field(item="32D", name='AID_AGED_BLIND', type='number', startIndex=48, endIndex=49, + " under title xiv-apdt of the social security act", + type='number', + startIndex=47, + endIndex=48, + required=True, + validators=[validators.oneOf([1, 2])] + ), + Field( + item="32D", + name='AID_AGED_BLIND', friendly_name="receives from the aid to the aged, blind, and disabled program", - required=False, validators=[ - validators.isLargerThanOrEqualTo(0) - ]), - Field(item="32E", name='RECEIVE_SSI', type='number', startIndex=49, endIndex=50, - friendly_name="receives social security income", required=True, validators=[ - validators.oneOf([1, 2]) - ]), - Field(item="33", name='MARITAL_STATUS', type='number', startIndex=50, endIndex=51, - friendly_name="marital status", required=False, validators=[ - validators.isInLimits(0, 5) - ]), - Field(item="34", name='RELATIONSHIP_HOH', type='string', startIndex=51, endIndex=53, - friendly_name="relationship to head of household", required=True, validators=[ - validators.isInStringRange(1, 10) - ]), - Field(item="35", name='PARENT_MINOR_CHILD', type='number', startIndex=53, endIndex=54, - friendly_name="parent of minor child", required=False, validators=[ - validators.isInLimits(0, 3) - ]), - Field(item="36", name='NEEDS_PREGNANT_WOMAN', type='number', startIndex=54, endIndex=55, - friendly_name="needs of pregnant woman", required=False, validators=[ - validators.isInLimits(0, 9) - ]), - Field(item="37", name='EDUCATION_LEVEL', type='number', startIndex=55, endIndex=57, - friendly_name="education level", required=False, validators=[ + type='number', + startIndex=48, + endIndex=49, + required=False, + validators=[validators.isLargerThanOrEqualTo(0)] + ), + Field( + item="32E", + name='RECEIVE_SSI', + friendly_name="receives social security income", + type='number', + startIndex=49, + endIndex=50, + required=True, + validators=[validators.oneOf([1, 2])] + ), + Field( + item="33", + name='MARITAL_STATUS', + friendly_name="marital status", + type='number', + startIndex=50, + endIndex=51, + required=False, + validators=[validators.isInLimits(0, 5)] + ), + Field( + item="34", + name='RELATIONSHIP_HOH', + friendly_name="relationship to head of household", + type='string', + startIndex=51, + endIndex=53, + required=True, + validators=[validators.isInStringRange(1, 10)] + ), + Field( + item="35", + name='PARENT_MINOR_CHILD', + friendly_name="parent of minor child", + type='number', + startIndex=53, + endIndex=54, + required=False, + validators=[validators.isInLimits(0, 3)] + ), + Field( + item="36", + name='NEEDS_PREGNANT_WOMAN', + friendly_name="needs of pregnant woman", + type='number', + startIndex=54, + endIndex=55, + required=False, + validators=[validators.isInLimits(0, 9)] + ), + Field( + item="37", + name='EDUCATION_LEVEL', + friendly_name="education level", + type='number', + startIndex=55, + endIndex=57, + required=False, + validators=[ validators.or_validators( validators.isInLimits(0, 16), validators.isInLimits(98, 99) ) - ]), - Field(item="38", name='CITIZENSHIP_STATUS', type='number', startIndex=57, endIndex=58, - friendly_name="citizenship status", required=False, validators=[ - validators.oneOf([0, 1, 2, 3, 9]) - ]), - Field(item="39", name='COOPERATION_CHILD_SUPPORT', type='number', startIndex=58, endIndex=59, - friendly_name="cooperation with child support", required=False, validators=[ - validators.oneOf([0, 1, 2, 9]) - ]), - Field(item="40", name='EMPLOYMENT_STATUS', type='number', startIndex=59, endIndex=60, - friendly_name="employment status", required=False, validators=[ - validators.isInLimits(0, 3) - ]), - Field(item="41", name='WORK_ELIGIBLE_INDICATOR', type='number', startIndex=60, endIndex=62, - friendly_name="work eligible indicator", required=True, validators=[ + ] + ), + Field( + item="38", + name='CITIZENSHIP_STATUS', + friendly_name="citizenship status", + type='number', + startIndex=57, + endIndex=58, + required=False, + validators=[validators.oneOf([0, 1, 2, 3, 9])] + ), + Field( + item="39", + name='COOPERATION_CHILD_SUPPORT', + friendly_name="cooperation with child support", + type='number', + startIndex=58, + endIndex=59, + required=False, + validators=[validators.oneOf([0, 1, 2, 9])] + ), + Field( + item="40", + name='EMPLOYMENT_STATUS', + friendly_name="employment status", + type='number', + startIndex=59, + endIndex=60, + required=False, + validators=[validators.isInLimits(0, 3)] + ), + Field( + item="41", + name='WORK_ELIGIBLE_INDICATOR', + friendly_name="work eligible indicator", + type='number', + startIndex=60, + endIndex=62, + required=True, + validators=[ validators.or_validators( validators.isInLimits(1, 4), validators.isInLimits(6, 9), validators.isInLimits(11, 12) ) - ]), - Field(item="42", name='WORK_PART_STATUS', type='number', startIndex=62, endIndex=64, - friendly_name="work participation status", required=False, validators=[ - validators.oneOf([1, 2, 5, 7, 9, 15, 16, 17, 18, 19, 99]) - ]), - Field(item="43", name='UNSUB_EMPLOYMENT', type='number', startIndex=64, endIndex=66, - friendly_name="unsubsidized employment", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="44", name='SUB_PRIVATE_EMPLOYMENT', type='number', startIndex=66, endIndex=68, - friendly_name="subsidized private employment", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="45", name='SUB_PUBLIC_EMPLOYMENT', type='number', startIndex=68, endIndex=70, - friendly_name="subsidized public employment", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="46A", name='WORK_EXPERIENCE_HOP', type='number', startIndex=70, endIndex=72, - friendly_name="work experience - hours of participation", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="46B", name='WORK_EXPERIENCE_EA', type='number', startIndex=72, endIndex=74, - friendly_name="work experience - excused absence", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="46C", name='WORK_EXPERIENCE_HOL', type='number', startIndex=74, endIndex=76, - friendly_name="work experience hours - holiday", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="47", name='OJT', type='number', startIndex=76, endIndex=78, - friendly_name="OJT", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="48A", name='JOB_SEARCH_HOP', type='number', startIndex=78, endIndex=80, - friendly_name="job search - hours of participation", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="48B", name='JOB_SEARCH_EA', type='number', startIndex=80, endIndex=82, - friendly_name="job search - excused absence", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="48C", name='JOB_SEARCH_HOL', type='number', startIndex=82, endIndex=84, - friendly_name="job search - holiday", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="49A", name='COMM_SERVICES_HOP', type='number', startIndex=84, endIndex=86, - friendly_name="community services - hours of participation", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="49B", name='COMM_SERVICES_EA', type='number', startIndex=86, endIndex=88, - friendly_name="community services - excused absence", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="49C", name='COMM_SERVICES_HOL', type='number', startIndex=88, endIndex=90, - friendly_name="community services - holiday", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="50A", name='VOCATIONAL_ED_TRAINING_HOP', type='number', startIndex=90, endIndex=92, - friendly_name="vocational education training - hours of participation", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="50B", name='VOCATIONAL_ED_TRAINING_EA', type='number', startIndex=92, endIndex=94, - friendly_name="vocational education training - excused absence", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="50C", name='VOCATIONAL_ED_TRAINING_HOL', type='number', startIndex=94, endIndex=96, - friendly_name="vocational education training - holiday", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="51A", name='JOB_SKILLS_TRAINING_HOP', type='number', startIndex=96, endIndex=98, - friendly_name="job skills training - hours of participation", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="51B", name='JOB_SKILLS_TRAINING_EA', type='number', startIndex=98, endIndex=100, - friendly_name="job skills training - excused absence", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="51C", name='JOB_SKILLS_TRAINING_HOL', type='number', startIndex=100, endIndex=102, - friendly_name="job skills training - holiday", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="52A", name='ED_NO_HIGH_SCHOOL_DIPL_HOP', type='number', startIndex=102, endIndex=104, + ] + ), + Field( + item="42", + name='WORK_PART_STATUS', + friendly_name="work participation status", + type='number', + startIndex=62, + endIndex=64, + required=False, + validators=[validators.oneOf([1, 2, 5, 7, 9, 15, 16, 17, 18, 19, 99])] + ), + Field( + item="43", + name='UNSUB_EMPLOYMENT', + friendly_name="unsubsidized employment", + type='number', + startIndex=64, + endIndex=66, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="44", + name='SUB_PRIVATE_EMPLOYMENT', + friendly_name="subsidized private employment", + type='number', + startIndex=66, + endIndex=68, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="45", + name='SUB_PUBLIC_EMPLOYMENT', + friendly_name="subsidized public employment", + type='number', + startIndex=68, + endIndex=70, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="46A", + name='WORK_EXPERIENCE_HOP', + friendly_name="work experience - hours of participation", + type='number', + startIndex=70, + endIndex=72, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="46B", + name='WORK_EXPERIENCE_EA', + friendly_name="work experience - excused absence", + type='number', + startIndex=72, + endIndex=74, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="46C", + name='WORK_EXPERIENCE_HOL', + friendly_name="work experience hours - holiday", + type='number', + startIndex=74, + endIndex=76, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="47", + name='OJT', + friendly_name="OJT", + type='number', + startIndex=76, + endIndex=78, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="48A", + name='JOB_SEARCH_HOP', + friendly_name="job search - hours of participation", + type='number', + startIndex=78, + endIndex=80, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="48B", + name='JOB_SEARCH_EA', + friendly_name="job search - excused absence", + type='number', + startIndex=80, + endIndex=82, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="48C", + name='JOB_SEARCH_HOL', + friendly_name="job search - holiday", + type='number', + startIndex=82, + endIndex=84, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="49A", + name='COMM_SERVICES_HOP', + friendly_name="community services - hours of participation", + type='number', + startIndex=84, + endIndex=86, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="49B", + name='COMM_SERVICES_EA', + friendly_name="community services - excused absence", + type='number', + startIndex=86, + endIndex=88, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="49C", + name='COMM_SERVICES_HOL', + friendly_name="community services - holiday", + type='number', + startIndex=88, + endIndex=90, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="50A", + name='VOCATIONAL_ED_TRAINING_HOP', + friendly_name="vocational education training - hours of participation", + type='number', + startIndex=90, + endIndex=92, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="50B", + name='VOCATIONAL_ED_TRAINING_EA', + friendly_name="vocational education training - excused absence", + type='number', + startIndex=92, + endIndex=94, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="50C", + name='VOCATIONAL_ED_TRAINING_HOL', + friendly_name="vocational education training - holiday", + type='number', + startIndex=94, + endIndex=96, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="51A", + name='JOB_SKILLS_TRAINING_HOP', + friendly_name="job skills training - hours of participation", + type='number', + startIndex=96, + endIndex=98, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="51B", + name='JOB_SKILLS_TRAINING_EA', + friendly_name="job skills training - excused absence", + type='number', + startIndex=98, + endIndex=100, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="51C", + name='JOB_SKILLS_TRAINING_HOL', + friendly_name="job skills training - holiday", + type='number', + startIndex=100, + endIndex=102, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="52A", + name='ED_NO_HIGH_SCHOOL_DIPL_HOP', friendly_name="education no high school diploma - hours of participation", - required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="52B", name='ED_NO_HIGH_SCHOOL_DIPL_EA', type='number', startIndex=104, endIndex=106, - friendly_name="education no high school diploma - excused absence", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="52C", name='ED_NO_HIGH_SCHOOL_DIPL_HOL', type='number', startIndex=106, endIndex=108, - friendly_name="education no high school diploma - holiday", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="53A", name='SCHOOL_ATTENDENCE_HOP', type='number', startIndex=108, endIndex=110, - friendly_name="school attendance - hours of participation", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="53B", name='SCHOOL_ATTENDENCE_EA', type='number', startIndex=110, endIndex=112, - friendly_name="school attendance - excused absence", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="53C", name='SCHOOL_ATTENDENCE_HOL', type='number', startIndex=112, endIndex=114, - friendly_name="school attendance - holiday", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="54A", name='PROVIDE_CC_HOP', type='number', startIndex=114, endIndex=116, - friendly_name="provide child care - hours of participation", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="54B", name='PROVIDE_CC_EA', type='number', startIndex=116, endIndex=118, - friendly_name="provide child care - excused absence", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="54C", name='PROVIDE_CC_HOL', type='number', startIndex=118, endIndex=120, - friendly_name="provide child care - holiday", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="55", name='OTHER_WORK_ACTIVITIES', type='number', startIndex=120, endIndex=122, - friendly_name="other work activities", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="56", name='DEEMED_HOURS_FOR_OVERALL', type='number', startIndex=122, endIndex=124, - friendly_name="deemed hours for overall", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="57", name='DEEMED_HOURS_FOR_TWO_PARENT', type='number', startIndex=124, endIndex=126, - friendly_name="deemed hours for two parents", required=False, validators=[ - validators.isInLimits(0, 99) - ]), - Field(item="58", name='EARNED_INCOME', type='number', startIndex=126, endIndex=130, - friendly_name="earned income", required=True, validators=[ - validators.isInLimits(0, 9999) - ]), - Field(item="59A", name='UNEARNED_INCOME_TAX_CREDIT', type='number', startIndex=130, endIndex=134, - friendly_name="unearned income tax credit", required=False, validators=[ - validators.isInLimits(0, 9999) - ]), - Field(item="59B", name='UNEARNED_SOCIAL_SECURITY', type='number', startIndex=134, endIndex=138, - friendly_name="unearned social security", required=True, validators=[ - validators.isInLimits(0, 9999) - ]), - Field(item="59C", name='UNEARNED_SSI', type='number', startIndex=138, endIndex=142, - friendly_name="unearned ssi benefit", required=True, validators=[ - validators.isInLimits(0, 9999) - ]), - Field(item="59D", name='UNEARNED_WORKERS_COMP', type='number', startIndex=142, endIndex=146, - friendly_name="unearned workers compensation", required=True, validators=[ - validators.isInLimits(0, 9999) - ]), - Field(item="59E", name='OTHER_UNEARNED_INCOME', type='number', startIndex=146, endIndex=150, - friendly_name="other unearned income", required=True, validators=[ - validators.isInLimits(0, 9999) - ]), - ], + type='number', + startIndex=102, + endIndex=104, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="52B", + name='ED_NO_HIGH_SCHOOL_DIPL_EA', + friendly_name="education no high school diploma - excused absence", + type='number', + startIndex=104, + endIndex=106, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="52C", + name='ED_NO_HIGH_SCHOOL_DIPL_HOL', + friendly_name="education no high school diploma - holiday", + type='number', + startIndex=106, + endIndex=108, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="53A", + name='SCHOOL_ATTENDENCE_HOP', + friendly_name="school attendance - hours of participation", + type='number', + startIndex=108, + endIndex=110, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="53B", + name='SCHOOL_ATTENDENCE_EA', + friendly_name="school attendance - excused absence", + type='number', + startIndex=110, + endIndex=112, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="53C", + name='SCHOOL_ATTENDENCE_HOL', + friendly_name="school attendance - holiday", + type='number', + startIndex=112, + endIndex=114, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="54A", + name='PROVIDE_CC_HOP', + friendly_name="provide child care - hours of participation", + type='number', + startIndex=114, + endIndex=116, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="54B", + name='PROVIDE_CC_EA', + friendly_name="provide child care - excused absence", + type='number', + startIndex=116, + endIndex=118, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="54C", + name='PROVIDE_CC_HOL', + friendly_name="provide child care - holiday", + type='number', + startIndex=118, + endIndex=120, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="55", + name='OTHER_WORK_ACTIVITIES', + friendly_name="other work activities", + type='number', + startIndex=120, + endIndex=122, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="56", + name='DEEMED_HOURS_FOR_OVERALL', + friendly_name="deemed hours for overall", + type='number', + startIndex=122, + endIndex=124, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="57", + name='DEEMED_HOURS_FOR_TWO_PARENT', + friendly_name="deemed hours for two parents", + type='number', + startIndex=124, + endIndex=126, + required=False, + validators=[validators.isInLimits(0, 99)] + ), + Field( + item="58", + name='EARNED_INCOME', + friendly_name="earned income", + type='number', + startIndex=126, + endIndex=130, + required=True, + validators=[validators.isInLimits(0, 9999)] + ), + Field( + item="59A", + name='UNEARNED_INCOME_TAX_CREDIT', + friendly_name="unearned income tax credit", + type='number', + startIndex=130, + endIndex=134, + required=False, + validators=[validators.isInLimits(0, 9999)] + ), + Field( + item="59B", + name='UNEARNED_SOCIAL_SECURITY', + friendly_name="unearned social security", + type='number', + startIndex=134, + endIndex=138, + required=True, + validators=[validators.isInLimits(0, 9999)] + ), + Field( + item="59C", + name='UNEARNED_SSI', + friendly_name="unearned ssi benefit", + type='number', + startIndex=138, + endIndex=142, + required=True, + validators=[validators.isInLimits(0, 9999)] + ), + Field( + item="59D", + name='UNEARNED_WORKERS_COMP', + friendly_name="unearned workers compensation", + type='number', + startIndex=142, + endIndex=146, + required=True, + validators=[validators.isInLimits(0, 9999)] + ), + Field( + item="59E", + name='OTHER_UNEARNED_INCOME', + friendly_name="other unearned income", + type='number', + startIndex=146, + endIndex=150, + required=True, + validators=[validators.isInLimits(0, 9999)] + ), + ], ) ] ) diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m3.py b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m3.py index 3ae40faa5..19c101687 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m3.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m3.py @@ -15,143 +15,302 @@ ], postparsing_validators=[ validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.matches(1), - result_field='SSN', result_function=validators.validateSSN(), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.matches(1), + result_field='SSN', + result_function=validators.validateSSN(), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='RACE_HISPANIC', result_function=validators.isInLimits(1, 2), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='RACE_HISPANIC', + result_function=validators.isInLimits(1, 2), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='RACE_AMER_INDIAN', result_function=validators.isInLimits(1, 2), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='RACE_AMER_INDIAN', + result_function=validators.isInLimits(1, 2), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='RACE_ASIAN', result_function=validators.isInLimits(1, 2), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='RACE_ASIAN', + result_function=validators.isInLimits(1, 2), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='RACE_BLACK', result_function=validators.isInLimits(1, 2), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='RACE_BLACK', + result_function=validators.isInLimits(1, 2), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='RACE_HAWAIIAN', result_function=validators.isInLimits(1, 2), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='RACE_HAWAIIAN', + result_function=validators.isInLimits(1, 2), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='RACE_WHITE', result_function=validators.isInLimits(1, 2), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='RACE_WHITE', + result_function=validators.isInLimits(1, 2), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='RELATIONSHIP_HOH', result_function=validators.isInLimits(4, 9), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='RELATIONSHIP_HOH', + result_function=validators.isInLimits(4, 9), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='PARENT_MINOR_CHILD', result_function=validators.oneOf((1, 2, 3)), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='PARENT_MINOR_CHILD', + result_function=validators.oneOf((1, 2, 3)), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.matches(1), - result_field='EDUCATION_LEVEL', result_function=validators.notMatches(99), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.matches(1), + result_field='EDUCATION_LEVEL', + result_function=validators.notMatches(99), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.matches(1), - result_field='CITIZENSHIP_STATUS', result_function=validators.oneOf((1, 2)), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.matches(1), + result_field='CITIZENSHIP_STATUS', + result_function=validators.oneOf((1, 2)), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.matches(2), - result_field='CITIZENSHIP_STATUS', result_function=validators.oneOf((1, 2, 3, 9)), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.matches(2), + result_field='CITIZENSHIP_STATUS', + result_function=validators.oneOf((1, 2, 3, 9)), ), ], fields=[ - Field(item="0", name='RecordType', type='string', startIndex=0, endIndex=2, - friendly_name="record type", required=True, validators=[]), - Field(item="3", name='RPT_MONTH_YEAR', type='number', startIndex=2, endIndex=8, - friendly_name="reporting month and year", required=True, validators=[ - validators.dateYearIsLargerThan(1998), - validators.dateMonthIsValid(), - ]), - Field(item="5", name='CASE_NUMBER', type='string', startIndex=8, endIndex=19, - friendly_name="case number", required=True, validators=[ - validators.isAlphaNumeric() - ]), - Field(item="60", name='FAMILY_AFFILIATION', type='number', startIndex=19, endIndex=20, - friendly_name="family affiliation", required=True, validators=[ - validators.oneOf([1, 2, 4]) - ]), - Field(item="61", name='DATE_OF_BIRTH', type='string', startIndex=20, endIndex=28, - friendly_name="date of birth", required=True, validators=[ - validators.dateYearIsLargerThan(1998), - validators.dateMonthIsValid(), - ]), - TransformField(transform_func=ssp_ssn_decryption_func, item="62", name='SSN', type='string', startIndex=28, - friendly_name="social security number", endIndex=37, required=True, is_encrypted=False, - validators=[ - validators.validateSSN() - ]), - Field(item="63A", name='RACE_HISPANIC', type='number', startIndex=37, endIndex=38, - friendly_name="race hispanic", required=False, validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="63B", name='RACE_AMER_INDIAN', type='number', startIndex=38, endIndex=39, - friendly_name="race american-indian", required=False, validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="63C", name='RACE_ASIAN', type='number', startIndex=39, endIndex=40, - friendly_name="race asian", required=False, validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="63D", name='RACE_BLACK', type='number', startIndex=40, endIndex=41, - friendly_name="race black", required=False, validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="63E", name='RACE_HAWAIIAN', type='number', startIndex=41, endIndex=42, - friendly_name="race hawaiian", required=False, validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="63F", name='RACE_WHITE', type='number', startIndex=42, endIndex=43, - friendly_name="race white", required=False, validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="64", name='GENDER', type='number', startIndex=43, endIndex=44, - friendly_name="gender", required=True, validators=[ - validators.isInLimits(0, 9) - ]), - Field(item="65A", name='RECEIVE_NONSSI_BENEFITS', type='number', startIndex=44, endIndex=45, - friendly_name="receive non-ssi benefits", required=True, validators=[ - validators.oneOf([1, 2]) - ]), - Field(item="65B", name='RECEIVE_SSI', type='number', startIndex=45, endIndex=46, - friendly_name="receives ssi", required=True, validators=[ - validators.oneOf([1, 2]) - ]), - Field(item="66", name='RELATIONSHIP_HOH', type='number', startIndex=46, endIndex=48, - friendly_name="relationship to head of household", required=False, validators=[ - validators.isInStringRange(0, 10) - ]), - Field(item="67", name='PARENT_MINOR_CHILD', type='number', startIndex=48, endIndex=49, - friendly_name="parent of minor child", required=False, validators=[ - validators.oneOf([0, 2, 3]) - ]), - Field(item="68", name='EDUCATION_LEVEL', type='number', startIndex=49, endIndex=51, - friendly_name="education level", required=True, validators=[ - validators.or_validators( - validators.isInStringRange(0, 16), - validators.isInStringRange(98, 99) - ) - ]), - Field(item="69", name='CITIZENSHIP_STATUS', type='number', startIndex=51, endIndex=52, - friendly_name="citizenship status", required=False, validators=[ - validators.oneOf([0, 1, 2, 3, 9]) - ]), - Field(item="70A", name='UNEARNED_SSI', type='number', startIndex=52, endIndex=56, - friendly_name="unearned ssi benefit", required=True, validators=[ - validators.isInLimits(0, 9999) - ]), - Field(item="70B", name='OTHER_UNEARNED_INCOME', type='number', startIndex=56, endIndex=60, - friendly_name="other unearned income", required=True, validators=[ - validators.isInLimits(0, 9999) - ]) + Field( + item="0", + name='RecordType', + friendly_name="record type", + type='string', + startIndex=0, + endIndex=2, + required=True, + validators=[] + ), + Field( + item="3", + name='RPT_MONTH_YEAR', + friendly_name="reporting month and year", + type='number', + startIndex=2, + endIndex=8, + required=True, + validators=[ + validators.dateYearIsLargerThan(1998), + validators.dateMonthIsValid(), + ] + ), + Field( + item="5", + name='CASE_NUMBER', + friendly_name="case number", + type='string', + startIndex=8, + endIndex=19, + required=True, + validators=[validators.isAlphaNumeric()] + ), + Field( + item="60", + name='FAMILY_AFFILIATION', + friendly_name="family affiliation", + type='number', + startIndex=19, + endIndex=20, + required=True, + validators=[validators.oneOf([1, 2, 4])] + ), + Field( + item="61", + name='DATE_OF_BIRTH', + friendly_name="date of birth", + type='string', + startIndex=20, + endIndex=28, + required=True, + validators=[ + validators.dateYearIsLargerThan(1998), + validators.dateMonthIsValid(), + ] + ), + TransformField( + transform_func=ssp_ssn_decryption_func, + item="62", + name='SSN', + friendly_name="social security number", + type='string', + startIndex=28, + endIndex=37, + required=True, + is_encrypted=False, + validators=[validators.validateSSN()] + ), + Field( + item="63A", + name='RACE_HISPANIC', + friendly_name="race hispanic", + type='number', + startIndex=37, + endIndex=38, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="63B", + name='RACE_AMER_INDIAN', + friendly_name="race american-indian", + type='number', + startIndex=38, + endIndex=39, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="63C", + name='RACE_ASIAN', + friendly_name="race asian", + type='number', + startIndex=39, + endIndex=40, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="63D", + name='RACE_BLACK', + friendly_name="race black", + type='number', + startIndex=40, + endIndex=41, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="63E", + name='RACE_HAWAIIAN', + friendly_name="race hawaiian", + type='number', + startIndex=41, + endIndex=42, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="63F", + name='RACE_WHITE', + friendly_name="race white", + type='number', + startIndex=42, + endIndex=43, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="64", + name='GENDER', + friendly_name="gender", + type='number', + startIndex=43, + endIndex=44, + required=True, + validators=[validators.isInLimits(0, 9)] + ), + Field( + item="65A", + name='RECEIVE_NONSSI_BENEFITS', + friendly_name="receive non-ssi benefits", + type='number', + startIndex=44, + endIndex=45, + required=True, + validators=[validators.oneOf([1, 2])] + ), + Field( + item="65B", + name='RECEIVE_SSI', + friendly_name="receives ssi", + type='number', + startIndex=45, + endIndex=46, + required=True, + validators=[validators.oneOf([1, 2])] + ), + Field( + item="66", + name='RELATIONSHIP_HOH', + friendly_name="relationship to head of household", + type='number', + startIndex=46, + endIndex=48, + required=False, + validators=[validators.isInStringRange(0, 10)] + ), + Field( + item="67", + name='PARENT_MINOR_CHILD', + friendly_name="parent of minor child", + type='number', + startIndex=48, + endIndex=49, + required=False, + validators=[validators.oneOf([0, 2, 3])] + ), + Field( + item="68", + name='EDUCATION_LEVEL', + friendly_name="education level", + type='number', + startIndex=49, + endIndex=51, + required=True, + validators=[ + validators.or_validators( + validators.isInStringRange(0, 16), + validators.isInStringRange(98, 99) + ) + ] + ), + Field( + item="69", + name='CITIZENSHIP_STATUS', + friendly_name="citizenship status", + type='number', + startIndex=51, + endIndex=52, + required=False, + validators=[validators.oneOf([0, 1, 2, 3, 9])] + ), + Field( + item="70A", + name='UNEARNED_SSI', + friendly_name="unearned ssi benefit", + type='number', + startIndex=52, + endIndex=56, + required=True, + validators=[validators.isInLimits(0, 9999)] + ), + Field( + item="70B", + name='OTHER_UNEARNED_INCOME', + friendly_name="other unearned income", + type='number', + startIndex=56, + endIndex=60, + required=True, + validators=[validators.isInLimits(0, 9999)] + ) ] ) @@ -163,144 +322,302 @@ ], postparsing_validators=[ validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.matches(1), - result_field='SSN', result_function=validators.validateSSN(), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.matches(1), + result_field='SSN', + result_function=validators.validateSSN(), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='RACE_HISPANIC', result_function=validators.isInLimits(1, 2), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='RACE_HISPANIC', + result_function=validators.isInLimits(1, 2), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='RACE_AMER_INDIAN', result_function=validators.isInLimits(1, 2), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='RACE_AMER_INDIAN', + result_function=validators.isInLimits(1, 2), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='RACE_ASIAN', result_function=validators.isInLimits(1, 2), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='RACE_ASIAN', + result_function=validators.isInLimits(1, 2), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='RACE_BLACK', result_function=validators.isInLimits(1, 2), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='RACE_BLACK', + result_function=validators.isInLimits(1, 2), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='RACE_HAWAIIAN', result_function=validators.isInLimits(1, 2), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='RACE_HAWAIIAN', + result_function=validators.isInLimits(1, 2), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='RACE_WHITE', result_function=validators.isInLimits(1, 2), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='RACE_WHITE', + result_function=validators.isInLimits(1, 2), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='RELATIONSHIP_HOH', result_function=validators.isInStringRange(4, 9), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='RELATIONSHIP_HOH', + result_function=validators.isInStringRange(4, 9), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), - result_field='PARENT_MINOR_CHILD', result_function=validators.oneOf((1, 2, 3)), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.oneOf((1, 2)), + result_field='PARENT_MINOR_CHILD', + result_function=validators.oneOf((1, 2, 3)), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.matches(1), - result_field='EDUCATION_LEVEL', result_function=validators.notMatches(99), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.matches(1), + result_field='EDUCATION_LEVEL', + result_function=validators.notMatches(99), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.matches(1), - result_field='CITIZENSHIP_STATUS', result_function=validators.oneOf((1, 2)), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.matches(1), + result_field='CITIZENSHIP_STATUS', + result_function=validators.oneOf((1, 2)), ), validators.if_then_validator( - condition_field='FAMILY_AFFILIATION', condition_function=validators.matches(2), - result_field='CITIZENSHIP_STATUS', result_function=validators.oneOf((1, 2, 3, 9)), + condition_field='FAMILY_AFFILIATION', + condition_function=validators.matches(2), + result_field='CITIZENSHIP_STATUS', + result_function=validators.oneOf((1, 2, 3, 9)), ), ], fields=[ - Field(item="0", name='RecordType', type='string', startIndex=0, endIndex=2, - friendly_name="record type", required=True, validators=[]), - Field(item="3", name='RPT_MONTH_YEAR', type='number', startIndex=2, endIndex=8, - friendly_name="reporting month and year", required=True, validators=[ - validators.dateYearIsLargerThan(1998), - validators.dateMonthIsValid(), - ]), - Field(item="5", name='CASE_NUMBER', type='string', startIndex=8, endIndex=19, - friendly_name="case number", required=True, validators=[ - validators.isAlphaNumeric() - ]), - Field(item="60", name='FAMILY_AFFILIATION', type='number', startIndex=60, endIndex=61, - friendly_name="family affiliation", required=True, validators=[ - validators.oneOf([1, 2, 4]) - ]), - Field(item="61", name='DATE_OF_BIRTH', type='string', startIndex=61, endIndex=69, - friendly_name="date of birth", required=True, validators=[ - validators.dateYearIsLargerThan(1998), - validators.dateMonthIsValid(), - ]), - TransformField(transform_func=ssp_ssn_decryption_func, item="62", name='SSN', type='string', startIndex=69, - endIndex=78, required=True, is_encrypted=False, friendly_name="social security number", - validators=[ - validators.validateSSN() - ]), - Field(item="63A", name='RACE_HISPANIC', type='number', startIndex=78, endIndex=79, - friendly_name="race hispanic", required=False, validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="63B", name='RACE_AMER_INDIAN', type='number', startIndex=79, endIndex=80, - friendly_name="race american-indian", required=False, validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="63C", name='RACE_ASIAN', type='number', startIndex=80, endIndex=81, - friendly_name="race asian", required=False, validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="63D", name='RACE_BLACK', type='number', startIndex=81, endIndex=82, - friendly_name="race black", required=False, validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="63E", name='RACE_HAWAIIAN', type='number', startIndex=82, endIndex=83, - friendly_name="race hawaiian", required=False, validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="63F", name='RACE_WHITE', type='number', startIndex=83, endIndex=84, - friendly_name="race white", required=False, validators=[ - validators.isInLimits(0, 2) - ]), - Field(item="64", name='GENDER', type='number', startIndex=84, endIndex=85, - friendly_name="gender", required=True, validators=[ - validators.isInLimits(0, 9) - ]), - Field(item="65A", name='RECEIVE_NONSSI_BENEFITS', type='number', startIndex=85, endIndex=86, - friendly_name="receives non-ssi benefit", required=True, validators=[ - validators.oneOf([1, 2]) - ]), - Field(item="65B", name='RECEIVE_SSI', type='number', startIndex=86, endIndex=87, - friendly_name="receives ssi", required=True, validators=[ - validators.oneOf([1, 2]) - ]), - Field(item="66", name='RELATIONSHIP_HOH', type='number', startIndex=87, endIndex=89, - friendly_name="relationship to head of household", required=False, validators=[ - validators.isInLimits(0, 10) - ]), - Field(item="67", name='PARENT_MINOR_CHILD', type='number', startIndex=89, endIndex=90, - friendly_name="parent of minor child", required=False, validators=[ - validators.oneOf([0, 2, 3]) - ]), - Field(item="68", name='EDUCATION_LEVEL', type='number', startIndex=90, endIndex=92, - friendly_name="education level", required=True, validators=[ - validators.or_validators( - validators.isInStringRange(0, 16), - validators.isInStringRange(98, 99) - ) - ]), - Field(item="69", name='CITIZENSHIP_STATUS', type='number', startIndex=92, endIndex=93, - friendly_name="citizenship status", required=False, validators=[ - validators.oneOf([0, 1, 2, 3, 9]) - ]), - Field(item="70A", name='UNEARNED_SSI', type='number', startIndex=93, endIndex=97, - friendly_name="unearned ssi benefit", - required=True, validators=[ - validators.isInLimits(0, 9999) - ]), - Field(item="70B", name='OTHER_UNEARNED_INCOME', type='number', startIndex=97, endIndex=101, - friendly_name="other unearned income", required=True, validators=[ - validators.isInLimits(0, 9999) - ]) + Field( + item="0", + name='RecordType', + friendly_name="record type", + type='string', + startIndex=0, + endIndex=2, + required=True, + validators=[] + ), + Field( + item="3", + name='RPT_MONTH_YEAR', + friendly_name="reporting month and year", + type='number', + startIndex=2, + endIndex=8, + required=True, + validators=[ + validators.dateYearIsLargerThan(1998), + validators.dateMonthIsValid(), + ] + ), + Field( + item="5", + name='CASE_NUMBER', + friendly_name="case number", + type='string', + startIndex=8, + endIndex=19, + required=True, + validators=[validators.isAlphaNumeric()] + ), + Field( + item="60", + name='FAMILY_AFFILIATION', + friendly_name="family affiliation", + type='number', + startIndex=60, + endIndex=61, + required=True, + validators=[validators.oneOf([1, 2, 4])] + ), + Field( + item="61", + name='DATE_OF_BIRTH', + friendly_name="date of birth", + type='string', + startIndex=61, + endIndex=69, + required=True, + validators=[ + validators.dateYearIsLargerThan(1998), + validators.dateMonthIsValid(), + ] + ), + TransformField( + transform_func=ssp_ssn_decryption_func, + item="62", + name='SSN', + friendly_name="social security number", + type='string', + startIndex=69, + endIndex=78, + required=True, + is_encrypted=False, + validators=[validators.validateSSN()] + ), + Field( + item="63A", + name='RACE_HISPANIC', + friendly_name="race hispanic", + type='number', + startIndex=78, + endIndex=79, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="63B", + name='RACE_AMER_INDIAN', + friendly_name="race american-indian", + type='number', + startIndex=79, + endIndex=80, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="63C", + name='RACE_ASIAN', + friendly_name="race asian", + type='number', + startIndex=80, + endIndex=81, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="63D", + name='RACE_BLACK', + friendly_name="race black", + type='number', + startIndex=81, + endIndex=82, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="63E", + name='RACE_HAWAIIAN', + friendly_name="race hawaiian", + type='number', + startIndex=82, + endIndex=83, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="63F", + name='RACE_WHITE', + friendly_name="race white", + type='number', + startIndex=83, + endIndex=84, + required=False, + validators=[validators.isInLimits(0, 2)] + ), + Field( + item="64", + name='GENDER', + friendly_name="gender", + type='number', + startIndex=84, + endIndex=85, + required=True, + validators=[validators.isInLimits(0, 9)] + ), + Field( + item="65A", + name='RECEIVE_NONSSI_BENEFITS', + friendly_name="receives non-ssi benefit", + type='number', + startIndex=85, + endIndex=86, + required=True, + validators=[validators.oneOf([1, 2])] + ), + Field( + item="65B", + name='RECEIVE_SSI', + friendly_name="receives ssi", + type='number', + startIndex=86, + endIndex=87, + required=True, + validators=[validators.oneOf([1, 2])] + ), + Field( + item="66", + name='RELATIONSHIP_HOH', + friendly_name="relationship to head of household", + type='number', + startIndex=87, + endIndex=89, + required=False, + validators=[validators.isInLimits(0, 10)] + ), + Field( + item="67", + name='PARENT_MINOR_CHILD', + friendly_name="parent of minor child", + type='number', + startIndex=89, + endIndex=90, + required=False, + validators=[validators.oneOf([0, 2, 3])] + ), + Field( + item="68", + name='EDUCATION_LEVEL', + friendly_name="education level", + type='number', + startIndex=90, + endIndex=92, + required=True, + validators=[ + validators.or_validators( + validators.isInStringRange(0, 16), + validators.isInStringRange(98, 99) + ) + ] + ), + Field( + item="69", + name='CITIZENSHIP_STATUS', + friendly_name="citizenship status", + type='number', + startIndex=92, + endIndex=93, + required=False, + validators=[validators.oneOf([0, 1, 2, 3, 9])] + ), + Field( + item="70A", + name='UNEARNED_SSI', + friendly_name="unearned ssi benefit", + type='number', + startIndex=93, + endIndex=97, + required=True, + validators=[validators.isInLimits(0, 9999)] + ), + Field( + item="70B", + name='OTHER_UNEARNED_INCOME', + friendly_name="other unearned income", + type='number', + startIndex=97, + endIndex=101, + required=True, + validators=[validators.isInLimits(0, 9999)] + ) ] ) diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m4.py b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m4.py index 00057d1b1..4d8f04f64 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m4.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m4.py @@ -99,7 +99,8 @@ required=True, validators=[ validators.or_validators( - validators.isInStringRange(1, 19), validators.matches("99") + validators.isInStringRange(1, 19), + validators.matches("99") ) ], ), diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m5.py b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m5.py index c9c72c3cb..b37ad8bda 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m5.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m5.py @@ -354,7 +354,8 @@ required=False, validators=[ validators.or_validators( - validators.isInLimits(0, 3), validators.matches(9) + validators.isInLimits(0, 3), + validators.matches(9) ) ], ), diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m6.py b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m6.py index 7096ace8e..6f266168b 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m6.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m6.py @@ -15,50 +15,157 @@ ], postparsing_validators=[ validators.sumIsEqual( - "SSPMOE_FAMILIES", ["NUM_2_PARENTS", "NUM_1_PARENTS", "NUM_NO_PARENTS"]), + "SSPMOE_FAMILIES", [ + "NUM_2_PARENTS", + "NUM_1_PARENTS", + "NUM_NO_PARENTS" + ] + ), validators.sumIsEqual( - "NUM_RECIPIENTS", ["ADULT_RECIPIENTS", "CHILD_RECIPIENTS"]), + "NUM_RECIPIENTS", [ + "ADULT_RECIPIENTS", + "CHILD_RECIPIENTS" + ] + ), ], fields=[ - Field(item="0", name='RecordType', type='string', startIndex=0, endIndex=2, - friendly_name='record type', required=True, validators=[]), - Field(item="2", name='CALENDAR_QUARTER', type='number', startIndex=2, endIndex=7, - friendly_name='calendar quarter', required=True, validators=[validators.dateYearIsLargerThan(1998), - validators.quarterIsValid()]), - TransformField(calendar_quarter_to_rpt_month_year(0), item="2B", name='RPT_MONTH_YEAR', type='number', - friendly_name='reporting month and year', - startIndex=2, endIndex=7, required=True, validators=[validators.dateYearIsLargerThan(1998), - validators.dateMonthIsValid()]), - Field(item="3A", name='SSPMOE_FAMILIES', type='number', startIndex=7, endIndex=15, - friendly_name='ssp/moe families', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="4A", name='NUM_2_PARENTS', type='number', startIndex=31, endIndex=39, - friendly_name='number of two-parent families', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="5A", name='NUM_1_PARENTS', type='number', startIndex=55, endIndex=63, - friendly_name='number of one-parent families', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="6A", name='NUM_NO_PARENTS', type='number', startIndex=79, endIndex=87, - friendly_name='number of no-parent families', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="7A", name='NUM_RECIPIENTS', type='number', startIndex=103, endIndex=111, - friendly_name='number of recipients', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="8A", name='ADULT_RECIPIENTS', type='number', startIndex=127, endIndex=135, - friendly_name='number of adult recipients', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="9A", name='CHILD_RECIPIENTS', type='number', startIndex=151, endIndex=159, - friendly_name='number of child recipients', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="10A", name='NONCUSTODIALS', type='number', startIndex=175, endIndex=183, - friendly_name='number of noncustodial parents', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="11A", name='AMT_ASSISTANCE', type='number', startIndex=199, endIndex=211, - friendly_name='amount of assistance', - required=True, validators=[validators.isInLimits(0, 999999999999)]), - Field(item="12A", name='CLOSED_CASES', type='number', startIndex=235, endIndex=243, - friendly_name='number of closed cases', - required=True, validators=[validators.isInLimits(0, 99999999)]), + Field( + item="0", + name='RecordType', + friendly_name='record type', + type='string', + startIndex=0, + endIndex=2, + required=True, + validators=[] + ), + Field( + item="2", + name='CALENDAR_QUARTER', + friendly_name='calendar quarter', + type='number', + startIndex=2, + endIndex=7, + required=True, + validators=[ + validators.dateYearIsLargerThan(1998), + validators.quarterIsValid() + ] + ), + TransformField( + calendar_quarter_to_rpt_month_year(0), + item="2B", + name='RPT_MONTH_YEAR', + friendly_name='reporting month and year', + type='number', + startIndex=2, + endIndex=7, + required=True, + validators=[ + validators.dateYearIsLargerThan(1998), + validators.dateMonthIsValid() + ] + ), + Field( + item="3A", + name='SSPMOE_FAMILIES', + friendly_name='ssp/moe families', + type='number', + startIndex=7, + endIndex=15, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="4A", + name='NUM_2_PARENTS', + friendly_name='number of two-parent families', + type='number', + startIndex=31, + endIndex=39, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="5A", + name='NUM_1_PARENTS', + friendly_name='number of one-parent families', + type='number', + startIndex=55, + endIndex=63, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="6A", + name='NUM_NO_PARENTS', + friendly_name='number of no-parent families', + type='number', + startIndex=79, + endIndex=87, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="7A", + name='NUM_RECIPIENTS', + friendly_name='number of recipients', + type='number', + startIndex=103, + endIndex=111, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="8A", + name='ADULT_RECIPIENTS', + friendly_name='number of adult recipients', + type='number', + startIndex=127, + endIndex=135, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="9A", + name='CHILD_RECIPIENTS', + friendly_name='number of child recipients', + type='number', + startIndex=151, + endIndex=159, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="10A", + name='NONCUSTODIALS', + friendly_name='number of noncustodial parents', + type='number', + startIndex=175, + endIndex=183, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="11A", + name='AMT_ASSISTANCE', + friendly_name='amount of assistance', + type='number', + startIndex=199, + endIndex=211, + required=True, + validators=[validators.isInLimits(0, 999999999999)] + ), + Field( + item="12A", + name='CLOSED_CASES', + friendly_name='number of closed cases', + type='number', + startIndex=235, + endIndex=243, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), ], ) @@ -69,52 +176,157 @@ ], postparsing_validators=[ validators.sumIsEqual( - "SSPMOE_FAMILIES", ["NUM_2_PARENTS", "NUM_1_PARENTS", "NUM_NO_PARENTS"]), + "SSPMOE_FAMILIES", [ + "NUM_2_PARENTS", + "NUM_1_PARENTS", + "NUM_NO_PARENTS" + ] + ), validators.sumIsEqual( - "NUM_RECIPIENTS", ["ADULT_RECIPIENTS", "CHILD_RECIPIENTS"]), + "NUM_RECIPIENTS", [ + "ADULT_RECIPIENTS", + "CHILD_RECIPIENTS" + ] + ), ], fields=[ - Field(item="0", name='RecordType', type='string', startIndex=0, endIndex=2, - friendly_name='record type', - required=True, validators=[]), - Field(item="2", name='CALENDAR_QUARTER', type='number', startIndex=2, endIndex=7, - friendly_name='calendar quarter', - required=True, validators=[validators.dateYearIsLargerThan(1998), - validators.quarterIsValid()]), - TransformField(calendar_quarter_to_rpt_month_year(1), item="2B", name='RPT_MONTH_YEAR', type='number', - friendly_name='reporting month and year', - startIndex=2, endIndex=7, required=True, validators=[validators.dateYearIsLargerThan(1998), - validators.dateMonthIsValid()]), - Field(item="3B", name='SSPMOE_FAMILIES', type='number', startIndex=15, endIndex=23, - friendly_name='ssp/moe families', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="4B", name='NUM_2_PARENTS', type='number', startIndex=39, endIndex=47, - friendly_name='number of two-parent families', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="5B", name='NUM_1_PARENTS', type='number', startIndex=63, endIndex=71, - friendly_name='number of one-parent families', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="6B", name='NUM_NO_PARENTS', type='number', startIndex=87, endIndex=95, - friendly_name='number of no-parent families', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="7B", name='NUM_RECIPIENTS', type='number', startIndex=111, endIndex=119, - friendly_name='number of recipients', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="8B", name='ADULT_RECIPIENTS', type='number', startIndex=135, endIndex=143, - friendly_name='number of adult recipients', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="9B", name='CHILD_RECIPIENTS', type='number', startIndex=159, endIndex=167, - friendly_name='number of child recipients', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="10B", name='NONCUSTODIALS', type='number', startIndex=183, endIndex=191, - friendly_name='number of noncustodial parents', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="11B", name='AMT_ASSISTANCE', type='number', startIndex=211, endIndex=223, - friendly_name='amount of assistance', - required=True, validators=[validators.isInLimits(0, 999999999999)]), - Field(item="12B", name='CLOSED_CASES', type='number', startIndex=243, endIndex=251, - friendly_name='number of closed cases', - required=True, validators=[validators.isInLimits(0, 99999999)]), + Field( + item="0", + name='RecordType', + friendly_name='record type', + type='string', + startIndex=0, + endIndex=2, + required=True, + validators=[] + ), + Field( + item="2", + name='CALENDAR_QUARTER', + friendly_name='calendar quarter', + type='number', + startIndex=2, + endIndex=7, + required=True, + validators=[ + validators.dateYearIsLargerThan(1998), + validators.quarterIsValid() + ] + ), + TransformField( + calendar_quarter_to_rpt_month_year(1), + item="2B", + name='RPT_MONTH_YEAR', + friendly_name='reporting month and year', + type='number', + startIndex=2, + endIndex=7, + required=True, + validators=[ + validators.dateYearIsLargerThan(1998), + validators.dateMonthIsValid() + ] + ), + Field( + item="3B", + name='SSPMOE_FAMILIES', + friendly_name='ssp/moe families', + type='number', + startIndex=15, + endIndex=23, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="4B", + name='NUM_2_PARENTS', + friendly_name='number of two-parent families', + type='number', + startIndex=39, + endIndex=47, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="5B", + name='NUM_1_PARENTS', + friendly_name='number of one-parent families', + type='number', + startIndex=63, + endIndex=71, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="6B", + name='NUM_NO_PARENTS', + friendly_name='number of no-parent families', + type='number', + startIndex=87, + endIndex=95, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="7B", + name='NUM_RECIPIENTS', + friendly_name='number of recipients', + type='number', + startIndex=111, + endIndex=119, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="8B", + name='ADULT_RECIPIENTS', + friendly_name='number of adult recipients', + type='number', + startIndex=135, + endIndex=143, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="9B", + name='CHILD_RECIPIENTS', + friendly_name='number of child recipients', + type='number', + startIndex=159, + endIndex=167, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="10B", + name='NONCUSTODIALS', + friendly_name='number of noncustodial parents', + type='number', + startIndex=183, + endIndex=191, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="11B", + name='AMT_ASSISTANCE', + friendly_name='amount of assistance', + type='number', + startIndex=211, + endIndex=223, + required=True, + validators=[validators.isInLimits(0, 999999999999)] + ), + Field( + item="12B", + name='CLOSED_CASES', + friendly_name='number of closed cases', + type='number', + startIndex=243, + endIndex=251, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), ], ) @@ -125,52 +337,157 @@ ], postparsing_validators=[ validators.sumIsEqual( - "SSPMOE_FAMILIES", ["NUM_2_PARENTS", "NUM_1_PARENTS", "NUM_NO_PARENTS"]), + "SSPMOE_FAMILIES", [ + "NUM_2_PARENTS", + "NUM_1_PARENTS", + "NUM_NO_PARENTS" + ] + ), validators.sumIsEqual( - "NUM_RECIPIENTS", ["ADULT_RECIPIENTS", "CHILD_RECIPIENTS"]), + "NUM_RECIPIENTS", [ + "ADULT_RECIPIENTS", + "CHILD_RECIPIENTS" + ] + ), ], fields=[ - Field(item="0", name='RecordType', type='string', startIndex=0, endIndex=2, - friendly_name='record type', - required=True, validators=[]), - Field(item="2", name='CALENDAR_QUARTER', type='number', startIndex=2, endIndex=7, - friendly_name='calendar quarter', - required=True, validators=[validators.dateYearIsLargerThan(1998), - validators.quarterIsValid()]), - TransformField(calendar_quarter_to_rpt_month_year(2), item="2B", name='RPT_MONTH_YEAR', type='number', - friendly_name='reporting month and year', - startIndex=2, endIndex=7, required=True, validators=[validators.dateYearIsLargerThan(1998), - validators.dateMonthIsValid()]), - Field(item="3C", name='SSPMOE_FAMILIES', type='number', startIndex=23, endIndex=31, - friendly_name='ssp/moe families', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="4C", name='NUM_2_PARENTS', type='number', startIndex=47, endIndex=55, - friendly_name='number of two-parent families', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="5C", name='NUM_1_PARENTS', type='number', startIndex=71, endIndex=79, - friendly_name='number of one-parent families', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="6C", name='NUM_NO_PARENTS', type='number', startIndex=95, endIndex=103, - friendly_name='number of no-parent families', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="7C", name='NUM_RECIPIENTS', type='number', startIndex=119, endIndex=127, - friendly_name='number of recipients', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="8C", name='ADULT_RECIPIENTS', type='number', startIndex=143, endIndex=151, - friendly_name='number of adult recipients', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="9C", name='CHILD_RECIPIENTS', type='number', startIndex=167, endIndex=175, - friendly_name='number of child recipients', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="10C", name='NONCUSTODIALS', type='number', startIndex=191, endIndex=199, - friendly_name='number of noncustodial parents', - required=True, validators=[validators.isInLimits(0, 99999999)]), - Field(item="11C", name='AMT_ASSISTANCE', type='number', startIndex=223, endIndex=235, - friendly_name='amount of assistance', - required=True, validators=[validators.isInLimits(0, 999999999999)]), - Field(item="12C", name='CLOSED_CASES', type='number', startIndex=251, endIndex=259, - friendly_name='number of closed cases', - required=True, validators=[validators.isInLimits(0, 99999999)]), + Field( + item="0", + name='RecordType', + friendly_name='record type', + type='string', + startIndex=0, + endIndex=2, + required=True, + validators=[] + ), + Field( + item="2", + name='CALENDAR_QUARTER', + friendly_name='calendar quarter', + type='number', + startIndex=2, + endIndex=7, + required=True, + validators=[ + validators.dateYearIsLargerThan(1998), + validators.quarterIsValid() + ] + ), + TransformField( + calendar_quarter_to_rpt_month_year(2), + item="2B", + name='RPT_MONTH_YEAR', + friendly_name='reporting month and year', + type='number', + startIndex=2, + endIndex=7, + required=True, + validators=[ + validators.dateYearIsLargerThan(1998), + validators.dateMonthIsValid() + ] + ), + Field( + item="3C", + name='SSPMOE_FAMILIES', + friendly_name='ssp/moe families', + type='number', + startIndex=23, + endIndex=31, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="4C", + name='NUM_2_PARENTS', + friendly_name='number of two-parent families', + type='number', + startIndex=47, + endIndex=55, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="5C", + name='NUM_1_PARENTS', + friendly_name='number of one-parent families', + type='number', + startIndex=71, + endIndex=79, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="6C", + name='NUM_NO_PARENTS', + friendly_name='number of no-parent families', + type='number', + startIndex=95, + endIndex=103, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="7C", + name='NUM_RECIPIENTS', + friendly_name='number of recipients', + type='number', + startIndex=119, + endIndex=127, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="8C", + name='ADULT_RECIPIENTS', + friendly_name='number of adult recipients', + type='number', + startIndex=143, + endIndex=151, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="9C", + name='CHILD_RECIPIENTS', + friendly_name='number of child recipients', + type='number', + startIndex=167, + endIndex=175, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="10C", + name='NONCUSTODIALS', + friendly_name='number of noncustodial parents', + type='number', + startIndex=191, + endIndex=199, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), + Field( + item="11C", + name='AMT_ASSISTANCE', + friendly_name='amount of assistance', + type='number', + startIndex=223, + endIndex=235, + required=True, + validators=[validators.isInLimits(0, 999999999999)] + ), + Field( + item="12C", + name='CLOSED_CASES', + friendly_name='number of closed cases', + type='number', + startIndex=251, + endIndex=259, + required=True, + validators=[validators.isInLimits(0, 99999999)] + ), ], ) diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py index 64c750a22..76ce8f0f5 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py @@ -419,7 +419,7 @@ Field( item="23B", name="TRANSP_NBR_MONTHS", - friendly_name="transportation number of months", + friendly_name="transportation - number of months", type="number", startIndex=75, endIndex=78, @@ -443,7 +443,7 @@ Field( item="24B", name="TRANSITION_NBR_MONTHS", - friendly_name="transition services number of months", + friendly_name="transition services - number of months", type="number", startIndex=82, endIndex=85, @@ -467,7 +467,7 @@ Field( item="25B", name="OTHER_NBR_MONTHS", - friendly_name="other number of months", + friendly_name="other - number of months", type="number", startIndex=89, endIndex=92, @@ -551,7 +551,7 @@ Field( item="26AVII", name="OTHER_SANCTION", - friendly_name="other, sanction", + friendly_name="other sanction", type="number", startIndex=101, endIndex=102, @@ -611,7 +611,7 @@ Field( item="26CIV", name="OTHER_NON_SANCTION", - friendly_name="other, non-sanction", + friendly_name="other non-sanction", type="number", startIndex=112, endIndex=113, @@ -630,7 +630,8 @@ required=False, validators=[ validators.or_validators( - validators.matches("9"), validators.isEmpty() + validators.matches("9"), + validators.isEmpty() ), validators.isAlphaNumeric(), ], diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py index 2725af62c..441795ca1 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py @@ -305,7 +305,8 @@ required=True, validators=[ validators.or_validators( - validators.oneOf(["1", "2"]), validators.isBlank() + validators.oneOf(["1", "2"]), + validators.isBlank() ) ], ), @@ -594,7 +595,7 @@ Field( item="55A", name="JOB_SEARCH_HOP", - friendly_name="job search hours of participation", + friendly_name="job search - hours of participation", type="string", startIndex=84, endIndex=86, @@ -606,7 +607,7 @@ Field( item="55B", name="JOB_SEARCH_EA", - friendly_name="job search excused absence", + friendly_name="job search - excused absence", type="string", startIndex=86, endIndex=88, @@ -630,7 +631,7 @@ Field( item="56A", name="COMM_SERVICES_HOP", - friendly_name="community service hours of participation", + friendly_name="community service - hours of participation", type="string", startIndex=90, endIndex=92, @@ -642,7 +643,7 @@ Field( item="56B", name="COMM_SERVICES_EA", - friendly_name="community service excused absence", + friendly_name="community service - excused absence", type="string", startIndex=92, endIndex=94, @@ -654,7 +655,7 @@ Field( item="56C", name="COMM_SERVICES_HOL", - friendly_name="community service hours of leave", + friendly_name="community service - hours of leave", type="string", startIndex=94, endIndex=96, @@ -666,7 +667,7 @@ Field( item="57A", name="VOCATIONAL_ED_TRAINING_HOP", - friendly_name="vocational education training hours of participation", + friendly_name="vocational education training - hours of participation", type="string", startIndex=96, endIndex=98, @@ -678,7 +679,7 @@ Field( item="57B", name="VOCATIONAL_ED_TRAINING_EA", - friendly_name="vocational education training excused absence", + friendly_name="vocational education training - excused absence", type="string", startIndex=98, endIndex=100, @@ -690,7 +691,7 @@ Field( item="57C", name="VOCATIONAL_ED_TRAINING_HOL", - friendly_name="vocational education training hours of leave", + friendly_name="vocational education training - hours of leave", type="string", startIndex=100, endIndex=102, @@ -702,7 +703,7 @@ Field( item="58A", name="JOB_SKILLS_TRAINING_HOP", - friendly_name="job skills training hours of participation", + friendly_name="job skills training - hours of participation", type="string", startIndex=102, endIndex=104, @@ -714,7 +715,7 @@ Field( item="58B", name="JOB_SKILLS_TRAINING_EA", - friendly_name="job skills training excused absence", + friendly_name="job skills training - excused absence", type="string", startIndex=104, endIndex=106, @@ -726,7 +727,7 @@ Field( item="58C", name="JOB_SKILLS_TRAINING_HOL", - friendly_name="job skills training hours of leave", + friendly_name="job skills training - hours of leave", type="string", startIndex=106, endIndex=108, @@ -738,7 +739,7 @@ Field( item="59A", name="ED_NO_HIGH_SCHOOL_DIPL_HOP", - friendly_name="education no high school diploma hours of participation", + friendly_name="education no high school diploma - hours of participation", type="string", startIndex=108, endIndex=110, @@ -750,7 +751,7 @@ Field( item="59B", name="ED_NO_HIGH_SCHOOL_DIPL_EA", - friendly_name="education no high school diploma excused absence", + friendly_name="education no high school diploma - excused absence", type="string", startIndex=110, endIndex=112, @@ -774,7 +775,7 @@ Field( item="60A", name="SCHOOL_ATTENDENCE_HOP", - friendly_name="school attendance hours of participation", + friendly_name="school attendance - hours of participation", type="string", startIndex=114, endIndex=116, @@ -786,7 +787,7 @@ Field( item="60B", name="SCHOOL_ATTENDENCE_EA", - friendly_name="school attendance excused absence", + friendly_name="school attendance - excused absence", type="string", startIndex=116, endIndex=118, @@ -810,7 +811,7 @@ Field( item="61A", name="PROVIDE_CC_HOP", - friendly_name="provide child care hours of participation", + friendly_name="provide child care - hours of participation", type="string", startIndex=120, endIndex=122, @@ -822,7 +823,7 @@ Field( item="61B", name="PROVIDE_CC_EA", - friendly_name="provide child care excused absence", + friendly_name="provide child care - excused absence", type="string", startIndex=122, endIndex=124, diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t3.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t3.py index ea5d65e6c..f91217ccd 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t3.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t3.py @@ -578,7 +578,8 @@ required=True, validators=[ validators.or_validators( - validators.isInStringRange(0, 16), validators.oneOf(["98", "99"]) + validators.isInStringRange(0, 16), + validators.oneOf(["98", "99"]) ) ], ), diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t4.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t4.py index 71427fa34..1a5a13c54 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t4.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t4.py @@ -100,7 +100,8 @@ required=True, validators=[ validators.or_validators( - validators.isInStringRange(1, 19), validators.matches("99") + validators.isInStringRange(1, 19), + validators.matches("99") ) ], ), diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t5.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t5.py index 63250181c..120c9389e 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t5.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t5.py @@ -355,7 +355,8 @@ required=True, validators=[ validators.or_validators( - validators.isInLimits(0, 2), validators.matches(9) + validators.isInLimits(0, 2), + validators.matches(9) ) ], ), diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t6.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t6.py index 215039fa4..77925781a 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t6.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t6.py @@ -15,12 +15,24 @@ validators.hasLength(379), ], postparsing_validators=[ - validators.sumIsEqual("NUM_APPLICATIONS", ["NUM_APPROVED", "NUM_DENIED"]), validators.sumIsEqual( - "NUM_FAMILIES", ["NUM_2_PARENTS", "NUM_1_PARENTS", "NUM_NO_PARENTS"] + "NUM_APPLICATIONS", [ + "NUM_APPROVED", + "NUM_DENIED" + ] ), validators.sumIsEqual( - "NUM_RECIPIENTS", ["NUM_ADULT_RECIPIENTS", "NUM_CHILD_RECIPIENTS"] + "NUM_FAMILIES", [ + "NUM_2_PARENTS", + "NUM_1_PARENTS", + "NUM_NO_PARENTS" + ] + ), + validators.sumIsEqual( + "NUM_RECIPIENTS", [ + "NUM_ADULT_RECIPIENTS", + "NUM_CHILD_RECIPIENTS" + ] ), ], fields=[ @@ -134,7 +146,7 @@ Field( item="11A", name="NUM_NO_PARENTS", - friendly_name="total number of no parent families", + friendly_name="total number of no-parent families", type="number", startIndex=187, endIndex=195, @@ -220,12 +232,24 @@ validators.hasLength(379), ], postparsing_validators=[ - validators.sumIsEqual("NUM_APPLICATIONS", ["NUM_APPROVED", "NUM_DENIED"]), validators.sumIsEqual( - "NUM_FAMILIES", ["NUM_2_PARENTS", "NUM_1_PARENTS", "NUM_NO_PARENTS"] + "NUM_APPLICATIONS", [ + "NUM_APPROVED", + "NUM_DENIED" + ] + ), + validators.sumIsEqual( + "NUM_FAMILIES", [ + "NUM_2_PARENTS", + "NUM_1_PARENTS", + "NUM_NO_PARENTS" + ] ), validators.sumIsEqual( - "NUM_RECIPIENTS", ["NUM_ADULT_RECIPIENTS", "NUM_CHILD_RECIPIENTS"] + "NUM_RECIPIENTS", [ + "NUM_ADULT_RECIPIENTS", + "NUM_CHILD_RECIPIENTS" + ] ), ], fields=[ @@ -419,12 +443,24 @@ validators.hasLength(379), ], postparsing_validators=[ - validators.sumIsEqual("NUM_APPLICATIONS", ["NUM_APPROVED", "NUM_DENIED"]), validators.sumIsEqual( - "NUM_FAMILIES", ["NUM_2_PARENTS", "NUM_1_PARENTS", "NUM_NO_PARENTS"] + "NUM_APPLICATIONS", [ + "NUM_APPROVED", + "NUM_DENIED" + ] ), validators.sumIsEqual( - "NUM_RECIPIENTS", ["NUM_ADULT_RECIPIENTS", "NUM_CHILD_RECIPIENTS"] + "NUM_FAMILIES", [ + "NUM_2_PARENTS", + "NUM_1_PARENTS", + "NUM_NO_PARENTS" + ] + ), + validators.sumIsEqual( + "NUM_RECIPIENTS", [ + "NUM_ADULT_RECIPIENTS", + "NUM_CHILD_RECIPIENTS" + ] ), ], fields=[ @@ -522,7 +558,7 @@ Field( item="10C", name="NUM_1_PARENTS", - friendly_name="total number of one parent families", + friendly_name="total number of one-parent families", type="number", startIndex=179, endIndex=187, @@ -532,7 +568,7 @@ Field( item="11C", name="NUM_NO_PARENTS", - friendly_name="total number of no parent families", + friendly_name="total number of no-parent families", type="number", startIndex=203, endIndex=211,