Template:Infobox election/doc

From Wikidata
Jump to navigation Jump to search


Infobox to show the aggregated final results of the elections. It also shows results of binary (Yes/No) or multiple choice referendums.

Syntax

[edit]
{{infobox election}}

It does not require any parameters to work. 100% of the content is fetched from Wikidata (WD).

Instructions of what properties to use and how to fill them to get the desired result can be found in the following sections.

However, in #Configuration settings you will find some settings for making configuration changes.

Operation

[edit]

The infobox election runs exclusively from WD information.

It can handle the following types of elections:


  • direct election: elections by direct voting to a candidate; the one with the most votes wins.
  • indirect election: the vote of the voters is equal to the direct election, but not to select just one final elected, but a set of representatives who will choose the president / maximum representative.
  • two-round system: It is a direct vote in which, if no candidate obtains an absolute majority, a second ballot is held in which only the two most voted candidates participate, and the winner of this second ballot are the final elected.
  • party-list proportional representation: Typical voting by parliamentary chambers where a political party or coalition is voted on a list. In this case, the application of a formula on the number of votes determines the number of seats or positions obtained by the party list. This list can be open or closed. This aspect is indifferent to the infobox, as it only shows the final results, but not the elected deputies.
  • Plurality block voting or multi-vote : These are elections where each voter can vote for more than one candidate. In this modality there are as many votes as positions to be filled, and in the case of limited voting (Q3786779), fewer are available. In the multi-vote method, the infobox only works with the information from P991, ie after the election date, to avoid long lists of candidate (P726) that will not be elected. Although voting is by candidate and not by party lists, the infotable can present information of the elects aggregated by party (when the P991 contains number of seats in assembly (P1410)), showing the seats won. Another modality is to present the list of elected people, showing the votes obtained; in this case, the ratios shown represent the support received by voters, not the distribution rate, because the sum may be greater than 100%, as it is a multi-vote model. This double modality allows to manage the item with the global results and the items with the detailed results by constituency.
  • Double Elections: These are in fact two elections held on the same election day. They are usually two-chamber elections in bicameral systems, but there are also municipal elections that elect mayor and councilors separately, with two direct votes. The infobox only handle TWO elections with one office each.
  • referendum: are votes where, unlike elections, the vote is not a support for a political option , but for or against a question-shaped text. In very exceptional cases, referendums don't have a binary answer, but a "choice" between several possible answers. To address these cases, the information structure is analogous to that described for an election, with small differences.

In the following summary we see the properties used and the structures of WD corresponding to the examples of the documentation for each type of election:

Instructions and

WD data model >>

direct election / indirect election party-list proportional representation two-round system Plurality block voting Double Elections Referendums
Election type >> direct indirect proportional election item round 1 round 2 item eleccions election item election 1 election 2





instance of (P31)



> > > > > > > qualifiers:
Election + type + jurisdiction, etc. NO year nor edition voting round (Q24097670) Election + type + jurisdiction, etc. NO year nor edition group of elections (Q76853179) + Election + type + jurisdiction, etc. NO year nor edition Election + type + jurisdiction, etc. NO year nor edition Mandatori.

Must be  = referendum (Q43109) or one of its subclasses.

follows (P155),
as qualifier of P31
mandatory mandatory
← 1st.round
mandatory mandatory mandatory
followed by (P156),
as qualifier of P31
mandatory mandatory
2nd.round →
mandatory mandatory mandatory
image (P18) optional, (Only when qualif.
depicts (P180) = ballot (Q905151))
optional, (Only when qualif.
depicts (P180) = ballot (Q905151))
optional, (Only when qualif.
depicts (P180) = ballot (Q905151))
country (P17) mandatory
applies to jurisdiction (P1001) mandatory
point in time (P585) mandatory. If it is multi-value and does not refer to the same call, it must be accompanied by P518 indicating the meaning of that date. mandatory. 2 values + P518 linked to each round mandatory. same rules as "direct election"
start time (P580) + end time (P582) Instead to P585 when ballot was not on specifics days, but in a period; same constraints
duration (P2047) + P518 = election campaign (Q11642595) optional optional optional
office contested (P541) mandatory

