From 0d1d9d562b22b49187af2fc8a91a1aca7512e609 Mon Sep 17 00:00:00 2001 From: Jan Timpe Date: Thu, 28 Sep 2023 15:39:55 -0400 Subject: [PATCH] differentiate item 6a/6b/67 in t7 records --- tdrs-backend/tdpservice/parsers/schema_defs/tanf/t7.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t7.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t7.py index 5c8e50675..2fcb4e0fd 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t7.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t7.py @@ -14,6 +14,10 @@ stratum_index = 8 families_index = 10 for i in range(1, 31): + month_index = (i - 1) % 3 + sub_item_labels = ['A', 'B', 'C'] + families_value_item_number = f"6{sub_item_labels[month_index]}" + schemas.append( RowSchema( model=TANF_T7, @@ -30,7 +34,7 @@ required=True, validators=[validators.dateYearIsLargerThan(1998), validators.quarterIsValid()]), TransformField( - transform_func=calendar_quarter_to_rpt_month_year((i - 1) % 3), + transform_func=calendar_quarter_to_rpt_month_year(month_index), item="3A", name='RPT_MONTH_YEAR', type='number', @@ -46,7 +50,7 @@ endIndex=section_ind_index + 1, required=True, validators=[validators.oneOf(['1', '2'])]), Field(item="5", name='STRATUM', type='string', startIndex=stratum_index, endIndex=stratum_index + 2, required=True, validators=[validators.isInStringRange(1, 99)]), - Field(item="6A", name='FAMILIES_MONTH', type='number', startIndex=families_index, + Field(item=families_value_item_number, name='FAMILIES_MONTH', type='number', startIndex=families_index, endIndex=families_index + 7, required=True, validators=[validators.isInLimits(0, 9999999)]), ] )