PolicyEngine / PolicyEngine/policyengine-api

Remove UK constituency map coordinates from impact responses

Open
#3,823 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
18
Forks
33
Avg merge
23h 40m
Merged PRs (30d)
22

Description

Supersedes PolicyEngine/policyengine-uk#1152 together with PolicyEngine/policyengine-app-v2#1190.

Current behavior

The UK constituency comparison code reads statistical weights from the private UK data repository and reads constituency codes, names, and hex-layout coordinates from the public UK data repository. It calculates constituency impacts, then places frontend-specific x and y positions in each API result. The planned API v2 ConstituencyImpact persistence model also stores those positions.

Required change

  • Preserve constituency statistical aggregation and return the constituency identity, average household income change, and relative household income change without presentation coordinates.
  • Use a stable constituency identifier in the response contract so app-v2 can join results to its versioned layout.
  • Remove x and y from the applicable API response models, serializers, tests, OpenAPI contract, and API v2 constituency-impact persistence model.
  • Add the required v2 Alembic migration if the coordinate columns have already been created in a retained target.
  • Do not remove coordinates from a deployed response until PolicyEngine/policyengine-app-v2#1190 has been deployed and verified.
  • Add contract coverage proving that constituency values and identities are preserved while layout positions are absent.

Deployment order

PolicyEngine/policyengine-app-v2#1190 is the compatibility prerequisite. Release the API contract change only after the frontend renders the same map from its own layout artifact.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the applicable API response models, serializers, tests, OpenAPI contract, and API v2 constituency-impact persistence model named in the issue, along with any required Alembic migration. First verify the compatibility prerequisite in PolicyEngine/policyengine-app-v2#1190, then trace the current constituency response and persistence fields. Done means identities and impact values remain, coordinates are absent from the contract and storage, contract coverage passes, and deployment waits for frontend verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, python
Domain
api, backend, databases
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.