Jump to content

Template talk:UK MP links

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Current Hansard

[edit]

At present the current session is hard coded to 2013-14. The actual current session is 2015-16. However fixing this would mean breaking the template for former MPs. A more permanent fix is needed.

There also exists a gap between the end of the hansard.millbanksystems.com records in 2005 and the current session on parliament.uk. Parliament.uk contains a Hansard indexed by MP from 2006-07. I suggest hansardcurr should link to each session from 2006 to date. The MP's identifier seems to be a constant - using the doc example, Nick Clegg is 2631 in both the 2013-14 and 2015-16 sessions. This could be done without any alteration to the current set of parameters.

Later an mp_start and mp_end could be added to restrict the range of session links generated to those years where the subject was actually an MP. Bazj (talk) 10:22, 2 June 2015 (UTC)[reply]

I've made the first change, though I'm sure it could be prettier. Now, how to restrict the range of sessions? Bazj (talk) 10:44, 2 June 2015 (UTC)[reply]
The 2010-12 session makes it impossible to do the range setting by simple maths. Perhaps tie it to the use of the categories Category:UK MPs 2005–10, Category:UK MPs 2010–15, and Category:UK_MPs_2015–20 somehow? Not perfect but spot on for the 95+% of MPs elected at the general elections rather than at by-elections. Bazj (talk) 11:06, 2 June 2015 (UTC)[reply]
@Bazj: congrats for spotting the problem and launching this discussion. First thing is that I think it's premature to make changes to the live template, when there are clearly still some unresolved issues. So I have reverted your good faith tests, and will create a sandbox version. --BrownHairedGirl (talk) • (contribs) 13:33, 2 June 2015 (UTC)[reply]
OK, sandbox created at Template:UK MP links/sandbox, using Bazj's last version. There's a link at the bottom to create a testcases page, to explore the effect of any changes. --BrownHairedGirl (talk) • (contribs) 13:39, 2 June 2015 (UTC)[reply]
BrownHairedGirl There's no way of improving this further without adding an mp_start and mp_end to the template and to the way it's called. As the sandbox version fixes the lack of links for all (and in the case of MPs who weren't there in 2013-14, adds valid links for the first time) I see no reason the change should not go live. Bazj (talk) 10:57, 11 July 2015 (UTC)[reply]
@Bazj: The sandbox version at Template:UK MP links/sandbox is unchanged from when I created it at the time I revereted the live template.
However, I don't see any testcases. Please can you use the link at the bottom of the sandbox page to create a testcases page, to demonstrate the effect of any changes? --BrownHairedGirl (talk) • (contribs) 03:49, 12 July 2015 (UTC)[reply]
BrownHairedGirl It's unchanged because it fixes the problem of missing links without requiring any change top the way it's called. Any attempt to remove redundant links will require changes to the way it's called. Pointing ONLY to 2013-14 Hansard for MPs who weren't there, and calling it Current Hansard when it's two sessions out of date are two simple fixes in the sandbox code. There's no magic in it, it's just extra links, nothing to test.
If however you're after a selection of edge case MPs as examples, I'll provide some. Bazj (talk) 05:20, 12 July 2015 (UTC)[reply]
@Bazj: Yes, I would like to see some edge cases. It seems to me to be a very bad idea for a template to knowingly create broken links (which is what I think you mean what you say "redundant") ... so that if a more radical change is needed to fix that, then we should do that radical change.
This template has only 584 transclusions, so it wouldn't be a huge job to update the calls if needed. --BrownHairedGirl (talk) • (contribs) 10:52, 12 July 2015 (UTC)[reply]
+512 via Template:MPLinksUK = 1096. Bazj (talk) 11:40, 13 July 2015 (UTC)[reply]
my bad. 512 of the 584 (now 582) were via MPLinksUK. Bazj (talk) 16:42, 13 July 2015 (UTC)[reply]
BrownHairedGirlThe edge cases are in there.
My experimental version of the template (just the Hansard links) in my subpages at the moment (User:Bazj/MPT) adds MPs in 3 clumps, one for each parliament (2005-10, 10-15, 15-20) (User:Bazj/MP,User:Bazj/MP2006,User:Bazj/MP2011-13,User:Bazj/MP2011-x,User:Bazj/MP2012) Not sure whether to break it down to individual sessions. And, as ever, Boris Johnson is an oddity, 2001-08, 2015-present. Your opinion would be appreciated. Bazj (talk) 11:06, 12 July 2015 (UTC)[reply]

Perhaps we could link to TheyWorkForYou search instead, e.g. [1], which would obviate the need for additional parameters. Alakzi (talk) 13:10, 12 July 2015 (UTC)[reply]

TheyWorkForYou is already in the template, so... just remove current Hansard? Bazj (talk) 13:17, 12 July 2015 (UTC)[reply]
There's no obvious way to jump from a TWFY profile to the search results. The relevant section is unhelpfully titled "Numerology", and contains a whole lot of other nonsense, like a readability score and use of alliterative phrases. Alakzi (talk) 16:15, 12 July 2015 (UTC)[reply]
The search seems to work without the + between names, Vince Cable, which suggests that a search on {{PAGENAME}} would work for most MPs. However, it doesn't play nicely when there is extra text in with the name, as in "Frank Field (British politician)". If bracketed text could be stripped from the PAGENAME we'd have a no-hassle winning solution for everybody, except for "Sir George Young, 6th Baronet". Bazj (talk) 19:59, 14 July 2015 (UTC)[reply]
You're looking for {{PAGENAMEBASE}}. Alakzi (talk) 20:07, 14 July 2015 (UTC)[reply]
Thanks. I've tried a couple at Richard Harrington (politician) and Geoffrey Clifton-Brown (born 1953)‎ (the edits marked "twfy hansard test"). Without quotes it searches for their first name, with quotes it searches for nothing, but uses the (properly stripped) pagename as the ext lk label. I'll sleep on it. Bazj (talk) 20:34, 14 July 2015 (UTC)[reply]

Guardian

[edit]
Resolved

The Guardian links are all diverting to www.theguardian.com/politics and no longer have any material relating to the politicians in question. I propose removing the Guardian links from the template. Bazj (talk) 13:18, 2 June 2015 (UTC)[reply]

Good idea. The Guardian appears to have removed that part of its website. --BrownHairedGirl (talk) • (contribs) 13:41, 2 June 2015 (UTC)[reply]
 Done. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 14:22, 23 July 2015 (UTC)[reply]

Parliamentary URL structure: change needed

[edit]

I've written a blog post, about an issue which may affect this template: United Kingdom parliamentary URL structure: change needed. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 14:23, 23 July 2015 (UTC)[reply]

Wikidata

[edit]

Are all the properties used in this template available in Wikidata now?

We should give some thought to making this template call values from Wikidata. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 14:26, 23 July 2015 (UTC)[reply]

Pigsonthewing, The first two I looked up were recorded differently. Clegg has Position (P39), MP (Q16707842) - whereas Cameron is Member of (P463), Parl of UK (Q11010). A bit of housekeeping seems to be required before we can reliably find the data needed.
Of the fields we need here:
| parliament = P1996
| hansard = P2015
| hansardcurr = Q19023695, but no identifiers, and seems to be linked to Malaysia; Q524352 no ids
| publicwhip = Q7257661, but no identifiers
| theywork = nothing
| record = nothing
| bbc = nothing
| journalisted = P1714
- Bazj (talk) 19:28, 12 September 2015 (UTC)[reply]
@Bazj: Thank you. The Clegg/ Cameron disparity you identify needs to be resolved, but won't stop this template from working with Wikidata. I'm not sure what you mean by "Malaysia; Q524352 no ids" - can you give an example please? I've proposed Wikidata properties for |hansardcurr=, |publicwhip=, |theywork= |record= and |bbc=, all at d:Wikidata:Property proposal/Authority control. We should be able to proceed with the rest immediately. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 21:25, 13 September 2015 (UTC)[reply]
Pigsonthewing, Bit of a miscommunication there. I meant there are two items for Hansard, one at d:Q524352, and the other at d:Q19023695, neither of which embodies MP IDs. Having cross checked to their linked wikis I now see one is a generic Hansard, and the other is only linked to the 2nd reading of the Malaysia Bill in the UK House of Commons, with the wikidata item acting as if that one debate embodied the whole UK HoC Hansard. Your requested |hansardcurr= will resolve the problem... The formatter URL you cite in the request hardcodes the 2013-14 session, will that be (become) a problem? Thanks, Bazj (talk) 12:04, 14 September 2015 (UTC)[reply]
Cameron's Member of (P463), Parl of UK (Q11010) has a start date (P580), and others presumably have an end date (P582) which are some steps toward solving the problems in #Current Hansard above - which leads to the question, how do we access a Property of a Qualifier of a Property? And modify a URL based on that info? Bazj (talk) 13:10, 14 September 2015 (UTC)[reply]
  • Current situation: the Wikidata items have been set up ~
   | parliament = P1996
   | hansard = P2015
   | hansardcurr = P2170 (faulty, hardcodes the 2013-14 session)
   | publicwhip = P2169
   | theywork = P2171
   | record = P2172
   | bbc = P2173
   | journalisted = P1714
will proceed to sandbox some code... Bazj (talk) 14:48, 10 October 2015 (UTC)[reply]

Redux

[edit]

What happened with this? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 12:28, 20 June 2017 (UTC)[reply]

@RexxS: Absent a reply to the above, would you be interested in resolving this, please? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 18:22, 27 July 2017 (UTC)[reply]
@Andy: I'll try to take a look when I get a few hours spare to devote to it, but you may need to prod me if I forget. I'm loathe to develop more applications fetching Wikidata outside of infoboxes because technically we don't have consensus for it, but this application looks like such a good candidate for Wikidata, I'm prepared to put some time into it. It might be worth pinging Cabayi to see if he ever wrote any sandbox code as he suggested he might. --RexxS (talk) 12:24, 28 July 2017 (UTC)[reply]
I think I tried, foundered on the coding necessary to get all the year-by-year hansard links (a two-year session, and the cases of MPs who joined mid-parliament via by-election or quit/died made it well nigh impossible to satisfy BrownHairedGirl's requirement that there be no links to non-existent pages) from parliament.uk and gave up. AJP seems to have come up with a workable solution for the 2010-15 hansard links below.
In fixing that issue, we're homing in on a single solution for MPs & Lords so that one template could track a politician's entire parliamentary career.
Andrew Gray had a checklist on wikidata showing the completion rate of various external identifiers for MPs which I can't find now. I thought it was somewhere under d:Wikidata:WikiProject British Politicians. Perhaps the data completion is now all at 100% and the list was redundant? Cabayi (talk) 16:14, 28 July 2017 (UTC)[reply]
I see official portraits are now available & has been uploading them to commons. Might be worth considering as an addition to the template if the uploads are at/near completion? Cabayi (talk) 16:24, 28 July 2017 (UTC)[reply]
@Andy: Well, I've been able to duplicate the current template by fetching the information from Wikidata using Template:UK MP links/Wikidata. Unfortunately, testing it in Nick Clegg revealed that both templates are broken for:
 Done He's Nick Clegg not Nicholas at Public Whip. Fixed wikidata entry. Cabayi (talk) 07:37, 29 July 2017 (UTC)[reply]
 Done He's Nick Clegg not Nicholas at TheyWorkForYou. Fixed wikidata entry. Cabayi (talk) 07:37, 29 July 2017 (UTC)[reply]
Looks like the website is dead. Cabayi (talk) 07:37, 29 July 2017 (UTC)[reply]
Perhaps someone can sort out the formatter URL (P1630)? Also I can't find a Wikidata identifier that corresponds to the |hansard= parameter.
Looks like P2015 corresponds to the |hansard= parameter. I've modified Template:UK MP links/Wikidata accordingly, but please check. AJP (talk) 09:46, 29 July 2017 (UTC)[reply]

Anyway, compare:

{{UK MP links | parliament = nick-clegg/1563 | hansardcurr = 2631 | hansard = mr-nick-clegg | publicwhip = Nicholas_Clegg | theywork = nicholas_clegg | record = Nick-Clegg/Sheffield-Hallam/1086 | journalisted = nick-clegg}}

with:

{{UK MP links/Wikidata |qid=Q189947}}

or with links for Commons and Lords, sometimes suppressed:

Obviously, you don't give the qid when using the template in an article (that's just included so we can see what it looks like from here). Let me know if you manage to sort out the urls, or if you run into any other problems. --RexxS (talk) 18:43, 28 July 2017 (UTC)[reply]

The required identifier(s) may well change again if/when https://beta.parliament.uk/ advances beyond the beta phase. Interestingly, several of the domains that we link to (even including http://hansard.millbanksystems.com/) appear in the illustration at https://pds.blog.parliament.uk/2017/02/14/a-new-website-for-parliament-first-public-steps/ so perhaps there will be some amalgamation. I'd be pleased if my bodge for 2006–2010 Hansard Archives was no longer required. AJP (talk) 09:46, 29 July 2017 (UTC)[reply]
I'm also reminded that Wikidata sometimes has too much information for our purposes. Nick Clegg has Hansard (1803–2005) ID (P2015) and the corresponding Contributions in Parliament link works, but there are no contributions listed because he only entered Parliament in 2005. Stella Creasy has Hansard (2006–March 2016) ID (P2170) which we currently use to generate links for 2006–07 to 2009–10 contributions only, but she first entered Parliament in 2010. These and similar examples would cause Template:UK MP links/Wikidata to generate superfluous links unless a suppression method can be devised. AJP (talk) 11:10, 29 July 2017 (UTC)[reply]
Thanks AJP for linking to the PDS blog. It's reassuring to see that they're working towards making Parliament's data more usable, and that they have Wikipedia/Wikidata in mind as they do so. Cabayi (talk) 11:25, 29 July 2017 (UTC)[reply]
Created Template:UK MP links/Wikidata/testcases for a fuller assessment... Cabayi (talk) 12:06, 29 July 2017 (UTC)[reply]
Test cases much appreciated. How about optional |firstyear= and |finalyear= parameters to allow suppression of displayed links where necessary, without requiring any changes in Wikidata? If |firstyear= 2005 or later (e.g. Nick Clegg) then the Hansard 1803–2005 link would not be displayed; if 2010 or later (e.g. Stella Creasy) then the 2006–07 to 2009–10 links needn't be displayed either. Similarly, if |finalyear= before 2010 (e.g. Tony Blair) then Hansard 2010–present would not be displayed, but the Parliament Profile still could be if (P1996) or |parliament= is given. These parameters could perhaps also change the displayed 2010–present to 2010–2015 or similar if so desired. In many cases omitting these formatting parameters would still yield acceptable results. AJP (talk) 21:35, 30 July 2017 (UTC)[reply]
Alternatively we could remove the P2015 property from MPs first elected in 2005 (e.g. Nick Clegg d:Q189947, Chris Huhne d:Q332540, Nadine Dorries d:Q258586) whose entries on millbanksystems.com obviously have no Hansard activity). As Parliament seems to be moving toward a single view of people I guess that eventually P1996 will do all the work currently done by d:Property:P1996, d:Property:P2170 & d:Property:P2015. Cabayi (talk) 12:41, 31 July 2017 (UTC)[reply]
  • @Cabayi and AJP: A belated note to say I am in awe of all the work being done here, this is pretty monumentally complex, well done :-). P1996 is likely to become the single standard ID at some point (both for Lords and Commons) but we might have a little way to go to get there - and even then it may not go as far back as we'd like for everyone.
