yournextrepresentative icon indicating copy to clipboard operation
yournextrepresentative copied to clipboard

Parties with duplicated IDs

Open martinszy opened this issue 10 years ago • 2 comments

Hi, I've discovered that in the file all-parties-from-popit.json there are some parties with the same ID, for instance:

{
    "classification": "Party",
    "contact_details": [],
    "dissolution_date": "9999-12-31",
    "founding_date": "1983-04-11",
    "id": "party:151",
    "identifiers": [],
    "links": [],
    "memberships": [],
    "name": "Partido Dem\u00f3crata",
    "other_names": [],
    "posts": [],
    "register": "DINE",
    "slug": "partido-dem-crata",
    "territory": "Mendoza"
},

{
    "classification": "Party",
    "contact_details": [],
    "dissolution_date": "9999-12-31",
    "founding_date": "1983-05-18",
    "id": "party:151",
    "identifiers": [],
    "links": [],
    "memberships": [],
    "name": "Movimiento Popular Neuquino",
    "other_names": [],
    "posts": [],
    "register": "DINE",
    "slug": "movimiento-popular-neuquino",
    "territory": "Neuqu\u00e9n"
},

This is an error fo the person who created the party list and me for not noticing. Now there's a problem in YNR where a politician appears with a different party, because they have the same ID. One fast fix would be to restrict party matching to the same territory (and national).

But the proper way, I think, would be to re-create the organizations in popit, and then re-run the candidate import script to fix the broken persons.

Is this doable?

martinszy avatar Aug 01 '15 22:08 martinszy

I agree, it would be much better to update the organizations in PopIt and fix the parties by re-running the import script. I've made this pull request (still being reviewed at the moment), which:

  • Prints warnings to stderr if there are multiple parties for one ID
  • Adds a command for giving new IDs to the parties with duplicate IDs (assuming there's no external meaning for these IDs?)
  • Updates the all-parties-from-popit.json file with the new IDs

mhl avatar Aug 03 '15 14:08 mhl

I'm not sure this is enough to keep popit consistent, check here: https://github.com/mysociety/yournextrepresentative/pull/490

martinszy avatar Aug 03 '15 21:08 martinszy