Skip to content

Commit

Permalink
Merge pull request #708 from DFE-Digital/add-ofsted-single-headline-g…
Browse files Browse the repository at this point in the history
…rades

Add ofsted single headline grades
  • Loading branch information
dynamictulip authored Jan 31, 2025
2 parents 3fcae9a + d134de3 commit cd26f4e
Show file tree
Hide file tree
Showing 32 changed files with 1,137 additions and 339 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased][unreleased]

### Added

- Added Single headline grades Ofsted subpage

### Changed

- Updated accessibility statement text
- Page spacing tweak on Ofsted subpages
- All Ofsted subpage tables - previous sub-judgements for academies with no previous inspection now say "Not inspected" (instead of "Not yet inspected" which is used for current sub-judgements)
- Ofsted data download - previous sub-judgements for academies with no previous inspection now say "Not inspected" (instead of "Not yet inspected" which is used for current sub-judgements)

### Removed

- Removed 'Date joined trust' from Ofsted data source list
- Removed Important dates Ofsted subpage

## [Release-19][release-19] (production-2025-01-20.4730)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ namespace DfE.FindInformationAcademiesTrusts.Data.AcademiesDb.Repositories;
public class AcademyRepository(IAcademiesDbContext academiesDbContext, ILogger<AcademyRepository> logger)
: IAcademyRepository
{
private static readonly DateTime
SingleHeadlineGradesPolicyChangeDate = new(2024, 09, 02, 0, 0, 0, DateTimeKind.Utc);

public async Task<AcademyDetails[]> GetAcademiesInTrustDetailsAsync(string uid)
{
return await academiesDbContext.GiasGroupLinks
Expand Down Expand Up @@ -138,9 +141,59 @@ await academiesDbContext.MisMstrFurtherEducationEstablishmentsFiat
ofstedRating.Urn);
}

// Ensure that there are no single headline grades after policy change on 2nd September 2024
if (ofstedRatings.Any(rating =>
HasSingleHeadlineGradeIssuedAfterPolicyChange(rating.Current) ||
HasSingleHeadlineGradeIssuedAfterPolicyChange(rating.Previous)))
{
LogErrorForUrnsWithSingleHeadlineGradesAfterPolicyChange(ofstedRatings);

ofstedRatings = RemoveSingleHeadlineGradesIssuedAfterPolicyChange(ofstedRatings);
}

return ofstedRatings.ToDictionary(o => o.Urn.ToString(), o => o);
}

private void LogErrorForUrnsWithSingleHeadlineGradesAfterPolicyChange(List<AcademyOfstedRatings> ofstedRatings)
{
foreach (var ofstedRating in ofstedRatings)
{
if (HasSingleHeadlineGradeIssuedAfterPolicyChange(ofstedRating.Current))
{
logger.LogError(
"URN {Urn} has a current Ofsted single headline grade of {score} issued on {InspectionDate} which was after single headline grades stopped being issued on 2nd September. This could be a data integrity issue with the Ofsted data in Academies Db.",
ofstedRating.Urn, ofstedRating.Current.OverallEffectiveness, ofstedRating.Current.InspectionDate);
}

if (HasSingleHeadlineGradeIssuedAfterPolicyChange(ofstedRating.Previous))
{
logger.LogError(
"URN {Urn} has a previous Ofsted single headline grade of {score} issued on {InspectionDate} which was after single headline grades stopped being issued on 2nd September. This could be a data integrity issue with the Ofsted data in Academies Db.",
ofstedRating.Urn, ofstedRating.Previous.OverallEffectiveness, ofstedRating.Previous.InspectionDate);
}
}
}

private static bool HasSingleHeadlineGradeIssuedAfterPolicyChange(OfstedRating rating)
{
return rating.InspectionDate >= SingleHeadlineGradesPolicyChangeDate &&
rating.OverallEffectiveness != OfstedRatingScore.SingleHeadlineGradeNotAvailable;
}

private static List<AcademyOfstedRatings> RemoveSingleHeadlineGradesIssuedAfterPolicyChange(
List<AcademyOfstedRatings> ratings)
{
return ratings.Select(rating => rating with
{
Current = HasSingleHeadlineGradeIssuedAfterPolicyChange(rating.Current)
? rating.Current with { OverallEffectiveness = OfstedRatingScore.SingleHeadlineGradeNotAvailable }
: rating.Current,
Previous = HasSingleHeadlineGradeIssuedAfterPolicyChange(rating.Previous)
? rating.Previous with { OverallEffectiveness = OfstedRatingScore.SingleHeadlineGradeNotAvailable }
: rating.Previous
}).ToList();
}

