test(dbt): warn when DfE's LA averages fall behind the school results (review)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e09d7a202b
commit
951c666f8a
1 file changed
+20
@@ -0,0 +1,20 @@
|
||||
{{ config(severity='warn') }}
|
||||
|
||||
-- DfE's LA averages cover the latest year with school results. They come from
|
||||
-- a fixed EES data set (ks4_summary.KS4_SUMMARY_CSV_URL); when DfE publishes a
|
||||
-- new year under a new data set, the school results move on and this mart does
|
||||
-- not, so /api/la-averages serves an empty map and every "vs LA avg" goes.
|
||||
-- A warning, not an error: it must not hold back a new year's school results.
|
||||
|
||||
with schools as (
|
||||
select max(year) as year from {{ ref('stg_ees_ks4') }} where attainment_8_score is not null
|
||||
),
|
||||
|
||||
las as (
|
||||
select max(year) as year from {{ ref('fact_ks4_la_averages') }}
|
||||
)
|
||||
|
||||
select s.year as latest_school_year, l.year as latest_la_year
|
||||
from schools s
|
||||
cross join las l
|
||||
where l.year is null or l.year < s.year
|
||||
Reference in new issue
Block a user