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

Uploaded Source

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

Hashes for sopn-publish-date-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a165d1a4fd903f8aa01d10712fb9234d9330dd5e83fda3b4efeb5e7e68112b3c
MD5 49527ae41b52987c67e11d899dd21536
BLAKE2b-256 4905ae995d9994cdab31ae002ffc44c59068a9d2e87a061c80ec156b15637954

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