bolster.data_sources.nisra.disease_prevalence

NISRA Disease Prevalence Module.

Provides access to Northern Ireland’s disease prevalence statistics from GP clinical disease registers (Quality & Outcomes Framework, QOF). Data are released annually after National Prevalence Day.

Data Coverage:
  • Financial years 2017/18 to present (extended annually)

  • NI-level: registered patients per disease register and prevalence per 1,000 patients

  • By Local Government District (LGD): same metrics per council

  • By HSC Trust: same metrics per Trust

Disease Registers (17):

Asthma, Atrial Fibrillation, Cancer, Chronic Kidney Disease, Chronic Obstructive Pulmonary Disease, Coronary Heart Disease, Dementia, Depression, Diabetes Mellitus, Heart Failure 1, Heart Failure 3, Hypertension, Mental Health, Non-Diabetic Hyperglycaemia, Osteoporosis, Rheumatoid Arthritis, Stroke & TIA

Original data sources:

https://www.opendatani.gov.uk/dataset/gp-practice-reference-file https://www.health-ni.gov.uk/topics/health-statistics/disease-prevalence

Data is fetched from the NISRA PxStat API using the following matrices:
  • DISPREVNI: NI-wide annual prevalence by disease

  • DISPREVLGD: Annual prevalence by LGD and disease

  • DISPREVHSCT: Annual prevalence by HSC Trust and disease

Update Frequency:

Annual, approximately May of the following calendar year.

Example

>>> from bolster.data_sources.nisra import disease_prevalence as dp
>>> df = dp.get_latest_disease_prevalence()
>>> 'registered_patients' in df.columns
True
>>> 'prevalence_per_1000' in df.columns
True

Attributes

logger

Functions

get_ni_prevalence([force_refresh])

Get NI-wide annual disease prevalence (DISPREVNI).

get_lgd_prevalence([force_refresh])

Get annual disease prevalence by Local Government District (DISPREVLGD).

get_hsct_prevalence([force_refresh])

Get annual disease prevalence by HSC Trust (DISPREVHSCT).

get_latest_disease_prevalence([force_refresh, level, lcg])

Get the latest NI disease prevalence data.

validate_disease_prevalence(df[, level])

Validate the disease prevalence DataFrame for internal consistency.

Module Contents

bolster.data_sources.nisra.disease_prevalence.logger[source]
bolster.data_sources.nisra.disease_prevalence.get_ni_prevalence(force_refresh=False)[source]

Get NI-wide annual disease prevalence (DISPREVNI).

Parameters:

force_refresh (bool) – Accepted for API compatibility but ignored; the PxStat API always returns the latest data without caching.

Returns:

financial_year, year, disease, registered_patients, prevalence_per_1000.

Return type:

DataFrame with columns

bolster.data_sources.nisra.disease_prevalence.get_lgd_prevalence(force_refresh=False)[source]

Get annual disease prevalence by Local Government District (DISPREVLGD).

Parameters:

force_refresh (bool) – Accepted for API compatibility but ignored; the PxStat API always returns the latest data without caching.

Returns:

financial_year, year, lgd, disease, registered_patients, prevalence_per_1000.

Return type:

DataFrame with columns

bolster.data_sources.nisra.disease_prevalence.get_hsct_prevalence(force_refresh=False)[source]

Get annual disease prevalence by HSC Trust (DISPREVHSCT).

Parameters:

force_refresh (bool) – Accepted for API compatibility but ignored; the PxStat API always returns the latest data without caching.

Returns:

financial_year, year, trust, disease, registered_patients, prevalence_per_1000.

Return type:

DataFrame with columns

bolster.data_sources.nisra.disease_prevalence.get_latest_disease_prevalence(force_refresh=False, level='ni', lcg=None)[source]

Get the latest NI disease prevalence data.

Fetches data from the NISRA PxStat API. The level parameter controls geographic granularity; lcg filters to a specific Local Government District (when level=’lgd’).

Parameters:
  • force_refresh (bool) – Accepted for API compatibility but ignored; the PxStat API always returns the latest data without caching.

  • level (str) – Geographic level — ‘ni’ for NI-wide (default), ‘lgd’ for Local Government District breakdown, or ‘trust’ for HSC Trust.

  • lcg (str | None) – Optional LGD name filter (used when level=’lgd’). If provided, only rows for that LGD are returned.

Returns:

financial_year, year, disease, registered_patients, prevalence_per_1000. When level=’lgd’, also includes an ‘lgd’ column. When level=’trust’, also includes a ‘trust’ column.

Return type:

DataFrame with columns

Raises:

ValueError – If level is not one of ‘ni’, ‘lgd’, or ‘trust’.

Example

>>> df = get_latest_disease_prevalence()
>>> 'registered_patients' in df.columns
True
>>> 'prevalence_per_1000' in df.columns
True
bolster.data_sources.nisra.disease_prevalence.validate_disease_prevalence(df, level='ni')[source]

Validate the disease prevalence DataFrame for internal consistency.

Parameters:
  • df (pandas.DataFrame) – DataFrame as returned by get_latest_disease_prevalence().

  • level (str) – Validation mode — ‘ni’ (default) or ‘lgd’/’trust’ for geographic breakdowns. Validates the ‘gp’ level alias for backward compatibility (treated same as ‘lgd’).

Returns:

True if all checks pass.

Raises:
Return type:

bool

Example

>>> import pandas as pd
>>> df = pd.DataFrame({
...     "year": [2017], "financial_year": ["2017/18"],
...     "disease": ["Hypertension"],
...     "registered_patients": [184824.0],
...     "prevalence_per_1000": [102.9],
... })
>>> validate_disease_prevalence(df)
True