feat(data): publish England only, dropping Welsh and overseas establishments
GIAS ships the whole UK plus overseas and offshore establishments. None of
them carry comparable DfE performance data — Wales does not publish on the
English measures at all — so every one of these pages rendered with null
results, null Ofsted and null phase. There were 2,036 of them: 1,569 Welsh,
123 offshore (Jersey, Guernsey, Isle of Man, Gibraltar), 316 British schools
overseas and 28 service children's schools. All 2,036 were being submitted to
search engines, alongside 29 local authorities that existed in the filters
purely to list them.
Filter at the mart boundary rather than the view layer. dim_school and
dim_location both exclude TypeOfEstablishment in {25, 26, 30, 37}, listed once
as vars.non_england_school_type_codes. Everything downstream reads those two
marts — search, the school page, /api/filters, rankings, Typesense and
build_sitemap() — so one filter removes them from the site and the sitemap
together, and Typesense drops them on its next rebuild since it recreates the
collection and swaps the alias rather than upserting in place.
coalesce rather than a bare NOT IN: a null type code would make the predicate
null and drop the row silently, and an unknown type is not grounds for
exclusion. No establishment has a null type today, but a future GIAS refresh
could ship one and the loss would be invisible.
assert_england_only_schools guards both directions: no excluded type survives
in dim_school, and dim_location holds no URN dim_school lacks — the API
inner-joins them, so the two filters drifting apart would silently shrink the
corpus.
Corpus goes from 27,229 schools to 25,193, and the authority list from 182 to
153. The 1,569 Welsh URLs now 404.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mWQnpye9F299NVRCCSRvj
This commit is contained in:
1 parent
228eb214f5
commit
7650b16f62
6 files changed
+461
-1
No files matched your search
@@ -0,0 +1,28 @@
|
||||
-- Custom test: the published corpus is England only.
|
||||
--
|
||||
-- GIAS ships the whole UK plus overseas and offshore establishments. None of
|
||||
-- them carry comparable DfE performance data, so dim_school and dim_location
|
||||
-- filter them out (see vars.non_england_school_type_codes in dbt_project.yml).
|
||||
-- This test is the guard: a GIAS refresh that reintroduces them, or an edit
|
||||
-- that drops the filter from one of the two models, fails the pipeline rather
|
||||
-- than quietly republishing ~2,000 dataless pages to the site and the sitemap.
|
||||
|
||||
select
|
||||
urn,
|
||||
school_name,
|
||||
school_type_code
|
||||
from {{ ref('dim_school') }}
|
||||
where school_type_code in ({{ var('non_england_school_type_codes') | join(', ') }})
|
||||
|
||||
union all
|
||||
|
||||
-- dim_location is inner-joined to dim_school by the API, so it must filter
|
||||
-- identically. Anything here that dim_school does not have means the two
|
||||
-- models have drifted apart.
|
||||
select
|
||||
l.urn,
|
||||
null::text as school_name,
|
||||
null::integer as school_type_code
|
||||
from {{ ref('dim_location') }} l
|
||||
left join {{ ref('dim_school') }} s on l.urn = s.urn
|
||||
where s.urn is null
|
||||
Reference in new issue
Block a user