Add similar school datamap and setup for primary schools - #283
Conversation
# Conflicts: # SAPSec.Data/Repositories/ISimilarSchoolsPrimaryRepository.cs # SAPSec.Infrastructure/Json/JsonSimilarSchoolsPrimaryRepository.cs # SAPSec.Infrastructure/Json/ServiceCollectionExtensions.cs # SAPSec.Infrastructure/Postgres/PostgresSimilarSchoolsPrimaryRepository.cs # Tests/SAPSec.Test.Common/InMemory/InMemorySimilarSchoolsPrimaryRepository.cs
|
Review app for PR 283 was deleted |
| grouplinks_edubaseallacademiesandfreeYYYYmmDD | ||
| secondary-email-addresses-12-01-2026 | ||
| 2026_07_03_neighbours_list_primary | ||
| 2026_07_03_matched_primary_schools_data No newline at end of file |
There was a problem hiding this comment.
Is there a reason why we don't include secondary similar schools raw tables in this list?
There was a problem hiding this comment.
this are newly added list just want them to be build as part of the list
| double? Latitude, | ||
| double? Longitude, | ||
| string SortMetricName, | ||
| DataWithAvailability<string> SortMetricDisplayValue, |
There was a problem hiding this comment.
In secondary similar schools this is represented using SortOptionValue<T> - any reason why this is different?
| ? parsed | ||
| : 0; | ||
| } | ||
| } |
There was a problem hiding this comment.
This seems generic and not related to similar schools - could this be pulled out into a generic helper class?
| var characteristics = SimilarSchoolsPrimaryValues.FromData( | ||
| await similarSchoolsRepository.GetValuesByUrnsAsync(urns)) | ||
| .ToDictionary(values => values.Urn, StringComparer.Ordinal); | ||
|
|
There was a problem hiding this comment.
I'm not sure why we need the similar school values here, they don't seem to be applicable to getting a list of similar schools
| } | ||
|
|
||
| return grouped; | ||
| } |
There was a problem hiding this comment.
It seems a lot of this is duplicated across secondary similar schools view models - could this be factored out at all?
| </div> | ||
| </div> | ||
| </form> | ||
| </div> |
There was a problem hiding this comment.
These views are almost identical to the secondary similar schools views - it looks like the only difference between them is the similar schools URL. Can we look at sharing these views across both primary and secondary and passing in the URL as a parameter?
Code Coverage Report: Only Changed Files listed
Minimum allowed coverage is |
Description
Summary
Implements the "View similar schools" page for primary schools (feature-flagged behind EnablePrimarySchools), mirroring the existing secondary schools feature: results list, filters, sort, pagination, and map view. Includes the full "Sort by" measure mapping and a round of alignment against the codebase's established use-case standard.
What's included
Core feature
List/filter/sort/paginate/map view for primary similar schools, following the same UX pattern as secondary.
Sort by — all 6 required measures wired up (Meeting/Achieving-higher standard in RWM and GPS, average scaled score in reading/maths), each using the latest year's data, correct 0dp/1dp formatting, and alphabetical tie-break for equal or missing scores.
Bug fixes
Address on the results list no longer renders the school's own name where the street should be (a GIAS data quirk where Address3 often duplicates the establishment name) — now built from Street/Town/Postcode, matching secondary.
Removed the extra "local authority" line from each result row to match secondary's layout.
Schools with no similar-schools group no longer 404 to the generic error page — they now show "There are no similar schools available for this school." (same as secondary), instead of the use case throwing NotFoundException on a missing (but valid) characteristics row.
Standards alignment (post-review)
Renamed FindPrimarySimilarSchools → FindPrimarySimilarSchoolsUseCase, matching the {Verb}{Noun}UseCase convention used by GetSchoolInfoUseCase/GetSchoolKs2PerformanceMeasuresUseCase.
Extracted PrimarySimilarSchoolsDataProvider so the use case's Execute is a thin orchestrator (fetch → filter → sort → paginate), mirroring the PrimarySimilarSchoolsPerformanceDataProvider pattern used by KS2 measures.
Removed duplication: deleted an unused/dead data-provider stub, extracted a shared SimilarSchoolsDecimalParsing helper, de-duplicated the row-mapping and query-filter-extraction logic in the ViewModel/controller, moved a ~70-line inline filter script into AssetSrc/js/similar-schools-filter.js.
Related Trello Ticket
https://trello.com/c/Id9I1aSV/874-ps40-view-similar-schools-page-for-primary-schools-list-map-view
https://trello.com/c/X0Zh5R8u/855-ps42-view-similar-schools-page-sort-by-functionality
https://trello.com/c/tI4YJ5fL/852-ps41-view-similar-schools-page-filters
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist
Screenshots (if applicable)