Skip to main content

Parse ward lists from Electoral Change Orders on http://www.legislation.gov.uk/

Project description

ECO Parser

Build Status Coverage Status PyPI Version License Python Support

Parse ward lists from Electoral Change Orders on http://www.legislation.gov.uk/

What does this package do?

This package solves a very specific problem.

Local Government electoral divisions/wards in the UK are defined by a piece of legislation called an Electoral Change Order. An Electoral Change Order (ECO) always comes into force the day before the first election which is held using the boundaries it defines. Once this first election has happened, details of the new divisions are fairly easy to get hold of. They are published as machine-readable structured data by organisations like Ordnance Survey and the Office for National Statistics. If you need information about divisions that have already been used for one or more elections, use one of these sources. In that situation, this tool is probably the least useful route to the information you want.

In the case where we need to talk about local electoral divisions which have been defined by an ECO but which have not yet been used in an election (i.e: the ECO has been made, but has not yet come into force), the only source for the division names is the ECO legislation itself.

This package provides some routines to help with parsing ward and division names from the legislation.gov.uk's XML API outputs (which are semi-structured). It is early days, so there are probably going to be some formats we don't support yet. If you find one in new or recent legislation, raise an issue.

TL;DR

If you need the official names of electoral divisions that are already in use, get the data from OS Boundary Line, ONS Geography or a web service like mapit. This information is already published as convenient machine-readable structured data.

If you need the official names of electoral divisions that are not in use yet, this package may be able to help you parse them from legislation.

Installation

pip install eco-parser

Usage

On the console

eco_parser "http://www.legislation.gov.uk/uksi/2017/1067/schedule/1/made/data.xml" > out.csv

As a library

from eco_parser import EcoParser, ParseError

p = EcoParser("http://www.legislation.gov.uk/uksi/2017/1067/schedule/1/made/data.xml")

try:
    result = p.parse()
except ParseError:
    raise

Licensing

The eco-parser software is made available under the MIT License.

Data Parsed from legislation.gov.uk is covered by the Open Government Licence v3. Your use of the data should comply with it.

Development

Run the tests locally:

./run_tests.py

Build locally:

./build.sh

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

eco_parser-0.1.1.tar.gz (5.2 kB view details)

Uploaded Source

File details

Details for the file eco_parser-0.1.1.tar.gz.

File metadata

  • Download URL: eco_parser-0.1.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6

File hashes

Hashes for eco_parser-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d3e768fcdd30a922a8241031163a7124e087f0c0598ad6a09c4c5ce20497f901
MD5 5d67a3357c192c2dcc2bb18d2a5c290d
BLAKE2b-256 15a2e7de3dc02dd19b2adfd93e2ffab94747444ab989856a41748b58304eafc3

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