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

Elastic Bulk Document Creation #2772

Merged
merged 118 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from 108 commits
Commits
Show all changes
118 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
c75bb7e
2599-added friendly name to postparsing validators
raftmsohani Nov 1, 2023
0ec8f16
refining the validator tests
raftmsohani 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
700a965
listing
raftmsohani Nov 20, 2023
8aae444
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani Nov 21, 2023
9636854
added m6
raftmsohani Nov 21, 2023
5c2e819
lint
raftmsohani Nov 21, 2023
763c09b
corrected new line break
raftmsohani Nov 22, 2023
3e73dbc
refactored validator logic
raftmsohani 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
206696a
- Added Kibana config
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
86e3024
Merge branch '2599-error-report-corrections-impact-wpr-metrics' of ht…
elipe17 Dec 4, 2023
25eb85e
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
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
657379d
- Added basic security to Kibana/Elastic
elipe17 Dec 5, 2023
eb59146
- Remove debug code
elipe17 Dec 5, 2023
ae41efd
- change provider name
elipe17 Dec 5, 2023
100d647
- Updating settings to reference environment variables
elipe17 Dec 5, 2023
beda306
Merge branch 'develop' into 2599-error-report-corrections-impact-wpr-…
raftmsohani Dec 6, 2023
13cd218
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 Dec 6, 2023
1536749
- Add elastic dependency
elipe17 Dec 6, 2023
bde9160
- Fix network issue
elipe17 Dec 6, 2023
0316025
- Added bulk creation of elastic indices
elipe17 Dec 6, 2023
acfb697
- Updated schemas to reference model based off of elastic document
elipe17 Dec 7, 2023
522ca38
- Remove password auth from elastic/kibana
elipe17 Dec 7, 2023
6dd34a0
- Fix tests
elipe17 Dec 7, 2023
1809129
- Fix lint
elipe17 Dec 7, 2023
640db6e
- remove debug print
elipe17 Dec 7, 2023
96e48d0
Merge branch '2599-error-report-corrections-impact-wpr-metrics' of ht…
elipe17 Dec 7, 2023
556221b
Changes for fully local development
Nov 29, 2023
32a4671
Reorganized front end logic on REACT_APP_DEVAUTH env var
Dec 5, 2023
7fd7b4d
Reorganized backend logic on REACT_APP_DEVAUTH env var
Dec 5, 2023
6ffbee8
added is_superuser and is_staff attrs to dev user
Dec 8, 2023
ccee755
- Fix lint errors
elipe17 Dec 9, 2023
86aae24
- Renaming variables to clarify things
elipe17 Dec 13, 2023
01bfd0b
- fix lint
elipe17 Dec 13, 2023
1497d4a
DevAuth feature redesign inspired by Cypress
Dec 14, 2023
2febdcd
Merge branch 'elastic-bulk-doc-creation' of https://github.com/raft-t…
Dec 14, 2023
97a0cf6
Fixed CustomAuthentication.authenticate return val for login.py use case
Dec 14, 2023
2b9b46f
Fixed CustomAuthentication.authenticate logging for login.py use case
Dec 14, 2023
c18383f
Removed unneeded permissions import
Dec 14, 2023
7fc2a09
Updates to REACT_APP_DEVAUTH env var settings
Dec 14, 2023
4bf8957
Restored support for CustomAuthentication.authenticate username keyword
Dec 15, 2023
761e4eb
Modified CustomAuthentication.authenticate comment to satisfy flake8
Dec 15, 2023
1aeb315
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 Dec 18, 2023
a284856
commit
elipe17 Dec 18, 2023
1f9f32d
Revert "Modified CustomAuthentication.authenticate comment to satisfy…
elipe17 Dec 19, 2023
eacffe9
Revert "Restored support for CustomAuthentication.authenticate userna…
elipe17 Dec 19, 2023
71615d2
Revert "Updates to REACT_APP_DEVAUTH env var settings"
elipe17 Dec 19, 2023
bd6edd1
Revert "Removed unneeded permissions import"
elipe17 Dec 19, 2023
65b32ce
Revert "Fixed CustomAuthentication.authenticate logging for login.py …
elipe17 Dec 19, 2023
c49365f
Revert "Fixed CustomAuthentication.authenticate return val for login.…
elipe17 Dec 19, 2023
7bb7522
Revert "DevAuth feature redesign inspired by Cypress"
elipe17 Dec 19, 2023
af2d342
Revert "commit"
elipe17 Dec 19, 2023
d88a329
Revert "added is_superuser and is_staff attrs to dev user"
elipe17 Dec 19, 2023
247347c
Revert "Reorganized backend logic on REACT_APP_DEVAUTH env var"
elipe17 Dec 19, 2023
8205b43
Revert "Reorganized front end logic on REACT_APP_DEVAUTH env var"
elipe17 Dec 19, 2023
e32cb0d
Revert "Changes for fully local development"
elipe17 Dec 19, 2023
26455b4
asdf
elipe17 Dec 19, 2023
702c547
- Adding integration tests for elastic bulk doc creation
elipe17 Dec 20, 2023
6c97446
Revert "asdf"
elipe17 Dec 20, 2023
ffb1993
- fix lint
elipe17 Dec 20, 2023
8026eae
fasdf
elipe17 Dec 20, 2023
6ae551f
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 Jan 9, 2024
f1b8a8b
- Added usage of document to tribal
elipe17 Jan 10, 2024
8d24f72
Merge branch 'develop' into elastic-bulk-doc-creation
andrew-jameson Jan 12, 2024
715ced8
- Fixing error
elipe17 Jan 17, 2024
3fdb9db
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
elipe17 Jan 17, 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
15 changes: 14 additions & 1 deletion tdrs-backend/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,25 @@ services:
# Copy in the Localstack setup script to configure any buckets needed
- ../scripts/localstack-setup.sh:/docker-entrypoint-initaws.d/localstack-setup.sh

