feat: drive sixth-form separation from GIAS OfficialSixthForm flag #21

Merged
tudor merged 10 commits from feat/gias-sixth-form-flag into main 2026-07-07 13:48:12 +00:00
3 changed files with 20 additions and 0 deletions
Showing only changes of commit d11faefebd - Show all commits
+1
View File
@@ -24,6 +24,7 @@ class DimSchool(Base):
religious_character = Column(String(100))
gender = Column(String(20))
age_range = Column(String(20))
has_sixth_form = Column(Boolean)
capacity = Column(Integer)
total_pupils = Column(Integer)
headteacher_name = Column(String(200))
@@ -16,6 +16,17 @@ models:
tests:
- not_null:
severity: warn
- name: has_sixth_form
description: >
Authoritative sixth-form flag from GIAS OfficialSixthForm.
"Has a sixth form" => true; "Does not have a sixth form" and
"Not applicable" => false; blank GIAS value falls back to
statutory_high_age >= 18. Replaces the age_range-contains-"18"
heuristic (spec 2026-07-07 §3).
tests:
- not_null
- accepted_values:
values: [true, false]
- name: status
tests:
- accepted_values:
@@ -52,6 +52,14 @@ select
s.religious_character,
s.gender,
s.statutory_low_age || '-' || s.statutory_high_age as age_range,
-- 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.
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
else coalesce(s.statutory_high_age >= 18, false)
end as has_sixth_form,
s.capacity,
s.total_pupils,
concat_ws(' ', s.head_title, s.head_first_name, s.head_last_name) as headteacher_name,