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,