Skip to content

Commit 2005ebe

Browse files
committed
add arrears_actions GX suite; update other tests and inputs
1 parent 5d4b685 commit 2005ebe

File tree

3 files changed

+148
-3
lines changed

3 files changed

+148
-3
lines changed

scripts/helpers/housing_nec_migration_gx_dq_inputs.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"contacts": {"id_field": "LCDE_LEGACY_REF"},
66
}
77

8-
data_load_list = ["properties", "tenancies", "people", "contacts"]
8+
data_load_list = ["properties", "tenancies", "people", "contacts", "arrears_actions"]
99

1010
table_list = {
1111
"properties": [
@@ -29,8 +29,9 @@
2929
"tenancies_all",
3030
"tenancies_other",
3131
],
32-
"people": ["people_1a", "people_1b", "people_1c", "people_2a"],
33-
"contacts": ["contacts_1a", "contacts_1b", "contacts_2a"]
32+
"people": ["people_1a", "people_1b", "people_1c", "people_2a", "people_all"],
33+
"contacts": ["contacts_1a", "contacts_1b", "contacts_2a", "contacts_all"],
34+
"arrears_actions": ["arrears_actions_1a", "arrears_actions_1c", "arrears_actions_2a"],
3435
}
3536

3637
partition_keys = ["import_date"]

scripts/jobs/housing/housing_nec_migration_apply_gx_dq_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import scripts.jobs.housing.housing_nec_migration_tenancies_data_load_gx_suite
2020
import scripts.jobs.housing.housing_nec_migration_people_data_load_gx_suite
2121
import scripts.jobs.housing.housing_nec_migration_contacts_data_load_gx_suite
22+
import scripts.jobs.housing.housing_nec_migration_arrears_actions_data_load_gx_suite
2223

2324
logging.basicConfig(level=logging.INFO)
2425
logger = logging.getLogger(__name__)
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# flake8: noqa: F821
2+
3+
import sys
4+
5+
from awsglue.utils import getResolvedOptions
6+
import great_expectations as gx
7+
import great_expectations.expectations as gxe
8+
9+
10+
class ExpectPayRefColumnValuesToNotBeNull(gxe.ExpectColumnValuesToNotBeNull):
11+
column: str = "LACA_PAY_REF"
12+
description: str = (
13+
"Expect LACA_PAY_REF (pay ref) values to not be Null in contacts load"
14+
)
15+
16+
17+
class ExpectValueColumnValuesToNotBeNull(gxe.ExpectColumnValuesToNotBeNull):
18+
column: str = "LACA_CREATED_DATE"
19+
description: str = "Expect LCDE_CONTACT_VALUE (contact value) to not be Null"
20+
21+
22+
class ExpectArrearCodeToBeInSet(gxe.ExpectColumnValuesToBeInSet):
23+
column: str = "LACA_ARA_CODE"
24+
value_set: list = [
25+
"BAGF",
26+
"BAG1",
27+
"RTRN",
28+
"FRA2",
29+
"ADVR",
30+
"RDCN",
31+
"DWPR",
32+
"DWPN",
33+
"EDCL",
34+
"NOTE",
35+
"RHCN",
36+
"CORT",
37+
"IUPO",
38+
"IRA1",
39+
"NTQ",
40+
"CON3",
41+
"RREQ",
42+
"RRFN",
43+
"STAT",
44+
"SHB",
45+
"SNW",
46+
"ARRN",
47+
"POP",
48+
"FRA1",
49+
"BCOL",
50+
"DWPC",
51+
"DWPT",
52+
"COUT",
53+
"NFA",
54+
"NRA2",
55+
"FRET",
56+
"SCH",
57+
"SNP",
58+
"VISN",
59+
"WOA",
60+
"WOC",
61+
"WOH",
62+
"WON",
63+
"CDAT",
64+
"CNOK",
65+
"ADVC",
66+
"EVIC",
67+
"FINC",
68+
"HBN",
69+
"SRA1",
70+
"TRA1",
71+
"NRA1",
72+
"IRA1",
73+
"MRA1",
74+
"TELO",
75+
"RPAN",
76+
"RRHB",
77+
"RRF",
78+
"SAR",
79+
"SBA",
80+
"SCM",
81+
"SSA",
82+
"VISI",
83+
"WOF",
84+
"RCHN",
85+
"RDDN",
86+
"CDL",
87+
"FINI",
88+
"GRA1",
89+
"AGRL",
90+
"SRA2",
91+
"TRA2",
92+
"NRA2",
93+
"IRA2",
94+
"MRA2",
95+
"CWAL",
96+
"TELI",
97+
"RELI",
98+
"LREF",
99+
"NOSP",
100+
"INTV",
101+
"SUP",
102+
"UCC"
103+
]
104+
description: str = "Expect arrear code to be one of the set"
105+
106+
107+
class ExpectArrearsActionsColumnsToMatchOrderedList(gxe.ExpectTableColumnsToMatchOrderedList):
108+
column_list = [
109+
"LACA_BALANCE",
110+
"LACA_PAY_REF",
111+
"LACA_TYPE",
112+
"LACA_CREATED_BY",
113+
"LACA_CREATED_DATE",
114+
"LACA_ARREARS_DISPUTE_IND",
115+
"LACA_ARA_CODE",
116+
"LACA_STATUS",
117+
"LACA_HRV_ADL_CODE",
118+
"LACA_EAC_EPO_CODE",
119+
"LACA_EFFECTIVE_DATE",
120+
"LACA_EXPIRY_DATE",
121+
"LACA_NEXT_ACTION_DATE",
122+
"LACA_AUTH_DATE",
123+
"LACA_AUTH_USERNAME",
124+
"LACA_PRINT_DATE",
125+
"LACA_DEL_"
126+
]
127+
description: str = "Expect columns to match ordered list exactly"
128+
129+
130+
arg_key = ["s3_target_location"]
131+
args = getResolvedOptions(sys.argv, arg_key)
132+
locals().update(args)
133+
134+
# add to GX context
135+
context = gx.get_context(mode="file", project_root_dir=s3_target_location)
136+
137+
suite = gx.ExpectationSuite(name="arrears_actions_data_load_suite")
138+
139+
suite.add_expectation(ExpectArrearsActionsColumnsToMatchOrderedList())
140+
suite.add_expectation(ExpectArrearCodeToBeInSet())
141+
suite.add_expectation(ExpectPayRefColumnValuesToNotBeNull())
142+
suite.add_expectation(ExpectValueColumnValuesToNotBeNull())
143+
suite = context.suites.add(suite)

0 commit comments

Comments
 (0)