From 352eeec2db6e78e63fb4e4ab0455805d36afa257 Mon Sep 17 00:00:00 2001 From: Tudor Date: Fri, 16 Jan 2026 09:58:11 +0000 Subject: [PATCH] Add pupil absence data to school details modal Display test absence percentages (reading, maths, GPS, writing, science) in a new section in the school modal. Requires database re-import. Co-Authored-By: Claude Opus 4.5 --- backend/models.py | 15 ++++++++++++- backend/schemas.py | 54 +++++++++++++++++++++++++++++++++++++++++++++ frontend/app.js | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+), 1 deletion(-) diff --git a/backend/models.py b/backend/models.py index c57f8a0..790fd03 100644 --- a/backend/models.py +++ b/backend/models.py @@ -96,7 +96,14 @@ class SchoolResult(Base): sen_support_pct = Column(Float) sen_ehcp_pct = Column(Float) stability_pct = Column(Float) - + + # Pupil Absence from Tests + reading_absence_pct = Column(Float) + gps_absence_pct = Column(Float) + maths_absence_pct = Column(Float) + writing_absence_pct = Column(Float) + science_absence_pct = Column(Float) + # Gender Breakdown rwm_expected_boys_pct = Column(Float) rwm_expected_girls_pct = Column(Float) @@ -173,6 +180,12 @@ RESULT_FIELD_MAPPING = { 'sen_support_pct': 'sen_support_pct', 'sen_ehcp_pct': 'sen_ehcp_pct', 'stability_pct': 'stability_pct', + # Absence + 'reading_absence_pct': 'reading_absence_pct', + 'gps_absence_pct': 'gps_absence_pct', + 'maths_absence_pct': 'maths_absence_pct', + 'writing_absence_pct': 'writing_absence_pct', + 'science_absence_pct': 'science_absence_pct', # Gender 'rwm_expected_boys_pct': 'rwm_expected_boys_pct', 'rwm_expected_girls_pct': 'rwm_expected_girls_pct', diff --git a/backend/schemas.py b/backend/schemas.py index a96abd8..fbbdae0 100644 --- a/backend/schemas.py +++ b/backend/schemas.py @@ -42,6 +42,12 @@ COLUMN_MAPPINGS = { "PSENELK": "sen_support_pct", "PSENELE": "sen_ehcp_pct", "PTMOBN": "stability_pct", + # Pupil absence from tests + "PTREAD_AT": "reading_absence_pct", + "PTGPS_AT": "gps_absence_pct", + "PTMAT_AT": "maths_absence_pct", + "PTWRITTA_AD": "writing_absence_pct", + "PTSCITA_AD": "science_absence_pct", # Gender breakdown "PTRWM_EXP_B": "rwm_expected_boys_pct", "PTRWM_EXP_G": "rwm_expected_girls_pct", @@ -86,6 +92,12 @@ NUMERIC_COLUMNS = [ "sen_support_pct", "sen_ehcp_pct", "stability_pct", + # Pupil absence from tests + "reading_absence_pct", + "gps_absence_pct", + "maths_absence_pct", + "writing_absence_pct", + "science_absence_pct", # Gender breakdown "rwm_expected_boys_pct", "rwm_expected_girls_pct", @@ -331,6 +343,42 @@ METRIC_DEFINITIONS = { "type": "percentage", "category": "context", }, + # Pupil Absence from Tests + "reading_absence_pct": { + "name": "Reading Test Absence %", + "short_name": "Reading Absent", + "description": "% of pupils absent from or unable to access the Reading test", + "type": "percentage", + "category": "absence", + }, + "gps_absence_pct": { + "name": "GPS Test Absence %", + "short_name": "GPS Absent", + "description": "% of pupils absent from or unable to access the GPS test", + "type": "percentage", + "category": "absence", + }, + "maths_absence_pct": { + "name": "Maths Test Absence %", + "short_name": "Maths Absent", + "description": "% of pupils absent from or unable to access the Maths test", + "type": "percentage", + "category": "absence", + }, + "writing_absence_pct": { + "name": "Writing Absence %", + "short_name": "Writing Absent", + "description": "% of pupils absent from or disapplied in Writing assessment", + "type": "percentage", + "category": "absence", + }, + "science_absence_pct": { + "name": "Science Absence %", + "short_name": "Science Absent", + "description": "% of pupils absent from or disapplied in Science assessment", + "type": "percentage", + "category": "absence", + }, # 3-Year Averages "rwm_expected_3yr_pct": { "name": "RWM Expected % (3-Year Avg)", @@ -398,6 +446,12 @@ RANKING_COLUMNS = [ "eal_pct", "sen_support_pct", "stability_pct", + # Absence + "reading_absence_pct", + "gps_absence_pct", + "maths_absence_pct", + "writing_absence_pct", + "science_absence_pct", # 3-year "rwm_expected_3yr_pct", "reading_avg_3yr", diff --git a/frontend/app.js b/frontend/app.js index ee56ef0..567a453 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -120,6 +120,36 @@ const TERM_DEFINITIONS = { description: "The total number of pupils enrolled at the school.", note: null, }, + reading_absence: { + title: "Reading Test Absence", + description: + "The percentage of pupils who were absent from or unable to access the Reading test on test day.", + note: "Includes pupils who were ill, absent, or had circumstances preventing access.", + }, + gps_absence: { + title: "GPS Test Absence", + description: + "The percentage of pupils who were absent from or unable to access the Grammar, Punctuation and Spelling test.", + note: "Includes pupils who were ill, absent, or had circumstances preventing access.", + }, + maths_absence: { + title: "Maths Test Absence", + description: + "The percentage of pupils who were absent from or unable to access the Maths test on test day.", + note: "Includes pupils who were ill, absent, or had circumstances preventing access.", + }, + writing_absence: { + title: "Writing Absence/Disapplied", + description: + "The percentage of pupils who were absent from or disapplied from the Writing teacher assessment.", + note: "Disapplied means formally removed from assessment, usually due to significant special needs.", + }, + science_absence: { + title: "Science Absence/Disapplied", + description: + "The percentage of pupils who were absent from or disapplied from the Science teacher assessment.", + note: "Disapplied means formally removed from assessment, usually due to significant special needs.", + }, }; // Warning definitions for alerts/notices @@ -1744,6 +1774,31 @@ async function openSchoolModal(urn) { + `; function getProgressClass(value) {