forked from HHS/TANF-app
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2429/single-clamav' of github.com:raft-tech/TANF-app in…
…to 2429/single-clamav
- Loading branch information
Showing
13 changed files
with
272 additions
and
46 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
"""Schema for TANF T7 Row.""" | ||
|
||
from ...util import SchemaManager | ||
from ...fields import Field, TransformField | ||
from ...row_schema import RowSchema | ||
from ...transforms import calendar_quarter_to_rpt_month_year | ||
from ... import validators | ||
from tdpservice.search_indexes.models.tanf import 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=TANF_T7, | ||
quiet_preparser_errors=i > 1, | ||
preparsing_validators=[ | ||
validators.notEmpty(0, 7), | ||
validators.notEmpty(validator_index, validator_index + 24), | ||
], | ||
postparsing_validators=[], | ||
fields=[ | ||
Field(item="0", name="RecordType", type='string', startIndex=0, endIndex=2, | ||
required=True, validators=[]), | ||
Field(item="3", name='CALENDAR_QUARTER', type='number', startIndex=2, endIndex=7, | ||
required=True, validators=[validators.dateYearIsLargerThan(1998), | ||
validators.quarterIsValid()]), | ||
TransformField( | ||
transform_func=calendar_quarter_to_rpt_month_year(month_index), | ||
item="3A", | ||
name='RPT_MONTH_YEAR', | ||
type='number', | ||
startIndex=2, | ||
endIndex=7, | ||
required=True, | ||
validators=[ | ||
validators.dateYearIsLargerThan(1998), | ||
validators.dateMonthIsValid() | ||
] | ||
), | ||
Field(item="4", name='TDRS_SECTION_IND', type='string', startIndex=section_ind_index, | ||
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=families_value_item_number, 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) |
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 @@ | ||
HEADER20204S06 TAN1 N | ||
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
71 changes: 71 additions & 0 deletions
71
tdrs-backend/tdpservice/search_indexes/migrations/0018_auto_20230920_1846.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,71 @@ | ||
# Generated by Django 3.2.15 on 2023-09-20 18:46 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('search_indexes', '0017_auto_20230914_1720'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='tanf_t7', | ||
name='calendar_quarter', | ||
), | ||
migrations.RemoveField( | ||
model_name='tanf_t7', | ||
name='families', | ||
), | ||
migrations.RemoveField( | ||
model_name='tanf_t7', | ||
name='fips_code', | ||
), | ||
migrations.RemoveField( | ||
model_name='tanf_t7', | ||
name='record', | ||
), | ||
migrations.RemoveField( | ||
model_name='tanf_t7', | ||
name='rpt_month_year', | ||
), | ||
migrations.RemoveField( | ||
model_name='tanf_t7', | ||
name='stratum', | ||
), | ||
migrations.RemoveField( | ||
model_name='tanf_t7', | ||
name='tdrs_section_ind', | ||
), | ||
migrations.AddField( | ||
model_name='tanf_t7', | ||
name='CALENDAR_QUARTER', | ||
field=models.IntegerField(blank=True, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='tanf_t7', | ||
name='FAMILIES_MONTH', | ||
field=models.IntegerField(null=True), | ||
), | ||
migrations.AddField( | ||
model_name='tanf_t7', | ||
name='RPT_MONTH_YEAR', | ||
field=models.IntegerField(null=True), | ||
), | ||
migrations.AddField( | ||
model_name='tanf_t7', | ||
name='RecordType', | ||
field=models.CharField(max_length=156, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='tanf_t7', | ||
name='STRATUM', | ||
field=models.CharField(max_length=2, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='tanf_t7', | ||
name='TDRS_SECTION_IND', | ||
field=models.CharField(max_length=1, null=True), | ||
), | ||
] |
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.