Derive publish dates of Statements of Persons Nominated for UK elections
Project description
sopn-publish-date
Given the polling day of an election in the UK, when should the Statement of Persons Nominated (SoPN) should be published?
This is a non-trivial question, depending on:
- type of election
- country
- calendars and bank holidays
Even then, it's fuzzy - if a candidate objects to their nomination, that can delay SoPN publication up to the next day.
This project answers when a SoPN should be published, but that is not a guarantee that it will be.
Usage
sopn_publish_date
defines a class StatementPublishDate
with two functions:
-
for_id
takes a stringelection_id
in uk-election-ids format and:- Returns a
datetime
where the location of the election is unambiguous e.g. Scottish Parliamentary elections - Throws an exception where the location of the election is ambiguous e.g.
local
,parl
- Returns a
-
for_country
takes a stringcountry
and adatetime
and:- Returns a
datetime
where the country is in the united kingdom - Throws an exception where the country is unknown
- Returns a
Examples:
from sopn_publish_date import StatementPublishDate
from datetime import datetime
sopn_publish_date = StatementPublishDate()
# Taking an id
sopn_publish_date.for_id('nia.belfast-east.2017-03-02')
# Taking a country and date
sopn_publish_date.for_country('scotland', datetime(2019, 2, 23))
Test
python -m pytest -v
Sources
The bank holidays JSON is provided by gov.uk under the Open Government Licence
Todo
Election types:
- Local
- Parliament
- Scottish Parliament
- National Assembly for Wales
- Northern Irish Assembly
- Mayoral
- EU parliament
- Greater London Assembly
- Police and Crime commissioner
Calendars:
- England + Wales
- Scotland
- Northern Ireland
- Fixed-date bank holidays e.g. royal weddings
Useful Links (delete pre-1.0)
- Association of Electoral Administrators review of May 2016 elections (Appendix D contains full timetabling for all concurrent elections)
- TheyWorkForYou/Hansard: Lord Roberts of Llandudno on overseas voting
Relevant Legislation
- The Local Authorities (Mayoral Elections) (England and Wales) Regulations 2007 - timetables for mayoral elections (schedule 1, Timetable)
- The Police and Crime Commissioner Elections Order 2012 - timetables for police and crime commissioner elections (schedule 1, Timetable)
- Electoral Law Act (Northern Ireland) 1962 and The Local Elections (Northern Ireland) Order 2010 - timetables for local elections in Northern Ireland
- The Greater London Authority Elections Rules 2007 - timetables for London Assembly and Mayor of London.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.