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:
|
if page_size is None:
|
||||||
page_size = settings.default_page_size
|
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)
|
# Get unique schools (latest year data for each)
|
||||||
latest_year = df.groupby("urn")["year"].max().reset_index()
|
latest_year = df.groupby("urn")["year"].max().reset_index()
|
||||||
df_latest = df.merge(latest_year, on=["urn", "year"])
|
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")
|
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
|
# Phase filter — uses PHASE_GROUPS so all-through/middle schools appear
|
||||||
# in the correct phase(s) rather than being invisible to both filters.
|
# in the correct phase(s) rather than being invisible to both filters.
|
||||||
if phase:
|
if phase:
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ _MAIN_QUERY = text("""
|
|||||||
p.sen_ehcp_pct
|
p.sen_ehcp_pct
|
||||||
FROM marts.dim_school s
|
FROM marts.dim_school s
|
||||||
JOIN marts.dim_location l ON s.urn = l.urn
|
JOIN marts.dim_location l ON s.urn = l.urn
|
||||||
JOIN marts.fact_performance p ON s.urn = p.urn
|
LEFT JOIN marts.fact_performance p ON s.urn = p.urn
|
||||||
ORDER BY s.school_name, p.year
|
ORDER BY s.school_name, p.year
|
||||||
""")
|
""")
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ def load_school_data() -> pd.DataFrame:
|
|||||||
if not _df_cache.empty:
|
if not _df_cache.empty:
|
||||||
print(f"Total records loaded: {len(_df_cache)}")
|
print(f"Total records loaded: {len(_df_cache)}")
|
||||||
print(f"Unique schools: {_df_cache['urn'].nunique()}")
|
print(f"Unique schools: {_df_cache['urn'].nunique()}")
|
||||||
print(f"Years: {sorted(_df_cache['year'].unique())}")
|
print(f"Years: {sorted(_df_cache['year'].dropna().unique())}")
|
||||||
else:
|
else:
|
||||||
print("No data found in marts (EES data may not have been loaded yet)")
|
print("No data found in marts (EES data may not have been loaded yet)")
|
||||||
return _df_cache
|
return _df_cache
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ services:
|
|||||||
POSTGRES_USER: schoolcompare
|
POSTGRES_USER: schoolcompare
|
||||||
POSTGRES_PASSWORD: schoolcompare
|
POSTGRES_PASSWORD: schoolcompare
|
||||||
POSTGRES_DB: schoolcompare
|
POSTGRES_DB: schoolcompare
|
||||||
|
POSTGRES_INITDB_ARGS: "--locale=C --encoding=UTF8"
|
||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
Reference in New Issue
Block a user