Remix.run Logo
ta1243 4 days ago

Your MP

    Name: Mike Wood
    Party: Conservative
    Constituency: Stafford
Err, Stafford has been Labour since the last election, and before that it was a Conservative, but it was Theodora Clarke. Mike Wood is MP for Kingswinford and South Staffordshire.

Surely the way you build something like this is a postcode -> constituency table (I assume available free), a constituency -> mp table, and mp -> image generation (with caching or generate multiple versions)

Even if the lookup data mis-selected the constituency (I think some postcodes can straddle constituencies), surely the Constituency/Name/Party would be consistent.

I'm guessing you're using chat-gpt for the entire program?

timje1 4 days ago | parent [-]

Nope! Office of national statistics published a CSV for postcode -> constituency name [ https://geoportal.statistics.gov.uk/datasets/6f2f35a9a0b94e7... ], and then the official gov.uk parliament API for a constituency name -> MP lookup [ https://members-api.parliament.uk/index.html ]. So all of the data is the officially available data. I humbly posit that this is a publicly owned bug.

ta1243 4 days ago | parent [-]

I would guess you're taking the constituency name and doing something like this:

https://members-api.parliament.uk/api/Location/Constituency/...

returns three constituencies, all of which look fine to me, but the "Stafford" one is the middle, and you're using the data from the first returned constituency