mysociety / theyworkforyou

Keeping tabs on the UK's parliaments and assemblies
http://www.theyworkforyou.com/
Other
224 stars 50 forks source link

Allow search by 'alias' person_names, and display aliases on profile #1681

Closed brianpeiris closed 1 year ago

brianpeiris commented 1 year ago

To use this functionality, you would insert an alias record into the person_names table, including all the names that you want users to be able to search for.

For example, to give Baroness Grey-Thompson her common name, you would:

INSERT INTO person_names (person_id, type, title, given_name, family_name) 
VALUES (24707, "alias", "Baroness", "Tanni", "Grey-Thompson");

So that the table would look like:

+-------+-----------+-------+----------+--------------+---------------+------------+------------+------------+
| id    | person_id | type  | title    | given_name   | family_name   | lordofname | start_date | end_date   |
+-------+-----------+-------+----------+--------------+---------------+------------+------------+------------+
| 12866 |     24707 | name  | Baroness | Carys Davina | Grey-Thompson |            | 0000-00-00 | 9999-12-31 |
| 14189 |     24707 | alias | Baroness | Tanni        | Grey-Thompson |            | 1000-01-01 | 9999-12-31 |
+-------+-----------+-------+----------+--------------+---------------+------------+------------+------------+

This would also add "Also known as: Tanni Grey-Thompson" to the Baroness' profile page, under her existing member summary.

image

Helps address #1608 and #72.

brianpeiris commented 1 year ago

Just closing this to remove it from my list. Feel free to take the changes if this is useful to you.