Open mhl opened 7 years ago
I thought I should add a plan for this, since I won't be around to work on it initially, in all probability.
Position
an on_behalf_of
foreign key from Position
to Organisation
COUNTRY_APP
-dependent population of the on_behalf_of
fields. This means finding, for Kenya, South Africa, Nigeria and Ghana (although I'd pick just South Africa to start with), what the positions are that people were elected to on behalf of a particular political party, based on title
and organisation
most likely, and only including memberships of the legislatures. Then for each of these positions, it should look for the positions representing memberships of a political party that overlap with the elected position. Particular care will need to be taken over cases where multiple party memberships overlap that time - some positions might need to be split, or some heuristic to pick one based on the overlap in time might be needed. Once you know what politicial party corresponds to each of those positions, it should be set as on_behalf_of
.on_behalf_of
organisation on positions (both on their own page and the inline position form on person pages in the admin). There should be some validation that the organisation selected is a political party.n.b. the Popolo specification's "Membership" corresponds closely to a Position
in Pombola. The meaning of on_behalf_of
is described here: http://www.popoloproject.com/specs/membership.html
After doing this, the next things to consider are:
parties
method of a Person
- any of those where the person is being found via a Position
(which will be many of them, I think) the on_behalf_of
method can be used instead, saving a lot of queries. This will unblock https://github.com/mysociety/pombola/pull/2246 - that page is too slow to load at the moment primarily because of all the parties lookups.parties_and_coalitions
method to find the coalition as well as the party. Parties' memberships of Coalitions aren't modelled at all at the moment. The best way to deal with this would be to represent coalitions as described here: https://github.com/mysociety/pombola/issues/1485(I hope this is fairly coherent and sensible - I'm still rather unwell, so might not be thinking straight about this.)
Displaying a party for each person which a particular type of position is expensive - Person.parties calls makes two queries, and that happens for each person. (e.g. this happens on pages like: http://www.pa.org.za/position/member/parliament/?order=name )
We should add the Popolo-recommended
on_behalf_of
property (a foreign key to an Organisation) to indicate the party that a membership was associated with, which will make all of these pages less expensive to generate.