Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ZA] Investigate why Andrew Ntwampe Morwamoche's profile is showing appearances from Mr Morwamoche of a different party from many years ago #1740

Closed
JenMysoc opened this issue Aug 24, 2015 · 5 comments
Assignees

Comments

@JenMysoc
Copy link
Member

From PA:

Mr Andrew Ntwampe Morwamoche is a member of the PAC (candidate for the 2014 election). The appearances on his profile reflect that of a Mr Morwamoche from the ANC who seemed to have been a MP years ago. Is there a way to delete the appearances from this profile. See link below.

http://www.pa.org.za/person/morwamoche-andrew-ntwampe/

@mhl
Copy link
Contributor

mhl commented Aug 28, 2015

This is a name resolution error; generally we delete the erroneously assigned speeches and add an exception to the code to stop them be reassigned, as in this issue:

In this case, Mr Andrew Ntwampe Morwamoche from PAC doesn't appear to hold a position that would allow him to speak in parliament, so the same could be done in this case by a developer.

(We're resisting getting caught up in fixing the underlying issues in the name resolution until something like #1748 is done.)

@duncanparkes
Copy link
Contributor

Misattributed speeches removed with

from pombola.core.models import Person as CorePerson
from speeches.models import Speaker, Speech
CorePerson.objects.get(slug='morwamoche-andrew-ntwampe').__dict__
person = Speaker.objects.get(person__popit_id='core_person:8277')
Speech.objects.filter(speaker=person).count()
[x.text for x in Speech.objects.filter(speaker=person)]
Speech.objects.filter(speaker=person).delete()

in the manage.py shell.

@duncanparkes
Copy link
Contributor

It looks like Morwamoche Andtrew Ntwampe is still getting things attributed to him despite us blacklisting his popit ID mysociety/za-hansard@14c0f13

@mhl
Copy link
Contributor

mhl commented Nov 26, 2015

The committee appearance is on date datetime.date(1999, 9, 21) committee ID 87 and meeting ID 3195, so we investigated this by putting in a breakpoint in the if options['import_to_sayit'] block and single-stepping. self.get_person in za_hansard/importers/import_json.py is called with display_name Morwamoche and party ANC. That returns a speaker with speaker.person.popit_id of core_person:8277 even though that is in the popit_id_blacklist.

What's happening is that this the blacklist is only used to reject results from self.resolver.get_person - if a speaker's not found there, it still goes on to try to find a unique speaker with that name from the Speaker model at this line: https://github.com/mysociety/za-hansard/blob/32664ad25f6b38da7a898ce9b0bde4cd552b95af/za_hansard/importers/import_base.py#L49

There's a fix here:

mysociety/za-hansard#69

... which can then fix the misassignment on the live site by running:

./manage.py za_hansard_pmg_api_scraper --committee=87 --meeting=3195 --scrape --save-json --delete-existing --import-to-sayit --commit

mhl added a commit to mysociety/za-hansard that referenced this issue Nov 26, 2015
Even if a PopIt ID was blacklisted, a speech might still end up
being associated with that person because there would still be a
Speaker object with the exact name that's being resolved which
has its person attribute set to a Person with the blacklisted
PopIt ID.

This commit makes sure that any Speaker with a person attribute
with a blacklisted PopIt ID has that person attribute set to None
when the ImportJson object is initialized.

Fixes mysociety/pombola#1740
@mhl mhl removed the 3 - Now label Nov 30, 2015
duncanparkes pushed a commit that referenced this issue Nov 30, 2015
This fixes issue #1740 - blacklisted people still getting speeches
associated with them.
And fixes #1762 - cope with an Http BadStatusLine.
It should also reduce some other cron noise.
@duncanparkes
Copy link
Contributor

I've deployed the site with the new za-hansard, and reparsed the meeting as @mhl suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants