Skip to main content

Bolster

PyPI Python License GitHub Actions Code Coverage Documentation Ruff uv

A Python library for accessing Northern Ireland and UK government open data. Covers population, health, crime, economy, transport, housing, and more — each source normalised into a clean pandas DataFrame with a matching CLI command.

Full documentation: bolster.readthedocs.io


Installation

pip install bolster

Requires Python 3.11+.


What can you do with it?

A few examples using real data:

Who is claiming UC/JSA, and where?

from bolster.data_sources.nisra import claimant_count

df = claimant_count.get_latest_claimant_count("lgd")
# 33,930 claimants across NI as of May 2026
# Derry City & Strabane has the highest rate at 4.1%
print(
    df[df["date"] == df["date"].max()].sort_values("claimant_rate_total_pct", ascending=False)[
        ["geography", "claimants_total", "claimant_rate_total_pct"]
    ]
)

How many people are on the hypertension register at each GP practice?

from bolster.data_sources.health_ni import disease_prevalence

# NI-wide: 304,952 patients on the hypertension register in 2024/25
summary = disease_prevalence.get_latest_disease_prevalence(level="ni")

# GP-practice level: ~360 practices across ~17 financial years
gp = disease_prevalence.get_latest_gp_prevalence()
print(gp[gp["disease"] == "Hypertension"].groupby("financial_year")["registered_patients"].sum())

How is NI's economy tracking against pre-pandemic levels?

from bolster.data_sources.nisra import composite_index

df = composite_index.get_latest_nicei()
# NICEI at 105.9 in Q1 2026 (base 100 = 2016)
# Breakdown by sector: services, production, construction, agriculture
print(df.tail(4)[["year", "quarter", "nicei", "services", "production"]])

What are A&E waiting times doing across HSC Trusts?

from bolster.data_sources.health_ni import emergency_care_waiting_times

df = emergency_care_waiting_times.get_latest_data()
# Monthly attendance and % seen within 4 hours by Trust and department type
latest = df[df["date"] == df["date"].max()]
print(latest.groupby("trust")["pct_within_4hrs"].mean().sort_values())

What is the median full-time weekly wage in NI?

from bolster.data_sources.nisra import ashe

df = ashe.get_latest_ashe_timeseries("weekly")
# £713.10 median full-time weekly earnings in 2025
print(df[df["work_pattern"] == "Full-time"].tail(5)[["year", "median_weekly_earnings"]])

Data sources

Sources are organised by publisher. Each module follows the same pattern: get_latest_*() returns a tidy DataFrame; bolster <command> --help gives CLI access.

NISRA — NI Statistics and Research Agency

People and society: population, births, deaths, marriages, stillbirths, migration, population_projections, baby_names, registrar_general, deprivation, wellbeing, public_confidence, drug_related_deaths

Economy and labour: labour_market, claimant_count, ashe, quarterly_employment_survey, composite_index, index_of_production, index_of_services, construction_output, business_register, planning_statistics, housing_stock, tourism, work_quality

Department of Health NI (health_ni)

disease_prevalence (NI / LGD / HSCT / GP-practice level), cancer_waiting_times, diagnostic_waiting_times, elective_waiting_times, emergency_care_waiting_times, child_protection

PSNI — Police Service of Northern Ireland

crime_statistics (historical), road_traffic_collisions, stop_and_search, pace, police_ombudsman

Other sources

Source Module What it covers
DVA dva Vehicle, driver, and theory test statistics (monthly)
NI Water ni_water Drinking water quality by supply zone and postcode
NI House Price Index ni_house_price_index Quarterly house price index and sales volumes
NI Assembly niassembly MLAs, oral/written questions, votes (2007–present)
EONI eoni Assembly election results (2016, 2022)
Translink translink Live departures and vehicle positions
ONS ons_cpi CPI / CPIH / RPI inflation indices
Bank of England boe_base_rate Official Bank Rate (1694–present)
Companies House companies_house UK company data
Gender Pay Gap gender_pay_gap UK GPG reporting (250+ employees, 2017–present)
DAERA daera_waste NI municipal waste statistics
Justice (NICTS) justice Mortgage possession actions
Met Office metoffice UK precipitation maps (requires API key)

CLI

Every data source has a matching CLI command:

bolster nisra deaths                        # latest weekly deaths
bolster nisra claimant-count --breakdown lgd
bolster nisra composite-index
bolster health-ni disease-prevalence --level gp
bolster psni stop-and-search
bolster translink departures "Europa Buscentre"
bolster water-quality BT1 5GS
bolster dva vehicle-tests
bolster --help                              # full command list

Utilities

Bolster also includes general-purpose helpers used internally:

  • poolmap() — ThreadPoolExecutor with progress bar and error handling
  • backoff() — exponential backoff retry decorator
  • memoize() — instance method cache with hit/miss tracking
  • get_recursively() / flatten_dict() — nested dict navigation
  • CachedDownloader — disk-cached HTTP download with TTL
  • session — shared requests.Session with retry/jitter logic
import bolster

results = bolster.poolmap(lambda x: x**2, range(1000), max_workers=4)


@bolster.backoff(Exception, tries=3, delay=1, backoff=2)
def unreliable(): ...

Development

git clone https://github.com/andrewbolster/bolster.git
cd bolster
uv sync --all-extras --dev
uv run pre-commit install
uv run pytest tests/ -q --no-cov        # quick run
uv run pytest tests/ --cov=src/bolster  # with coverage

See AGENTS.md for the data source development workflow and CONTRIBUTING.md for guidelines.


License

GNU General Public License v3

Download files

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

Source Distribution

bolster-0.7.7.tar.gz (467.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bolster-0.7.7-py3-none-any.whl (568.8 kB view details)

Uploaded Python 3

File details

Details for the file bolster-0.7.7.tar.gz.

File metadata

  • Download URL: bolster-0.7.7.tar.gz
  • Upload date:
  • Size: 467.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for bolster-0.7.7.tar.gz
Algorithm Hash digest
SHA256 b0f671a52b9f89fdc27bdba5acee5c233604c68f8cbe115699f7ebe0b966a638
MD5 c82b15af45ff628ce5bf0ea8e5fd372f
BLAKE2b-256 b55719957f352cf1282b04bcd9cafbdbeb746883f1dc3094044f433fad9c2d01

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolster-0.7.7.tar.gz:

Publisher: publish.yml on andrewbolster/bolster

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bolster-0.7.7-py3-none-any.whl.

File metadata

  • Download URL: bolster-0.7.7-py3-none-any.whl
  • Upload date:
  • Size: 568.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for bolster-0.7.7-py3-none-any.whl
Algorithm Hash digest
SHA256 df55f18856c4317503d55a0c1cd2d786536ef354c03d784c844996d0a30039b8
MD5 227b8a7cd0a9695d780c8558a6f00b02
BLAKE2b-256 956d3223b547a26f9c50d7b4587eaad45dade41f3357d7c739840d0a85d4768a

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolster-0.7.7-py3-none-any.whl:

Publisher: publish.yml on andrewbolster/bolster

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.10.1

2 files

0.10.0

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

This release

0.7.7 This release

2 files

0.7.6

2 files

0.7.5

2 files

0.7.4

2 files

0.7.3

2 files

0.7.1

2 files

0.6.0

2 files

0.4.0

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

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