Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2818 Update Indicator - 2 #2899

Merged
merged 12 commits into from
Apr 15, 2024
2 changes: 1 addition & 1 deletion tdrs-backend/tdpservice/parsers/schema_defs/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
startIndex=22,
endIndex=23,
required=True,
validators=[validators.oneOf(["N", "D", "U"])],
validators=[validators.matches("D")],
),
],
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HEADER20204A06 TAN1EN
HEADER20204A06 TAN1ED
T12020101111111111223003403361110213120000300000000000008730010000000000000000000000000000000000222222000000002229012
T2202010111111111121219740114WTTTTTY@W2221222222221012212110014722011400000000000000000000000000000000000000000000000000000000000000000000000000000000000291
T320201011111111112120190127WTTTT90W022212222204398100000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HEADER20214A00142TAN1EU
HEADER20214A00142TAN1ED
T120211011111111119255 140245112 23322 03 0 0 0 502 9 0 0 0 0 0 0 0 0 3 0222222 0 0222 12
T2202110111111111193219690425WTTTTTZBT2222212222225 1321219 0602199 0 0 0 0 0 0 0 0 0 0 0 000 0 0 0 0 0 0 0
T320211011111111119120100412WTTTTT9ZB212222222 63 11 0 0120140424WTTTTT@0T212222122 63981 0 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HEADER20204C06 TAN1EN
HEADER20204C06 TAN1ED
T42020101111111115825301400141123113
T520201011111111158119970123WTTTTTP@Y2222212222221011212100946200000000
T520201011111111158120160206WTTTT90TY2222212 2 2 0422981 00000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HEADER20194C00142TAN1EU
HEADER20194C00142TAN1ED
T420191011111111762255 0402451153123
T520191011111111762120160102WTTTTT@YB2122222222221 822981 0 03 0 0
T520191011111111762120170526WTTTTTZPW2122221222221 822981 0 03 0 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HEADER20204G06 TAN1 N
HEADER20204G06 TAN1 D
T620204000127470001104500011146000043010000397700003924000084460000706800007222000055042849000055141378000056643253000755810007592100075542000009810000097000000968000392980003934900038972000353020003560200035602001684470016904700168107000464480004649800046203001219990012254900121904000001630000014900000151000003440000033100000276000002580000024100000187000054530000388100003884
TRAILER0000001
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HEADER20194G00142TAN1EU
HEADER20194G00142TAN1ED
T620194 5 1 1 5 1 1 0 0 0 21097 22915 21441 40 41 40 5 6 4 8 9 11 27 26 25 85 89 85 18 21 19 67 68 66 0 0 0 0 0 0 0 0 0 3 3 0
TRAILER0000001
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HEADER20204S06 TAN1 N
HEADER20204S06 TAN1 D
T720204101006853700680540068454103000312400037850003180104000347400036460003583106000044600004360000325299000506200036070003385202000039100002740000499
TRAILER0000001
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HEADER20231A53000TAN1EN
HEADER20231A53000TAN1ED
T12023011111111115424200409731120233120000300000000000004170990000000000000000000000000000000000222222000000002229022
T2202301111111111543219680723WT@BT#ZZZ2222211222222012212110421811069929000000000000000000000000000000000000000000000000000000000000999900000000000000000000
T320230111111111154120060507WT@9YZ9@@21222222206310100000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HEADER20231A53000TAN1EN
HEADER20231A53000TAN1ED
T12023011111111115424200409731120233120000300000000000004170990000000000000000000000000000000000222222000000002229022
T2202301111111111543219680723WT@BT#ZZZ2222211222222012212110421811069929000000000000000000000000000000000000000000000000000000000000999900000000000000000000
T320230111111111154120060507WT@9YZ9@@21222222206310100000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HEADER20184C24 SSP1EU
HEADER20184C24 SSP1ED
M42018101111111116120000406911161113
M520181011111111161119791106WTTTY0ZB922212222222210112111112970000
M520181011111111161120150623WTTTYT#0W222122222222 0422981 0000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HEADER20184G24 SSP1 N
HEADER20184G24 SSP1 D
M620184000158690001600800015956000008610000085100000845000149050001505500015013000001030000010200000098000513550005169600051348000157070001581400015766000356480003588200035582000000000000000000000000000000000000000000000000000000000000000012020000118900001229
TRAILER0000001
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HEADER20184S24 SSP1 N
HEADER20184S24 SSP1 D
M720184101000176900013100001111102000074800007670000768103001335200139310014077200000120200011890001229
TRAILER0000001
2 changes: 1 addition & 1 deletion tdrs-backend/tdpservice/parsers/test/data/bad_TANF_S1.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HEADER20214A25 TAN1EU
HEADER20214A25 TAN1ED
T12021101111111112320303404701120213110305300000000011602530020000000000000000000000000000000000222222000000002229012
T2202110111111111231219810321WTTTBZ9B02212212222221012212110012412011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000
T320211011111111123520190908WTTTP00TW22222122104398109080000
Expand Down
2 changes: 1 addition & 1 deletion tdrs-backend/tdpservice/parsers/test/data/bad_TANF_S2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HEADER20214A25 TANF1EU
HEADER20214A25 TANF1ED
T12021101111111112320303404701120213110305300000000011602530020000000000000000000000000000000000222222000000002229012
TRAILER0003698
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HEADER20204S06 TAN1 N
HEADER20204S06 TAN1 D
T720204101006853700680540068454103000312400037850003180104000347400036460003583106000044600004360000325299000506200036070003385202000039100002740000499
TRAILER0000001
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HEADER20204A06 TAN1 N
HEADER20204A06 TAN1 D
T1trash
TRAILERoops
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HEADER20204A06 TAN1 N
HEADER20204A06 TAN1 D
T12020101111111111223003403361110213120000300000000000008730010000000000000000000000000000000000222222000000002229012
T1trash
4 changes: 2 additions & 2 deletions tdrs-backend/tdpservice/parsers/test/data/bad_two_headers.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
HEADER20234A25 TAN1EU
HEADER20234A25 TAN1ED
T12026101111111111223003403361110213120000300000000000008730010000000000000000000000000000000000222222000000002229012
T2202010111111111121219740114WTTTTTY@W2221222222221012212110014722011400000000000000000000000000000000000000000000000000000000000000000000000000000000000291
T320201011111111112120190127WTTTT90W022212222204398100000000
T1202313111111111232030340470112021311030530000000001160253002000000000000000000000000000000000022222200000000222
T2202313111111111231219810321WTTTBZ9B02212212222221012212110012412011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000
T320231311111111123520190908WTTTP00TW22222122104398109080000
TRAILER0003467
HEADER20223A25 TAN1EU
HEADER20223A25 TAN1ED
T42024121111111111321101400701110213110700300000000000005890060000000000000000000000000000000000222222000000002229012
T12025101111111114721801401711120212110374300000000000003820060000000000000000000000000000000000222222000000002229012
T2202510111111111471219800223WTTTT@TTW2222212222221012212110065423010700000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Expand Down
2 changes: 1 addition & 1 deletion tdrs-backend/tdpservice/parsers/test/data/no_records.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
HEADER20204A06 TAN1 N
HEADER20204A06 TAN1 D
TRAILER0000001
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HEADER20184A24 SSP1EU
HEADER20184A24 SSP1ED
M1 111111114312120140429105233110741300000000000000010010000000000000000000000000000000000222222000000002229
M2 111111114311219870621WTTTYPYZ@2222211222221101211112011400000000000000000000000000000000000000000000000000000000000000000000000000000000000000
M3 11111111431120140515WTTTPY@YW22222112204398100000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HEADER20204A06 TAN1EN
HEADER20204A06 TAN1ED
T1 1111111114721801401711120212110374300000000000003820060000000000000000000000000000000000222222000000002229012
T2 111111111471219800223WTTTT@TTW2222212222221012212110065423010700000000000000000000000000000000000000000000000000000000000000000000000000000000000000
T3 11111111147120201101WTTTTTZWY22222112204398100000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HEADER20204A06 TAN1 N
HEADER20204A06 TAN1 D
T12020101111111111223003403361110212120000300000000000008730010000000000000000000000000000000000222222000000002229012
TRAILER0000001
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HEADER20204A06 TAN1 N
HEADER20204A06 TAN1 D
T12020101111111111223003403361110213120000300000000000008730000000000000000000000000000000000000222222000000002229012
TRAILER0000001
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HEADER20234A24 SSP1EU
HEADER20234A24 SSP1ED
M1202310111111111272140140035102133110027300000000000000010540000000000000000000000000000000000222222000000002229
M2202310111111111271219811103WTTT#PW@W2221222222225012211111011935000000000000000000000000000000000000000000000000000000000000225300000000000000000000
M320231011111111127120110615WTTTP99B#22212222204301100000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HEADER20204A06 TAN1EN
HEADER20204A06 TAN1ED
T12020101111111111223003403361110212120000300000000000008730010000000000000000000000000000000000222222000000002229012
T2202010111111111121219740114WTTTTTY@W2221222222221012212110014722011500000000000000000000000000000000000000000000000000000000000000000000000000000000000291
T320201011111111112120190127WTTTT90W022212222204398100000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HEADER20204C06 TAN1EN
HEADER20204C06 TAN1ED
T42020101111111115825301400141123113
T520201011111111158119970123WTTTTTP@Y2222212222221011212100946200000000
TRAILER0000828
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HEADER20184A24 SSP1EU
HEADER20184A24 SSP1ED
M1201810111111111272140140035102133110027300000000000000010540000000000000000000000000000000000222222000000002229
M2201810111111111271219811103WTTT#PW@W2221222222225012211111011935000000000000000000000000000000000000000000000000000000000000225300000000000000000000
M320181011111111127120110615WTTTP99B#22212222204301100000000
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
HEADER20204A06 TAN1 U
T12020101111111111223003403361110213120000300000000000008730010000000000000000000000000000000000222222000000002229012
TRAILER0000001
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HEADER20204A06 TAN1EN
HEADER20204A06 TAN1ED
T120201011111111112230 4033611102121 0000 00000000000008730010000000000000000 00002 222200000000222901
T2202010111111111121219740114WTTTTTY@W 2221 1 01 0199 0000 0000000000000291
T320201011111111112120190127WTTTT90W0 222 98 00000000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HEADER20204A06 TAN1 N
HEADER20204A06 TAN1 D
T12020101111111111223003403361110212120000300000000000008730010000000000000000000000000000000000222222000000002229012
TRAILER0000001
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HEADER20204S06 TAN1 N
HEADER20204S06 TAN1 D
T720204700006853700680540068454103000312400000000003180104000347400036460003583106000044600004360000325299000506200036070003385202000039100002740000499
TRAILER0000001
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HEADER20194A01142TAN1EU
HEADER20194A01142TAN1ED
T120191011111111119255 140245112 23322 03 0 0 0 502 9 0 0 0 0 0 0 0 0 3 0222222 0 0222 12
TRAILER0000001
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
HEADER20204S00142TAN1EU
HEADER20204S00142TAN1ED
T720204101006853700680540068454103000312400037850003180104000347400036460003583106000044600004360000325299000506200036070003385202000039100002740000499
TRAILER0000001
24 changes: 23 additions & 1 deletion tdrs-backend/tdpservice/parsers/test/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def t2_invalid_dob_file():
quarter='Q1',
file__name='t2_invalid_dob_file.txt',
file__section='Active Case Data',
file__data=(b'HEADER20204A25 TAN1EU\n'
file__data=(b'HEADER20204A25 TAN1ED\n'
b'T22020101111111111212Q897$9 3WTTTTTY@W222122222222101221211001472201140000000000000000000000000'
b'0000000000000000000000000000000000000000000000000000000000291\n'
b'TRAILER0000001 ')
Expand Down Expand Up @@ -1652,3 +1652,25 @@ def test_parse_no_records_file(no_records_file, dfs):
assert error.error_type == ParserErrorCategoryChoices.PRE_CHECK
assert error.content_type is None
assert error.object_id is None


@pytest.fixture
def tanf_section_1_file_with_bad_update_indicator(stt_user, stt):
"""Fixture for tanf_section_1_file_with_bad_update_indicator."""
return util.create_test_datafile('tanf_s1_bad_update_indicator.txt', stt_user, stt, "Active Case Data")

@pytest.mark.django_db()
def test_parse_tanf_section_1_file_with_bad_update_indicator(tanf_section_1_file_with_bad_update_indicator, dfs):
"""Test parsing TANF Section 1 submission update indicator."""
dfs.datafile = tanf_section_1_file_with_bad_update_indicator

parse.parse_datafile(tanf_section_1_file_with_bad_update_indicator, dfs)

parser_errors = ParserError.objects.filter(file=tanf_section_1_file_with_bad_update_indicator)

assert parser_errors.count() == 1

error = parser_errors.first()

assert error.error_type == ParserErrorCategoryChoices.FIELD_VALUE
assert error.error_message == "U does not match D."
Loading