Skip to content

Commit f8d6d9d

Browse files
committed
bug fix on missing eol comma clae_cla_last_iro_contact_date
1 parent 82646dc commit f8d6d9d

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

deployment_extracts/systemc/live/ssd_deployment_individual_files/systemc_sqlserver_v1.3.8_1_20251205.sql

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ Where used, item level metadata follows simple key value structure. Example:
128128
-- Optional notes from la config file
129129

130130
-- META-ELEMENT: {"type": "dev_set_up"}
131-
GO
132131
SET NOCOUNT ON;
133132

134133
-- META-ELEMENT: {"type": "ssd_timeframe"}
@@ -237,11 +236,11 @@ SET @StartTime = GETDATE(); -- Script start time
237236
SET @TableName = N'ssd_person';
238237

239238

240-
/* START - Temp Hard drop and recreate due to d2i structure changes */
241-
IF OBJECT_ID(N'ssd_development.ssd_person', N'U') IS NOT NULL
242-
DROP TABLE ssd_development.ssd_person;
243-
GO
244-
/* END - remove this tmp block once SSD has run once for v1.3.5+! */
239+
-- /* START - Temp Hard drop and recreate due to d2i structure changes */
240+
-- IF OBJECT_ID(N'ssd_development.ssd_person', N'U') IS NOT NULL
241+
-- DROP TABLE ssd_development.ssd_person;
242+
-- GO
243+
-- /* END - remove this tmp block once SSD has run once for v1.3.5+! */
245244

246245

247246
-- META-ELEMENT: {"type": "drop_table"}
@@ -317,8 +316,8 @@ SELECT
317316
p.FORENAME,
318317
p.SURNAME,
319318
p.GENDER_MAIN_CODE AS pers_sex, -- Sex/Gender as used in stat-returns
320-
p.GENDER_MAIN_CODE, -- Placeholder for those LAs that store sex and gender independently
321-
p.ETHNICITY_MAIN_CODE, -- [REVIEW] LEFT(p.ETHNICITY_MAIN_CODE, 4)
319+
p.GENDER_MAIN_CODE, -- Placeholder for those LAs that store sex and gender independently
320+
dlde.NAT_ID, -- COV change to align with national ID was LEFT(p.ETHNICITY_MAIN_CODE, 4) [REVIEW]
322321
CASE WHEN (p.DOB_ESTIMATED) = 'N'
323322
THEN p.BIRTH_DTTM -- Set to BIRTH_DTTM when DOB_ESTIMATED = 'N'
324323
ELSE NULL -- or NULL
@@ -358,10 +357,15 @@ LEFT JOIN (
358357
ON
359358
p.DIM_PERSON_ID = f903.dim_person_id
360359

360+
LEFT JOIN
361+
-- align with national ID
362+
HDM.Child_Social.DIM_LOOKUP_DFE_ETHNIC dlde
363+
ON p.ETHNICITY_MAIN_CODE = dlde.MAIN_CODE
364+
361365
WHERE
362366
/* EXCLUSIONS */
363367

364-
-- p.DIM_PERSON_ID IN (1, 2, 3) AND -- -- hard filter on CMS person ids for LA reduced cohort testing
368+
-- p.DIM_PERSON_ID IN (1, 2, 3) AND -- -- hard filter on CMS person ids for LA reduced tiny cohort testing
365369

366370
p.DIM_PERSON_ID IS NOT NULL
367371
AND p.DIM_PERSON_ID <> -1
@@ -3490,7 +3494,7 @@ END
34903494
MAX(CASE
34913495
WHEN cn.DIM_LOOKUP_CASNT_TYPE_ID_CODE = 'IRO'
34923496
THEN cn.EVENT_DTTM
3493-
END) AS clae_cla_last_iro_contact_date
3497+
END) AS clae_cla_last_iro_contact_date,
34943498
fc.START_DTTM AS clae_entered_care_date
34953499
FROM HDM.Child_Social.FACT_CARE_EPISODES AS fce
34963500
JOIN HDM.Child_Social.FACT_CLA AS fc

0 commit comments

Comments
 (0)