Skip to content
Derive publish dates of Statements of Persons Nominated for UK elections
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
sopn_publish_date
tests
.gitignore
.travis.yml
README.md
requirements.txt
setup.py

README.md

sopn-publish-date

Build Status Code style: black

Given the polling day of an election in the UK, when should the Statement of Persons Nominated (SoPN) should be published?

Turns out this is a non-trivial question, depending on:

  • type of election
  • country
  • calendars and bank holidays

Usage

This library defines a class StatementPublishDate with two functions:

  • for_id takes a string election_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
  • for_country takes a string country and a datetime and:

    • Returns a datetime where the country is in the united kingdom
    • Throws an exception where the country is unknown

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

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)

Relevant Legislation

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.