From f1388ff5bd0af1409823a1e047b7ba84246a0f70 Mon Sep 17 00:00:00 2001 From: Tudor Date: Tue, 7 Jul 2026 14:05:10 +0100 Subject: [PATCH] fix(pipeline): normalize GIAS OfficialSixthForm comparison with lower(trim()) Matches the phase derivation's guard against casing/whitespace variants in raw GIAS data; an unmatched variant previously fell through silently to the statutory-age fallback. Co-Authored-By: Claude Fable 5 --- pipeline/transform/models/marts/dim_school.sql | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pipeline/transform/models/marts/dim_school.sql b/pipeline/transform/models/marts/dim_school.sql index a09a016..0de54fa 100644 --- a/pipeline/transform/models/marts/dim_school.sql +++ b/pipeline/transform/models/marts/dim_school.sql @@ -55,9 +55,12 @@ select -- Authoritative sixth-form flag (spec §3): GIAS OfficialSixthForm. -- "Not applicable" (nurseries, primaries, PRUs) => false. Blank GIAS -- value (rare, new establishments) falls back to the statutory age range. + -- lower(trim()) guards against casing/whitespace variants in raw GIAS + -- data, same as the phase derivation above — an unmatched variant would + -- otherwise silently fall through to the age-range fallback. case - when s.official_sixth_form = 'Has a sixth form' then true - when s.official_sixth_form in ('Does not have a sixth form', 'Not applicable') then false + when lower(trim(s.official_sixth_form)) = 'has a sixth form' then true + when lower(trim(s.official_sixth_form)) in ('does not have a sixth form', 'not applicable') then false else coalesce(s.statutory_high_age >= 18, false) end as has_sixth_form, s.capacity,