bolster.data_sources.nisra.cancer_waiting_times

NISRA Cancer Waiting Times Module.

This module provides access to Northern Ireland’s cancer waiting times statistics, measuring performance against key cancer treatment targets.

Cancer Waiting Time Targets:
  • 14-day: Urgent breast cancer referrals seen within 14 days

  • 31-day: Treatment started within 31 days of decision to treat

  • 62-day: Treatment started within 62 days of urgent GP referral

Data Coverage:
  • 31-day and 62-day by HSC Trust: April 2008 - Present (monthly)

  • 31-day and 62-day by Tumour Site: December 2008 - Present (monthly)

  • 14-day Breast (Historic by Trust): April 2008 - April 2025

  • 14-day Breast (Regional): May 2025 - Present (new regional service)

  • Breast Cancer Referrals: April 2016 - Present (monthly)

HSC Trusts:
  • Belfast, Northern, South Eastern, Southern, Western

Tumour Sites:
  • Brain/Central Nervous System, Breast Cancer, Gynaecological Cancers,

  • Haematological Cancers, Head/Neck Cancer, Lower Gastrointestinal Cancer,

  • Lung Cancer, Other, Skin Cancers, Upper Gastrointestinal Cancer,

  • Urological Cancer

Data Source: Department of Health Northern Ireland provides cancer waiting times statistics through their health publications at https://www.health-ni.gov.uk/articles/cancer-waiting-times. The data tracks performance against cancer treatment targets across Health and Social Care Trusts and by tumour site, providing comprehensive monitoring of cancer care pathways in Northern Ireland.

Update Frequency: Quarterly publications are released approximately 3 months after the end of each quarter. Cancer waiting times statistics are published by the Department of Health as part of their healthcare performance monitoring, with data updated four times per year to track progress against key cancer treatment targets.

Example

>>> from bolster.data_sources.nisra import cancer_waiting_times as cwt
>>> # Get latest 31-day waiting times by HSC Trust
>>> df = cwt.get_latest_31_day_by_trust()
>>> sorted(df.columns.tolist())
['date', 'month', 'over_target', 'performance_rate', 'total', 'trust', 'within_target', 'year']
>>> # Get 62-day waiting times by tumour site
>>> df_tumour = cwt.get_latest_62_day_by_tumour()
>>> 'tumour_site' in df_tumour.columns
True
Publication Details:

Attributes

logger

DOH_CANCER_PAGE

DOH_BASE_URL

SHEET_31_DAY_TRUST

SHEET_31_DAY_TUMOUR

SHEET_62_DAY_TRUST

SHEET_62_DAY_TUMOUR

SHEET_14_DAY_REGIONAL

SHEET_14_DAY_HISTORIC

SHEET_14_DAY_LEGACY

SHEET_BREAST_REFERRALS

Functions

get_latest_publication_url()

Find the latest cancer waiting times publication URL.

parse_31_day_by_trust(file_path)

Parse 31-day waiting times by HSC Trust.

parse_31_day_by_tumour(file_path)

Parse 31-day waiting times by Tumour Site.

parse_62_day_by_trust(file_path)

Parse 62-day waiting times by HSC Trust.

parse_62_day_by_tumour(file_path)

Parse 62-day waiting times by Tumour Site.

parse_14_day_breast(file_path)

Parse 14-day breast cancer waiting times.

parse_breast_referrals(file_path)

Parse breast cancer referrals data.

get_latest_31_day_by_trust([force_refresh])

Get latest 31-day waiting times by HSC Trust.

get_latest_31_day_by_tumour([force_refresh])

Get latest 31-day waiting times by Tumour Site.

get_latest_62_day_by_trust([force_refresh])

Get latest 62-day waiting times by HSC Trust.

get_latest_62_day_by_tumour([force_refresh])

Get latest 62-day waiting times by Tumour Site.

get_latest_14_day_breast([force_refresh])

Get latest 14-day breast cancer waiting times.

get_latest_breast_referrals([force_refresh])

Get latest breast cancer referrals data.

get_data_by_year(df, year)

Filter data for a specific year.

get_performance_summary_by_year(df[, group_col])

Calculate annual performance summary.

get_ni_wide_performance(df)

Calculate NI-wide performance (aggregated across all trusts/sites).

get_performance_trend(df[, window])

Calculate rolling performance trend.

get_tumour_site_ranking(df[, year])

Rank tumour sites by performance.

validate_performance_data(df)

Validate that performance data is internally consistent.

Module Contents

