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

Tribal Section 4 Parsing & Validation #2762

Merged
merged 153 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
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 Oct 19, 2023
29fd04c
Formatted the headers
raftmsohani Oct 20, 2023
699245c
added year/month to the columns
raftmsohani Oct 20, 2023
5310946
Added contants - translation column
raftmsohani Oct 23, 2023
0269728
added friendly names to T1 and T2
raftmsohani Oct 25, 2023
ac120a6
added friendly name to m1 and m2
raftmsohani Oct 26, 2023
a7c1207
added friendly name to m3
raftmsohani Oct 26, 2023
d460fe2
added friendly_name to t3
raftmsohani Oct 27, 2023
2bb6622
added friendly_name to t4 and t5
raftmsohani Oct 27, 2023
c90ce75
added friendly_name to t7
raftmsohani Oct 27, 2023
9dfd6f8
correct missing friendly_name
raftmsohani Oct 27, 2023
90aea2f
correction on failing tests
raftmsohani Oct 27, 2023
8f210cd
addedfriendly name to excel report
raftmsohani Oct 30, 2023
a093aa0
linting
raftmsohani Oct 30, 2023
8ea36c6
linting
raftmsohani Oct 30, 2023
85da10b
linting
raftmsohani Oct 30, 2023
ac95c41
delete contants.py
raftmsohani Oct 30, 2023
d75ba04
added test for json field in error model
raftmsohani Oct 30, 2023
ea5aa30
linting
raftmsohani Oct 31, 2023
b4d0549
linting
raftmsohani Oct 31, 2023
8ce83ce
linting
raftmsohani Oct 31, 2023
7719e85
- Added Tribal models, docs, admin refs
elipe17 Oct 31, 2023
0408123
- Update t1 field validators
elipe17 Oct 31, 2023
d1a9407
- t2/t3 field validators
elipe17 Oct 31, 2023
c75bb7e
2599-added friendly name to postparsing validators
raftmsohani Nov 1, 2023
179a81c
- Updated cat3 validators
elipe17 Nov 1, 2023
77acd5a
- Updated how we detect tribe code
elipe17 Nov 1, 2023
2eb688f
- Added error handling for inconsistent header info wrt tribe code
elipe17 Nov 1, 2023
df77436
- Updated test
elipe17 Nov 1, 2023
8da540e
- Grammar fix
elipe17 Nov 1, 2023
b8671dc
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 Nov 6, 2023
1dce7d4
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 Nov 6, 2023
0ec8f16
refining the validator tests
raftmsohani Nov 7, 2023
3f9bfce
- Format with Black
elipe17 Nov 7, 2023
c8607b2
- Fix lint
elipe17 Nov 7, 2023
164af6a
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 Nov 7, 2023
359dae0
added returning fields names to validators
raftmsohani Nov 8, 2023
8ed0b4a
added friendly_name to error field
raftmsohani Nov 13, 2023
c57a2d5
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani Nov 14, 2023
812a2dd
linting
raftmsohani Nov 14, 2023
96634b2
corrections on views/tests
raftmsohani Nov 14, 2023
0be491f
corrections for fields
raftmsohani Nov 15, 2023
02ce7d0
failing test corrected
raftmsohani Nov 15, 2023
aa8a534
failing test corrected
raftmsohani Nov 15, 2023
19926ea
correcting test failures
raftmsohani Nov 15, 2023
6b7c86e
linting
raftmsohani Nov 16, 2023
94ef180
corrected the excel fiel generator
raftmsohani Nov 16, 2023
b6eee03
removed excessive space in validator
raftmsohani Nov 20, 2023
49dc398
linting
raftmsohani Nov 20, 2023
b0fd38a
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani Nov 20, 2023
b869b19
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 Nov 20, 2023
92a549f
- Updated based on review feedback
elipe17 Nov 20, 2023
f4e6bfa
- removing debug assert
elipe17 Nov 20, 2023
3699cdf
- Fix lint
elipe17 Nov 20, 2023
700a965
listing
raftmsohani Nov 20, 2023
8aae444
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani Nov 21, 2023
a32fde6
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 Nov 21, 2023
7d1eb79
- deconflicting migrations
elipe17 Nov 21, 2023
41cada2
- Fixing test
elipe17 Nov 21, 2023
9636854
added m6
raftmsohani Nov 21, 2023
5c2e819
lint
raftmsohani Nov 21, 2023
b18b9d3
- Adding datafile
elipe17 Nov 21, 2023
50507bf
- Added support for parsing tribal t4/t5
elipe17 Nov 21, 2023
3936483
- ADded cat2/cat3 validators
elipe17 Nov 21, 2023
763c09b
corrected new line break
raftmsohani Nov 22, 2023
e5dff79
- Update doc strings
elipe17 Nov 22, 2023
56b0842
- Fixed failing test
elipe17 Nov 22, 2023
989f098
- Fix lint
elipe17 Nov 22, 2023
3e73dbc
refactored validator logic
raftmsohani Nov 22, 2023
4f6039b
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 Nov 22, 2023
8161b4c
- resolving conflict
elipe17 Nov 22, 2023
8a5665a
- Fix lint errors
elipe17 Nov 22, 2023
2d68b52
- Resolve conflict
elipe17 Nov 22, 2023
55ff4bd
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 Nov 22, 2023
e1c9c9a
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani Nov 25, 2023
dcc1dca
linting and correction on t1
raftmsohani Nov 25, 2023
741b442
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani Nov 25, 2023
28c9636
friendly_name correction from comments
raftmsohani Nov 25, 2023
091e716
Merge branch '2599-error-report-corrections-impact-wpr-metrics' of ht…
raftmsohani Nov 25, 2023
3e19f2d
friendly_name correction
raftmsohani Nov 25, 2023
c2501f8
corrected failing test for m5
raftmsohani Nov 25, 2023
b04df52
refactor the field_json creation DRY
raftmsohani Nov 27, 2023
cda507d
- Renamed tribal files
elipe17 Nov 27, 2023
f79364f
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 Nov 27, 2023
1838bf8
- Reduced file size
elipe17 Nov 27, 2023
7ae9054
- Fix lint errors
elipe17 Nov 27, 2023
b52c0d1
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 Nov 28, 2023
2b7036f
- Added support for parsing and validating tribal t6 records
elipe17 Nov 29, 2023
5bfca9c
- Fix lint
elipe17 Nov 29, 2023
4a1a5b3
- Added support for parsing/validating tribal t7
elipe17 Nov 29, 2023
666fc67
- Fix lint
elipe17 Nov 29, 2023
6ef6bc1
- Docstring fix
elipe17 Nov 29, 2023
968eec2
- Docstring fix
elipe17 Nov 29, 2023
50192aa
Merge branch '1116-tribal-s3' of https://github.com/raft-tech/TANF-ap…
elipe17 Nov 29, 2023
ad17b56
friendly_name corrections
raftmsohani Nov 30, 2023
efc15bd
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani Nov 30, 2023
71daf97
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 Dec 4, 2023
a3a835b
Merge branch '2599-error-report-corrections-impact-wpr-metrics' of ht…
elipe17 Dec 4, 2023
fdd3b72
- Adding friendly names to tribal
elipe17 Dec 4, 2023
5b66912
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 Dec 4, 2023
7d06746
- Fixing typo
elipe17 Dec 4, 2023
f338fc4
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 Dec 4, 2023
2441dc3
- Added friendly names
elipe17 Dec 4, 2023
a50c176
Merge branch '1115-tribal-s2' of https://github.com/raft-tech/TANF-ap…
elipe17 Dec 4, 2023
0799f62
- Adding friendly names
elipe17 Dec 4, 2023
700f996
Merge branch '1116-tribal-s3' of https://github.com/raft-tech/TANF-ap…
elipe17 Dec 4, 2023
68c6781
- Adding friendly names
elipe17 Dec 4, 2023
d2d443d
linting and cleaning errors
raftmsohani Dec 4, 2023
573a056
linting
raftmsohani Dec 4, 2023
b1be7bb
correction on friendly_names
raftmsohani Dec 4, 2023
cad9173
corrected friendly_name for test_util
raftmsohani Dec 4, 2023
aa6a5ad
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani Dec 4, 2023
4bce93d
correction child care - number of months
raftmsohani Dec 4, 2023
d29ed8e
Merge branch '2599-error-report-corrections-impact-wpr-metrics' of ht…
raftmsohani Dec 4, 2023
bd29c09
fixed a few more typos and some spacing. (#2767)
George-Hudson Dec 5, 2023
beda306
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani Dec 6, 2023
cfec7f2
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 Dec 11, 2023
55ce817
- knowledge center
elipe17 Dec 11, 2023
58e3324
- Integrating Jans changes. Parametrizing values_is_empty
elipe17 Dec 11, 2023
3e5ac65
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 Dec 11, 2023
d3965e7
Merge branch '1115-tribal-s2' of https://github.com/raft-tech/TANF-ap…
elipe17 Dec 11, 2023
fe7a6cf
Merge branch '1116-tribal-s3' of https://github.com/raft-tech/TANF-ap…
elipe17 Dec 11, 2023
395e786
Merge branch '2599-error-report-corrections-impact-wpr-metrics' of ht…
elipe17 Dec 11, 2023
d669d3e
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 Dec 11, 2023
228c17c
Merge branch '1115-tribal-s2' of https://github.com/raft-tech/TANF-ap…
elipe17 Dec 11, 2023
66ef440
Merge branch '1116-tribal-s3' of https://github.com/raft-tech/TANF-ap…
elipe17 Dec 11, 2023
05b0b8b
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 Dec 18, 2023
d799e90
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 Dec 18, 2023
c5df3f3
Merge branch '1115-tribal-s2' of https://github.com/raft-tech/TANF-ap…
elipe17 Dec 18, 2023
ac4bfdc
Merge branch '1116-tribal-s3' of https://github.com/raft-tech/TANF-ap…
elipe17 Dec 18, 2023
06ca2ab
- Update based on review feedback
elipe17 Dec 20, 2023
bce13b4
- Updated length checks
elipe17 Dec 21, 2023
729a4d2
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 Dec 21, 2023
7152df2
- removing fips code
elipe17 Dec 28, 2023
e84b01f
Update tdrs-backend/tdpservice/parsers/schema_defs/tribal_tanf/t2.py
elipe17 Dec 28, 2023
5e29f46
Update tdrs-backend/tdpservice/parsers/schema_defs/tribal_tanf/t3.py
elipe17 Dec 28, 2023
f4477ce
Update tdrs-backend/tdpservice/parsers/schema_defs/tribal_tanf/t3.py
elipe17 Dec 28, 2023
4e1fed7
Update tdrs-backend/tdpservice/parsers/schema_defs/tribal_tanf/t3.py
elipe17 Dec 28, 2023
1d9070d
- update based on review
elipe17 Dec 28, 2023
120274b
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 Dec 28, 2023
a5e9cf3
- Fix migration
elipe17 Dec 28, 2023
5850dc8
- Fixed name clash on PARENT_MINOR_CHILD
elipe17 Dec 29, 2023
dcaba96
- Fixed name clash on PARENT_MINOR_CHILD
elipe17 Dec 29, 2023
fcb8766
- Cherry pick commit and remove test file
elipe17 Dec 29, 2023
c15d92d
Revert "- Fixed name clash on PARENT_MINOR_CHILD"
elipe17 Dec 29, 2023
43a7a4e
Merge branch '1114-tribal-s1' of https://github.com/raft-tech/TANF-ap…
elipe17 Jan 4, 2024
5af444b
Merge branch '1115-tribal-s2' of https://github.com/raft-tech/TANF-ap…
elipe17 Jan 4, 2024
8347980
Merge branch '1116-tribal-s3' of https://github.com/raft-tech/TANF-ap…
elipe17 Jan 4, 2024
507a4ac
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 Jan 4, 2024
37d0e23
Merge branch '1115-tribal-s2' of https://github.com/raft-tech/TANF-ap…
elipe17 Jan 4, 2024
7be6021
Merge branch '1116-tribal-s3' of https://github.com/raft-tech/TANF-ap…
elipe17 Jan 4, 2024
1dc1c73
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 Jan 8, 2024
d089f54
Merge branch 'develop' into 1117-tribal-s4
andrew-jameson Jan 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
validators.if_then_validator(
condition_field="FAMILY_AFFILIATION",
condition_function=validators.isInLimits(1, 2),
result_field="PARENT_WITH_MINOR_CHILD",
result_field="PARENT_MINOR_CHILD",
result_function=validators.isInLimits(1, 3),
),
validators.if_then_validator(
Expand Down Expand Up @@ -359,8 +359,8 @@
),
Field(
item="39",
name="PARENT_WITH_MINOR_CHILD",
friendly_name="parent with minor child",
name="PARENT_MINOR_CHILD",
friendly_name="parent of minor child",
type="number",
startIndex=53,
endIndex=54,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
from .t4 import t4
from .t5 import t5
from .t6 import t6
from .t7 import t7

t1 = t1
t2 = t2
t3 = t3
t4 = t4
t5 = t5
t6 = t6
t7 = t7
4 changes: 2 additions & 2 deletions tdrs-backend/tdpservice/parsers/schema_defs/tribal_tanf/t2.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@
),
Field(
item="39",
name="PARENT_WITH_MINOR_CHILD",
friendly_name="parent with minor child",
name="PARENT_MINOR_CHILD",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked this. lgtm 👍🏾

friendly_name="parent of minor child",
type="number",
startIndex=53,
endIndex=54,
Expand Down
109 changes: 109 additions & 0 deletions tdrs-backend/tdpservice/parsers/schema_defs/tribal_tanf/t7.py
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(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elipe17 i discovered an issue with this validator.

  • If the quarter is a space, then no error is raised in the logs or the feedback report
  • if the quarter = 0 or > 4, then this message is returned in the logs Invalid quarter value. and the processing status stays in the "pending" state which does not generate a feedback report.

I believe this is an edge case, but does need to be addressed in a new ticket.

Copy link
Collaborator

Choose a reason for hiding this comment

The 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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
HEADER20194S00142TAN1EU
T720204101006853700680540068454103000312400037850003180104000347400036460003583106000044600004360000325299000506200036070003385202000039100002740000499
TRAILER0000001
2 changes: 1 addition & 1 deletion tdrs-backend/tdpservice/parsers/test/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class Meta:
RECEIVE_SSI = 1
MARITAL_STATUS = 1
RELATIONSHIP_HOH = "01"
PARENT_WITH_MINOR_CHILD = 1
PARENT_MINOR_CHILD = 1
NEEDS_PREGNANT_WOMAN = 1
EDUCATION_LEVEL = "01"
CITIZENSHIP_STATUS = 1
Expand Down
28 changes: 27 additions & 1 deletion tdrs-backend/tdpservice/parsers/test/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ..models import ParserError, ParserErrorCategoryChoices, DataFileSummary
from tdpservice.search_indexes.models.tanf import TANF_T1, TANF_T2, TANF_T3, TANF_T4, TANF_T5, TANF_T6, TANF_T7
from tdpservice.search_indexes.models.tribal import Tribal_TANF_T1, Tribal_TANF_T2, Tribal_TANF_T3, Tribal_TANF_T4
from tdpservice.search_indexes.models.tribal import Tribal_TANF_T5, Tribal_TANF_T6
from tdpservice.search_indexes.models.tribal import Tribal_TANF_T5, Tribal_TANF_T6, Tribal_TANF_T7
from tdpservice.search_indexes.models.ssp import SSP_M1, SSP_M2, SSP_M3, SSP_M4, SSP_M5, SSP_M6, SSP_M7
from .factories import DataFileSummaryFactory
from tdpservice.data_files.models import DataFile
Expand Down Expand Up @@ -1096,3 +1096,29 @@ def test_parse_tribal_section_3_file(tribal_section_3_file):
assert t6.NUM_APPLICATIONS == 1
assert t6.NUM_FAMILIES == 41
assert t6.NUM_CLOSED_CASES == 3

@pytest.fixture
def tribal_section_4_file(stt_user, stt):
"""Fixture for tribal_section_4_fake.txt."""
return util.create_test_datafile('tribal_section_4_fake.txt', stt_user, stt, "Tribal Stratum Data")

@pytest.mark.django_db()
def test_parse_tribal_section_4_file(tribal_section_4_file):
"""Test parsing Tribal TANF Section 4 submission."""
parse.parse_datafile(tribal_section_4_file)

assert Tribal_TANF_T7.objects.all().count() == 18

t7_objs = Tribal_TANF_T7.objects.all().order_by('FAMILIES_MONTH')

first = t7_objs.first()
sixth = t7_objs[5]

assert first.RPT_MONTH_YEAR == 202011
assert sixth.RPT_MONTH_YEAR == 202012

assert first.TDRS_SECTION_IND == '2'
assert sixth.TDRS_SECTION_IND == '2'

assert first.FAMILIES_MONTH == 274
assert sixth.FAMILIES_MONTH == 499
10 changes: 5 additions & 5 deletions tdrs-backend/tdpservice/parsers/test/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,16 +587,16 @@ def test_validate_parent_with_minor(self, record):
"""Test cat3 validator for parent with a minor child."""
val = validators.if_then_validator(
condition_field='FAMILY_AFFILIATION', condition_function=validators.isInLimits(1, 3),
result_field='PARENT_WITH_MINOR_CHILD', result_function=validators.isInLimits(1, 3),
result_field='PARENT_MINOR_CHILD', result_function=validators.isInLimits(1, 3),
)
result = val(record)
assert result == (True, None, ['FAMILY_AFFILIATION', 'PARENT_WITH_MINOR_CHILD'])
assert result == (True, None, ['FAMILY_AFFILIATION', 'PARENT_MINOR_CHILD'])

record.PARENT_WITH_MINOR_CHILD = 0
record.PARENT_MINOR_CHILD = 0
result = val(record)
assert result == (False, 'if FAMILY_AFFILIATION :1 validator1 passed then PARENT_WITH_MINOR_CHILD 0 is not ' +
assert result == (False, 'if FAMILY_AFFILIATION :1 validator1 passed then PARENT_MINOR_CHILD 0 is not ' +
'larger or equal to 1 and smaller or equal to 3.',
['FAMILY_AFFILIATION', 'PARENT_WITH_MINOR_CHILD'])
['FAMILY_AFFILIATION', 'PARENT_MINOR_CHILD'])

def test_validate_education_level(self, record):
"""Test cat3 validator for education level."""
Expand Down
6 changes: 6 additions & 0 deletions tdrs-backend/tdpservice/parsers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ def get_schema_options(program, section, query=None, model=None, model_name=None
'T6': schema_defs.tribal_tanf.t6,
}
},
'S': {
'section': DataFile.Section.TRIBAL_STRATUM_DATA,
'models': {
'T7': schema_defs.tribal_tanf.t7,
}
},
},
}

