From fe31be34a0704f11c57db24938255500d8815a4c Mon Sep 17 00:00:00 2001 From: Tudor Sitaru Date: Thu, 9 Apr 2026 16:15:31 +0100 Subject: [PATCH] fix(secondary): expose GIAS total_pupils in school_info API response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The school_info object was missing total_pupils entirely, so the frontend always fell back to the KS4 exam cohort from yearly_data. Now selects s.total_pupils (GIAS NumberOfPupils — full school roll) as gias_total_pupils in the main query and exposes it as total_pupils on school_info. Co-Authored-By: Claude Sonnet 4.6 --- backend/app.py | 1 + backend/data_loader.py | 1 + 2 files changed, 2 insertions(+) diff --git a/backend/app.py b/backend/app.py index 74175f9..570705e 100644 --- a/backend/app.py +++ b/backend/app.py @@ -553,6 +553,7 @@ async def get_school_details(request: Request, urn: int): "website": latest.get("website"), "headteacher_name": latest.get("headteacher_name"), "capacity": latest.get("capacity"), + "total_pupils": latest.get("gias_total_pupils"), "trust_name": latest.get("trust_name"), "gender": latest.get("gender"), }, diff --git a/backend/data_loader.py b/backend/data_loader.py index ddfac01..7ce4941 100644 --- a/backend/data_loader.py +++ b/backend/data_loader.py @@ -127,6 +127,7 @@ _MAIN_QUERY = text(""" s.age_range, s.admissions_policy, s.capacity, + s.total_pupils AS gias_total_pupils, s.headteacher_name, s.website, s.ofsted_grade,