single-value constraint, may be together to a vice-president position, when both are a team option.
- - -
common qualifiers: electoral district (P768), parliamentary term (P2937), of (P642), number of constituencies (P4253),

mandatory + common qualifiers + number of seats (P1342) or quantity (P1114), maximum capacity (P1083) from the chamber, when not all seats are on votation. same rules as "direct election" same rules as "proportional election" mandatory single-value constraint same qualifiers
voting system (P8196) mandatory mandatory mandatory mandatory
candidate (P726) mandatory

common qualifiers: image (P18), member of political party (P102) o represents (P1268), party chief representative (P210), running mate (P6149), votes received (P1111) (mandatory), series ordinal (P1545)


qualifs. related to political party: short name (P1813), small logo or icon (P8972) or logo image (P154), sRGB color hex triplet (P465), political coalition (P5832), said to be the same as (P460)

mandatory only "elected candidates" in round 1 optional. Only the seats won by the elected candidates are listed in the aggregate item of the election Same conditions as the correspondance type of election for this case Only when multi-response. +votes received (P1111) + sRGB color hex triplet (P465)
successful candidate (P991) mandatory

qualifs. number of seats in assembly (P1410) in case of proportional elections

mandatory, single-value constraint mandatory

qualifs. number of seats in assembly (P1410), in case of aggregated item

same qualifiers optional
eligible voters (P1867) mandatory mandatory optional mandatory mandatory
ballots cast (P1868) mandatory mandatory optional mandatory mandatory
total valid votes (P1697) mandatory mandatory optional mandatory mandatory
number of spoilt votes (P5044) mandatory mandatory optional mandatory mandatory
number of blank votes (P5045) mandatory mandatory optional mandatory mandatory
has part(s) (P527) May point to items of partial results by constituency, which are not covered by this infobox. Point to the round items with series ordinal (P1545) qualifier May point to items of partial results by constituency, which are not covered by this infobox. Point to the round items with series ordinal (P1545) qualifier May point to items of partial results by constituency, which are not covered by this infobox.
part of (P361) it may indicate that it is part of some grouping, such as "elections to the European Parliament of the year xxxx". Point to the related election items with series ordinal (P1545) qualifier it may indicate that it is part of some grouping, such as "elections to the European Parliament of the year xxxx". it may indicate a kind of grouping, but avoid to confuse with P31 Point to the related election items with series ordinal (P1545) qualifier it may indicate that it is part of some grouping, such as "Referendums from independence preparation period".
distribution map (P1846) optional, (Only when qualif.
depicts (P180) = electoral result (Q19571328))
optional, (Only when qualif.
depicts (P180) = electoral result (Q19571328))
optional, (Only when qualif.
depicts (P180) = electoral result (Q19571328))
official website (P856) optional optional optional
hashtag (P2572) optional optional optional
immediate cause of (P1536) optional.

It allows building a box at the foot with the succession of individual positions (presidents, mayors, etc.); ex.:2016 Tokyo gubernatorial election (Q24639891). Or, the investiture of an elected president among the deputies of the election we are dealing with; ex:2021 Catalan parliament election (Q48838589)
When the value of P1536 or the qualif. P3831 or the P31 of the item of P1536 = appointment (Q1318578) or investiture (Q167407), a position succession box will be built with the data of the qualifiers and/or from the item pointed by P1536.
Any P1536 values that do not meet the described conditions will be listed as a normal line in the info table; ex: 2015 Catalan regional election (Q17082048).

