From c15d92d3d3b45035f10e04bbe919050fd7c21328 Mon Sep 17 00:00:00 2001 From: Eric Lipe Date: Fri, 29 Dec 2023 10:36:20 -0700 Subject: [PATCH] Revert "- Fixed name clash on PARENT_MINOR_CHILD" This reverts commit 5850dc845e2f84d7858e591cb6c0f5c381e63470. --- .../tdpservice/parsers/schema_defs/tanf/t2.py | 6 +++--- .../tdpservice/parsers/schema_defs/test.py | 10 ---------- .../parsers/schema_defs/tribal_tanf/t2.py | 4 ++-- .../tdpservice/parsers/test/factories.py | 2 +- .../tdpservice/parsers/test/test_validators.py | 10 +++++----- .../search_indexes/documents/tanf.py | 2 +- .../0026_parent_minor_child_rename.py | 18 ------------------ .../tdpservice/search_indexes/models/tanf.py | 2 +- .../search_indexes/test/test_model_mapping.py | 8 ++++---- 9 files changed, 17 insertions(+), 45 deletions(-) delete mode 100644 tdrs-backend/tdpservice/parsers/schema_defs/test.py delete mode 100644 tdrs-backend/tdpservice/search_indexes/migrations/0026_parent_minor_child_rename.py diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py index 1331490ea..63f8706ac 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t2.py @@ -69,7 +69,7 @@ validators.if_then_validator( condition_field="FAMILY_AFFILIATION", condition_function=validators.isInLimits(1, 2), - result_field="PARENT_MINOR_CHILD", + result_field="PARENT_WITH_MINOR_CHILD", result_function=validators.isInLimits(1, 3), ), validators.if_then_validator( @@ -359,8 +359,8 @@ ), Field( item="39", - name="PARENT_MINOR_CHILD", - friendly_name="parent of minor child", + name="PARENT_WITH_MINOR_CHILD", + friendly_name="parent with minor child", type="number", startIndex=53, endIndex=54, diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/test.py b/tdrs-backend/tdpservice/parsers/schema_defs/test.py deleted file mode 100644 index bd30dea14..000000000 --- a/tdrs-backend/tdpservice/parsers/schema_defs/test.py +++ /dev/null @@ -1,10 +0,0 @@ - -class Field: - name="name" - friendly_name="friendly_name" - -field = Field() -fields = [field] - -x = {getattr(f, 'name', ''): getattr(f, 'friendly_name', '') for f in fields} -print(x) diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tribal_tanf/t2.py b/tdrs-backend/tdpservice/parsers/schema_defs/tribal_tanf/t2.py index 980e653fd..ed1d03e8d 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tribal_tanf/t2.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tribal_tanf/t2.py @@ -348,8 +348,8 @@ ), Field( item="39", - name="PARENT_MINOR_CHILD", - friendly_name="parent of minor child", + name="PARENT_WITH_MINOR_CHILD", + friendly_name="parent with minor child", type="number", startIndex=53, endIndex=54, diff --git a/tdrs-backend/tdpservice/parsers/test/factories.py b/tdrs-backend/tdpservice/parsers/test/factories.py index 1d5bb28af..63a6d237d 100644 --- a/tdrs-backend/tdpservice/parsers/test/factories.py +++ b/tdrs-backend/tdpservice/parsers/test/factories.py @@ -170,7 +170,7 @@ class Meta: RECEIVE_SSI = 1 MARITAL_STATUS = 1 RELATIONSHIP_HOH = "01" - PARENT_MINOR_CHILD = 1 + PARENT_WITH_MINOR_CHILD = 1 NEEDS_PREGNANT_WOMAN = 1 EDUCATION_LEVEL = "01" CITIZENSHIP_STATUS = 1 diff --git a/tdrs-backend/tdpservice/parsers/test/test_validators.py b/tdrs-backend/tdpservice/parsers/test/test_validators.py index bd3eb88ce..dc65d2745 100644 --- a/tdrs-backend/tdpservice/parsers/test/test_validators.py +++ b/tdrs-backend/tdpservice/parsers/test/test_validators.py @@ -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_MINOR_CHILD', result_function=validators.isInLimits(1, 3), + result_field='PARENT_WITH_MINOR_CHILD', result_function=validators.isInLimits(1, 3), ) result = val(record) - assert result == (True, None, ['FAMILY_AFFILIATION', 'PARENT_MINOR_CHILD']) + assert result == (True, None, ['FAMILY_AFFILIATION', 'PARENT_WITH_MINOR_CHILD']) - record.PARENT_MINOR_CHILD = 0 + record.PARENT_WITH_MINOR_CHILD = 0 result = val(record) - assert result == (False, 'if FAMILY_AFFILIATION :1 validator1 passed then PARENT_MINOR_CHILD 0 is not ' + + assert result == (False, 'if FAMILY_AFFILIATION :1 validator1 passed then PARENT_WITH_MINOR_CHILD 0 is not ' + 'larger or equal to 1 and smaller or equal to 3.', - ['FAMILY_AFFILIATION', 'PARENT_MINOR_CHILD']) + ['FAMILY_AFFILIATION', 'PARENT_WITH_MINOR_CHILD']) def test_validate_education_level(self, record): """Test cat3 validator for education level.""" diff --git a/tdrs-backend/tdpservice/search_indexes/documents/tanf.py b/tdrs-backend/tdpservice/search_indexes/documents/tanf.py index a6b5fd6b4..c613c50a2 100644 --- a/tdrs-backend/tdpservice/search_indexes/documents/tanf.py +++ b/tdrs-backend/tdpservice/search_indexes/documents/tanf.py @@ -110,7 +110,7 @@ class Django: 'RECEIVE_SSI', 'MARITAL_STATUS', 'RELATIONSHIP_HOH', - 'PARENT_MINOR_CHILD', + 'PARENT_WITH_MINOR_CHILD', 'NEEDS_PREGNANT_WOMAN', 'EDUCATION_LEVEL', 'CITIZENSHIP_STATUS', diff --git a/tdrs-backend/tdpservice/search_indexes/migrations/0026_parent_minor_child_rename.py b/tdrs-backend/tdpservice/search_indexes/migrations/0026_parent_minor_child_rename.py deleted file mode 100644 index 73fe7eda6..000000000 --- a/tdrs-backend/tdpservice/search_indexes/migrations/0026_parent_minor_child_rename.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.2.15 on 2023-09-14 17:20 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('search_indexes', '0022_tribal_tanf_t1_tribal_tanf_t2_tribal_tanf_t3'), - ] - - operations = [ - migrations.RenameField( - model_name='tanf_t2', - old_name='PARENT_WITH_MINOR_CHILD', - new_name='PARENT_MINOR_CHILD', - ), - ] diff --git a/tdrs-backend/tdpservice/search_indexes/models/tanf.py b/tdrs-backend/tdpservice/search_indexes/models/tanf.py index 204106406..f6ba10f29 100644 --- a/tdrs-backend/tdpservice/search_indexes/models/tanf.py +++ b/tdrs-backend/tdpservice/search_indexes/models/tanf.py @@ -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_MINOR_CHILD = models.IntegerField(null=True, blank=False) + PARENT_WITH_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) diff --git a/tdrs-backend/tdpservice/search_indexes/test/test_model_mapping.py b/tdrs-backend/tdpservice/search_indexes/test/test_model_mapping.py index 187f0e760..28b948553 100644 --- a/tdrs-backend/tdpservice/search_indexes/test/test_model_mapping.py +++ b/tdrs-backend/tdpservice/search_indexes/test/test_model_mapping.py @@ -112,7 +112,7 @@ def test_can_create_and_index_tanf_t2_submission(test_datafile): submission.RECEIVE_SSI = 1 submission.MARITAL_STATUS = 1 submission.RELATIONSHIP_HOH = "01" - submission.PARENT_MINOR_CHILD = 1 + submission.PARENT_WITH_MINOR_CHILD = 1 submission.NEEDS_PREGNANT_WOMAN = 1 submission.EDUCATION_LEVEL = 1 submission.CITIZENSHIP_STATUS = 1 @@ -273,11 +273,11 @@ def test_can_create_and_index_tanf_t5_submission(test_datafile): submission.REC_FEDERAL_DISABILITY = 1 submission.REC_AID_TOTALLY_DISABLED = 1 submission.REC_AID_AGED_BLIND = 1 - submission.REC_SSI = 1 + submission.RECEIVE_SSI = 1 submission.MARITAL_STATUS = 1 submission.RELATIONSHIP_HOH = "01" - submission.PARENT_MINOR_CHILD = 1 - submission.NEEDS_OF_PREGNANT_WOMAN = 1 + submission.PARENT_WITH_MINOR_CHILD = 1 + submission.NEEDS_PREGNANT_WOMAN = 1 submission.EDUCATION_LEVEL = "1" submission.CITIZENSHIP_STATUS = 1 submission.COUNTABLE_MONTH_FED_TIME = "1"