Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c7dff17
add english core subject
vipinsamreddy Apr 1, 2026
c81a330
add english literature
vipinsamreddy Apr 1, 2026
4fdea36
add maths
vipinsamreddy Apr 1, 2026
b66a3b7
add combine science
vipinsamreddy Apr 1, 2026
63beb5f
add remaning core subjects
vipinsamreddy Apr 2, 2026
508a697
fixed page shell issues
vipinsamreddy Apr 8, 2026
785d570
fix issue related charts
vipinsamreddy Apr 8, 2026
95071c9
Merge branch 'main' into feature-ks4core-subjects
vipinsamreddy Apr 8, 2026
c6bf0c3
fix build
vipinsamreddy Apr 8, 2026
52fd772
fix issues related to the css bug
vipinsamreddy Apr 9, 2026
acdfb0a
fix tests
vipinsamreddy Apr 9, 2026
664788d
fix year by year charts
vipinsamreddy Apr 9, 2026
2f2ba21
fix issue related to bar
vipinsamreddy Apr 9, 2026
aff2748
fix issues rlated to percentage
vipinsamreddy Apr 10, 2026
c666a9c
label issue
vipinsamreddy Apr 10, 2026
ce58443
fix data
vipinsamreddy Apr 10, 2026
c711380
removed all puils option
vipinsamreddy Apr 10, 2026
85b04cd
fix test
vipinsamreddy Apr 10, 2026
dadc8eb
fix text
vipinsamreddy Apr 13, 2026
4b1cea7
fix text
vipinsamreddy Apr 13, 2026
9ba692b
Merge branch 'main' into feature-ks4core-subjects
vipinsamreddy Apr 13, 2026
956898f
adde right text
vipinsamreddy Apr 13, 2026
2e979ac
fix the issues related to tests
vipinsamreddy Apr 14, 2026
4ac4438
Merge branch 'main' into feature-ks4core-subjects
vipinsamreddy Apr 14, 2026
9074ee6
refactor
vipinsamreddy Apr 15, 2026
20b1289
Merge branch 'feature-ks4core-subjects' of https://github.com/DFE-Dig…
vipinsamreddy Apr 15, 2026
141c178
fix top performer
vipinsamreddy Apr 15, 2026
dde87e3
fix pr comments
vipinsamreddy Apr 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -506,3 +506,4 @@ wwwroot/**/*.min.js
**/wwwroot/*
**/wwwroot/*
/coveragereport
/SAPData/Sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using SAPSec.Core.Features.Ks4HeadlineMeasures;
using SAPSec.Core.Features.SimilarSchools;
using SAPSec.Core.Interfaces.Repositories;

namespace SAPSec.Core.Features.Ks4CoreSubjects.UseCases;

public class GetFilteredSchoolKs4CoreSubject(
IKs4PerformanceRepository repository,
IEstablishmentRepository establishmentRepository,
ISimilarSchoolsSecondaryRepository similarSchoolsRepository)
{
public async Task<GetFilteredSchoolKs4CoreSubjectResponse> Execute(GetFilteredSchoolKs4CoreSubjectRequest request)
{
var gradeFilter = SchoolKs4CoreSubjectExtensions.ParseFilter(request.Grade);
var subjectFilter = SchoolKs4CoreSubjectExtensions.ParseSubject(request.Subject);
var schoolData = await repository.GetByUrnAsync(request.Urn);
var similarSchoolUrns = (await similarSchoolsRepository.GetSimilarSchoolUrnsAsync(request.Urn))
.Where(urn => !string.IsNullOrWhiteSpace(urn))
.Distinct(StringComparer.Ordinal)
.ToArray();
var similarSchoolData = ((await repository.GetByUrnsAsync(similarSchoolUrns)) ?? [])
.ToDictionary(x => x.Urn, x => x, StringComparer.Ordinal);
var similarSchoolDetails = ((await establishmentRepository.GetEstablishmentsAsync(similarSchoolUrns))
?? Array.Empty<SAPSec.Core.Model.Generated.Establishment>())
.Where(x => !string.IsNullOrWhiteSpace(x.URN))
.ToDictionary(x => x.URN, StringComparer.Ordinal);
var similarSchools = similarSchoolUrns
.Where(similarSchoolDetails.ContainsKey)
.Select(urn => new SimilarSchoolMeasure(
urn,
similarSchoolDetails[urn].EstablishmentName,
similarSchoolData.GetValueOrDefault(urn)))
.ToArray();

return new(
SchoolKs4CoreSubjectSelectionBuilder.BuildSelection(schoolData, similarSchools, subjectFilter, gradeFilter),
subjectFilter,
gradeFilter);
}
}

public record GetFilteredSchoolKs4CoreSubjectRequest(
string Urn,
string? Subject,
string? Grade);

public record GetFilteredSchoolKs4CoreSubjectResponse(
SchoolKs4CoreSubjectSelection Selection,
SchoolKs4CoreSubject Subject,
SchoolKs4CoreSubjectGradeFilter Grade);

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
namespace SAPSec.Core.Features.Ks4CoreSubjects.UseCases;

public static class SchoolKs4CoreSubjectExtensions
{
public static SchoolKs4CoreSubjectGradeFilter ParseFilter(string? grade) =>
grade switch
{
"5" => SchoolKs4CoreSubjectGradeFilter.Grade5,
"7" => SchoolKs4CoreSubjectGradeFilter.Grade7,
"4" => SchoolKs4CoreSubjectGradeFilter.Grade4,
_ => throw new ArgumentOutOfRangeException(nameof(grade), grade, "Unsupported KS4 core subject grade filter.")
};

public static SchoolKs4CoreSubject ParseSubject(string? subject) =>
subject?.ToLowerInvariant() switch
{
"english-language" => SchoolKs4CoreSubject.EnglishLanguage,
"english-literature" => SchoolKs4CoreSubject.EnglishLiterature,
"biology" => SchoolKs4CoreSubject.Biology,
"chemistry" => SchoolKs4CoreSubject.Chemistry,
"physics" => SchoolKs4CoreSubject.Physics,
"maths" => SchoolKs4CoreSubject.Maths,
"combined-science-double-award" => SchoolKs4CoreSubject.CombinedScienceDoubleAward,
_ => throw new ArgumentOutOfRangeException(nameof(subject), subject, "Unsupported KS4 core subject.")
};

public static string ToFilterValue(this SchoolKs4CoreSubjectGradeFilter filter) =>
filter switch
{
SchoolKs4CoreSubjectGradeFilter.Grade5 => "5",
SchoolKs4CoreSubjectGradeFilter.Grade7 => "7",
_ => "4"
};

public static string ToSubjectValue(this SchoolKs4CoreSubject subject) =>
subject switch
{
SchoolKs4CoreSubject.EnglishLanguage => "english-language",
SchoolKs4CoreSubject.EnglishLiterature => "english-literature",
SchoolKs4CoreSubject.Biology => "biology",
SchoolKs4CoreSubject.Chemistry => "chemistry",
SchoolKs4CoreSubject.Physics => "physics",
SchoolKs4CoreSubject.Maths => "maths",
SchoolKs4CoreSubject.CombinedScienceDoubleAward => "combined-science-double-award",
_ => throw new ArgumentOutOfRangeException(nameof(subject), subject, "Unsupported KS4 core subject.")
};
}
Loading
Loading