kibana:
image: elastic/kibana:7.17.10
ports:
- 5601:5601
environment:
- xpack.security.encryptionKey="something_at_least_32_characters"
- xpack.security.session.idleTimeout="1h"
- xpack.security.session.lifespan="30d"
volumes:
- ./kibana.yml:/usr/share/kibana/config/kibana.yml
depends_on:
- elastic

elastic:
image: elasticsearch:7.17.6
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- logger.discovery.level=debug
- xpack.security.enabled=false
ports:
- 9200:9200
- 9300:9300
Expand Down
2 changes: 2 additions & 0 deletions tdrs-backend/kibana.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
elasticsearch.hosts: ["http://elastic:9200"]
server.host: kibana
32 changes: 20 additions & 12 deletions tdrs-backend/tdpservice/parsers/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,29 @@ def parse_datafile(datafile):

return errors


def bulk_create_records(unsaved_records, line_number, header_count, batch_size=10000, flush=False):
"""Bulk create passed in records."""
if (line_number % batch_size == 0 and header_count > 0) or flush:
logger.debug("Bulk creating records.")
try:
num_created = 0
num_expected = 0
for model, records in unsaved_records.items():
num_expected += len(records)
num_created += len(model.objects.bulk_create(records))
if num_created != num_expected:
logger.error(f"Bulk create only created {num_created}/{num_expected}!")
num_db_records_created = 0
num_expected_db_records = 0
num_elastic_records_created = 0
for document, records in unsaved_records.items():
num_expected_db_records += len(records)
created_objs = document.Django.model.objects.bulk_create(records)
num_elastic_records_created += document.update(created_objs)[0]
num_db_records_created += len(created_objs)
if num_db_records_created != num_expected_db_records:
logger.error(f"Bulk Django record creation only created {num_db_records_created}/" +

Choose a reason for hiding this comment

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

Suggestion is to add line_number/header count (if it is meaningful) for understanding the error and being able to debug from the log

f"{num_expected_db_records}!")
elif num_elastic_records_created != num_expected_db_records:
logger.error(f"Bulk Elastic document creation only created {num_elastic_records_created}/" +
f"{num_expected_db_records}!")
else:
logger.info(f"Created {num_created}/{num_expected} records.")
return num_created == num_expected, {}
logger.info(f"Created {num_db_records_created}/{num_expected_db_records} records.")
return num_db_records_created == num_expected_db_records and \
num_elastic_records_created == num_expected_db_records, {}
except DatabaseError as e:
logger.error(f"Encountered error while creating datafile records: {e}")
return False, unsaved_records
Expand Down Expand Up @@ -107,7 +114,8 @@ def evaluate_trailer(datafile, trailer_count, multiple_trailer_errors, is_last_l
def rollback_records(unsaved_records, datafile):
"""Delete created records in the event of a failure."""
logger.info("Rolling back created records.")
for model in unsaved_records:
for document in unsaved_records:
model = document.Django.model
num_deleted, models = model.objects.filter(datafile=datafile).delete()
Copy link

Choose a reason for hiding this comment

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

out of curiosity i ran the big fake_rollback file and noticed the delete requests going crazy

Screen.Recording.2023-12-20.at.10.39.15.AM.mov

but the db and elastic eventually both end up in a consistent state.

this may be a topic for another ticket, but implementing some sort of bulk_delete may be helpful. existing solutions might not honor the signals needed for elastic, though. https://stackoverflow.com/a/36935536

Copy link
Author

Choose a reason for hiding this comment

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

Agreed, our transaction-less rollback is a pain point for sure. It would be interesting to test out the raw_delete.

Choose a reason for hiding this comment

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

have to be careful with raw_delete though!

logger.debug(f"Deleted {num_deleted} records of type: {model}.")

Expand Down Expand Up @@ -198,7 +206,7 @@ def parse_datafile_lines(datafile, program_type, section, is_encrypted):
if record:
s = schema_manager.schemas[i]
record.datafile = datafile
unsaved_records.setdefault(s.model, []).append(record)
unsaved_records.setdefault(s.document, []).append(record)

all_created, unsaved_records = bulk_create_records(unsaved_records, line_number, header_count,)
unsaved_parser_errors, num_errors = bulk_create_errors(unsaved_parser_errors, num_errors)
Expand Down
8 changes: 4 additions & 4 deletions tdrs-backend/tdpservice/parsers/row_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ class RowSchema:

def __init__(
self,
model=dict,
document,
preparsing_validators=[],
postparsing_validators=[],
fields=[],
quiet_preparser_errors=False
quiet_preparser_errors=False,
):
self.model = model
self.document = document
Copy link

Choose a reason for hiding this comment

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

this change makes me nervous because of the potential side-effects, but you've covered all the cases i've thought of so far

self.preparsing_validators = preparsing_validators
self.postparsing_validators = postparsing_validators
self.fields = fields
Expand Down Expand Up @@ -90,7 +90,7 @@ def run_preparsing_validators(self, line, generate_error):

def parse_line(self, line):
"""Create a model for the line based on the schema."""
record = self.model()
record = self.document.Django.model() if self.document is not None else dict()

for field in self.fields:
value = field.parse_value(line)
Expand Down
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 @@ -7,7 +7,7 @@


header = RowSchema(
model=dict,
document=None,
preparsing_validators=[
validators.hasLength(
23,
Expand Down
4 changes: 2 additions & 2 deletions tdrs-backend/tdpservice/parsers/schema_defs/ssp/m1.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
from tdpservice.parsers.fields import Field
from tdpservice.parsers.row_schema import RowSchema
from tdpservice.parsers import validators
from tdpservice.search_indexes.models.ssp import SSP_M1
from tdpservice.search_indexes.documents.ssp import SSP_M1DataSubmissionDocument

m1 = SchemaManager(
schemas=[
RowSchema(
model=SSP_M1,
document=SSP_M1DataSubmissionDocument(),
preparsing_validators=[
validators.hasLength(150),
],
Expand Down
11 changes: 5 additions & 6 deletions tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
from tdpservice.parsers.fields import TransformField, Field
from tdpservice.parsers.row_schema import RowSchema
from tdpservice.parsers import validators
from tdpservice.search_indexes.models.ssp import SSP_M2
from tdpservice.search_indexes.documents.ssp import SSP_M2DataSubmissionDocument


m2 = SchemaManager(
schemas=[
RowSchema(
model=SSP_M2,
document=SSP_M2DataSubmissionDocument(),
preparsing_validators=[
validators.hasLength(150),
],
Expand Down Expand Up @@ -78,7 +78,7 @@
result_field='EDUCATION_LEVEL',
result_function=validators.or_validators(
validators.isInStringRange(1, 16),
validators.isInStringRange(98, 99)
validators.isInStringRange(98, 99),
),
),
validators.if_then_validator(
Expand Down Expand Up @@ -367,8 +367,7 @@
required=False,
validators=[
validators.or_validators(
validators.isInLimits(0, 16),
validators.isInLimits(98, 99)
validators.isInLimits(0, 16), validators.isInLimits(98, 99)
)
]
),
Expand Down Expand Up @@ -414,7 +413,7 @@
validators.or_validators(
validators.isInLimits(1, 4),
validators.isInLimits(6, 9),
validators.isInLimits(11, 12)
validators.isInLimits(11, 12),
)
]
),
Expand Down
6 changes: 3 additions & 3 deletions tdrs-backend/tdpservice/parsers/schema_defs/ssp/m3.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
from tdpservice.parsers.fields import TransformField, Field
from tdpservice.parsers.row_schema import RowSchema
from tdpservice.parsers import validators
from tdpservice.search_indexes.models.ssp import SSP_M3
from tdpservice.search_indexes.documents.ssp import SSP_M3DataSubmissionDocument

first_part_schema = RowSchema(
model=SSP_M3,
document=SSP_M3DataSubmissionDocument(),
preparsing_validators=[
validators.notEmpty(start=19, end=60),
],
Expand Down Expand Up @@ -315,7 +315,7 @@
)

second_part_schema = RowSchema(
model=SSP_M3,
document=SSP_M3DataSubmissionDocument(),
quiet_preparser_errors=True,
preparsing_validators=[
validators.notEmpty(start=60, end=101),
Expand Down
4 changes: 2 additions & 2 deletions tdrs-backend/tdpservice/parsers/schema_defs/ssp/m4.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
from tdpservice.parsers.fields import Field
from tdpservice.parsers.row_schema import RowSchema
from tdpservice.parsers import validators
from tdpservice.search_indexes.models.ssp import SSP_M4
from tdpservice.search_indexes.documents.ssp import SSP_M4DataSubmissionDocument

m4 = SchemaManager(
schemas=[
RowSchema(
model=SSP_M4,
document=SSP_M4DataSubmissionDocument(),
preparsing_validators=[
validators.hasLength(66),
],
Expand Down
4 changes: 2 additions & 2 deletions tdrs-backend/tdpservice/parsers/schema_defs/ssp/m5.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
from tdpservice.parsers.fields import TransformField, Field
from tdpservice.parsers.row_schema import RowSchema
from tdpservice.parsers import validators
from tdpservice.search_indexes.models.ssp import SSP_M5
from tdpservice.search_indexes.documents.ssp import SSP_M5DataSubmissionDocument


m5 = SchemaManager(
schemas=[
RowSchema(
model=SSP_M5,
document=SSP_M5DataSubmissionDocument(),
preparsing_validators=[
validators.hasLength(66),
],
Expand Down
16 changes: 5 additions & 11 deletions tdrs-backend/tdpservice/parsers/schema_defs/ssp/m6.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
from ...fields import Field, TransformField
from ...row_schema import RowSchema
from ... import validators
from tdpservice.search_indexes.models.ssp import SSP_M6
from tdpservice.search_indexes.documents.ssp import SSP_M6DataSubmissionDocument

s1 = RowSchema(
model=SSP_M6,
document=SSP_M6DataSubmissionDocument(),
preparsing_validators=[
validators.hasLength(259),
],
Expand Down Expand Up @@ -170,7 +170,7 @@
)

s2 = RowSchema(
model=SSP_M6,
document=SSP_M6DataSubmissionDocument(),
preparsing_validators=[
validators.hasLength(259),
],
Expand Down Expand Up @@ -331,7 +331,7 @@
)

s3 = RowSchema(
model=SSP_M6,
document=SSP_M6DataSubmissionDocument(),
preparsing_validators=[
validators.hasLength(259),
],
Expand Down Expand Up @@ -492,10 +492,4 @@
)


m6 = SchemaManager(
schemas=[
s1,
s2,
s3
]
)
m6 = SchemaManager(schemas=[s1, s2, s3])
4 changes: 2 additions & 2 deletions tdrs-backend/tdpservice/parsers/schema_defs/ssp/m7.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from ...row_schema import RowSchema
from ...transforms import calendar_quarter_to_rpt_month_year
from ... import validators
from tdpservice.search_indexes.models.ssp import SSP_M7
from tdpservice.search_indexes.documents.ssp import SSP_M7DataSubmissionDocument

schemas = []

Expand All @@ -20,7 +20,7 @@
for i in range(1, 31):
schemas.append(
RowSchema(
model=SSP_M7,
document=SSP_M7DataSubmissionDocument(),
quiet_preparser_errors=i > 1,
preparsing_validators=[
validators.hasLength(247),
Expand Down
4 changes: 2 additions & 2 deletions tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from tdpservice.parsers.fields import Field
from tdpservice.parsers.row_schema import RowSchema
from tdpservice.parsers import validators
from tdpservice.search_indexes.models.tanf import TANF_T1
from tdpservice.search_indexes.documents.tanf import TANF_T1DataSubmissionDocument


t1 = SchemaManager(
schemas=[
RowSchema(
model=TANF_T1,
document=TANF_T1DataSubmissionDocument(),
preparsing_validators=[
validators.hasLength(156),
],
Expand Down
4 changes: 2 additions & 2 deletions tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
from tdpservice.parsers.fields import TransformField, Field
from tdpservice.parsers.row_schema import RowSchema
from tdpservice.parsers import validators
from tdpservice.search_indexes.models.tanf import TANF_T2
from tdpservice.search_indexes.documents.tanf import TANF_T2DataSubmissionDocument


t2 = SchemaManager(
schemas=[
RowSchema(
model=TANF_T2,
document=TANF_T2DataSubmissionDocument(),
preparsing_validators=[
validators.hasLength(156),
],
Expand Down
6 changes: 3 additions & 3 deletions tdrs-backend/tdpservice/parsers/schema_defs/tanf/t3.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
from tdpservice.parsers.fields import TransformField, Field
from tdpservice.parsers.row_schema import RowSchema
from tdpservice.parsers import validators
from tdpservice.search_indexes.models.tanf import TANF_T3
from tdpservice.search_indexes.documents.tanf import TANF_T3DataSubmissionDocument


child_one = RowSchema(
model=TANF_T3,
document=TANF_T3DataSubmissionDocument(),
preparsing_validators=[
validators.notEmpty(start=19, end=60),
],
Expand Down Expand Up @@ -313,7 +313,7 @@
)

child_two = RowSchema(
model=TANF_T3,
document=TANF_T3DataSubmissionDocument(),
quiet_preparser_errors=True,
preparsing_validators=[
validators.notEmpty(start=60, end=101),
Expand Down
4 changes: 2 additions & 2 deletions tdrs-backend/tdpservice/parsers/schema_defs/tanf/t4.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
from tdpservice.parsers.fields import Field
from tdpservice.parsers.row_schema import RowSchema
from tdpservice.parsers import validators
from tdpservice.search_indexes.models.tanf import TANF_T4
from tdpservice.search_indexes.documents.tanf import TANF_T4DataSubmissionDocument


t4 = SchemaManager(
schemas=[
RowSchema(
model=TANF_T4,
document=TANF_T4DataSubmissionDocument(),
preparsing_validators=[
validators.hasLength(71),
],
Expand Down
4 changes: 2 additions & 2 deletions tdrs-backend/tdpservice/parsers/schema_defs/tanf/t5.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
from tdpservice.parsers.fields import TransformField, Field
from tdpservice.parsers.row_schema import RowSchema
from tdpservice.parsers import validators
from tdpservice.search_indexes.models.tanf import TANF_T5
from tdpservice.search_indexes.documents.tanf import TANF_T5DataSubmissionDocument


t5 = SchemaManager(
schemas=[
RowSchema(
model=TANF_T5,
document=TANF_T5DataSubmissionDocument(),
preparsing_validators=[
validators.hasLength(71),
],
Expand Down
Loading
Loading