fix(school, compare): ISI, not-yet-inspected and further-education states (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:35:10 +01:00
1 parent ab25d83b9d
commit 9feb37b974
12 files changed
+143 -16

No files matched your search

+13 -2
View File
@@ -10,7 +10,8 @@
* methodology instead of thresholding point estimates.
*/
import type { OfstedInspection, SchoolAdmissions } from './types';
import { hasReportCard } from './ofstedStatus';
import type { OfstedInspection, School, SchoolAdmissions } from './types';
// ---------------------------------------------------------------------------
// Verdicts against an anchor (England average or state-school benchmark)
@@ -104,6 +105,16 @@ export type OfstedDisplay =
| { kind: 'no_overall_grade' }
| { kind: 'report_card'; summary: ReportCardSummary };
/**
* The compare cell when a school has no Ofsted record (audit H4): ISI per GIAS,
* Ofsted's own "not yet inspected", or plainly that we hold nothing.
*/
export function noInspectionLabel(school: Pick<School, 'inspectorate' | 'ofsted_listed'>): string {
if (school.inspectorate === 'ISI') return 'Inspected by ISI';
if (school.ofsted_listed) return 'Not yet inspected';
return 'No inspection in our dataset';
}
export function ofstedDisplay(
ofsted: OfstedInspection | null | undefined,
): OfstedDisplay {
@@ -111,7 +122,7 @@ export function ofstedDisplay(
// A report card is the newest inspection format; when present it wins —
// never derive or prefer an overall grade alongside it.
if (ofsted.report_card && Object.keys(ofsted.report_card).length > 0) {
if (hasReportCard(ofsted)) {
return { kind: 'report_card', summary: summariseReportCard(ofsted) };
}
+2 -1
View File
@@ -97,7 +97,8 @@ export interface School {
// ============================================================================
export interface OfstedInspection {
framework: 'OEIF' | 'ReportCard' | null;
/** Ofsted's event grouping (e.g. "Schools - S5"), or "Further education and skills" for FE records (audit H4). */
framework: string | null;
inspection_date: string | null;
/** Start date of the report-card inspection itself (Nov 2025+); null otherwise. */
rc_inspection_date?: string | null;