fix(backend): serve the current Ofsted status from fact_ofsted_latest
The list query and the batch Ofsted fetch each picked 'the latest row' of fact_ofsted_inspection themselves, and _ofsted_block carried an older ungraded grade forward when the latest graded inspection gave none. All three now read marts.fact_ofsted_latest. List rows: ofsted_grade is the grade still in force, ofsted_grade_date when it was awarded or confirmed, ofsted_date the latest visit. The ofsted block gains current_grade and latest_visit and loses grade_source; overall_effectiveness is the graded inspection's own result. A school with only an inspection stays publishable in the sitemap. Requires fact_ofsted_latest (PR #183's pipeline run) on the database. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
96732c56d1
commit
a9e3a6a700
8 files changed
+188
-78
No files matched your search
@@ -162,6 +162,49 @@ class FactOfstedInspection(Base):
|
||||
report_url = Column(Text)
|
||||
|
||||
|
||||
class FactOfstedLatest(Base):
|
||||
"""Current Ofsted status — one row per URN (pipeline: int_ofsted_latest).
|
||||
|
||||
`current_grade` is the overall grade still in force, dated by the
|
||||
inspection that awarded or confirmed it; `latest_visit_*` is the school's
|
||||
most recent inspection of any kind.
|
||||
"""
|
||||
__tablename__ = "fact_ofsted_latest"
|
||||
__table_args__ = MARTS
|
||||
|
||||
urn = Column(Integer, primary_key=True)
|
||||
latest_visit_date = Column(Date)
|
||||
latest_visit_kind = Column(String(20))
|
||||
latest_visit_outcome = Column(String(100))
|
||||
current_grade = Column(Integer)
|
||||
current_grade_date = Column(Date)
|
||||
current_grade_basis = Column(String(20))
|
||||
graded_inspection_date = Column(Date)
|
||||
ungraded_inspection_date = Column(Date)
|
||||
rc_inspection_date = Column(Date)
|
||||
inspection_type = Column(String(100))
|
||||
framework = Column(String(20))
|
||||
overall_effectiveness = Column(Integer)
|
||||
quality_of_education = Column(Integer)
|
||||
behaviour_attitudes = Column(Integer)
|
||||
personal_development = Column(Integer)
|
||||
leadership_management = Column(Integer)
|
||||
early_years_provision = Column(Integer)
|
||||
sixth_form_provision = Column(Integer)
|
||||
ungraded_outcome = Column(String(100))
|
||||
ungraded_grade = Column(Integer)
|
||||
rc_safeguarding_met = Column(Boolean)
|
||||
rc_inclusion = Column(Integer)
|
||||
rc_curriculum_teaching = Column(Integer)
|
||||
rc_achievement = Column(Integer)
|
||||
rc_attendance_behaviour = Column(Integer)
|
||||
rc_personal_development = Column(Integer)
|
||||
rc_leadership_governance = Column(Integer)
|
||||
rc_early_years = Column(Integer)
|
||||
rc_sixth_form = Column(Integer)
|
||||
report_url = Column(Text)
|
||||
|
||||
|
||||
class FactAdmissions(Base):
|
||||
"""School admissions — one row per URN per year."""
|
||||
__tablename__ = "fact_admissions"
|
||||
|
||||
Reference in new issue
Block a user