bolster.data_sources.nisra.cancer_waiting_times.logger[source]
bolster.data_sources.nisra.cancer_waiting_times.DOH_CANCER_PAGE = 'https://www.health-ni.gov.uk/articles/cancer-waiting-times'[source]
bolster.data_sources.nisra.cancer_waiting_times.DOH_BASE_URL = 'https://www.health-ni.gov.uk'[source]
bolster.data_sources.nisra.cancer_waiting_times.SHEET_31_DAY_TRUST = '31 Day Wait by HSC Trust'[source]
bolster.data_sources.nisra.cancer_waiting_times.SHEET_31_DAY_TUMOUR = '31 Day Wait by Tumour Site'[source]
bolster.data_sources.nisra.cancer_waiting_times.SHEET_62_DAY_TRUST = '62 Day Wait by HSC Trust'[source]
bolster.data_sources.nisra.cancer_waiting_times.SHEET_62_DAY_TUMOUR = '62 Day Wait by Tumour Site'[source]
bolster.data_sources.nisra.cancer_waiting_times.SHEET_14_DAY_REGIONAL = '14 d Wait - Breast Regional'[source]
bolster.data_sources.nisra.cancer_waiting_times.SHEET_14_DAY_HISTORIC = '14 d Wait - Breast Historic'[source]
bolster.data_sources.nisra.cancer_waiting_times.SHEET_14_DAY_LEGACY = '14 Day Wait - Breast Cancer'[source]
bolster.data_sources.nisra.cancer_waiting_times.SHEET_BREAST_REFERRALS = 'Breast Cancer Referrals'[source]
bolster.data_sources.nisra.cancer_waiting_times.get_latest_publication_url()[source]

Find the latest cancer waiting times publication URL.

Scrapes the Department of Health cancer waiting times page to find the most recent quarterly publication.

Returns:

Tuple of (excel_file_url, quarter_string)

Raises:

NISRADataNotFoundError – If publication cannot be found

Return type:

tuple[str, str]

bolster.data_sources.nisra.cancer_waiting_times.parse_31_day_by_trust(file_path)[source]

Parse 31-day waiting times by HSC Trust.

Handles both the 5-column format (pre-Q3 2025-26) and the 7-column format (Q3 2025-26+, which added Median and 95th Percentile columns).

Parameters:

file_path (str | pathlib.Path) – Path to the Excel file

Returns:

date, year, month, trust, within_target, over_target, total, performance_rate

Return type:

DataFrame with columns

bolster.data_sources.nisra.cancer_waiting_times.parse_31_day_by_tumour(file_path)[source]

Parse 31-day waiting times by Tumour Site.

Handles both the 5-column format (pre-Q3 2025-26) and the 7-column format (Q3 2025-26+, which added Median and 95th Percentile columns).

Parameters:

file_path (str | pathlib.Path) – Path to the Excel file

Returns:

date, year, month, tumour_site, within_target, over_target, total, performance_rate

Return type:

DataFrame with columns

bolster.data_sources.nisra.cancer_waiting_times.parse_62_day_by_trust(file_path)[source]

Parse 62-day waiting times by HSC Trust.

Handles both the 5-column format (pre-Q3 2025-26) and the 7-column format (Q3 2025-26+, which added Median and 95th Percentile columns).

Parameters:

file_path (str | pathlib.Path) – Path to the Excel file

Returns:

date, year, month, trust, within_target, over_target, total, performance_rate

Return type:

DataFrame with columns

Note

62-day data may contain fractional patient counts due to shared care arrangements between trusts.

bolster.data_sources.nisra.cancer_waiting_times.parse_62_day_by_tumour(file_path)[source]

Parse 62-day waiting times by Tumour Site.

Handles both the 5-column format (pre-Q3 2025-26) and the 7-column format (Q3 2025-26+, which added Median and 95th Percentile columns).

Parameters:

file_path (str | pathlib.Path) – Path to the Excel file

Returns:

date, year, month, tumour_site, within_target, over_target, total, performance_rate

Return type:

DataFrame with columns

bolster.data_sources.nisra.cancer_waiting_times.parse_14_day_breast(file_path)[source]

Parse 14-day breast cancer waiting times.

Handles three publication formats: - Pre-Q4 2024-25: single sheet ‘SHEET_14_DAY_LEGACY’ (5 cols) - Q4 2024-25 to Q2 2025-26: split into historic (5 cols) + regional (5 cols) - Q3 2025-26+: split into historic (5 cols) + regional (7 cols, + median/95th pct)

Parameters:

file_path (str | pathlib.Path) – Path to the Excel file

Returns:

date, year, month, trust, within_target, over_target, total, performance_rate

Return type:

DataFrame with columns

Note

From May 2025, breast cancer services became regional. Historic data (pre-May 2025) is by individual Trust. Regional data shows NI-wide figures.

