mysociety / pombola

GNU Affero General Public License v3.0
65 stars 41 forks source link

Constituency box should only show constituency of Parliamentary Memberships #1838

Closed tmtmtmtm closed 8 years ago

tmtmtmtm commented 8 years ago

If other memberships are (probably erroneously) set to have a constituency, these end up displayed in the Constituency box on a member page (see #1831)

@paullenz tidied up the incorrect data for the specific cases we could find, but we should also ensure that this box only looks at the constituency for memberships of the legislature itself, so that even if bad data is entered in future, this error will not reappear.

tmtmtmtm commented 8 years ago

This is ticketed against KE, as we know it's definitely an issue there, but we should also ensure that this doesn't happen on other sites too.

tmtmtmtm commented 8 years ago

@paullenz this is still a problem for

paullenz commented 8 years ago

Looking at e.g.

screenshot 2015-11-23 11 12 14

I can only see a single constituency listed?

paullenz commented 8 years ago

(http://info.mzalendo.com/person/mutava-musyimi/)

tmtmtmtm commented 8 years ago

@paullenz I don't really understand the conditions under which a "County" should appear in this box, but this is triggered here by him having "Member of The National Alliance (TNA) for Embu" set, which is the same underlying problem.

paullenz commented 8 years ago

It will be triggered by that, yes - but is the county display an issue per se? It is not a dupe constituency

tmtmtmtm commented 8 years ago

It depends slightly on what the purpose of this field is — is there something that explains it somewhere?

It's not necessarily a problem to show both, but if it should be shown here, it would be good if it was for the right reason, rather than the wrong one.

tmtmtmtm commented 8 years ago

Today's update caused problems due to these ones having multiple constituencies:

And http://info.mzalendo.com/person/naomi-shaban/ having both a county and a constituency.

(The latter does currently confuse my scraper, as I had originally just looked for anything that was a 'place' link in the box, and there's no distinction here between counties and constituency. I could, and possibly should, rewrite the scraper to only find the link immediately after a Constituency header, but that's just working around the problem, so it would be good to also fix the underlying issue in Mzalendo/Pombola.)

paullenz commented 8 years ago

Sorry - fixed all of these now

On 25 November 2015 at 09:55, Tony Bowden notifications@github.com wrote:

Today's update caused problems due to these ones having multiple constituencies:

And http://info.mzalendo.com/person/naomi-shaban/ have both a county and a constituency

(The latter does currently confuse my scraper, as I had originally just looked for anything that was a 'place' link in the box, and there's no distinction here between counties and constituency. I could, and possibly should, rewrite the scraper to only find the link immediately after a Constituency header, but that's just working around the problem, so it would be good to also fix the underlying issue in Mzalendo/Pombola.)

— Reply to this email directly or view it on GitHub https://github.com/mysociety/pombola/issues/1838#issuecomment-159554761.

tmtmtmtm commented 8 years ago

http://info.mzalendo.com/person/mwalimu-mwahima/ is a new twist, because it's picking up the Ward as well. I'm guessing this is because the Councillor position should have been marked as ended when he became a Member of the National Assembly?

paullenz commented 8 years ago

Fixed

tmtmtmtm commented 8 years ago

Reopening, as this isn't fixed yet — all we've done is remove some of the problem cases, but there are still more to find, and the correct solution is to prevent this at a deeper level.

tmtmtmtm commented 8 years ago

http://info.mzalendo.com/person/mutava-musyimi/ is still an issue, for example, and http://info.mzalendo.com/person/shakeel-shabbir/ appeared in today's updates.

tmtmtmtm commented 8 years ago

This has also reappeared today for http://info.mzalendo.com/person/moses-ole-sakuda/

tmtmtmtm commented 8 years ago

@paullenz any chance of manual cleanups for these people? Would be good to end the sprint with at least one run that imports cleanly…

@duncanparkes is also hopefully going to look at this today to see if the box can be changed to only display their Assembly membership here, but we should also clean up the underlying data problems.

tmtmtmtm commented 8 years ago

This seems like a non-trivial thing to change in the code, but as a first pass we should generate a list of the people who have this issue (directly from the data, rather than waiting for the issue to appear, as it's non-deterministic) so we can work out whether the data is simply incorrect, and can be fixed in one shot, or whether people can reasonably have memberships with multiple constituencies, in which case the box more definitely needs changed.

mhl commented 8 years ago

Here are all the people who have multiple constituencies:

In [8]: for p in Person.objects.all():
    cons = p.constituencies()
    if len(cons) > 1:
        print p.id, p.get_absolute_url(), p.name, cons
   ...:         
140 /person/shakeel-shabbir/ Shakeel Shabbir [<Place: Kisumu East (Constituency 2013-)>, <Place: Kisumu Town East (Constituency 2007-2013)>]
6 /person/peter-anyanga/ Peter Edick Omondi Anyanga [<Place: Nyatike (Constituency 2007-2013)>, <Place: Nyatike (Constituency 2013-)>]
385 /person/simon-ogari/ Simon Ogari [<Place: Bomachoge (Constituency 2007-2013)>, <Place: Bomachoge Chache (Constituency 2013-)>]
82 /person/mohamed-elmi/ Mohamed Ibrahim Elmi [<Place: Tarbaj (Constituency 2013-)>, <Place: Wajir East (Constituency 2007-2013)>]
18 /person/francis-ganya/ Francis Chachu Ganya [<Place: North Horr (Constituency 2007-2013)>, <Place: North Horr (Constituency 2013-)>]
19 /person/james-gesami/ James Gesami [<Place: West Mugirango (Constituency 2007-2013)>, <Place: West Mugirango (Constituency 2013-)>]
21 /person/stanley-githunguri/ Stanley Githunguri [<Place: Kiambaa (Constituency 2007-2013)>, <Place: Kiambu (County 2013-)>]
30 /person/hassan-joho/ Hassan Ali Joho [<Place: Kisauni (Constituency 2007-2013)>, <Place: Mombasa (County 2013-)>]
131 /person/wilber-ottichilo/ Wilber Ottichilo Khasilwa [<Place: Emuhaya (Constituency 2007-2013)>, <Place: Emuhaya (Constituency 2013-)>]
27 /person/amason-kingi/ Amason Kingi [<Place: Kilifi (County 2013-)>, <Place: Magarini (Constituency 2007-2013)>]
379 /person/maison-leshoomo/ Maison Leshoomo [<Place: Samburu (County 2013-)>, <Place: Trans-Nzoia (County 2013-)>]
76 /person/gideon-maitha/ Gideon Maitha [<Place: Kilifi North (Constituency 2013-)>, <Place: Malindi (Constituency 2007-2013)>]
184 /person/jakoyo-midiwo/ Washington Jakoyo Midiwo [<Place: Gem (Constituency 2007-2013)>, <Place: Gem (Constituency 2013-)>]
305 /person/gideon-moi/ Gideon Moi [<Place: Baringo Central (Constituency 2007-2013)>, <Place: Baringo (County 2013-)>]
95 /person/mutava-musyimi/ Mutava Musyimi [<Place: Embu (County 2013-)>, <Place: Mbeere South (Constituency 2013-)>]
98 /person/thomas-mwadeghu/ Thomas Mwadeghu [<Place: Wundanyi (Constituency 2007-2013)>, <Place: Wundanyi (Constituency 2013-)>]
99 /person/mwalimu-mwahima/ Mwalimu Masoud Mwahima [<Place: Likoni (Constituency 2007-2013)>, <Place: Likoni (Constituency 2013-)>, <Place: Shika Adabu (Ward 2013-)>]
101 /person/danson-mwazo/ Danson Mwazo [<Place: Taita Taveta (County 2013-)>, <Place: Voi (Constituency 2007-2013)>]
108 /person/ababu-namwamba/ Ababu Namwamba [<Place: Budalangi (Constituency 2007-2013)>, <Place: Budalangi (Constituency 2013-)>]
57 /person/josephat-nanok/ Josephat Nanok [<Place: Turkana (County 2013-)>, <Place: Turkana South (Constituency 2007-2013)>]
443 /person/tirus-ngahu/ Tirus Nyingi Ngahu [<Place: Kangema (Constituency 2007-2013)>, <Place: Kangema (Constituency 2013-)>]
193 /person/peter-nyongo/ Anyang' Nyong'o [<Place: Kisumu (County 2013-)>, <Place: Kisumu Rural (Constituency 2007-2013)>]
196 /person/sospeter-ojaamongson/ Sospeter Ojaamongson [<Place: Amagoro (Constituency 2007-2013)>, <Place: Busia (County 2013-)>]
201 /person/wycliffe-oparanya/ Wycliffe Oparanya [<Place: Butere (Constituency 2007-2013)>, <Place: Kakamega (County 2013-)>]
130 /person/dalmas-otieno/ Dalmas Otieno [<Place: Rongo (Constituency 2007-2013)>, <Place: Rongo (Constituency 2013-)>]
132 /person/paul-otuoma/ Paul Otuoma [<Place: Funyula (Constituency 2007-2013)>, <Place: Funyula (Constituency 2013-)>]
133 /person/fredrick-outa/ Fredrick Otieno Outa [<Place: Nyando (Constituency 2007-2013)>, <Place: Nyando (Constituency 2013-)>]
444 /person/augostinho-neto-oyugi/ Augostinho Neto Oyugi [<Place: Ndhiwa (Constituency 2007-2013)>, <Place: Ndhiwa (Constituency 2013-)>]
442 /person/moses-ole-sakuda/ Moses Somoine ole Sakuda [<Place: Kajiado North (Constituency 2007-2013)>, <Place: Kajiado West (Constituency 2013-)>]
139 /person/naomi-shaban/ Naomi Shaban [<Place: Taita Taveta (County 2013-)>, <Place: Taveta (Constituency 2013-)>]
252 /person/ali-wario/ Ali Wario [<Place: Bura (Constituency 2013-)>, <Place: Bura (Ward 2013-)>]
tmtmtmtm commented 8 years ago

(Summary of IRC conversation with @mhl about this:)

Although at a glance many of these look like simple consecutive memberships (e.g. "<Place: West Mugirango (Constituency 2007-2013)>, <Place: West Mugirango (Constituency 2013-)>", Person.constituencies() only returns current positions, so these are all currently active.

Anything that is a Membership of a 2007-2013 Constituency is incorrect — but as there is nothing to prevent someone assigning such an Area to any Membership, no matter its dates, this is quite likely just a data issue.

In particular, most of these seem to be due to parallel Areas being set on both the Membership of the Party, and the Membership of the Assembly — in many cases because the Party membership is spanning multiple Terms (e.g. was originally created as being for Gem 2007, and is still active as that, even though the person is now the MP for Gem 2013).

This is slightly tricky to fix as constituencies is a core method, so can't be explicitly restricted to memberships of specific Organizations (e.g. the Assembly) — it will presumably need to be set to an Organization type (which we'll then need to ensure is set on all the relevant Organizations across each installation).

duncanparkes commented 8 years ago

Summary from @tmtmtmtm "The discussion on 1838 was that we would produce a list of all the people who have more than one Area, rather than just building it up piecemeal based on what the scraper uncovers each night. Then we can ask Jessica whether it makes sense for those to have, say, a Party Membership for an Area that's different from their Constituency, and get her (or Paul) to fix anything that's purely a data error. If it turns out that people can sensibly have multiple Areas, then we definitely need to fix the code to handle that — otherwise the data cleanup should be enough to work around the problem short-term, though it would still be good to do something deeper long-term."

tmtmtmtm commented 8 years ago

@duncanparkes : the revised version of this, however (and the work scheduled for this sprint), was that we would use the new "Important Organizations" approach (that we used for the person's tagline) to restrict the Area box to current memberships of those organizations.

duncanparkes commented 8 years ago

2016-02-02-174432_1366x768_scrot