Expand Down
1 change: 1 addition & 0 deletions tdrs-backend/tdpservice/search_indexes/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
admin.site.register(models.tribal.Tribal_TANF_T4, tribal.Tribal_TANF_T4Admin)
admin.site.register(models.tribal.Tribal_TANF_T5, tribal.Tribal_TANF_T5Admin)
admin.site.register(models.tribal.Tribal_TANF_T6, tribal.Tribal_TANF_T6Admin)
admin.site.register(models.tribal.Tribal_TANF_T7, tribal.Tribal_TANF_T7Admin)

admin.site.register(models.ssp.SSP_M1, ssp.SSP_M1Admin)
admin.site.register(models.ssp.SSP_M2, ssp.SSP_M2Admin)
Expand Down
19 changes: 19 additions & 0 deletions tdrs-backend/tdpservice/search_indexes/admin/tribal.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,22 @@ class Tribal_TANF_T6Admin(admin.ModelAdmin):
CreationDateFilter,
'RPT_MONTH_YEAR'
]

class Tribal_TANF_T7Admin(admin.ModelAdmin):
"""ModelAdmin class for parsed Tribal T7 data files."""

list_display = [
'RecordType',
'CALENDAR_QUARTER',
'RPT_MONTH_YEAR',
'TDRS_SECTION_IND',
'STRATUM',
'FAMILIES_MONTH',
'datafile',
]

