Skip to main content

ECO Parser

Run tests 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 can 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

Release files for eco-parser 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eco-parser 0.3.0
File Size Uploaded
eco_parser-0.3.0.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for eco-parser 0.3.0
File Interpreter ABI Platform
eco_parser-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / eco_parser-0.3.0.tar.gz

Download URL eco_parser-0.3.0.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a307e34876c8e2ee60b679d5f18cb4d75b7af6e6cbf1740c1377ecd073fa0c05
BLAKE2b-256 checksum
How to use checksums
d1bcfa33b10086f256d0aed3121c722f1813f525c911095ccd8edbd831c1212b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 12, 2024.

Transparency log

Release files / eco_parser-0.3.0-py3-none-any.whl

Download URL eco_parser-0.3.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
690a1116ef8a234b6abb9faeb45557f8af7dba4990d41995dce14d0a6477c632
BLAKE2b-256 checksum
How to use checksums
b1a35d7d2f4d930dbe80806a571689b5522c0cadb9a622b0edc3d317bb9ea6ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 12, 2024.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page