feat(pipeline): extract Ofsted report-card judgements (rc_* columns)

Wires the tap TODO in stg_ofsted_inspections.sql: maps the 7 confirmed
report-card MI columns (Safeguarding standards, Inclusion, Curriculum
and teaching, Achievement, Attendance and behaviour, Personal
development and wellbeing, Leadership and governance) into rc_*
fields, parsed via the new parse_report_card_grade macro against
real sampled grade values (Exceptional/Strong standard/Expected
standard/Needs attention/Urgent improvement). rc_safeguarding_met
becomes boolean from Met/Not met. rc_early_years/rc_sixth_form have
no MI column yet and are intentionally omitted from COLUMN_PRIORITY,
staying NULL.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0146VHeLAWjDVE2B5uU67jCB
This commit is contained in:
Tudor
2026-07-12 22:12:33 +01:00
co-authored by Claude Fable 5
parent bee63a7836
commit 02084e427c
3 changed files with 55 additions and 11 deletions
@@ -0,0 +1,17 @@
-- Macro: Parse Ofsted Report Card grade (post-Nov 2025 framework) from text
-- into the 5-point scale. Real values confirmed via a live sample of the MI
-- CSV (see pipeline/scripts/diagnose_compare_gaps.py's
-- "TASK 7 VALUE SAMPLE 2026-07-12" note) -- unrecognised text (including the
-- 'NULL' sentinel used by the source CSV for blanks) parses to NULL, never
-- errors.
{% macro parse_report_card_grade(column_name) %}
case lower(trim(nullif({{ column_name }}, 'NULL')))
when 'exceptional' then 1
when 'strong standard' then 2
when 'expected standard' then 3
when 'needs attention' then 4
when 'urgent improvement' then 5
else null
end
{% endmacro %}