Skip to main content

Derive publish dates of Statements of Persons Nominated for UK elections

Project description

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?

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 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 -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)

Relevant Legislation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sopn-publish-date-0.1.1.tar.gz (3.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page