fix(api): inspectorate and Ofsted listing in payloads; Ofsted links that resolve (H4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
TudorandClaude Opus 5.5 committed 2026-10-13 21:32:06 +01:00
1 parent 2b5e681482
commit 69da9d84db
7 files changed
+89 -6

No files matched your search

+8 -1
View File
@@ -251,6 +251,8 @@ _MAIN_QUERY = text("""
s.website,
s.telephone,
s.nursery_provision,
s.inspectorate,
s.ofsted_listed,
foi.current_grade AS ofsted_grade,
foi.current_grade_date AS ofsted_grade_date,
foi.latest_visit_date AS ofsted_date,
@@ -376,7 +378,8 @@ for _old, _new in _LEGACY_NAME_REPLACEMENTS:
_MAIN_QUERY_LEGACY_NAMES = text(_MAIN_QUERY_LEGACY_NAMES)
# Fallback used when marts predate the optional GIAS/location detail columns
# (telephone, nursery provision, county, parliamentary constituency) — i.e. the
# (telephone, nursery provision, county, parliamentary constituency, and the
# inspectorate / Ofsted-listing columns added for audit H4) — i.e. the
# nightly dbt pipeline hasn't rebuilt the mart yet on this DB. Keeps each column
# present as NULL so the whole data load degrades gracefully instead of failing.
_EXTRA_OPTIONAL_COLUMNS = (
@@ -384,6 +387,8 @@ _EXTRA_OPTIONAL_COLUMNS = (
"nursery_provision",
"county",
"parliamentary_constituency",
"inspectorate",
"ofsted_listed",
)
_MAIN_QUERY_NO_EXTRA_COLS = str(_MAIN_QUERY)
for _col, _tbl in (
@@ -391,6 +396,8 @@ for _col, _tbl in (
("nursery_provision", "s"),
("county", "l"),
("parliamentary_constituency", "l"),
("inspectorate", "s"),
("ofsted_listed", "s"),
):
_src = f"{_tbl}.{_col},"
assert _src in _MAIN_QUERY_NO_EXTRA_COLS, (