feat(pipeline): one current Ofsted status per school (C1/M1, part 1 of 2) #183
No files matched your search
@@ -125,6 +125,30 @@ models:
|
||||
- name: inspection_date
|
||||
tests: [not_null]
|
||||
|
||||
- name: fact_ofsted_latest
|
||||
description: >
|
||||
Current Ofsted status, one row per URN: the latest visit and the overall
|
||||
grade still in force. See int_ofsted_latest for the rule.
|
||||
columns:
|
||||
- name: urn
|
||||
tests: [not_null, unique]
|
||||
- name: latest_visit_date
|
||||
tests: [not_null]
|
||||
- name: latest_visit_kind
|
||||
tests:
|
||||
- not_null
|
||||
- accepted_values:
|
||||
values: ['report_card', 'graded', 'ungraded']
|
||||
- name: current_grade
|
||||
tests:
|
||||
- accepted_values:
|
||||
values: [1, 2, 3, 4]
|
||||
quote: false
|
||||
- name: current_grade_basis
|
||||
tests:
|
||||
- accepted_values:
|
||||
values: ['graded', 'confirmed']
|
||||
|
||||
- name: fact_pupil_characteristics
|
||||
description: Pupil demographics — one row per URN per year
|
||||
columns:
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
-- Mart: current Ofsted status — one row per URN
|
||||
-- The backend reads this instead of choosing the latest row of
|
||||
-- fact_ofsted_inspection itself. The rule lives in int_ofsted_latest.
|
||||
|
||||
select
|
||||
urn,
|
||||
latest_visit_date,
|
||||
latest_visit_kind,
|
||||
latest_visit_outcome,
|
||||
current_grade,
|
||||
current_grade_date,
|
||||
current_grade_basis,
|
||||
graded_inspection_date,
|
||||
ungraded_inspection_date,
|
||||
rc_inspection_date,
|
||||
inspection_type,
|
||||
framework,
|
||||
overall_effectiveness,
|
||||
quality_of_education,
|
||||
behaviour_attitudes,
|
||||
personal_development,
|
||||
leadership_management,
|
||||
early_years_provision,
|
||||
sixth_form_provision,
|
||||
ungraded_outcome,
|
||||
ungraded_grade,
|
||||
rc_safeguarding_met,
|
||||
rc_inclusion,
|
||||
rc_curriculum_teaching,
|
||||
rc_achievement,
|
||||
rc_attendance_behaviour,
|
||||
rc_personal_development,
|
||||
rc_leadership_governance,
|
||||
rc_early_years,
|
||||
rc_sixth_form,
|
||||
report_url
|
||||
from {{ ref('int_ofsted_latest') }}
|
||||
@@ -0,0 +1,10 @@
|
||||
-- A grade is dated by the inspection that awarded or confirmed it, never
|
||||
-- after the latest visit, and has a date and a basis exactly when it exists.
|
||||
-- A report card leaves no legacy grade in force.
|
||||
|
||||
select urn
|
||||
from {{ ref('fact_ofsted_latest') }}
|
||||
where current_grade_date > latest_visit_date
|
||||
or (current_grade is null) <> (current_grade_date is null)
|
||||
or (current_grade is null) <> (current_grade_basis is null)
|
||||
or (latest_visit_kind = 'report_card' and current_grade is not null)
|
||||
Reference in new issue
Block a user