Same description as another type of election. optional
title (P1476) mandatory
number of support votes (P8683) mandatory:P8683 + optional:sRGB color hex triplet (P465), of (P642)
number of negative votes (P8682) mandatory:P8682 + optional:sRGB color hex triplet (P465), of (P642)
Data get from higher level
term length of office (P2097) from office contested (P541)
subclass of (P279) from office contested (P541) generic name of seat positions
flag image (P41) from applies to jurisdiction (P1001)
instance of (P31) from candidate (P726) to determine if the election is person-oriented or party-oriented
image (P18) from candidate (P726) o de party chief representative (P210) candidate personal image in personal oriented elections; or lead candidate in case of proportional list elections
member of political party (P102) from candidate (P726)
short name (P1813) from candidate (P726) political party acronym, in case of proportional elections
logo image (P154) from candidate (P726) political party logo, in case of proportional elections
sRGB color hex triplet (P465) from candidate (P726) used to draw result bars with this colour.

Configuration settings

[edit]

Any information displayed by this infobox is fetched from WD, as it is described in exemples and documentations sections.

In addition, the infobox has some manual parameters to make changes to his appearance or operation.

  • type_election: The infobox infers the election type or obtains it from voting system (P8196). If you want to select it manually, the accepted values are: direct, proportional, two_rounds, double.
  • election_name / name: Text to show as a title, above of the infobox. It may be useful to put more synthetic text. By default, the article name is used.
  • id_position1: In "double elections", the letter "A" is used by default to indicate the results of the first election. This parameter allows you to indicate which character you want to use instead.
  • id_position2: Similar to above, to swap the letter "B" for another digit.
  • roundcolor_1: In double and two-round elections, it allows you to change the color that identifies the first election or first round.
  • roundcolor_2: In double and two-round elections, it allows you to change the color that identifies the second election or second round.
  • yes_color: Bar color for the "Yes" option in a referendum. By default is  #2ca02c .
  • not_color: Bar color for the "No" option in a referendum. By default is  #d62728 .
  • threshold_list
All candidates are shown before the election date. After elections only are shown: those who have won a seat or who have obtained more than 2% of the votes in the case of proportional elections, or more than 25% for non-proportional elections. This parameter allows you to alter this threshold. Only the figure must be informed (as 3.5 or 1.0, etc.).
  • item: Item Qid to use, when is different from the present article
  • debug: The infobox election has a debug system that displays the value of the parameter collection that any of the subtemplates has received. Possible values for this parameter are:
  • core: data passed to /core
  • prepdemo: data passed to /prepare for demography
  • preprefe: data passed to /prepare for referendum
  • prepcand: data passed to /prepare for each candidate
  • prepmult: data passed to /prepare_multi
  • showblok: data passed to /showblocks. Must be accopanied with a Qnnnnnn of candidate
  • showrefe: data passed to /showblocks for referendum

Tech documentation

[edit]

See: template:Infobox election/doctech/doc for schema and functionalities of involved sub-templates.

Examples

[edit]
Infobox election samples
Basic samples: direct, proportional, two rounds Direct election: USA president, president elected from chamber deputies, etc.
Double election: two assembly chambers, etc. Double election: more samples, etc.
Series: Part of double + only aggregate + constituency level Series: Constituency level with "direct election" + 2 aggregate level:State & country
Series: Local elections Series: Supra-state. European Parliament elections
Referendums: Two-rounds, multi-option and basic yes-no referendum
direct election / indirect election
2018 Finnish presidential election (Q1658720)
 ← 2012 Edit the value on WikidataFinland Edit the value on Wikidata 2024 Edit the value on Wikidata  → 
Point in timeJanuary 28, 2018 Edit the value on Wikidata
Typepresidential election in Finland Edit the value on Wikidata
Office contestedPresident of Finland. Term length of office: 6 year Edit the value on Wikidata
Voter turnout
Electorate4,498,004 Edit the value on Wikidata
3,001,325
   66.73٪
Total valid votes2,991,529    Number of blank votes  ?    Number of spoilt votes 9,042
Voting result Edit the value on Wikidata
Sauli NiinistöSuccessful candidate
1,874,334   62.65٪
 
