diff --git a/frontend/app.js b/frontend/app.js
index 2d2b5d6..9373592 100644
--- a/frontend/app.js
+++ b/frontend/app.js
@@ -49,6 +49,89 @@ const CHART_COLORS = [
"#9b59b6", // violet
];
+// Term definitions for tooltips
+const TERM_DEFINITIONS = {
+ rwm_expected: {
+ title: "RWM Expected Standard",
+ description:
+ "The percentage of pupils meeting the expected standard in Reading, Writing and Maths combined at the end of Key Stage 2 (Year 6).",
+ note: "National average: 61%",
+ },
+ rwm_higher: {
+ title: "RWM Higher Standard",
+ description:
+ "The percentage of pupils exceeding the expected standard and reaching the higher standard in Reading, Writing and Maths combined.",
+ note: "National average: 8%",
+ },
+ gps_expected: {
+ title: "GPS Expected Standard",
+ description:
+ "The percentage of pupils meeting the expected standard in Grammar, Punctuation and Spelling at the end of Key Stage 2.",
+ note: "National average: 72%",
+ },
+ science_expected: {
+ title: "Science Expected Standard",
+ description:
+ "The percentage of pupils meeting the expected standard in Science, assessed by teacher judgement at the end of Key Stage 2.",
+ note: "National average: 80%",
+ },
+ reading_progress: {
+ title: "Reading Progress Score",
+ description:
+ "A value-added measure showing how much progress pupils made in Reading between KS1 and KS2, compared to pupils with similar starting points nationally.",
+ note: "A score of 0 is average. Positive = above-average progress.",
+ },
+ writing_progress: {
+ title: "Writing Progress Score",
+ description:
+ "A value-added measure showing how much progress pupils made in Writing between KS1 and KS2, compared to pupils with similar starting points nationally.",
+ note: "A score of 0 is average. Positive = above-average progress.",
+ },
+ maths_progress: {
+ title: "Maths Progress Score",
+ description:
+ "A value-added measure showing how much progress pupils made in Maths between KS1 and KS2, compared to pupils with similar starting points nationally.",
+ note: "A score of 0 is average. Positive = above-average progress.",
+ },
+ disadvantaged_pct: {
+ title: "% Disadvantaged",
+ description:
+ "The percentage of pupils eligible for free school meals or who have been at any point in the last six years, or are looked-after children.",
+ note: "Affects school funding through the Pupil Premium.",
+ },
+ eal_pct: {
+ title: "% EAL",
+ description:
+ "The percentage of pupils whose first language is known or believed to be other than English. These pupils may need additional language support.",
+ note: null,
+ },
+ sen_support_pct: {
+ title: "% SEN Support",
+ description:
+ "The percentage of pupils receiving Special Educational Needs Support. These pupils need extra help but do not have an Education, Health and Care Plan.",
+ note: "Does not include pupils with EHCPs.",
+ },
+ total_pupils: {
+ title: "Total Pupils",
+ description: "The total number of pupils enrolled at the school.",
+ note: null,
+ },
+};
+
+/**
+ * Creates an info trigger button for a term tooltip
+ * @param {string} termKey - Key from TERM_DEFINITIONS
+ * @returns {string} HTML string for the info trigger
+ */
+function createInfoTrigger(termKey) {
+ const definition = TERM_DEFINITIONS[termKey];
+ if (!definition) return "";
+
+ const label = `What is ${definition.title}?`;
+
+ return ``;
+}
+
// Map instances (stored to allow cleanup)
const schoolMaps = new Map();
@@ -290,6 +373,9 @@ async function init() {
// Always set up event listeners and routing, even if data loading fails
setupEventListeners();
+ // Initialize tooltip manager
+ tooltipManager = new TooltipManager();
+
// Handle initial route
handleRoute();
@@ -523,15 +609,15 @@ function renderFeaturedSchools(schools) {
${formatMetricValue(school.rwm_expected_pct, "rwm_expected_pct")}
${getTrendIndicator(school.rwm_expected_pct, school.prev_rwm_expected_pct)}
-