Skip to content

Commit ae1489c

Browse files
authored
Merge pull request #2030 from LBHackney-IT/di-447-amend-dq-tests-for-housing
amending gx dq tests to be more specific to data subsets
2 parents 729aa63 + 58b2dd4 commit ae1489c

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

scripts/helpers/housing_gx_dq_inputs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
'expect_llpg_column_values_to_match_regex': 'VALIDITY',
5050
'expect_llpg_column_values_to_not_be_null': 'COMPLETENESS',
5151
'expect_member_full_name_column_value_lengths_between': 'VALIDITY',
52+
'expect_member_is_responsible_values_to_be_in_set': 'CONSISTENCY',
5253
'expect_payment_ref_no_column_values_to_match_regex': 'VALIDITY',
5354
'expect_payment_reference_column_not_to_be_null': 'COMPLETENESS',
5455
'expect_person_id_and_payment_reference_column_values_to_be_unique_within_record': 'UNIQUENESS',
@@ -64,9 +65,11 @@
6465
'expect_property_ref_column_values_to_not_be_null': 'COMPLETENESS',
6566
'expect_select_column_values_to_be_unique_within_record': 'UNIQUENESS',
6667
'expect_start_of_tenure_date_column_not_to_be_null': 'COMPLETENESS',
68+
'expect_end_of_tenure_date_column_to_be_null': 'COMPLETENESS',
6769
'expect_sub_type_column_values_to_be_in_set': 'CONSISTENCY',
6870
'expect_sub_type_column_values_to_not_be_null': 'COMPLETENESS',
6971
'expect_surname_column_value_length': 'VALIDITY',
72+
'expect_firstname_column_value_length': 'VALIDITY',
7073
'expect_target_id_and_value_column_values_to_be_unique_within_record': 'UNIQUENESS',
7174
'expect_target_id_column_values_to_not_be_null': 'COMPLETENESS',
7275
'expect_target_type_column_values_to_be_in_set': 'CONSISTENCY',

scripts/jobs/housing/housing_person_reshape_gx_suite.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ class ExpectSurnameColumnValueLength(gxe.ExpectColumnValueLengthsToBeBetween):
2121
column: str = "surname"
2222
min_value: int = 1
2323
description: str = "Expect surname to be at least 1 character length"
24+
condition_parser: str = 'pandas'
25+
row_condition: str = 'isorganisation<>True'
26+
27+
28+
class ExpectFirstnameColumnValueLength(gxe.ExpectColumnValueLengthsToBeBetween):
29+
column: str = "firstname"
30+
min_value: int = 1
31+
description: str = "Expect firstname to be at least 1 character length"
32+
condition_parser: str = 'pandas'
33+
row_condition: str = 'isorganisation<>True'
2434

2535

2636
class ExpectPersonTypeValuesToBeInSet(gxe.ExpectColumnValuesToBeInSet):
@@ -78,14 +88,16 @@ class ExpectDateOfBirthColumnValuesToNotBeNull(gxe.ExpectColumnValuesToNotBeNull
7888
column: str = 'dateofbirth_parsed'
7989
description: str = "Expect dateofbirth_parsed be complete with no missing values"
8090
condition_parser: str = 'pandas'
81-
row_condition: str = 'isorganisation<>true'
91+
row_condition: str = 'isorganisation<>True'
8292

8393

8494
class ExpectDateOfBirthToBeBetween(gxe.ExpectColumnValuesToBeBetween):
8595
column: str = 'dateofbirth_parsed'
8696
min_value: str = datetime(1900, 1, 1, 0, 0, 0).isoformat()
8797
max_value: str = datetime.today().isoformat()
88-
description: str = "Expect dateofbirth_parsed be complete with no missing values"
98+
description: str = "Expect dateofbirth_parsed be between 1900-01-01 and today's date"
99+
condition_parser: str = 'pandas'
100+
row_condition: str = 'isorganisation<>True'
89101

90102

91103
# add to GX context
@@ -94,6 +106,7 @@ class ExpectDateOfBirthToBeBetween(gxe.ExpectColumnValuesToBeBetween):
94106
suite = gx.ExpectationSuite(name='person_reshape_suite')
95107
# suite.add_expectation(ExpectFirstNameColumnValueLength())
96108
suite.add_expectation(ExpectSurnameColumnValueLength())
109+
suite.add_expectation(ExpectFirstnameColumnValueLength())
97110
suite.add_expectation(ExpectPersonTypeValuesToBeInSet())
98111
suite.add_expectation(ExpectPreferredTitleValuesToBeInSet())
99112
suite.add_expectation(ExpectPersonIDColumnValuesToBeUnique())

scripts/jobs/housing/housing_tenure_reshape_gx_suite.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ class ExpectMemberIsResponsibleValuesToBeInSet(gxe.ExpectColumnValuesToBeInSet):
3434
description: str = "Expect member_is_responsible field to be boolean value of true or false"
3535

3636

37+
class ExpectIsMutualExchangeValuesToBeInSet(gxe.ExpectColumnValuesToBeInSet):
38+
column: str = 'ismutualexchange'
39+
value_set: list = [True, False]
40+
description: str = "Expect ismutualexchange field to be boolean value of true or false"
41+
42+
3743
class ExpectTenancyIDAndPropertyReferenceColumnValuesToBeUniqueWithinRecord(
3844
gxe.ExpectSelectColumnValuesToBeUniqueWithinRecord):
3945
column_list: list = ['tenancy_id', 'property_reference']
@@ -61,6 +67,13 @@ class ExpectStartOfTenureDateColumnNotToBeNull(gxe.ExpectColumnValuesToNotBeNull
6167
description: str = "Expect Start of Tenure Date column to be complete with no missing values"
6268

6369

70+
class ExpectEndOfTenureDateColumnToBeNull(gxe.ExpectColumnValuesToBeNull):
71+
column: str = "endoftenuredate"
72+
description: str = "Expect End of Tenure Date column to be null with no default values"
73+
condition_parser: str = 'pandas'
74+
row_condition: str = 'isterminated<>False'
75+
76+
6477
class ExpectTenureCodeColumnNotToBeNull(gxe.ExpectColumnValuesToNotBeNull):
6578
column: str = "tenure_code"
6679
description: str = "Expect Tenure Code column to be complete with no missing values"
@@ -84,6 +97,7 @@ class ExpectTenureCodeValuesToBeInSet(gxe.ExpectColumnValuesToBeInSet):
8497
suite.add_expectation(ExpectTenancyIDAndPropertyReferenceColumnValuesToBeUniqueWithinRecord())
8598
suite.add_expectation(ExpectTenancyIDColumnNotToBeNull())
8699
suite.add_expectation(ExpectStartOfTenureDateColumnNotToBeNull())
100+
suite.add_expectation(ExpectEndOfTenureDateColumnToBeNull())
87101
suite.add_expectation(ExpectTenureCodeColumnNotToBeNull())
88102
suite.add_expectation(ExpectTagRefColumnNotToBeNull())
89103
suite.add_expectation(ExpectTenureCodeValuesToBeInSet())

0 commit comments

Comments
 (0)