mysociety / pombola

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

KE: 'Constituency' set on non-Assembly memberships #2072

Open tmtmtmtm opened 8 years ago

tmtmtmtm commented 8 years ago

I suspect that only memberships of the Assembly (or 'aspirant' equivalents) should have a Place of type 'Constituency', but there are many many others:

                role                 |                  organisation                   |     orgkind     | howmany 
-------------------------------------+-------------------------------------------------+-----------------+---------
 Aspirant MP                         | REPUBLIC OF KENYA                               | Unknown         |    2154
 Member of Parliament                | Parliament                                      | Governmental    |     604
 Member of the National Assembly     | Parliament                                      | Governmental    |     295
 Member                              | National Rainbow Coalition                      | Political Party |      92
 Member                              | Kenya African National Union                    | Political Party |      82
 Member                              | Orange Democratic Movement                      | Political Party |      73
 Member                              | Party of National Unity                         | Political Party |      45
 Member                              | Orange Democratic Movement Party Of Kenya       | Political Party |      18
 Member                              | The National Alliance (TNA)                     | Political Party |      14
 Member                              | NARC - Kenya                                    | Political Party |       9
 Member                              | Forum For The Restoration Of Democracy - Kenya  | Political Party |       8
 Member                              | Ford People                                     | Political Party |       8
 Member                              | United Republican Party (URP)                   | Political Party |       8
 Member                              | Safina Party Of Kenya                           | Political Party |       7
 Member                              | Democratic Party                                | Political Party |       6
 Aspirant MP                         | Parliament                                      | Governmental    |       4
 Member of Parliament                | National Rainbow Coalition                      | Political Party |       4
 Member                              | Forum for Restoration and Democracy- People     | Political Party |       4
 Member of Parliament                | Kenya African National Union                    | Political Party |       4
 Member                              | Parliament                                      | Governmental    |       3
 Member                              | Ford Asili                                      | Political Party |       3
 Member                              | New Ford Kenya                                  | Political Party |       2
 Member of Parliament                | National Development Party (NDP)                | Political Party |       2
 Chairman                            | Orange Democratic Movement                      | Political Party |       2
 Member of Parliament                | REPUBLIC OF KENYA                               | Unknown         |       2
 Member of Parliament                | Democratic Party                                | Political Party |       2
 Aspirant MP                         | Orange Democratic Movement                      | Political Party |       2
 Member                              | Chama Cha Uzalendo                              | Political Party |       2
 Member of Parliament                | Forum for Restoration and Democracy- People     | Political Party |       2
 Member                              | Sisi Kwa Sisi                                   | Political Party |       2
 Coalition Member                    | Jubilee Alliance                                | Coalition       |       2
 Member                              | Shirikisho Party Of Kenya                       | Political Party |       2
 Nominated Member of Parliament      | Parliament                                      | Governmental    |       1
 Coalition Member                    | Coalition for Reforms & Democracy               | Coalition       |       1
 Member                              | Wiper democratic Movement Kenya                 | Political Party |       1
 Aspirant MP                         | Ford Asili                                      | Political Party |       1
 Member                              | Party of Independent Candidates of Kenya (PICK) | Political Party |       1
 Vice Chair                          | Forum For The Restoration Of Democracy - Kenya  | Political Party |       1
 party leader                        | Orange Democratic Movement Party Of Kenya       | Political Party |       1
 Member                              | Liberal Democratic Party                        | Political Party |       1
 Member of Parliament                | Forum For The Restoration Of Democracy - Kenya  | Political Party |       1
 Member                              | Muungano Party                                  | Political Party |       1
 Member                              | Mazingira  Greens Party of Kenya                | Political Party |       1
 Member                              | Ford Kenya                                      | Political Party |       1
 Member of Parliament                | Forum For The Restoration Of Democracy          | Political Party |       1
 Chairman                            | Party of Independent Candidates of Kenya (PICK) | Political Party |       1
 party leader                        | National Development Party (NDP)                | Political Party |       1
 Chairman                            | Safina Party Of Kenya                           | Political Party |       1
 Member                              | Peoples Party of Kenya                          | Political Party |       1
 Aspirant MP                         | Kenya National Congress                         | Political Party |       1
 Member                              | Social Democratic Party                         | Political Party |       1
 Founding member                     | Democratic Party                                | Political Party |       1
 Member                              | Kenya African Democratic Union - Asili          | Political Party |       1
 Founder                             | Kibra Foundation                                | Unknown         |       1
 Secretary                           | Kenya African National Union                    | Political Party |       1
 Chairman                            |                                                 |                 |       1
 Founder Member                      | REACH                                           | Unknown         |       1
 Chair                               | Kenya African National Union                    | Political Party |       1
                                     | REPUBLIC OF KENYA                               | Unknown         |       1
 Member of Parliament                | The National Alliance (TNA)                     | Political Party |       1
 Aspirant Ward Representative        | REPUBLIC OF KENYA                               | Unknown         |       1
 Chairman                            | Party of National Unity                         | Political Party |       1
 Member                              | National Democratic Party                       | Political Party |       1
 Councillor                          | REPUBLIC OF KENYA                               | Unknown         |       1
 Member                              | Kenya National Democratic Alliance              | Political Party |       1
 Member                              | People's Democratic Party (PDP)                 | Political Party |       1
 Member of the National Assembly     | REPUBLIC OF KENYA                               | Unknown         |       1
 Organizing Secretary                | Kenya African National Union                    | Political Party |       1
 Member                              | Social Democratic Party of Kenya                | Political Party |       1
 Primary School Student              | Marsabit Primary School                         | Educational     |       1
 Businessman                         | Private business                                | Unknown         |       1
 Founder Member                      | National Rainbow Coalition                      | Political Party |       1
 Chief whip                          | Orange Democratic Movement                      | Political Party |       1
 Member                              | National Development Party (NDP)                | Political Party |       1
 Deputy Secretary General            | Ford People                                     | Political Party |       1
 Secondary School Student            | Marsabit High School                            | Educational     |       1
 Assistant Minister of Youth Affairs | Parliament                                      | Governmental    |       1
(77 rows)

via

SELECT t.name AS role, o.name AS organisation, ok.name AS orgkind, COUNT(*) AS howmany
  FROM core_person mp
  LEFT JOIN core_position p ON mp.id = p.person_id
  LEFT JOIN core_positiontitle t ON p.title_id = t.id
  LEFT JOIN core_organisation o ON p.organisation_id = o.id
  LEFT JOIN core_organisationkind ok ON o.kind_id = ok.id
  LEFT JOIN core_place a ON a.id = p.place_id
  LEFT JOIN core_placekind pk ON a.kind_id = pk.id
 WHERE pk.name = 'Constituency'
 GROUP BY pk.name, t.name, o.name, ok.name
 ORDER BY howmany DESC;
tmtmtmtm commented 8 years ago

Most of these are having a parallel 'area' set on both the legislative membership and the on_behalf_of equivalent party membership.

tmtmtmtm commented 8 years ago

There are also parallel issues with places of kind 'Ward', 'County', 'Province', and possibly 'Country' (I'm not really sure what Country is meant to be used for…)