bolster.data_sources.nisra.cancer_waiting_times.parse_breast_referrals(file_path)[source]

Parse breast cancer referrals data.

Handles two formats: - Pre-Q3 2025-26: 4 columns (referral_month, trust, total_referrals, urgent_referrals) - Q3 2025-26+: 5 columns (referral_month, trust, routine_referrals, urgent_referrals, total_referrals)

Parameters:

file_path (str | pathlib.Path) – Path to the Excel file

Returns:

date, year, month, trust, total_referrals, urgent_referrals, urgent_rate

Return type:

DataFrame with columns

bolster.data_sources.nisra.cancer_waiting_times.get_latest_31_day_by_trust(force_refresh=False)[source]

Get latest 31-day waiting times by HSC Trust.

Parameters:

force_refresh (bool) – Force re-download even if cached

Returns:

DataFrame with 31-day performance by Trust

Return type:

pandas.DataFrame

bolster.data_sources.nisra.cancer_waiting_times.get_latest_31_day_by_tumour(force_refresh=False)[source]

Get latest 31-day waiting times by Tumour Site.

Parameters:

force_refresh (bool) – Force re-download even if cached

Returns:

DataFrame with 31-day performance by tumour site

Return type:

pandas.DataFrame

bolster.data_sources.nisra.cancer_waiting_times.get_latest_62_day_by_trust(force_refresh=False)[source]

Get latest 62-day waiting times by HSC Trust.

Parameters:

force_refresh (bool) – Force re-download even if cached

Returns:

DataFrame with 62-day performance by Trust

Return type:

pandas.DataFrame

bolster.data_sources.nisra.cancer_waiting_times.get_latest_62_day_by_tumour(force_refresh=False)[source]

Get latest 62-day waiting times by Tumour Site.

Parameters:

force_refresh (bool) – Force re-download even if cached

Returns:

DataFrame with 62-day performance by tumour site

Return type:

pandas.DataFrame

bolster.data_sources.nisra.cancer_waiting_times.get_latest_14_day_breast(force_refresh=False)[source]

Get latest 14-day breast cancer waiting times.

Parameters:

force_refresh (bool) – Force re-download even if cached

Returns:

DataFrame with 14-day breast cancer performance

Return type:

pandas.DataFrame

bolster.data_sources.nisra.cancer_waiting_times.get_latest_breast_referrals(force_refresh=False)[source]

Get latest breast cancer referrals data.

Parameters:

force_refresh (bool) – Force re-download even if cached

Returns:

DataFrame with breast cancer referrals

Return type:

pandas.DataFrame

bolster.data_sources.nisra.cancer_waiting_times.get_data_by_year(df, year)[source]

Filter data for a specific year.

Parameters:
Returns:

Filtered DataFrame

Return type:

pandas.DataFrame

bolster.data_sources.nisra.cancer_waiting_times.get_performance_summary_by_year(df, group_col='trust')[source]

Calculate annual performance summary.

Parameters:
  • df (pandas.DataFrame) – DataFrame with performance data

  • group_col (str) – Column to group by (‘trust’ or ‘tumour_site’)

Returns:

DataFrame with annual summary statistics

Return type:

pandas.DataFrame

bolster.data_sources.nisra.cancer_waiting_times.get_ni_wide_performance(df)[source]

Calculate NI-wide performance (aggregated across all trusts/sites).

Parameters:

df (pandas.DataFrame) – DataFrame with performance data

Returns:

DataFrame with NI-wide monthly performance

Return type:

pandas.DataFrame

bolster.data_sources.nisra.cancer_waiting_times.get_performance_trend(df, window=12)[source]

Calculate rolling performance trend.

Parameters:
  • df (pandas.DataFrame) – DataFrame with NI-wide performance data

  • window (int) – Rolling window size in months (default: 12)

Returns:

DataFrame with rolling average performance

Return type:

pandas.DataFrame

bolster.data_sources.nisra.cancer_waiting_times.get_tumour_site_ranking(df, year=None)[source]

Rank tumour sites by performance.

Parameters:
  • df (pandas.DataFrame) – DataFrame with tumour site data

  • year (int) – Optional year to filter (default: all years)

Returns:

DataFrame ranked by performance (worst to best)

Return type:

pandas.DataFrame

bolster.data_sources.nisra.cancer_waiting_times.validate_performance_data(df)[source]

Validate that performance data is internally consistent.

Parameters:

df (pandas.DataFrame) – DataFrame with performance columns

Returns:

True if validation passes

Raises:

ValueError – If validation fails

Return type:

bool

Note

Rows with NaN values (e.g., due to encompass system rollout) or zero totals are excluded from validation checks.