feat(data): integrate 9 UK government data sources via Kestra
Some checks failed
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 47s
Build and Push Docker Images / Trigger Portainer Update (push) Has been cancelled
Build and Push Docker Images / Build Frontend (Next.js) (push) Has been cancelled

Adds a full data integration pipeline for enriching school profiles with
supplementary data from Ofsted, GIAS, EES, IDACI, and FBIT.

Backend:
- Bump SCHEMA_VERSION to 3; add 8 new DB tables (ofsted_inspections,
  ofsted_parent_view, school_census, admissions, sen_detail, phonics,
  school_deprivation, school_finance) plus GIAS columns on schools
- Expose all supplementary data via GET /api/schools/{urn}
- Enrich school list responses with ofsted_grade + ofsted_date

Integrator (new service):
- FastAPI HTTP microservice; Kestra calls POST /run/{source}
- 9 source modules: ofsted, gias, parent_view, census, admissions,
  sen_detail, phonics, idaci, finance
- 9 Kestra flow YAMLs with scheduled triggers and 3× retry

Frontend:
- SchoolRow: colour-coded Ofsted badge (Outstanding/Good/RI/Inadequate)
- SchoolDetailView: 7 new sections — Ofsted sub-judgements, Parent View
  survey bars, Admissions, Pupils & Inclusion / SEN, Phonics, Deprivation
  Context, Finances
- types.ts: 8 new interfaces + extended School/SchoolDetailsResponse

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-24 11:44:04 +00:00
parent c49593d4d6
commit dd49ef28b2
36 changed files with 2849 additions and 8 deletions

View File

@@ -47,6 +47,102 @@ export interface School {
// Location search fields
distance?: number | null;
// GIAS enrichment fields
website?: string | null;
headteacher_name?: string | null;
capacity?: number | null;
trust_name?: string | null;
gender?: string | null;
// Ofsted (for list view — summary only)
ofsted_grade?: 1 | 2 | 3 | 4 | null;
ofsted_date?: string | null;
}
// ============================================================================
// Supplementary Data Types (populated by Kestra data integrator)
// ============================================================================
export interface OfstedInspection {
overall_effectiveness: 1 | 2 | 3 | 4 | null;
quality_of_education: number | null;
behaviour_attitudes: number | null;
personal_development: number | null;
leadership_management: number | null;
early_years_provision: number | null;
previous_overall: number | null;
inspection_date: string | null;
inspection_type: string | null;
}
export interface OfstedParentView {
survey_date: string | null;
total_responses: number | null;
q_happy_pct: number | null;
q_safe_pct: number | null;
q_behaviour_pct: number | null;
q_bullying_pct: number | null;
q_communication_pct: number | null;
q_progress_pct: number | null;
q_teaching_pct: number | null;
q_information_pct: number | null;
q_curriculum_pct: number | null;
q_future_pct: number | null;
q_leadership_pct: number | null;
q_wellbeing_pct: number | null;
q_recommend_pct: number | null;
q_sen_pct: number | null;
}
export interface SchoolCensus {
year: number;
class_size_avg: number | null;
ethnicity_white_pct: number | null;
ethnicity_asian_pct: number | null;
ethnicity_black_pct: number | null;
ethnicity_mixed_pct: number | null;
ethnicity_other_pct: number | null;
}
export interface SchoolAdmissions {
year: number;
published_admission_number: number | null;
total_applications: number | null;
first_preference_offers_pct: number | null;
oversubscribed: boolean | null;
}
export interface SenDetail {
year: number;
primary_need_speech_pct: number | null;
primary_need_autism_pct: number | null;
primary_need_mld_pct: number | null;
primary_need_spld_pct: number | null;
primary_need_semh_pct: number | null;
primary_need_physical_pct: number | null;
primary_need_other_pct: number | null;
}
export interface Phonics {
year: number;
year1_phonics_pct: number | null;
year2_phonics_pct: number | null;
}
export interface SchoolDeprivation {
lsoa_code: string | null;
idaci_score: number | null;
idaci_decile: number | null;
}
export interface SchoolFinance {
year: number;
per_pupil_spend: number | null;
staff_cost_pct: number | null;
teacher_cost_pct: number | null;
support_staff_cost_pct: number | null;
premises_cost_pct: number | null;
}
// ============================================================================
@@ -152,6 +248,15 @@ export interface SchoolDetailsResponse {
school_info: School;
yearly_data: SchoolResult[];
absence_data: AbsenceData | null;
// Supplementary data (null until Kestra populates)
ofsted: OfstedInspection | null;
parent_view: OfstedParentView | null;
census: SchoolCensus | null;
admissions: SchoolAdmissions | null;
sen_detail: SenDetail | null;
phonics: Phonics | null;
deprivation: SchoolDeprivation | null;
finance: SchoolFinance | null;
}
export interface ComparisonData {