One suggestion that might be useful is that we've finally rolled out a newer data model on Wikidata for MPs - now rather than having :Member of Parliament (Q16707842), they have a series of :member of the 57th Parliament of the United Kingdom (Q30524710) and so on. (They're now on all MPs back to the 2001 election). You could use this to actively query Wikidata for which Parliaments they were in, and (eg) if they were not in the 2010-15, 15-17, or 17-on Parliaments, suppress "Hansard 2010–present"; if they *were* in the 2005-10, 10-15, etc, ones, then suppress "Hansard 1803–2005". Andrew Gray (talk) 22:21, 14 August 2017 (UTC)[reply]
Thanks Andrew Gray for the Wikidata suggestion. I think I could use that approach to adapt Template:UK MP links/Wikidata to address all my link suppression concerns. I note there is also member of the House of Lords (Q18952564), although coverage for recently created peers who were formerly MPs is patchy e.g. Peter Mandelson d:Q310046 but not John Prescott d:Q332393 or William Hague d:Q58282. If all current members (and more?) had member of the House of Lords (Q18952564) then a unified template of links for MPs and peers would seem quite possible. AJP (talk) 12:14, 19 August 2017 (UTC)[reply]
I'm cautious about saying we can do something *reliably* for peers - term based memberships don't conceptually work so well here. You'd need to be able to query start/end dates - is that something you'd be able to code in the template? If so I can look at rolling this out.
For MPs, we now have term-based P39 entries back to 1997 (the 52nd Parliament). Earlier Parliaments will appear, but probably not in the next couple of weeks. Hopefully it's enough to take us back to the "pre-Internet" parliaments... Andrew Gray (talk) 12:48, 22 August 2017 (UTC)[reply]
I hadn't thought about term based membership of the Lords, but simply presence or absence of member of the House of Lords (Q18952564). While MP's terms are used to suppress links (e.g. don't generate links using Hansard (2006–March 2016) ID (P2170) unless a member of the 54th Parliament), membership of the Lords is more useful as an enabler of recent Hansard links using (P1996) for Lords who weren't MPs post 2010, and to select Lords rather than Commons URL formats where applicable. The bottom half of Template:UK MP links/Wikidata (see Template:UK MP links/Wikidata/testcases) shows where I've got to. Missing links are largely due to peers having fewer identifiers set in Wikidata. I've added |house= that can be set to |house=lords instead of relying on member of the House of Lords (Q18952564). I briefly thought TheyWorkForYou would be a problem for non-MPs because the URL includes "/mp/", but see d:Property_talk:P2171 where that issue and numerical ids are discussed. I've removed the Westminster Parliamentary Record link because the website is dead.
As the bottom half of Template:UK MP links/Wikidata stands, I believe it would cover MPs and peers sufficiently well to supersede Template:UK MP links and Template:UK Peer links. The latter could transclude our new Wikidata-enabled template but pass |house=lords by default. My main concern is that the Wikidata-enabled template over-complicates matters by being too prescriptive. AJP (talk) 11:34, 2 September 2017 (UTC)[reply]

Hansard... again

[edit]

Recap:

  • P1996 points to the MPs profile at parliament.uk
  • P2170 was added to record the number used to access the hansard entries, session by session, at parliament.uk

So that for Stella Creasy, d:Q291502,

In a case of "be careful what you wish for", Pigsonthewing's wish above for a purely numerical key to the data seems to have been half answered with a new all-years entry point to an MP's Hansard at https://hansard.digiminster.com/search/MemberContributions?memberId=4088&type=Spoken which is keyed on the numerical part of P1966.

The access via P2170 still works, but I don't see any way to locate the ID for any MP for whom we don't already have it. The access to the profile works using a variant of P1966... http://www.parliament.uk/biographies/Commons/member/4088

The sandbox version is a Wikidata-based version of the template which would be ready to go once this issue is resolved.

So,... any ideas/preferences/wishlists on where we go from here, Wikidata-wise, template-wise...?

Thanks to Andrew Gray and RexxS on helping me fathom Wikidata to try & code a session-by-session access to Hansard. It was nearly there when I found the goalposts had changed. Pinging BrownHairedGirl & Izkala from previous discussion.

TIA, Bazj (talk) 18:05, 29 April 2016 (UTC)[reply]

The digiminster.com (what a domain...) seems to be using a similar system to the old millbanksystems.com Hansard - for which we have Hansard ID, P2015, but there's no-one there from before 2005. Argh. I think I am now pretty comprehensively confused.
It looks like for recent MPs, P1966 might be the best way forward. What we could do is:
  • redefine P1966 to be just the four-digit number
  • mass-convert all the existing ones to be the short form rather than the long form (this is fiddly but trivial, and an hour's work with a bot)
  • use that to generate both the biography profile (using the new no-name style) *and* recent Hansard links
  • & for "older" sessions, we could also pop up the millbanksystems.com Hansard links
However, I'd be cautious about doing this big a change to P1966 without discussing it on Wikidata first. I'm not sure what if any downstream users/other wikis with templates are basing things on it. Andrew Gray (talk) 10:18, 30 April 2016 (UTC)[reply]

BBC News Democracy Live

[edit]

The BBC links recently started redirecting to http://www.bbc.co.uk/news/politics/parliaments rather than the profile of the specified politician. I asked the BBC if this was just a temporary phenomenon and was told they have "permanently removed the profiles for operational reasons." I suggest the |bbc= parameter should be removed from this template and its documentation, but thought I should seek a second opinion before breaking anything. AJP (talk) 19:56, 5 October 2016 (UTC)[reply]

This will also affect d:Property:P2173 which ought to be deleted. Cabayi (talk) 20:17, 5 October 2016 (UTC)[reply]
Deletion proposed at d:Wikidata:Properties for deletion#BBC News Democracy Live ID (P2173), ping Pigsonthewing as creation proposer. Cabayi (talk) 10:24, 6 October 2016 (UTC)[reply]
For consistency with the Keep verdict in relation to d:Property:P2173, the template could display something like this:
On the other hand, I'm still inclined to just remove the |bbc= parameter (as was done for #Guardian above) if nobody objects? AJP (talk) 11:15, 9 October 2016 (UTC)[reply]

Parliament and Hansard

[edit]

Links to a particular session of Hansard under http://www.publications.parliament.uk are not supported beyond the 2015-16 session, as [2] says it is now an archive. However, Hansard is now available for current and previous sessions back to 2010 under https://hansard.parliament.uk instead, indexed by the numerical part of our existing |parliament parameter. I have a few suggestions, illustrated using Michael Fallon as an example:

|parliament = sir-michael-fallon/88
|hansard = mr-michael-fallon
|hansardcurr = 3183

Although he was only knighted in 2016, the |parliament parameter suggested at [3] has already changed accordingly. I'd be keen to ignore and ultimately deprecate the somewhat arbitrary name prefixes in |parliament parameters, with only the numerical part required in future. Something like the following code could help isolate just the numerical part for backward compatibility, whether a name prefix has been included or not:

{{#invoke:String|replace|source={{{parliament}}}|pattern=.*/|replace=|plain=false}}

Contributions from the 2010 session onward can then be found using the numerical part of the |parliament parameter:

There is a link from the above page to the corresponding Parliament Profile that doesn't bother with a name prefix but uses "member" instead, followed by the numerical part:

Hansard for 1803–2005 still works using the existing |hansard parameter:

The |hansardcurr parameter can fill in some gaps between 2005 and 2010 (sadly not the 2005–06 session) to produce something like:

I note earlier discussions (in no particular order: Pigsonthewing, Cabayi, BrownHairedGirl, et al.) and would welcome any comments. AJP (talk) 20:03, 19 December 2016 (UTC)[reply]

Twitter

[edit]

It seems that more current MPs than not are on Twitter. Shall we add a parameter for that to this template? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 13:14, 11 June 2017 (UTC)[reply]

WP:Twitter-EL advises against linking to Twitter as a matter of routine. Judicious use of Template:Official website and Template:Twitter (which can both use Wikidata) seems preferable. The documentation of the latter suggests not linking to Twitter if another link provides an easy way to find the same Twitter feed. In the case of MPs, their Official website and/or Parliament profile typically include such a link. AJP (talk) 20:50, 12 June 2017 (UTC)[reply]

Discussion about "TheyWorkForYou"

[edit]

See Wikipedia_talk:WikiProject_Politics_of_the_United_Kingdom#Does_a_summary_of_an_MP's_parliamentary_voting_record_belong_on_Wikipedia? for a relevant discussion. PamD 08:44, 23 July 2021 (UTC)[reply]