list_filter = [
'CALENDAR_QUARTER',
CreationDateFilter,
'RPT_MONTH_YEAR',
]
2 changes: 1 addition & 1 deletion tdrs-backend/tdpservice/search_indexes/documents/tanf.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class Django:
'RECEIVE_SSI',
'MARITAL_STATUS',
'RELATIONSHIP_HOH',
'PARENT_WITH_MINOR_CHILD',
'PARENT_MINOR_CHILD',
'NEEDS_PREGNANT_WOMAN',
'EDUCATION_LEVEL',
'CITIZENSHIP_STATUS',
Expand Down
28 changes: 27 additions & 1 deletion tdrs-backend/tdpservice/search_indexes/documents/tribal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django_elasticsearch_dsl import Document
from django_elasticsearch_dsl.registries import registry
from ..models.tribal import Tribal_TANF_T1, Tribal_TANF_T2, Tribal_TANF_T3, Tribal_TANF_T4, Tribal_TANF_T5
from ..models.tribal import Tribal_TANF_T6
from ..models.tribal import Tribal_TANF_T6, Tribal_TANF_T7
from .document_base import DocumentBase

@registry.register_document
Expand Down Expand Up @@ -303,3 +303,29 @@ class Django:
'NUM_OUTWEDLOCK_BIRTHS',
'NUM_CLOSED_CASES'
]