public async Task<AcademyPupilNumbers[]> GetAcademiesInTrustPupilNumbersAsync(string uid)
{
return await academiesDbContext.GiasGroupLinks
Expand Down Expand Up @@ -211,7 +264,7 @@ public static OfstedRatingScore ConvertOverallEffectivenessToOfstedRatingScore(s
// Check if it is 'Not judged' all other gradings are int based
if (rating?.ToLower().Equals("not judged") ?? false)
{
return OfstedRatingScore.NoJudgement;
return OfstedRatingScore.SingleHeadlineGradeNotAvailable;
}

return ConvertNullableStringToOfstedRatingScore(rating);
Expand Down
2 changes: 1 addition & 1 deletion DfE.FindInformationAcademiesTrusts.Data/OfstedRating.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public enum OfstedRatingScore
RequiresImprovement = 3,
Inadequate = 4,
DoesNotApply = 8,
NoJudgement = 9
SingleHeadlineGradeNotAvailable = 9
}

public enum SafeguardingScore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,26 @@ public static int ToDataSortValue(this OfstedRatingScore rating)
OfstedRatingScore.RequiresImprovement => 3,
OfstedRatingScore.Inadequate => 4,
OfstedRatingScore.InsufficientEvidence => 5,
OfstedRatingScore.NoJudgement => 6,
OfstedRatingScore.SingleHeadlineGradeNotAvailable => 6,
OfstedRatingScore.DoesNotApply => 7,
OfstedRatingScore.NotInspected => 8,
_ => -1
};
}

