Template talk:Infobox Canada electoral district
From Wikipedia, the free encyclopedia
Contents |
[edit] Additional info
[edit] District profiles
Elections BC sets the standard for electoral district information.
- Federal electoral district profiles - includes Electoral district number, Area, Population, Number of electors on list, Major census subdivisions (municipalities), Adjacent electoral districts
- BC electoral district profiles - extensive and excellent data (in PDF), and election results
- Alberta electoral district profiles - only lists incumbent and locations (no demographic data)
- Saskatchewan electoral district maps and 2007 election results (PDF) - no demographic data, but results contain number of electors
- Manitoba electoral district maps and 2007 election results (no demographic data)
- Ontario electoral district maps, elector counts, 2007 election results, and district lists - not much demographic data
- Quebec electoral districts (good info), maps, election results (2006 results contain number of electors, voter turnout); also provides a list of toponyms
- PEI electoral districts, election results, members (district links don't seem to work, though), elector count (PDF); no demographic data
- Nova Scotia electoral district maps, election results (2006 results), election stats
- New Brunswick electoral district maps, MLAs by district, 2006 election results (and [1])
- Newfoundland and Labrador district reports (see 2006), MapGuide (QuickSearch at top will list MHAs, districts to the right), electors by district (as of 5 Oct 2007)
- Yukon electoral district maps, Boundary Commission, 2006 election results (PDF)
- Northwest Territories constituency maps, and 2003 election results
- Nunavut 2004 election results, constituencies, Elections Nunavut
[edit] Other sources
- electoral district descriptions - including maps
- Constituency Profile
- electionprediction.org
- CBC Canada votes, and provincial elections too; 2003 and later, or so it appears
[edit] Additional features
Add the following:
add "riding dissolved" field, or something similar (per Bearcat's suggestion)eliminate MP/MLA field if riding is defunct (per Bearcat's suggestion)- determine how to handle demographic info for defunct ridings (it'll become increasingly irrelevant)
ensure status test is more rigorous (currently, it may be set to anything, and the template will accordingly set up the appropriate fed/prov section as if it's valid)improve demo-cd and demo-csd fields so user need only type in the community or region name (eg - "Richmond Hill") instead of the article name (eg - "Richmond Hill, Ontario")automatically calculate population density if population and area are givenautomatically retrieve district name; over-ride with "name" attributeensure number of district electors is less than district populationhandle creation/abolishment versus first/last election; these don't always match (see Neepawa (electoral district))- handle case of districts which span multiple periods (see Yukon (electoral district), which was abolished for a brief period, then re-created)
suppress party affiliation and colours when province is set to Nunavut or Northwest Territories, and the riding is territorial (federal ridings are similar to the provinces)population density field should be rounded to 2 decimal places for territories and other low-density districts, instead of the default 1 placeensure that province is correctly specified
[edit] Error conditions
check that fed-created is greater than fed-abolished, if both are definedcheck that prov-created is greater than prov-abolished, if both are definedcheck that fed-rep-party-link article page exists, if definedcheck that prov-rep-party-link article page exists, if definedcheck that fed-rep-link article page exists, if definedcheck that prov-rep-party-link article page exists, if defined- check that fed-last is greater than fed-first, if both are defined
- check that prov-last is greater than prov-first, if both are defined
[edit] Feedback
The documentation's good. I made a couple of minor adjustments; you referred to the federal level of government a couple of times in provincial tags. I'd also like to mention that according to the test page, the current version is visibly displaying an extraneous {{ #if: active | under the map and in the federal status field. I realize this is probably a temporary artifact related to my suggestion that certain fields should be hidden if the status is flagged as defunct, but I thought I should mention it anyway just in case. Bearcat 20:43, 9 November 2007 (UTC)
- I was working on that as you were typing this message. I had added fed-rep-link and prov-rep-link to the template, and was testing for their existence, but forgot to close out the conditional. It's been fixed. Thanks for spotting the doc errors. As you can tell, I employed the ol' "copy and paste" method a few times. Mindmatrix 20:46, 9 November 2007 (UTC)
It appears that it may not work for Nunavut and the NWT. Neither of them have political parties and use Consensus government which messes up the incumbent section. CambridgeBayWeather (Talk) 18:15, 10 November 2007 (UTC)
- Each of the federal districts in the territories should be fine. The territorial districts can be handled with a clause in the template that would suppress the display of party affiliation and colours if the province field is set to Nunavut or Northwest Territories. It should be fairly easy to implement. Mindmatrix 20:37, 10 November 2007 (UTC)
-
- I've now implemented the change. Mindmatrix 21:15, 10 November 2007 (UTC)
- That appears to work now. Thanks. CambridgeBayWeather (Talk) 01:45, 11 November 2007 (UTC)
- I've now implemented the change. Mindmatrix 21:15, 10 November 2007 (UTC)
[edit] Notes about parser functions
I've clearly mis-read the documentation for parser functions. Things that need to be fixed:
- conditional for (demo-pop > 0) and (demo-electors > 0)
- conditional for (demo-area > 0)
For some reason, #ifexpr: is not behaving as I expected it to, and #if lets everything through so long as it it not an empty string (in particular, expressions that evaluate to 0 are true). I'm missing the obvious. Mindmatrix 05:10, 10 November 2007 (UTC)
[edit] Spacing issues
There are four extraneous <br /> tags in the rendered page, causing a gap immediately after the image; it seems they were introduced in this edit, which added four error-checking expressions. Removing newlines between if blocks has eliminated two of those (see this), but a clear (and annoying) gap remains. Mindmatrix 15:48, 13 November 2007 (UTC)
- Resolved by moving the error notices to the bottom of the table, though the cause of the problem was not identified. Since the gap does not display at the bottom, I'm leaving it like this. (Actually, the br tags aren't even rendered in the resultant page, so ParserFunctions is doing something quirky.) Mindmatrix 15:28, 15 November 2007 (UTC)
- There is still one issue with spacing, in which a district is defined with no fed-status (ie - no federal district component). The routines for fed-district add one br tag when parsed and rendered empty, giving a small gap after the image. I'll have to investigate why that happens. Mindmatrix 17:49, 15 November 2007 (UTC)
[edit] NDP
THere seems to be this weird thing going on whereby you can't put in "New Democratic Party", but only "NDP", which is automatically linked to NDP, which is a disambiguation page. Is there a way of fixing this so that the correct article name is linked so that the reader isn't taken to the wrong place? Ground Zero | t 23:58, 21 December 2007 (UTC)
- Somewhat similarly, adding this infobox to a page causes it to show as linking to Independent which is another disambiguation page. The parameter fed-rep-party-link can be populated with 'Independent (politician)' and handle it correctly, but it doesn't seem to solve the issue. I'm stumped. Any ideas? --AndrewHowse (talk) 16:43, 8 January 2008 (UTC)
-
- For purposes of the template, all parties use a long-form and short-form name. The short-form names are used on templates such as {{Canadian politics/party colours/Liberal}}, which are used by the template to format the colour bar beside the representative's name and party. The short-form is also used to display the visible link to the party. The long-form name is only used to pipe to the correct article for a party if there is a need for disambiguation, or if the short-form name is not the official title for an article about the party on Wikipedia. In both cases mentioned above, there should be settings for both fed-rep-party and fed-rep-party-link, like so:
- | fed-rep-party = Independent
- | fed-rep-party-link = Independent (politician)
- and
- | fed-rep-party = NDP
- | fed-rep-party-link = New Democratic Party
- To automatically handle all party short-form and long-form names, both federally and provincially, would make the template obnoxiously complicated; using fed-rep-party-link and prov-rep-party-link solves the problem with much less effort. Is there a way I can update the documentation that can clarify this, because it seems I haven't done a good job of it. Mindmatrix 17:31, 8 January 2008 (UTC)
- For purposes of the template, all parties use a long-form and short-form name. The short-form names are used on templates such as {{Canadian politics/party colours/Liberal}}, which are used by the template to format the colour bar beside the representative's name and party. The short-form is also used to display the visible link to the party. The long-form name is only used to pipe to the correct article for a party if there is a need for disambiguation, or if the short-form name is not the official title for an article about the party on Wikipedia. In both cases mentioned above, there should be settings for both fed-rep-party and fed-rep-party-link, like so:
-
-
- Aside: it seems I caused some of the confusion, since I added the template to some articles without using fed-rep-party-link = Independent (politician) (for example, in this edit to the Portneuf—Jacques-Cartier electoral district article. Sorry about that. Mindmatrix 17:34, 8 January 2008 (UTC)
-
-
-
-
- Thanks for your feedback; I don't think the fed-rep-party-link is quite doing what I hoped it would. Even when there's an explicit value for a non-disambiguation page, it still shows as linked to the dab page. See for example User:AndrewHowse/canadatest, where I simply copied the whole infobox call from the Portneuf-Jacques Cartier page. Special:Whatlinkshere/Independent still shows a link from my user subpage. It could be a bug in the analysis of the links, of course. --AndrewHowse (talk) 18:00, 8 January 2008 (UTC)
-
-
-
-
-
-
- There are a number of reasons this could happen. One is that the links page is either cached in your browser (not likely, since I see the same thing), or on Wikipedia servers (quite possible, but not likely either). The template itself should not be the cause of the problem, since the conditional expression that produces the link is quite trivial. (The specific code is: {{ #ifexist: {{{fed-rep-party-link}}} | [[ {{{fed-rep-party-link}}} | {{{fed-rep-party}}} ]] }}, which means "create a link to the article fed-rep-party-link, with title fed-rep-party, if the article fed-rep-party-link exists in Wikipedia.) I've taken a look at the source of your test page (that is, the HTML produced, not the wiki text), and the template is formatting as expected.
- However, it appears that in the head of the document, a keywords meta field lists both Independent (politician) and Independent, so the problem may lie with the way MediaWiki parses this. I just edited my own test file (see User:Mindmatrix/beta), and I get the same thing with Liberal Party of Canada and Liberal. Browsing through Special:Whatlinkshere/Liberal, I'm now fairly certain that MediaWiki's generation of meta keywords is at fault here. (Specifically, whatever algorithm is generating the keywords is also adding an entry to the MediaWiki internal links database table.) I don't think filing a MediaWiki bug is wothwhile. "Fixing" this template isn't worth the time, either. Mindmatrix 18:46, 8 January 2008 (UTC)
-
-
-
-
-
-
-
- Well, there is something quirky going on, though. If you look at the HTML source for my test page, a keyword for Newfoundland general election, 1841 shows up. That shouldn't happen, so it may be an issue with ParserFunctions instead of the keywords algorithm. Mindmatrix 18:54, 8 January 2008 (UTC)
- I think that last is coming from your theta-box for Champlain.
-
- | prov-abolished =
- | prov-election-first = 1841
- | prov-election-last = 1867
-
- My test page has an 1867 date in it with a similar effect in the keyword list. --AndrewHowse (talk) 19:30, 8 January 2008 (UTC)
- I think that last is coming from your theta-box for Champlain.
- Well, there is something quirky going on, though. If you look at the HTML source for my test page, a keyword for Newfoundland general election, 1841 shows up. That shouldn't happen, so it may be an issue with ParserFunctions instead of the keywords algorithm. Mindmatrix 18:54, 8 January 2008 (UTC)
-
-
-
-
-
-
-
-
-
- Yes, it certainly is coming from there; however, the template doesn't generate the corresponding HTML source in the viewable area, so the question is: why are these keywords being generated by the ParserFunctions, when the corresponding HTML is not? That is, a link to "Newfoundland general election, 1841" doesn't appear in the HTML source, or in any clickable link on the page, but it does appear as a keyword. Since templates don't control what happens within the "head" of an HTML page, I'm certain this is not a flaw in this template's design. (I did find a few issues regarding the display of election dates for defunct districts, though, which have now been fixed.) Mindmatrix 01:14, 9 January 2008 (UTC)
-
-
-
-
-
-
-
-
-
-
-
- Apparently, a new parser has been coded (see the Signpost article). Forcing its use on an article with this template (instead of using the old parser) actually produces better results. For example, on the Champlain (Province_of_Canada) article, compare the keyword meta information using the old parser with that generated with the new parser. Here they are:
- old: meta name="keywords" content="Champlain (Province of Canada),Newfoundland general election, 1841,Province of Canada general election, 1841,Newfoundland general election, 1867,Province of Canada general election, 1867,1841,1843,1867,1st Parliament of the Province of Canada,2nd Parliament of the Province of Canada,3rd Parliament of the Province of Canada"
- new: meta name="keywords" content="Champlain (Province of Canada),Province of Canada general election, 1841,Province of Canada general election, 1867,1841,1843,1867,1st Parliament of the Province of Canada,2nd Parliament of the Province of Canada,3rd Parliament of the Province of Canada,4th Parliament of the Province of Canada,5th Parliament of the Province of Canada"
- This is better, but still suffers from a few bugs (essentially, the same problem, but more refined). There's nothing I can do from the template level, apart from removing chunks of it, to fix this situation. Mindmatrix 16:22, 22 January 2008 (UTC)
- Apparently, a new parser has been coded (see the Signpost article). Forcing its use on an article with this template (instead of using the old parser) actually produces better results. For example, on the Champlain (Province_of_Canada) article, compare the keyword meta information using the old parser with that generated with the new parser. Here they are:
-
-
-
-
-
-
-
-
-
-
-
- I've left a message at the preprocessor migration talk page about this. Mindmatrix 17:06, 22 January 2008 (UTC)
-
-
-
-
-