feat: add secondary school support with KS4 data and metric tooltips
Some checks failed
Build and Push Docker Images / Build Frontend (Next.js) (push) Has been cancelled
Build and Push Docker Images / Build Pipeline (Meltano + dbt + Airflow) (push) Has been cancelled
Build and Push Docker Images / Trigger Portainer Update (push) Has been cancelled
Build and Push Docker Images / Build Backend (FastAPI) (push) Has been cancelled

- Backend: replace INNER JOIN ks2 with UNION ALL (ks2 + ks4) so primary
  and secondary schools both appear in the main DataFrame
- Backend: add /api/national-averages endpoint computing means from live
  data, replacing the hardcoded NATIONAL_AVG constant on the frontend
- Backend: add phase filter param to /api/schools; return phases from
  /api/filters; fix hardcoded "phase": "Primary" in school detail endpoint
- Backend: add KS4 metric definitions (Attainment 8, Progress 8, EBacc,
  English & Maths pass rates) to METRIC_DEFINITIONS and RANKING_COLUMNS
- Frontend: SchoolDetailView is now phase-aware — secondary schools show
  a GCSE Results section (Att8, P8, E&M, EBacc) instead of SATs; phonics
  tab hidden for secondary; admissions says Year 7 instead of Year 3;
  history table shows KS4 columns; chart datasets switch for secondary
- Frontend: new MetricTooltip component (CSS-only ⓘ icon) backed by
  METRIC_EXPLANATIONS — added to RWM, GPS, SEN, EAL, IDACI, progress
  scores and all KS4 metrics throughout SchoolDetailView and SchoolCard
- Frontend: METRIC_EXPLANATIONS extended with KS4 terms (Attainment 8,
  Progress 8, EBacc) and previously missing terms (SEN, EHCP, EAL, IDACI)
- Frontend: SchoolCard expands "RWM" to "Reading, Writing & Maths" and
  shows Attainment 8 / English & Maths Grade 4+ for secondary schools
- Frontend: FilterBar adds Phase dropdown (Primary / Secondary / All-through)
- Frontend: HomeView hero copy updated; compact list shows phase-aware metric
- Global metadata updated to remove "primary only" framing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-28 14:59:40 +00:00
parent b0990e30ee
commit 5eff9af69c
16 changed files with 903 additions and 187 deletions

View File

@@ -23,11 +23,11 @@ const playfairDisplay = Playfair_Display({
export const metadata: Metadata = {
title: {
default: 'SchoolCompare | Compare Primary School Performance',
default: 'SchoolCompare | Compare School Performance',
template: '%s | SchoolCompare',
},
description: 'Compare primary school KS2 performance across England',
keywords: 'school comparison, KS2 results, primary school performance, England schools, SATs results',
description: 'Compare primary and secondary school SATs and GCSE performance across England',
keywords: 'school comparison, KS2 results, KS4 results, primary school, secondary school, England schools, SATs results, GCSE results',
authors: [{ name: 'SchoolCompare' }],
manifest: '/manifest.json',
icons: {
@@ -37,15 +37,15 @@ export const metadata: Metadata = {
},
openGraph: {
type: 'website',
title: 'SchoolCompare | Compare Primary School Performance',
description: 'Compare primary school KS2 performance across England',
title: 'SchoolCompare | Compare School Performance',
description: 'Compare primary and secondary school SATs and GCSE performance across England',
url: 'https://schoolcompare.co.uk',
siteName: 'SchoolCompare',
},
twitter: {
card: 'summary',
title: 'SchoolCompare | Compare Primary School Performance',
description: 'Compare primary school KS2 performance across England',
title: 'SchoolCompare | Compare School Performance',
description: 'Compare primary and secondary school SATs and GCSE performance across England',
},
};

View File

@@ -11,6 +11,7 @@ interface HomePageProps {
search?: string;
local_authority?: string;
school_type?: string;
phase?: string;
page?: string;
postcode?: string;
radius?: string;
@@ -19,7 +20,7 @@ interface HomePageProps {
export const metadata = {
title: 'Home',
description: 'Search and compare primary school KS2 performance across England',
description: 'Search and compare school performance across England',
};
// Force dynamic rendering (no static generation at build time)
@@ -38,6 +39,7 @@ export default async function HomePage({ searchParams }: HomePageProps) {
params.search ||
params.local_authority ||
params.school_type ||
params.phase ||
params.postcode
);
@@ -52,6 +54,7 @@ export default async function HomePage({ searchParams }: HomePageProps) {
search: params.search,
local_authority: params.local_authority,
school_type: params.school_type,
phase: params.phase,
postcode: params.postcode,
radius,
page,
@@ -65,7 +68,7 @@ export default async function HomePage({ searchParams }: HomePageProps) {
return (
<HomeView
initialSchools={schoolsData}
filters={filtersData || { local_authorities: [], school_types: [], years: [] }}
filters={filtersData || { local_authorities: [], school_types: [], years: [], phases: [] }}
totalSchools={dataInfo?.total_schools ?? null}
/>
);
@@ -76,7 +79,7 @@ export default async function HomePage({ searchParams }: HomePageProps) {
return (
<HomeView
initialSchools={{ schools: [], page: 1, page_size: 50, total: 0, total_pages: 0 }}
filters={{ local_authorities: [], school_types: [], years: [] }}
filters={{ local_authorities: [], school_types: [], years: [], phases: [] }}
totalSchools={null}
/>
);

View File

@@ -17,8 +17,8 @@ interface RankingsPageProps {
export const metadata: Metadata = {
title: 'School Rankings',
description: 'Top-ranked primary schools by KS2 performance across England',
keywords: 'school rankings, top schools, best schools, KS2 rankings, school league tables',
description: 'Top-ranked schools by SATs and GCSE performance across England',
keywords: 'school rankings, top schools, best schools, KS2 rankings, KS4 rankings, school league tables',
};
// Force dynamic rendering