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.0.tar.gz (3.9 kB view details)

Uploaded Source

File details

Details for the file sopn-publish-date-0.1.0.tar.gz.

File metadata

  • Download URL: sopn-publish-date-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 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

Hashes for sopn-publish-date-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5d3c838b04ae96b7024ab6b8013daf2405477ba6a47e093f24968d63bd135aea
MD5 ad10696f3ff8370ab87905ed1e3bf12b
BLAKE2b-256 f6fdc8aae7b92bbf073f150059bc66771fccb52f79580853381ce7f396112d16

See more details on using hashes here.

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