Repository navigation
Update deleted entities expectation - #608
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughDataset expectation checks now prefetch active and historical resources. Deleted-entity checks use historical resource facts to restrict comparisons to entities previously supplied by the organisation. ChangesDataset expectation resource caches
Deleted-entity comparison scope
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant DatasetCheckpoint
participant DatasetResourceFetchers
participant DatasetExpectationOperation
DatasetCheckpoint->>DatasetResourceFetchers: Fetch active and historical resources
DatasetResourceFetchers-->>DatasetCheckpoint: Return resource caches
DatasetCheckpoint->>DatasetExpectationOperation: Pass supported resource caches
Suggested reviewers: Merge Risk: ⚪ Minimal · up to
|
What type of PR is this? (check all applicable)
Description
count_deleted_entitiesflagged entities that the LPA never supplied. It treated every entity belonging to an organisation as something that should appear in that organisation's active resources. But MHCLG seeds data on behalf of LPAs, so those entities belong to the LPA without ever being in the LPA's own data. They were always reported as "deleted".For example, entity 5100307 belongs to
local-authority:MAI, but MHCLG supplied it. Maidstone has never had a plan-timetable endpoint, so all 32 of its plan-timetable entities were flagged.Fix
An entity now only counts as deleted if the organisation supplied it at some point (in any of its resources, current or ended) and it's missing from the organisation's active resources. This handles the organisation-to-organisation case. It also covers shared endpoints, e.g. Hackney brownfield-land entities supplied through the GLA/Harrow endpoint.
Changes in
digital-land-python(digital_land/expectations/operations/dataset.py):fetch_all_resources_for_dataset, which fetches every resource each organisation has supplied, including ended ones. The checkpoint prefetches it once per dataset, like the existing active-resources cache.count_deleted_entitiestakes a newall_resources_cacheand only considers entities with at least one fact from one of those resources.Impact (old rule vs new rule)
Related Tickets & Documents
Summary by CodeRabbit