public static string ToDisplayString(this OfstedRatingScore rating)
public static string ToDisplayString(this OfstedRatingScore rating, bool isCurrentRating)
{
return rating switch
return (rating, isCurrentRating) switch
{
OfstedRatingScore.Outstanding => "Outstanding",
OfstedRatingScore.Good => "Good",
OfstedRatingScore.RequiresImprovement => "Requires improvement",
OfstedRatingScore.Inadequate => "Inadequate",
OfstedRatingScore.InsufficientEvidence => "Insufficient evidence",
OfstedRatingScore.NoJudgement => "No judgement",
OfstedRatingScore.DoesNotApply => "Does not apply",
OfstedRatingScore.NotInspected => "Not yet inspected",
(OfstedRatingScore.Outstanding, _) => "Outstanding",
(OfstedRatingScore.Good, _) => "Good",
(OfstedRatingScore.RequiresImprovement, _) => "Requires improvement",
(OfstedRatingScore.Inadequate, _) => "Inadequate",
(OfstedRatingScore.InsufficientEvidence, _) => "Insufficient evidence",
(OfstedRatingScore.SingleHeadlineGradeNotAvailable, _) => "Not available",
(OfstedRatingScore.DoesNotApply, _) => "Does not apply",
(OfstedRatingScore.NotInspected, true) => "Not yet inspected",
(OfstedRatingScore.NotInspected, false) => "Not inspected",
_ => "Unknown"
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Layout = "Ofsted/_OfstedLayout";
}

<section class="govuk-!-margin-top-8 app-table-container" data-testid="ofsted-current-ratings-table">
<section class="app-table-container" data-testid="ofsted-current-ratings-table">
<table class="govuk-table" data-module="moj-sortable-table">
<caption class="govuk-table__caption govuk-table__caption--m" data-testid="subpage-header">Current ratings</caption>
<thead class="govuk-table__head">
Expand Down Expand Up @@ -45,25 +45,25 @@
@academy.EstablishmentName<br/>
</td>
<td class="govuk-table__cell govuk-body" data-sort-value="@academy.CurrentOfstedRating.QualityOfEducation.ToDataSortValue()" data-testid="ofsted-current-ratings-quality-of-education">
@academy.CurrentOfstedRating.QualityOfEducation.ToDisplayString()
@academy.CurrentOfstedRating.QualityOfEducation.ToDisplayString(true)
</td>
<td class="govuk-table__cell govuk-body" data-sort-value="@academy.CurrentOfstedRating.BehaviourAndAttitudes.ToDataSortValue()" data-testid="ofsted-current-ratings-behaviour-and-attitudes">
@academy.CurrentOfstedRating.BehaviourAndAttitudes.ToDisplayString()
@academy.CurrentOfstedRating.BehaviourAndAttitudes.ToDisplayString(true)
</td>
<td class="govuk-table__cell govuk-body" data-sort-value="@academy.CurrentOfstedRating.PersonalDevelopment.ToDataSortValue()" data-testid="ofsted-current-ratings-personal-development">
@academy.CurrentOfstedRating.PersonalDevelopment.ToDisplayString()
@academy.CurrentOfstedRating.PersonalDevelopment.ToDisplayString(true)
</td>
<td class="govuk-table__cell govuk-body" data-sort-value="@academy.CurrentOfstedRating.EffectivenessOfLeadershipAndManagement.ToDataSortValue()" data-testid="ofsted-current-ratings-leadership-and-management">
@academy.CurrentOfstedRating.EffectivenessOfLeadershipAndManagement.ToDisplayString()
@academy.CurrentOfstedRating.EffectivenessOfLeadershipAndManagement.ToDisplayString(true)
</td>
<td class="govuk-table__cell govuk-body" data-sort-value="@academy.CurrentOfstedRating.EarlyYearsProvision.ToDataSortValue()" data-testid="ofsted-current-ratings-early-years-provision">
@academy.CurrentOfstedRating.EarlyYearsProvision.ToDisplayString()
@academy.CurrentOfstedRating.EarlyYearsProvision.ToDisplayString(true)
</td>
<td class="govuk-table__cell govuk-body" data-sort-value="@academy.CurrentOfstedRating.SixthFormProvision.ToDataSortValue()" data-testid="ofsted-current-ratings-sixth-form-provision">
@academy.CurrentOfstedRating.SixthFormProvision.ToDisplayString()
@academy.CurrentOfstedRating.SixthFormProvision.ToDisplayString(true)
</td>
<td class="govuk-table__cell govuk-body" data-sort-value="@academy.WhenDidCurrentInspectionHappen" data-testid="ofsted-current-ratings-before-or-after-joining">
@await Html.PartialAsync("_BeforeOrAfterTag", academy.WhenDidCurrentInspectionHappen)
<partial name="_BeforeOrAfterTag" model="new BeforeOrAfterTagModel(academy.WhenDidCurrentInspectionHappen, true)"/>
</td>
</tr>
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,27 @@ public override async Task<IActionResult> OnGetAsync()

SubNavigationLinks =
[
new TrustSubNavigationLinkModel(ViewConstants.OfstedSingleHeadlineGradesPageName, "./SingleHeadlineGrades",
Uid, TrustPageMetadata.PageName!, this is SingleHeadlineGradesModel),
new TrustSubNavigationLinkModel(ViewConstants.OfstedCurrentRatingsPageName, "./CurrentRatings", Uid,
TrustPageMetadata.PageName!,
this is CurrentRatingsModel),
TrustPageMetadata.PageName!, this is CurrentRatingsModel),
new TrustSubNavigationLinkModel(ViewConstants.OfstedPreviousRatingsPageName, "./PreviousRatings", Uid,
TrustPageMetadata.PageName!,
this is PreviousRatingsModel),
new TrustSubNavigationLinkModel(ViewConstants.OfstedImportantDatesPageName, "./ImportantDates", Uid,
TrustPageMetadata.PageName!,
this is ImportantDatesModel),
TrustPageMetadata.PageName!, this is PreviousRatingsModel),
new TrustSubNavigationLinkModel(ViewConstants.OfstedSafeguardingAndConcernsPageName,
"./SafeguardingAndConcerns", Uid,
TrustPageMetadata.PageName!, this is SafeguardingAndConcernsModel)
"./SafeguardingAndConcerns", Uid, TrustPageMetadata.PageName!, this is SafeguardingAndConcernsModel)
];

// Add data sources
var giasDataSource = await DataSourceService.GetAsync(Source.Gias);
var misDataSource = await DataSourceService.GetAsync(Source.Mis);

var dateJoinedTrust = new DataSourceListEntry(giasDataSource, "Date joined trust");

