forked from HHS/TANF-app
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Tribal Section 4 Parsing & Validation #2762
Merged
Merged
Changes from all commits
Commits
Show all changes
153 commits
Select commit
Hold shift + click to select a range
f8a4d54
Added formating for header and autofit columns
raftmsohani 29fd04c
Formatted the headers
raftmsohani 699245c
added year/month to the columns
raftmsohani 5310946
Added contants - translation column
raftmsohani 0269728
added friendly names to T1 and T2
raftmsohani ac120a6
added friendly name to m1 and m2
raftmsohani a7c1207
added friendly name to m3
raftmsohani d460fe2
added friendly_name to t3
raftmsohani 2bb6622
added friendly_name to t4 and t5
raftmsohani c90ce75
added friendly_name to t7
raftmsohani 9dfd6f8
correct missing friendly_name
raftmsohani 90aea2f
correction on failing tests
raftmsohani 8f210cd
addedfriendly name to excel report
raftmsohani a093aa0
linting
raftmsohani 8ea36c6
linting
raftmsohani 85da10b
linting
raftmsohani ac95c41
delete contants.py
raftmsohani d75ba04
added test for json field in error model
raftmsohani ea5aa30
linting
raftmsohani b4d0549
linting
raftmsohani 8ce83ce
linting
raftmsohani 7719e85
- Added Tribal models, docs, admin refs
elipe17 0408123
- Update t1 field validators
elipe17 d1a9407
- t2/t3 field validators
elipe17 c75bb7e
2599-added friendly name to postparsing validators
raftmsohani 179a81c
- Updated cat3 validators
elipe17 77acd5a
- Updated how we detect tribe code
elipe17 2eb688f
- Added error handling for inconsistent header info wrt tribe code
elipe17 df77436
- Updated test
elipe17 8da540e
- Grammar fix
elipe17 b8671dc
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 1dce7d4
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 0ec8f16
refining the validator tests
raftmsohani 3f9bfce
- Format with Black
elipe17 c8607b2
- Fix lint
elipe17 164af6a
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 359dae0
added returning fields names to validators
raftmsohani 8ed0b4a
added friendly_name to error field
raftmsohani c57a2d5
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani 812a2dd
linting
raftmsohani 96634b2
corrections on views/tests
raftmsohani 0be491f
corrections for fields
raftmsohani 02ce7d0
failing test corrected
raftmsohani aa8a534
failing test corrected
raftmsohani 19926ea
correcting test failures
raftmsohani 6b7c86e
linting
raftmsohani 94ef180
corrected the excel fiel generator
raftmsohani b6eee03
removed excessive space in validator
raftmsohani 49dc398
linting
raftmsohani b0fd38a
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani b869b19
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 92a549f
- Updated based on review feedback
elipe17 f4e6bfa
- removing debug assert
elipe17 3699cdf
- Fix lint
elipe17 700a965
listing
raftmsohani 8aae444
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani a32fde6
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 7d1eb79
- deconflicting migrations
elipe17 41cada2
- Fixing test
elipe17 9636854
added m6
raftmsohani 5c2e819
lint
raftmsohani b18b9d3
- Adding datafile
elipe17 50507bf
- Added support for parsing tribal t4/t5
elipe17 3936483
- ADded cat2/cat3 validators
elipe17 763c09b
corrected new line break
raftmsohani e5dff79
- Update doc strings
elipe17 56b0842
- Fixed failing test
elipe17 989f098
- Fix lint
elipe17 3e73dbc
refactored validator logic
raftmsohani 4f6039b
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 8161b4c
- resolving conflict
elipe17 8a5665a
- Fix lint errors
elipe17 2d68b52
- Resolve conflict
elipe17 55ff4bd
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 e1c9c9a
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani dcc1dca
linting and correction on t1
raftmsohani 741b442
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani 28c9636
friendly_name correction from comments
raftmsohani 091e716
Merge branch '2599-error-report-corrections-impact-wpr-metrics' of ht…
raftmsohani 3e19f2d
friendly_name correction
raftmsohani c2501f8
corrected failing test for m5
raftmsohani b04df52
refactor the field_json creation DRY
raftmsohani cda507d
- Renamed tribal files
elipe17 f79364f
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 1838bf8
- Reduced file size
elipe17 7ae9054
- Fix lint errors
elipe17 b52c0d1
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 2b7036f
- Added support for parsing and validating tribal t6 records
elipe17 5bfca9c
- Fix lint
elipe17 4a1a5b3
- Added support for parsing/validating tribal t7
elipe17 666fc67
- Fix lint
elipe17 6ef6bc1
- Docstring fix
elipe17 968eec2
- Docstring fix
elipe17 50192aa
Merge branch '1116-tribal-s3' of https://github.com/raft-tech/TANF-ap…
elipe17 ad17b56
friendly_name corrections
raftmsohani efc15bd
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani 71daf97
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 a3a835b
Merge branch '2599-error-report-corrections-impact-wpr-metrics' of ht…
elipe17 fdd3b72
- Adding friendly names to tribal
elipe17 5b66912
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 7d06746
- Fixing typo
elipe17 f338fc4
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 2441dc3
- Added friendly names
elipe17 a50c176
Merge branch '1115-tribal-s2' of https://github.com/raft-tech/TANF-ap…
elipe17 0799f62
- Adding friendly names
elipe17 700f996
Merge branch '1116-tribal-s3' of https://github.com/raft-tech/TANF-ap…
elipe17 68c6781
- Adding friendly names
elipe17 d2d443d
linting and cleaning errors
raftmsohani 573a056
linting
raftmsohani b1be7bb
correction on friendly_names
raftmsohani cad9173
corrected friendly_name for test_util
raftmsohani aa6a5ad
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani 4bce93d
correction child care - number of months
raftmsohani d29ed8e
Merge branch '2599-error-report-corrections-impact-wpr-metrics' of ht…
raftmsohani bd29c09
fixed a few more typos and some spacing. (#2767)
George-Hudson beda306
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani cfec7f2
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 55ce817
- knowledge center
elipe17 58e3324
- Integrating Jans changes. Parametrizing values_is_empty
elipe17 3e5ac65
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 d3965e7
Merge branch '1115-tribal-s2' of https://github.com/raft-tech/TANF-ap…
elipe17 fe7a6cf
Merge branch '1116-tribal-s3' of https://github.com/raft-tech/TANF-ap…
elipe17 395e786
Merge branch '2599-error-report-corrections-impact-wpr-metrics' of ht…
elipe17 d669d3e
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 228c17c
Merge branch '1115-tribal-s2' of https://github.com/raft-tech/TANF-ap…
elipe17 66ef440
Merge branch '1116-tribal-s3' of https://github.com/raft-tech/TANF-ap…
elipe17 05b0b8b
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 d799e90
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 c5df3f3
Merge branch '1115-tribal-s2' of https://github.com/raft-tech/TANF-ap…
elipe17 ac4bfdc
Merge branch '1116-tribal-s3' of https://github.com/raft-tech/TANF-ap…
elipe17 06ca2ab
- Update based on review feedback
elipe17 bce13b4
- Updated length checks
elipe17 729a4d2
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 7152df2
- removing fips code
elipe17 e84b01f
Update tdrs-backend/tdpservice/parsers/schema_defs/tribal_tanf/t2.py
elipe17 5e29f46
Update tdrs-backend/tdpservice/parsers/schema_defs/tribal_tanf/t3.py
elipe17 f4477ce
Update tdrs-backend/tdpservice/parsers/schema_defs/tribal_tanf/t3.py
elipe17 4e1fed7
Update tdrs-backend/tdpservice/parsers/schema_defs/tribal_tanf/t3.py
elipe17 1d9070d
- update based on review
elipe17 120274b
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 a5e9cf3
- Fix migration
elipe17 5850dc8
- Fixed name clash on PARENT_MINOR_CHILD
elipe17 dcaba96
- Fixed name clash on PARENT_MINOR_CHILD
elipe17 fcb8766
- Cherry pick commit and remove test file
elipe17 c15d92d
Revert "- Fixed name clash on PARENT_MINOR_CHILD"
elipe17 43a7a4e
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 5af444b
Merge branch '1115-tribal-s2' of https://github.com/raft-tech/TANF-ap…
elipe17 8347980
Merge branch '1116-tribal-s3' of https://github.com/raft-tech/TANF-ap…
elipe17 507a4ac
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 37d0e23
Merge branch '1115-tribal-s2' of https://github.com/raft-tech/TANF-ap…
elipe17 7be6021
Merge branch '1116-tribal-s3' of https://github.com/raft-tech/TANF-ap…
elipe17 1dc1c73
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 d089f54
Merge branch 'develop' into 1117-tribal-s4
andrew-jameson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
tdrs-backend/tdpservice/parsers/schema_defs/tribal_tanf/t7.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
"""Schema for Tribal TANF T7 Row.""" | ||
|
||
from tdpservice.parsers.util import SchemaManager | ||
from tdpservice.parsers.fields import Field, TransformField | ||
from tdpservice.parsers.row_schema import RowSchema | ||
from tdpservice.parsers.transforms import calendar_quarter_to_rpt_month_year | ||
from tdpservice.parsers import validators | ||
from tdpservice.search_indexes.models.tribal import Tribal_TANF_T7 | ||
|
||
schemas = [] | ||
|
||
validator_index = 7 | ||
section_ind_index = 7 | ||
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=Tribal_TANF_T7, | ||
quiet_preparser_errors=i > 1, | ||
preparsing_validators=[ | ||
validators.hasLength(247), | ||
validators.notEmpty(0, 7), | ||
validators.notEmpty(validator_index, validator_index + 24), | ||
], | ||
postparsing_validators=[], | ||
fields=[ | ||
Field( | ||
item="0", | ||
name="RecordType", | ||
friendly_name="record type", | ||
type="string", | ||
startIndex=0, | ||
endIndex=2, | ||
required=True, | ||
validators=[], | ||
), | ||
Field( | ||
item="3", | ||
name="CALENDAR_QUARTER", | ||
friendly_name="calendar quarter", | ||
type="number", | ||
startIndex=2, | ||
endIndex=7, | ||
required=True, | ||
validators=[ | ||
validators.dateYearIsLargerThan(1998), | ||
validators.quarterIsValid(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @elipe17 i discovered an issue with this validator.
I believe this is an edge case, but does need to be addressed in a new ticket. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
], | ||
), | ||
TransformField( | ||
transform_func=calendar_quarter_to_rpt_month_year(month_index), | ||
item="3A", | ||
name="RPT_MONTH_YEAR", | ||
friendly_name="reporting month year", | ||
type="number", | ||
startIndex=2, | ||
endIndex=7, | ||
required=True, | ||
validators=[ | ||
validators.dateYearIsLargerThan(1998), | ||
validators.dateMonthIsValid(), | ||
], | ||
), | ||
Field( | ||
item="4", | ||
name="TDRS_SECTION_IND", | ||
friendly_name="tdrs section indicator", | ||
type="string", | ||
startIndex=section_ind_index, | ||
endIndex=section_ind_index + 1, | ||
required=True, | ||
validators=[validators.oneOf(["1", "2"])], | ||
), | ||
Field( | ||
item="5", | ||
name="STRATUM", | ||
friendly_name="stratum", | ||
type="string", | ||
startIndex=stratum_index, | ||
endIndex=stratum_index + 2, | ||
required=True, | ||
validators=[validators.isInStringRange(0, 99)], | ||
), | ||
Field( | ||
item=families_value_item_number, | ||
name="FAMILIES_MONTH", | ||
friendly_name="families month", | ||
type="number", | ||
startIndex=families_index, | ||
endIndex=families_index + 7, | ||
required=True, | ||
validators=[validators.isInLimits(0, 9999999)], | ||
), | ||
], | ||
) | ||
) | ||
|
||
index_offset = 0 if i % 3 != 0 else 24 | ||
validator_index += index_offset | ||
section_ind_index += index_offset | ||
stratum_index += index_offset | ||
families_index += 7 if i % 3 != 0 else 10 | ||
|
||
t7 = SchemaManager(schemas=schemas) |
3 changes: 3 additions & 0 deletions
3
tdrs-backend/tdpservice/parsers/test/data/tribal_section_4_fake.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
HEADER20194S00142TAN1EU | ||
T720204101006853700680540068454103000312400037850003180104000347400036460003583106000044600004360000325299000506200036070003385202000039100002740000499 | ||
TRAILER0000001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
tdrs-backend/tdpservice/search_indexes/migrations/0025_tribal_tanf_t7.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Generated by Django 3.2.15 on 2023-11-29 19:49 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import uuid | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('data_files', '0012_datafile_s3_versioning_id'), | ||
('search_indexes', '0024_tribal_tanf_t6'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Tribal_TANF_T7', | ||
fields=[ | ||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), | ||
('RecordType', models.CharField(max_length=156, null=True)), | ||
('CALENDAR_QUARTER', models.IntegerField(blank=True, null=True)), | ||
('RPT_MONTH_YEAR', models.IntegerField(null=True)), | ||
('TDRS_SECTION_IND', models.CharField(max_length=1, null=True)), | ||
('STRATUM', models.CharField(max_length=2, null=True)), | ||
('FAMILIES_MONTH', models.IntegerField(null=True)), | ||
('datafile', models.ForeignKey(blank=True, help_text='The parent file from which this record was created.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='tribal_t7_parent', to='data_files.datafile')), | ||
], | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
tdrs-backend/tdpservice/search_indexes/migrations/0026_parent_minor_child_rename.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 3.2.15 on 2023-09-14 17:20 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('search_indexes', '0025_tribal_tanf_t7'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name='tanf_t2', | ||
old_name='PARENT_WITH_MINOR_CHILD', | ||
new_name='PARENT_MINOR_CHILD', | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checked this. lgtm 👍🏾