@registry.register_document
class Tribal_TANF_T7DataSubmissionDocument(DocumentBase, Document):
"""Elastic search model mapping for a parsed Tribal TANF T7 data file."""

class Index:
"""ElasticSearch index generation settings."""

name = 'tribal_tanf_t7_submissions'
settings = {
'number_of_shards': 1,
'number_of_replicas': 0,
}

class Django:
"""Django model reference and field mapping."""

model = Tribal_TANF_T7
fields = [
"RecordType",
"CALENDAR_QUARTER",
"RPT_MONTH_YEAR",
"TDRS_SECTION_IND",
"STRATUM",
"FAMILIES_MONTH",
]
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')),
],
),
]
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',
),
]
2 changes: 1 addition & 1 deletion tdrs-backend/tdpservice/search_indexes/models/tanf.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class TANF_T2(models.Model):
RECEIVE_SSI = models.IntegerField(null=True, blank=False)
MARITAL_STATUS = models.IntegerField(null=True, blank=False)
RELATIONSHIP_HOH = models.CharField(max_length=2, null=True, blank=False)
PARENT_WITH_MINOR_CHILD = models.IntegerField(null=True, blank=False)
PARENT_MINOR_CHILD = models.IntegerField(null=True, blank=False)
NEEDS_PREGNANT_WOMAN = models.IntegerField(null=True, blank=False)
EDUCATION_LEVEL = models.CharField(max_length=2, null=True, blank=False)
CITIZENSHIP_STATUS = models.IntegerField(null=True, blank=False)
Expand Down
Loading
Loading