party-list proportional representation
2015 Catalan regional election (Q17082048)
 ← 2012 Edit the value on WikidataCatalonia Edit the value on Wikidata 2017 Edit the value on Wikidata  → 
Point in timeSeptember 27, 2015 Edit the value on Wikidata
Typeelection to the Parliament of Catalonia and snap election Edit the value on Wikidata
Office contested135 Member of the Parliament of Catalonia ≈ 11th Parliament of Catalonia. Term length of office: 4 year Edit the value on Wikidata
Election campaign15 day Edit the value on Wikidata
Voter turnout
Electorate5,310,103 Edit the value on Wikidata
4,130,196
   77.78٪
Percentage point 10.02
Total valid votes4,114,244    Number of blank votes 21,895   Number of spoilt votes 15,952
Voting result Edit the value on Wikidata
<1
2>
JxSí  — Raül Romeva
1,628,714   39.59٪
Deputy 62
<1
2>
CS  — Inés Arrimadas
736,364   17.9٪
Percentage point 10.33
Deputy 9 → 25 Number of seats 16
<1
2>
PSC  — Miquel Iceta i Llorens
523,283   12.72٪
Percentage point 1.71
Deputy 20 → 14 Number of seats 6
<1
2>
CSQP  — Lluís Rabell
Comparació amb: Initiative for Catalonia Greens-United and Alternative Left
367,613   8.94٪
Percentage point 0.96
Deputy 13 → 11 Number of seats 2
<1
2>
PPC  — Xavier García Albiol
349,193   8.49٪
Percentage point 4.49
Deputy 19 → 11 Number of seats 8
<1
2>
CUP-CC  — Antonio Baños Boncompain
Comparació amb: Candidatura d'Unitat Popular-Alternativa d'Esquerres
337,794   8.21٪
Percentage point 4.73
Deputy 3 → 10 Number of seats 7
Democratic Union of Catalonia
103,293   2.51٪
Deputy

lang=en Edit the value on Wikidata
Presidential investiture in Catalonia, 2016 Edit the value on Wikidata
Replaces:Elected person:
Artur MasCarles Puigdemont Edit the value on Wikidata
Immediate cause of
January 12, 2016: Puigdemont Government Edit the value on Wikidata
two-round system
2017 French presidential election (Q7020999)
 ← 2012 Edit the value on WikidataFrance Edit the value on Wikidata 2022 Edit the value on Wikidata  → 
Point in timeApril 23, 2017, first round of French presidential election, 2017
May 7, 2017, second round of French presidential election, 2017 Edit the value on Wikidata
Typepresidential election in France Edit the value on Wikidata
Office contestedPresident of the French Republic. Term length of office: 5 year Edit the value on Wikidata
Election campaign14 day Edit the value on Wikidata
Voter turnout
First voting round Edit the value on Wikidata
Electorate47,582,183 Edit the value on Wikidata
37,003,728
   77.77٪
Percentage point 1.65
Total valid votes36,054,394    Number of blank votes 659,997   Number of spoilt votes 289,337
Second voting round Edit the value on Wikidata
Electorate47,568,693 Edit the value on Wikidata
35,467,327
   74.56٪
Percentage point 5.79
Total valid votes31,381,603    Number of blank votes 3,021,499   Number of spoilt votes 1,064,225
Voting result Edit the value on Wikidata Edit the value on Wikidata
Emmanuel Macron  — Renaissance
1
8,656,346   24.01٪
2
20,743,128   66.1٪
Marine Le Pen  — National Rally
1
7,678,491   21.3٪
Percentage point 3.4
2
10,638,475   33.9٪
François Fillon  — The Republicans
1
7,212,995   20.01٪
 


Leading candidate and vote share by department in the first round
Leading candidate and vote share by department in the second round Edit the value on Wikidata
Investiture Edit the value on Wikidata
Replaces:Elected person:
François HollandeEmmanuel Macron Edit the value on Wikidata
Immediate cause of
presidency of Emmanuel Macron Edit the value on Wikidata