Election Identifier Reference
An election code starts with an election type string. It may optionally contain descriptors for election subtype, organisation and division The identifier is terminated with the date that the polls open (in ISO 8601 format) for that particular election. Each section is separated by a period character ('.'). Names are slugified with hyphens ('-') separating tokens. An optional segment is used to indicate by-elections
All characters used are URL-friendly lowercase unreserved characters -- i.e. RFC3986 unreserved characters = ALPHA / DIGIT / "-" / "." / "_" / "~", where ALPHA is [a-z] and DIGIT is [0-9].
Examples of this could be
|Election type||Required, text|
|Election subtype||Optional, text|
|Date polls open||Required, (ISO 8601 format date)|
All election identifiers must include an election type. This describes the type of elected office that will be held by the winner(s) of this election.
Subtypes are used when an official body (Scottish Parliament, National Assembly for Wales, Greater London Authority) elects members by two different methods. In this case, elections are split into sub-elections based on voting system.
An administrative body which can hold an election.
When an election type only covers a single organisation the
organisation segment of the ID is excluded. This is to prevent
senedd.senedd and so on where the
organisation name and election type are the same.
Organisation segments must use official names. Organisation names are
Short form versions of names should be used i.e:
A sub-part of an organisation that a candidate can be elected to represent. This could be a ward in the case of a local election or a constituency in the case of a parliamentary election.
Division segments must use names as they appear in legislation. For boundaries that are already in use, the names of parliamentary constituencies, district wards and county electoral divisions are sourced from OS Boundary Line. Names of new boundaries are extracted from Electoral Change Orders.
By-elections are indicated with the segment
|European Parliament (UK) elections||
|Greater London Assembly elections||Constituencies||
|Greater London Assembly elections||Additional||
|National Assembly for Wales elections||Constituencies||
|National Assembly for Wales elections||Regions||
|Northern Ireland Assembly elections||
|UK Parliament elections||
|Police and Crime Commissioner elections||
|Senedd Cymru elections||Constituencies||
|Senedd Cymru elections||Regions||
|Scottish Parliament elections||Constituencies||
|Scottish Parliament elections||Regions||
Election ids are hierarchical. The lowest level (or most detailed) identifer for an election type is called the ballot id and describes a single ballot paper. Each level above this is a group id.
For example, the ballot id
senedd.c.aberavon.2021-05-06 is a child of the (subtype) group
senedd.c.2021-05-06 which is in turn a child of the (election) group
Similarly, the ballot id
local.worcestershire.bewdley.2017-05-04 is a child of the (organisation) group
local.worcestershire.2017-05-04 which is in turn a child of the (election) group
by segment only applies to a ballot id, so
parl.oldham-west-and-royton.by.2015-12-03 is a child of
parl.2015-12-03. The group id does not include the
by segment, even if all of its childen are by-elections.
uk-election-ids - A python package with includes a builder object, slugging algorithm and validation rules for creating identifiers that conform to this specification.