From 0be491f9056cdfd5e0c9e46763174c084a8f38bb Mon Sep 17 00:00:00 2001 From: Mo Sohani Date: Wed, 15 Nov 2023 11:46:53 -0500 Subject: [PATCH] corrections for fields --- tdrs-backend/tdpservice/parsers/fields.py | 12 +- .../tdpservice/parsers/schema_defs/tanf/t2.py | 570 +++++++++--------- tdrs-backend/tdpservice/parsers/validators.py | 3 +- 3 files changed, 286 insertions(+), 299 deletions(-) diff --git a/tdrs-backend/tdpservice/parsers/fields.py b/tdrs-backend/tdpservice/parsers/fields.py index af60769dd..617006f32 100644 --- a/tdrs-backend/tdpservice/parsers/fields.py +++ b/tdrs-backend/tdpservice/parsers/fields.py @@ -75,9 +75,17 @@ def parse_value(self, line): class TransformField(Field): """Represents a field that requires some transformation before serializing.""" - def __init__(self, transform_func, item, name, type, startIndex, endIndex, required=True, + def __init__(self, transform_func, item, name, friendly_name, type, startIndex, endIndex, required=True, validators=[], **kwargs): - super().__init__(item, name, type, startIndex, endIndex, required, validators) + super().__init__( + item=item, + name=name, + type=type, + friendly_name=friendly_name, + startIndex=startIndex, + endIndex=endIndex, + required=required, + validators=validators) self.transform_func = transform_func self.kwargs = kwargs diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py index d06b793a5..0c39f08bc 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py @@ -9,323 +9,301 @@ from tdpservice.search_indexes.models.tanf import TANF_T2 -t2 = SchemaManager( - schemas=[ - RowSchema( - model=TANF_T2, - preparsing_validators=[ - validators.hasLength(156), - ], - postparsing_validators=[ +t2 = SchemaManager(schemas=[ + RowSchema( + model=TANF_T2, + preparsing_validators=[ + validators.hasLength(156), + ], + 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(), + 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), + 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), - ), + 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), - ), + 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), - ), + 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), - ), + 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), - ), + 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), - ), + 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_WITH_MINOR_CHILD", - result_function=validators.isInLimits(1, 3), - ), + condition_field='FAMILY_AFFILIATION', condition_function=validators.isInLimits(1, 2), + result_field='PARENT_WITH_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(0, 16), - validators.isInStringRange(98, 99), + condition_field='FAMILY_AFFILIATION', condition_function=validators.isInLimits(1, 3), + result_field='EDUCATION_LEVEL', result_function=validators.or_validators( + validators.isInStringRange(0, 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)), - ), + 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)), - ), + condition_field='FAMILY_AFFILIATION', condition_function=validators.isInLimits(1, 3), + result_field='COOPERATION_CHILD_SUPPORT', result_function=validators.oneOf((1, 2, 9)), + ), validators.validate__FAM_AFF__HOH__Fed_Time(), validators.if_then_validator( - condition_field="FAMILY_AFFILIATION", - condition_function=validators.isInLimits(1, 3), - result_field="EMPLOYMENT_STATUS", - result_function=validators.isInLimits(1, 3), - ), + 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.isInStringRange(1, 9), validators.oneOf(("11", "12")) + condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), + result_field='WORK_ELIGIBLE_INDICATOR', result_function=validators.or_validators( + validators.isInStringRange(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( - ["01", "02", "05", "07", "09", "15", "17", "18", "19", "99"] + condition_field='FAMILY_AFFILIATION', condition_function=validators.oneOf((1, 2)), + result_field='WORK_PART_STATUS', result_function=validators.oneOf(['01', '02', '05', '07', '09', + '15', '17', '18', '19', '99'] + ), ), - ), validators.if_then_validator( - condition_field="WORK_ELIGIBLE_INDICATOR", - condition_function=validators.isInStringRange(1, 5), - result_field="WORK_PART_STATUS", - result_function=validators.notMatches("99"), - ), + condition_field='WORK_ELIGIBLE_INDICATOR', condition_function=validators.isInStringRange(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="4", name='RPT_MONTH_YEAR', type='number', startIndex=2, endIndex=8, - friendly_name="report month year", required=True, - validators=[validators.dateYearIsLargerThan(1998), validators.dateMonthIsValid(),]), - Field(item="6", name='CASE_NUMBER', type='string', startIndex=8, endIndex=19, - friendly_name="case number", required=True, validators=[validators.isAlphaNumeric()]), - Field(item="30", name='FAMILY_AFFILIATION', type='number', startIndex=19, endIndex=20, - friendly_name="family affiliation", required=True, validators=[validators.oneOf([1, 2, 3, 5])]), - Field(item="31", name='NONCUSTODIAL_PARENT', type='number', startIndex=20, endIndex=21, required=True, - friendly_name="noncustodial parent", validators=[validators.oneOf([1, 2])]), - Field(item="32", name='DATE_OF_BIRTH', type='number', startIndex=21, endIndex=29, required=True, - friendly_name="date of birth", validators=[validators.isLargerThan(0),]), - TransformField( - transform_func=tanf_ssn_decryption_func, item="33", name='SSN', type='string', startIndex=29, - friendly_name="social security number SSN", endIndex=38, required=True, - validators=[validators.validateSSN()], is_encrypted=False), - Field(item="34A", name='RACE_HISPANIC', type='number', startIndex=38, endIndex=39, required=False, - friendly_name="race hispanic", validators=[validators.isInLimits(0, 2)]), - Field(item="34B", name='RACE_AMER_INDIAN', type='number', startIndex=39, endIndex=40, required=False, - friendly_name="race american indian", validators=[validators.isInLimits(0, 2)]), - Field(item="34C", name='RACE_ASIAN', type='number', startIndex=40, endIndex=41, required=False, - friendly_name="race asian", validators=[validators.isInLimits(0, 2)]), - Field(item="34D", name='RACE_BLACK', type='number', startIndex=41, endIndex=42, required=False, - friendly_name="race black", validators=[validators.isInLimits(0, 2)]), - Field(item="34E", name='RACE_HAWAIIAN', type='number', startIndex=42, endIndex=43, required=False, - friendly_name="race hawaiian", validators=[validators.isInLimits(0, 2)]), - Field(item="34F", name='RACE_WHITE', type='number', startIndex=43, endIndex=44, required=False, - friendly_name="race white", validators=[validators.isInLimits(0, 2)]), - Field(item="35", name='GENDER', type='number', startIndex=44, endIndex=45, required=True, - friendly_name="gender", validators=[validators.isLargerThanOrEqualTo(0),]), - Field(item="36A", name='FED_OASDI_PROGRAM', type='number', startIndex=45, endIndex=46, required=True, - friendly_name="fed qasdi program", validators=[validators.oneOf([1, 2])]), - Field(item="36B", name='FED_DISABILITY_STATUS', type='number', - startIndex=46, endIndex=47, required=True, - friendly_name="fed disability status", validators=[validators.oneOf([1, 2])]), - Field(item="36C", name='DISABLED_TITLE_XIVAPDT', type='string', - startIndex=47, endIndex=48, required=True, - friendly_name="disbaled title xivapdt", - validators=[validators.or_validators(validators.oneOf(["1", "2"]), validators.isBlank())]), - Field(item="36D", name='AID_AGED_BLIND', type='number', startIndex=48, endIndex=49, required=False, - friendly_name="aid aged blind", validators=[validators.isLargerThanOrEqualTo(0),]), - Field(item="36E", name='RECEIVE_SSI', type='number', startIndex=49, endIndex=50, required=True, - friendly_name="receive ssi", validators=[validators.oneOf([1, 2]),]), - Field(item="37", name='MARITAL_STATUS', type='number', startIndex=50, endIndex=51, required=False, - friendly_name="marital status", validators=[validators.isInLimits(0, 5),]), - Field(item="38", name='RELATIONSHIP_HOH', type='string', startIndex=51, endIndex=53, required=True, - friendly_name="relationship to head of household", - validators=[validators.isInStringRange(1, 10),]), - Field(item="39", name='PARENT_WITH_MINOR_CHILD', type='number', - startIndex=53, endIndex=54, required=False, - friendly_name="parent with minor child", validators=[validators.isInLimits(0, 3),]), - Field(item="40", name='NEEDS_PREGNANT_WOMAN', type='number', - startIndex=54, endIndex=55, required=False, - friendly_name="needs of pregnant woman", validators=[validators.isInLimits(0, 9),]), - Field(item="41", name='EDUCATION_LEVEL', type='string', startIndex=55, endIndex=57, required=False, - friendly_name="education level", - validators=[ - validators.or_validators(validators.isInStringRange(0, 16), - validators.isInStringRange(98, 99)) - ]), - Field(item="42", name='CITIZENSHIP_STATUS', type='number', startIndex=57, endIndex=58, required=False, - friendly_name="citizenship status", validators=[validators.oneOf([0, 1, 2, 9])]), - Field(item="43", name='COOPERATION_CHILD_SUPPORT', type='number', startIndex=58, endIndex=59, - friendly_name="coopeartion with child support", required=False, - validators=[validators.oneOf([0, 1, 2, 9]),]), - Field(item="44", name='MONTHS_FED_TIME_LIMIT', type='string', - startIndex=59, endIndex=62, required=False, - friendly_name="number of months countable toward federal time limit", - validators=[validators.isInStringRange(0, 999),]), - Field(item="45", name='MONTHS_STATE_TIME_LIMIT', type='string', - startIndex=62, endIndex=64, required=False, - friendly_name="months of state time limit", validators=[validators.isInStringRange(0, 99),]), - Field(item="46", name='CURRENT_MONTH_STATE_EXEMPT', type='number', startIndex=64, endIndex=65, - friendly_name="is current month exempt from the state time limit", - required=False, validators=[validators.isInLimits(0, 9),]), - Field(item="47", name='EMPLOYMENT_STATUS', type='number', startIndex=65, endIndex=66, required=False, - friendly_name="employment status", validators=[validators.isInLimits(0, 3),]), - Field(item="48", name='WORK_ELIGIBLE_INDICATOR', type='string', - startIndex=66, endIndex=68, required=True, - friendly_name="work-eligible indivdual indicator", - validators=[ - validators.or_validators(validators.isInStringRange(0, 9), - validators.oneOf(('11', '12'))) - ]), - Field(item="49", name='WORK_PART_STATUS', type='string', startIndex=68, endIndex=70, required=False, - friendly_name="work participation status", - validators=[ - validators.oneOf(['01', '02', '05', '07', '09', '15', '16', '17', '18', '19', '99']) - ]), - Field(item="50", name='UNSUB_EMPLOYMENT', type='string', startIndex=70, endIndex=72, required=False, - friendly_name="employement status", validators=[validators.isInStringRange(0, 99),]), - Field(item="51", name='SUB_PRIVATE_EMPLOYMENT', type='string', - startIndex=72, endIndex=74, required=False, - friendly_name="subsidized private employment", validators=[validators.isInStringRange(0, 99),]), - Field(item="52", name='SUB_PUBLIC_EMPLOYMENT', type='string', - startIndex=74, endIndex=76, required=False, - friendly_name="subsidized public employment", validators=[validators.isInStringRange(0, 99),]), - Field(item="53A", name='WORK_EXPERIENCE_HOP', type='string', - startIndex=76, endIndex=78, required=False, - friendly_name="work experience - hours of participation", - validators=[validators.isInStringRange(0, 99),]), - Field(item="53B", name='WORK_EXPERIENCE_EA', type='string', - startIndex=78, endIndex=80, required=False, - friendly_name="work experience - excused absence", - validators=[validators.isInStringRange(0, 99),]), - Field(item="53C", name='WORK_EXPERIENCE_HOL', type='string', - startIndex=80, endIndex=82, required=False, - friendly_name="work experience - holiday", validators=[validators.isInStringRange(0, 99),]), - Field(item="54", name='OJT', type='string', startIndex=82, endIndex=84, required=False, - friendly_name="on the job training", - validators=[ - validators.isInStringRange(0, 99), - ]), - Field(item="55A", name='JOB_SEARCH_HOP', type='string', startIndex=84, endIndex=86, required=False, - friendly_name="job search - hours of operation", - validators=[validators.isInStringRange(0, 99),]), - Field(item="55B", name='JOB_SEARCH_EA', type='string', startIndex=86, endIndex=88, required=False, - friendly_name="job search - exceused absense", validators=[validators.isInStringRange(0, 99),]), - Field(item="55C", name='JOB_SEARCH_HOL', type='string', startIndex=88, endIndex=90, required=False, - friendly_name="job search - holiday", validators=[validators.isInStringRange(0, 99),]), - Field(item="56A", name='COMM_SERVICES_HOP', type='string', startIndex=90, endIndex=92, required=False, - friendly_name="community service - hours of operation", - validators=[validators.isInStringRange(0, 99),]), - Field(item="56B", name='COMM_SERVICES_EA', type='string', startIndex=92, endIndex=94, required=False, - friendly_name="community service - excused absense", - validators=[validators.isInStringRange(0, 99),]), - Field(item="56C", name='COMM_SERVICES_HOL', type='string', startIndex=94, endIndex=96, required=False, - friendly_name="community service - holiday", validators=[validators.isInStringRange(0, 99),]), - Field(item="57A", name='VOCATIONAL_ED_TRAINING_HOP', type='string', startIndex=96, endIndex=98, - friendly_name="vocational education training - hours of operation", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="57B", name='VOCATIONAL_ED_TRAINING_EA', type='string', startIndex=98, endIndex=100, - friendly_name="vocational education - exceused absense", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="57C", name='VOCATIONAL_ED_TRAINING_HOL', type='string', startIndex=100, endIndex=102, - friendly_name="vocational education training - holiday", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="58A", name='JOB_SKILLS_TRAINING_HOP', type='string', startIndex=102, endIndex=104, - friendly_name="job skills training - hours of participation", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="58B", name='JOB_SKILLS_TRAINING_EA', type='string', startIndex=104, endIndex=106, - friendly_name="job skills training - excused absense", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="58C", name='JOB_SKILLS_TRAINING_HOL', type='string', startIndex=106, endIndex=108, - friendly_name="job skills training holiday", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="59A", name='ED_NO_HIGH_SCHOOL_DIPL_HOP', type='string', startIndex=108, endIndex=110, - friendly_name="education no high school diploma - hours of operation", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="59B", name='ED_NO_HIGH_SCHOOL_DIPL_EA', type='string', startIndex=110, endIndex=112, - friendly_name="education no high school diploma - excused absense", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="59C", name='ED_NO_HIGH_SCHOOL_DIPL_HOL', type='string', startIndex=112, endIndex=114, - friendly_name="education no high school diploma - holiday", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="60A", name='SCHOOL_ATTENDENCE_HOP', type='string', startIndex=114, endIndex=116, - friendly_name="school attendance - hours of participation", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="60B", name='SCHOOL_ATTENDENCE_EA', type='string', startIndex=116, endIndex=118, - friendly_name="school attendance - exceused absense", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="60C", name='SCHOOL_ATTENDENCE_HOL', type='string', startIndex=118, endIndex=120, - friendly_name="school attendance - holiday", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="61A", name='PROVIDE_CC_HOP', type='string', startIndex=120, endIndex=122, - friendly_name="provide child care - hours of participation", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="61B", name='PROVIDE_CC_EA', type='string', startIndex=122, endIndex=124, - friendly_name="provide child care - excused absense", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="61C", name='PROVIDE_CC_HOL', type='string', startIndex=124, endIndex=126, - friendly_name="provide child care - holiday", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="62", name='OTHER_WORK_ACTIVITIES', type='string', startIndex=126, endIndex=128, - friendly_name="other work activities", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="63", name='DEEMED_HOURS_FOR_OVERALL', type='string', startIndex=128, endIndex=130, - friendly_name="number of deemed core hours for overall rate", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="64", name='DEEMED_HOURS_FOR_TWO_PARENT', type='string', startIndex=130, endIndex=132, - friendly_name="number of deemed core hours for two-parent rate", - required=False, validators=[validators.isInStringRange(0, 99),]), - Field(item="65", name='EARNED_INCOME', type='string', startIndex=132, endIndex=136, - friendly_name="earned income", required=True, - validators=[validators.isInStringRange(0, 9999),]), - Field(item="66A", name='UNEARNED_INCOME_TAX_CREDIT', type='string', startIndex=136, endIndex=140, - friendly_name="unearned income tax credit", - required=False, validators=[validators.isInStringRange(0, 9999),]), - Field(item="66B", name='UNEARNED_SOCIAL_SECURITY', type='string', startIndex=140, endIndex=144, - friendly_name="unearned social security", - required=True, validators=[validators.isInStringRange(0, 9999),]), - Field(item="66C", name='UNEARNED_SSI', type='string', startIndex=144, endIndex=148, required=True, - friendly_name="unearned SSI", validators=[validators.isInStringRange(0, 9999),]), - Field(item="66D", name='UNEARNED_WORKERS_COMP', type='string', - startIndex=148, endIndex=152, required=True, - friendly_name="unearned workers compensation", - validators=[validators.isInStringRange(0, 9999),]), - Field(item="66E", name='OTHER_UNEARNED_INCOME', type='string', - startIndex=152, endIndex=156, required=True, - friendly_name="other unearned income", validators=[validators.isInStringRange(0, 9999),]), - ], - ) - ] - ) + fields=[ + Field(item="0", name='RecordType', type='string', startIndex=0, endIndex=2, + required=True, friendly_name='record type', validators=[]), + Field(item="4", name='RPT_MONTH_YEAR', type='number', startIndex=2, endIndex=8, + required=True, friendly_name='reporting month/year', + validators=[validators.dateYearIsLargerThan(1998), + validators.dateMonthIsValid(), + ]), + Field(item="6", name='CASE_NUMBER', type='string', startIndex=8, endIndex=19, + required=True, friendly_name='case number', + validators=[validators.isAlphaNumeric()]), + Field(item="30", name='FAMILY_AFFILIATION', type='number', startIndex=19, endIndex=20, + required=True, friendly_name='family affiliation', + validators=[validators.oneOf([1, 2, 3, 5])]), + Field(item="31", name='NONCUSTODIAL_PARENT', type='number', startIndex=20, endIndex=21, required=True, + friendly_name='noncustodial parent', + validators=[validators.oneOf([1, 2])]), + Field(item="32", name='DATE_OF_BIRTH', type='number', startIndex=21, endIndex=29, required=True, + friendly_name='date of birth', + validators=[validators.isLargerThan(0),]), + TransformField(transform_func=tanf_ssn_decryption_func, item="33", name='SSN', type='string', startIndex=29, + endIndex=38, required=True, friendly_name='social security number', + validators=[validators.validateSSN()], is_encrypted=False), + Field(item="34A", name='RACE_HISPANIC', type='number', startIndex=38, endIndex=39, required=False, + friendly_name='race hispanic', + validators=[validators.isInLimits(0, 2)]), + Field(item="34B", name='RACE_AMER_INDIAN', type='number', startIndex=39, endIndex=40, required=False, + friendly_name='race american Indian', + validators=[validators.isInLimits(0, 2)]), + Field(item="34C", name='RACE_ASIAN', type='number', startIndex=40, endIndex=41, required=False, + friendly_name='race asian', + validators=[validators.isInLimits(0, 2)]), + Field(item="34D", name='RACE_BLACK', type='number', startIndex=41, endIndex=42, required=False, + friendly_name='race black', + validators=[validators.isInLimits(0, 2)]), + Field(item="34E", name='RACE_HAWAIIAN', type='number', startIndex=42, endIndex=43, required=False, + friendly_name='race Hawaiian', + validators=[validators.isInLimits(0, 2)]), + Field(item="34F", name='RACE_WHITE', type='number', startIndex=43, endIndex=44, required=False, + friendly_name='race white', + validators=[validators.isInLimits(0, 2)]), + Field(item="35", name='GENDER', type='number', startIndex=44, endIndex=45, required=True, + friendly_name='gender', + validators=[validators.isLargerThanOrEqualTo(0),]), + Field(item="36A", name='FED_OASDI_PROGRAM', type='number', startIndex=45, endIndex=46, required=True, + friendly_name='federal oasdi program', + validators=[validators.oneOf([1, 2])]), + Field(item="36B", name='FED_DISABILITY_STATUS', type='number', startIndex=46, endIndex=47, required=True, + friendly_name='federal disability status', + validators=[validators.oneOf([1, 2])]), + Field(item="36C", name='DISABLED_TITLE_XIVAPDT', type='string', startIndex=47, endIndex=48, required=True, + friendly_name='disabled title xivapdt', + validators=[validators.or_validators(validators.oneOf(["1", "2"]), validators.isBlank())]), + Field(item="36D", name='AID_AGED_BLIND', type='number', startIndex=48, endIndex=49, required=False, + friendly_name='aid aged blind', + validators=[validators.isLargerThanOrEqualTo(0),]), + Field(item="36E", name='RECEIVE_SSI', type='number', startIndex=49, endIndex=50, required=True, + friendly_name='receive ssi', + validators=[validators.oneOf([1, 2]),]), + Field(item="37", name='MARITAL_STATUS', type='number', startIndex=50, endIndex=51, required=False, + friendly_name='marital status', + validators=[validators.isInLimits(0, 5),]), + Field(item="38", name='RELATIONSHIP_HOH', type='string', startIndex=51, endIndex=53, required=True, + friendly_name='relationship to head of household', + validators=[validators.isInStringRange(1, 10),]), + Field(item="39", name='PARENT_WITH_MINOR_CHILD', type='number', startIndex=53, endIndex=54, required=False, + friendly_name='parent with minor child', + validators=[validators.isInLimits(0, 3),]), + Field(item="40", name='NEEDS_PREGNANT_WOMAN', type='number', startIndex=54, endIndex=55, required=False, + friendly_name='needs pregnant woman', + validators=[validators.isInLimits(0, 9),]), + Field(item="41", name='EDUCATION_LEVEL', type='string', startIndex=55, endIndex=57, required=False, + friendly_name='education level', + validators=[validators.or_validators(validators.isInStringRange(0, 16), + validators.isInStringRange(98, 99) + )]), + Field(item="42", name='CITIZENSHIP_STATUS', type='number', startIndex=57, endIndex=58, required=False, + friendly_name='citizenship status', + validators=[validators.oneOf([0, 1, 2, 9])]), + Field(item="43", name='COOPERATION_CHILD_SUPPORT', type='number', startIndex=58, endIndex=59, + friendly_name='cooperation child support', + required=False, validators=[validators.oneOf([0, 1, 2, 9]),]), + Field(item="44", name='MONTHS_FED_TIME_LIMIT', type='string', startIndex=59, endIndex=62, required=False, + friendly_name='months federal time limit', + validators=[validators.isInStringRange(0, 999),]), + Field(item="45", name='MONTHS_STATE_TIME_LIMIT', type='string', startIndex=62, endIndex=64, required=False, + friendly_name='months state time limit', + validators=[validators.isInStringRange(0, 99),]), + Field(item="46", name='CURRENT_MONTH_STATE_EXEMPT', type='number', startIndex=64, endIndex=65, + friendly_name='current month state exempt', + required=False, validators=[validators.isInLimits(0, 9),]), + Field(item="47", name='EMPLOYMENT_STATUS', type='number', startIndex=65, endIndex=66, required=False, + friendly_name='employment status', + validators=[validators.isInLimits(0, 3),]), + Field(item="48", name='WORK_ELIGIBLE_INDICATOR', type='string', startIndex=66, endIndex=68, required=True, + friendly_name='work eligible indicator', + validators=[validators.or_validators(validators.isInStringRange(0, 9), + validators.oneOf(('11', '12')) + )]), + Field(item="49", name='WORK_PART_STATUS', type='string', startIndex=68, endIndex=70, required=False, + friendly_name='work participation status', + validators=[validators.oneOf(['01', '02', '05', '07', '09', '15', '16', '17', '18', '19', '99'])]), + Field(item="50", name='UNSUB_EMPLOYMENT', type='string', startIndex=70, endIndex=72, required=False, + friendly_name='unsubsidized employment', + validators=[validators.isInStringRange(0, 99),]), + Field(item="51", name='SUB_PRIVATE_EMPLOYMENT', type='string', startIndex=72, endIndex=74, required=False, + friendly_name='subsidized provate employment', + validators=[validators.isInStringRange(0, 99),]), + Field(item="52", name='SUB_PUBLIC_EMPLOYMENT', type='string', startIndex=74, endIndex=76, required=False, + friendly_name='subsidized public employment', + validators=[validators.isInStringRange(0, 99),]), + Field(item="53A", name='WORK_EXPERIENCE_HOP', type='string', startIndex=76, endIndex=78, required=False, + friendly_name='work experience hours of participation', + validators=[validators.isInStringRange(0, 99),]), + Field(item="53B", name='WORK_EXPERIENCE_EA', type='string', startIndex=78, endIndex=80, required=False, + friendly_name='work experience excused absence', + validators=[validators.isInStringRange(0, 99),]), + Field(item="53C", name='WORK_EXPERIENCE_HOL', type='string', startIndex=80, endIndex=82, required=False, + friendly_name='work experience holiday', + validators=[validators.isInStringRange(0, 99),]), + Field(item="54", name='OJT', type='string', startIndex=82, endIndex=84, required=False, + friendly_name='ojt', + validators=[validators.isInStringRange(0, 99),]), + Field(item="55A", name='JOB_SEARCH_HOP', type='string', startIndex=84, endIndex=86, required=False, + friendly_name='job search hours of participation', + validators=[validators.isInStringRange(0, 99),]), + Field(item="55B", name='JOB_SEARCH_EA', type='string', startIndex=86, endIndex=88, required=False, + friendly_name='job search excused absence', + validators=[validators.isInStringRange(0, 99),]), + Field(item="55C", name='JOB_SEARCH_HOL', type='string', startIndex=88, endIndex=90, required=False, + friendly_name='job search holiday', + validators=[validators.isInStringRange(0, 99),]), + Field(item="56A", name='COMM_SERVICES_HOP', type='string', startIndex=90, endIndex=92, required=False, + friendly_name='community services hrs of participation', + validators=[validators.isInStringRange(0, 99),]), + Field(item="56B", name='COMM_SERVICES_EA', type='string', startIndex=92, endIndex=94, required=False, + friendly_name='community services excused absence', + validators=[validators.isInStringRange(0, 99),]), + Field(item="56C", name='COMM_SERVICES_HOL', type='string', startIndex=94, endIndex=96, required=False, + friendly_name='community services holiday', + validators=[validators.isInStringRange(0, 99),]), + Field(item="57A", name='VOCATIONAL_ED_TRAINING_HOP', type='string', startIndex=96, endIndex=98, + friendly_name='vocational education training - hrs of participation', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="57B", name='VOCATIONAL_ED_TRAINING_EA', type='string', startIndex=98, endIndex=100, + friendly_name='vocational education training excused absence', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="57C", name='VOCATIONAL_ED_TRAINING_HOL', type='string', startIndex=100, endIndex=102, + friendly_name='vocational education training holiday', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="58A", name='JOB_SKILLS_TRAINING_HOP', type='string', startIndex=102, endIndex=104, + friendly_name='job skills training hrs of participation', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="58B", name='JOB_SKILLS_TRAINING_EA', type='string', startIndex=104, endIndex=106, + friendly_name='job skills training excused absence', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="58C", name='JOB_SKILLS_TRAINING_HOL', type='string', startIndex=106, endIndex=108, + friendly_name='job skills training - holiday', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="59A", name='ED_NO_HIGH_SCHOOL_DIPL_HOP', type='string', startIndex=108, endIndex=110, + friendly_name='education no high schoold diploma hrs of particiation', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="59B", name='ED_NO_HIGH_SCHOOL_DIPL_EA', type='string', startIndex=110, endIndex=112, + friendly_name='education no high school diploma eacused absence', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="59C", name='ED_NO_HIGH_SCHOOL_DIPL_HOL', type='string', startIndex=112, endIndex=114, + friendly_name='education no high school diploma - holiday', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="60A", name='SCHOOL_ATTENDENCE_HOP', type='string', startIndex=114, endIndex=116, + friendly_name='school attendance - hrs of participation', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="60B", name='SCHOOL_ATTENDENCE_EA', type='string', startIndex=116, endIndex=118, + friendly_name='school attendance - excused absence', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="60C", name='SCHOOL_ATTENDENCE_HOL', type='string', startIndex=118, endIndex=120, + friendly_name='school attendance - holiday', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="61A", name='PROVIDE_CC_HOP', type='string', startIndex=120, endIndex=122, + friendly_name='provide child care - hrs of participation', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="61B", name='PROVIDE_CC_EA', type='string', startIndex=122, endIndex=124, + friendly_name='provide child care - excused absence', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="61C", name='PROVIDE_CC_HOL', type='string', startIndex=124, endIndex=126, + friendly_name='provide child care - holiday', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="62", name='OTHER_WORK_ACTIVITIES', type='string', startIndex=126, endIndex=128, + friendly_name='other work activities', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="63", name='DEEMED_HOURS_FOR_OVERALL', type='string', startIndex=128, endIndex=130, + friendly_name='deemed hours for overall', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="64", name='DEEMED_HOURS_FOR_TWO_PARENT', type='string', startIndex=130, endIndex=132, + friendly_name='deemed hours for two parent', + required=False, validators=[validators.isInStringRange(0, 99),]), + Field(item="65", name='EARNED_INCOME', type='string', startIndex=132, endIndex=136, + friendly_name='earned income', + required=True, validators=[validators.isInStringRange(0, 9999),]), + Field(item="66A", name='UNEARNED_INCOME_TAX_CREDIT', type='string', startIndex=136, endIndex=140, + friendly_name='unearned income tax credit', + required=False, validators=[validators.isInStringRange(0, 9999),]), + Field(item="66B", name='UNEARNED_SOCIAL_SECURITY', type='string', startIndex=140, endIndex=144, + friendly_name='un earned social security', + required=True, validators=[validators.isInStringRange(0, 9999),]), + Field(item="66C", name='UNEARNED_SSI', type='string', startIndex=144, endIndex=148, required=True, + friendly_name='unearned ssi', + validators=[validators.isInStringRange(0, 9999),]), + Field(item="66D", name='UNEARNED_WORKERS_COMP', type='string', startIndex=148, endIndex=152, required=True, + friendly_name='unearned workers compensation', + validators=[validators.isInStringRange(0, 9999),]), + Field(item="66E", name='OTHER_UNEARNED_INCOME', type='string', startIndex=152, endIndex=156, required=True, + friendly_name='other unearned income', + validators=[validators.isInStringRange(0, 9999),]), + ], + )] +) \ No newline at end of file diff --git a/tdrs-backend/tdpservice/parsers/validators.py b/tdrs-backend/tdpservice/parsers/validators.py index accc166de..dde771cc3 100644 --- a/tdrs-backend/tdpservice/parsers/validators.py +++ b/tdrs-backend/tdpservice/parsers/validators.py @@ -443,7 +443,8 @@ def validate(instance): if FAMILY_AFFILIATION == 1 and (RELATIONSHIP_HOH == 1 or RELATIONSHIP_HOH == 2): if MONTHS_FED_TIME_LIMIT is None or int(MONTHS_FED_TIME_LIMIT) < 1: return (False, - 'If FAMILY_AFFILIATION == 2 and MONTHS_FED_TIME_LIMIT== 1 or 2, then MONTHS_FED_TIME_LIMIT > 1.' + 'If FAMILY_AFFILIATION == 2 and MONTHS_FED_TIME_LIMIT== 1 or 2, then MONTHS_FED_TIME_LIMIT > 1.', + ['FAMILY_AFFILIATION', 'MONTHS_FED_TIME_LIMIT'] ) else: return (