showing schools with no KS2 results
All checks were successful
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 44s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 1m9s
Build and Push Docker Images / Build Pipeline (Meltano + dbt + Airflow) (push) Successful in 32s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 1s
All checks were successful
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 44s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 1m9s
Build and Push Docker Images / Build Pipeline (Meltano + dbt + Airflow) (push) Successful in 32s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 1s
This commit is contained in:
@@ -330,6 +330,11 @@ async def get_schools(
|
||||
if page_size is None:
|
||||
page_size = settings.default_page_size
|
||||
|
||||
# Schools with no performance data (special schools, PRUs, newly opened, etc.)
|
||||
# have NULL year from the LEFT JOIN — keep them but skip the groupby/trend logic.
|
||||
df_no_perf = df[df["year"].isna()].drop_duplicates(subset=["urn"])
|
||||
df = df[df["year"].notna()]
|
||||
|
||||
# Get unique schools (latest year data for each)
|
||||
latest_year = df.groupby("urn")["year"].max().reset_index()
|
||||
df_latest = df.merge(latest_year, on=["urn", "year"])
|
||||
@@ -351,6 +356,9 @@ async def get_schools(
|
||||
)
|
||||
df_latest = df_latest.merge(prev_rwm, on="urn", how="left")
|
||||
|
||||
# Merge back schools with no performance data
|
||||
df_latest = pd.concat([df_latest, df_no_perf], ignore_index=True)
|
||||
|
||||
# Phase filter — uses PHASE_GROUPS so all-through/middle schools appear
|
||||
# in the correct phase(s) rather than being invisible to both filters.
|
||||
if phase:
|
||||
|
||||
Reference in New Issue
Block a user