DataSourcesPerPage.AddRange([
new DataSourcePageListEntry(ViewConstants.OfstedSingleHeadlineGradesPageName, [
new DataSourceListEntry(giasDataSource, "Date joined trust"),
new DataSourceListEntry(misDataSource, "All single headline grades"),
new DataSourceListEntry(misDataSource, "All inspection dates")
]
),
new DataSourcePageListEntry(ViewConstants.OfstedCurrentRatingsPageName, [
new DataSourceListEntry(misDataSource, "Current Ofsted rating"),
new DataSourceListEntry(misDataSource, "Date of current inspection")
Expand All @@ -66,12 +66,6 @@ public override async Task<IActionResult> OnGetAsync()
new DataSourceListEntry(misDataSource, "Date of previous inspection")
]
),
new DataSourcePageListEntry(ViewConstants.OfstedImportantDatesPageName, [
dateJoinedTrust,
new DataSourceListEntry(misDataSource, "Date of current inspection"),
new DataSourceListEntry(misDataSource, "Date of previous inspection")
]
),
new DataSourcePageListEntry(ViewConstants.OfstedSafeguardingAndConcernsPageName, [
new DataSourceListEntry(misDataSource, "Effective safeguarding"),
new DataSourceListEntry(misDataSource, "Category of concern"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Layout = "Ofsted/_OfstedLayout";
}

<section class="govuk-!-margin-top-8 app-table-container" data-testid="ofsted-previous-ratings-table">
<section class="app-table-container" data-testid="ofsted-previous-ratings-table">
<table class="govuk-table" data-module="moj-sortable-table">
<caption class="govuk-table__caption govuk-table__caption--m" data-testid="subpage-header">Previous ratings</caption>
<thead class="govuk-table__head">
Expand Down Expand Up @@ -45,25 +45,25 @@
@academy.EstablishmentName<br/>
</td>
<td class="govuk-table__cell govuk-body" data-sort-value="@academy.PreviousOfstedRating.QualityOfEducation.ToDataSortValue()" data-testid="ofsted-previous-ratings-quality-of-education">
@academy.PreviousOfstedRating.QualityOfEducation.ToDisplayString()
@academy.PreviousOfstedRating.QualityOfEducation.ToDisplayString(false)
</td>
<td class="govuk-table__cell govuk-body" data-sort-value="@academy.PreviousOfstedRating.BehaviourAndAttitudes.ToDataSortValue()" data-testid="ofsted-previous-ratings-behaviour-and-attitudes">
@academy.PreviousOfstedRating.BehaviourAndAttitudes.ToDisplayString()
@academy.PreviousOfstedRating.BehaviourAndAttitudes.ToDisplayString(false)
</td>
<td class="govuk-table__cell govuk-body" data-sort-value="@academy.PreviousOfstedRating.PersonalDevelopment.ToDataSortValue()" data-testid="ofsted-previous-ratings-personal-development">
@academy.PreviousOfstedRating.PersonalDevelopment.ToDisplayString()
@academy.PreviousOfstedRating.PersonalDevelopment.ToDisplayString(false)
</td>
<td class="govuk-table__cell govuk-body" data-sort-value="@academy.PreviousOfstedRating.EffectivenessOfLeadershipAndManagement.ToDataSortValue()" data-testid="ofsted-previous-ratings-leadership-and-management">
@academy.PreviousOfstedRating.EffectivenessOfLeadershipAndManagement.ToDisplayString()
@academy.PreviousOfstedRating.EffectivenessOfLeadershipAndManagement.ToDisplayString(false)
</td>
<td class="govuk-table__cell govuk-body" data-sort-value="@academy.PreviousOfstedRating.EarlyYearsProvision.ToDataSortValue()" data-testid="ofsted-previous-ratings-early-years-provision">
@academy.PreviousOfstedRating.EarlyYearsProvision.ToDisplayString()
@academy.PreviousOfstedRating.EarlyYearsProvision.ToDisplayString(false)
</td>
<td class="govuk-table__cell govuk-body" data-sort-value="@academy.PreviousOfstedRating.SixthFormProvision.ToDataSortValue()" data-testid="ofsted-previous-ratings-sixth-form-provision">
@academy.PreviousOfstedRating.SixthFormProvision.ToDisplayString()
@academy.PreviousOfstedRating.SixthFormProvision.ToDisplayString(false)
</td>
<td class="govuk-table__cell govuk-body" data-sort-value="@academy.WhenDidPreviousInspectionHappen" data-testid="ofsted-previous-ratings-before-or-after-joining">
@await Html.PartialAsync("_BeforeOrAfterTag", academy.WhenDidPreviousInspectionHappen)
<partial name="_BeforeOrAfterTag" model="new BeforeOrAfterTagModel(academy.WhenDidPreviousInspectionHappen, false)"/>
</td>
</tr>
}
Expand Down
Loading

0 comments on commit cd26f4e

Please sign in to comment.