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.
Source Distribution
File details
Details for the file sopn-publish-date-0.1.2.tar.gz
.
File metadata
- Download URL: sopn-publish-date-0.1.2.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a165d1a4fd903f8aa01d10712fb9234d9330dd5e83fda3b4efeb5e7e68112b3c |
|
MD5 | 49527ae41b52987c67e11d899dd21536 |
|
BLAKE2b-256 | 4905ae995d9994cdab31ae002ffc44c59068a9d2e87a061c80ec156b15637954 |