bolster.data_sources.nisra.stillbirths

NISRA Monthly Stillbirth Registrations Data Source.

Provides access to monthly stillbirth registration statistics for Northern Ireland. A stillbirth is defined as a baby born after 24 weeks of pregnancy that did not show any signs of life.

Data covers registrations by month from 2006 to present, updated monthly.

Data Source:

Mother Page: https://www.nisra.gov.uk/publications/monthly-stillbirths

The monthly Excel file contains a single “Stillbirths” sheet with counts by month of registration (rows) and year (columns), covering 2006 to present.

Update Frequency: Monthly (published ~6 weeks after reference month) Geographic Coverage: Northern Ireland (resident stillbirths)

Example

>>> from bolster.data_sources.nisra import stillbirths
>>> df = stillbirths.get_latest_stillbirths()
>>> sorted(df.columns.tolist())
['date', 'month', 'stillbirths', 'year']
>>> # Total stillbirths in 2024
>>> total_2024 = df[df['year'] == 2024]['stillbirths'].sum()
>>> bool(total_2024 >= 0)
True

Attributes

logger

STILLBIRTHS_PUBLICATION_URL

MONTH_ORDER

Functions

get_latest_stillbirths_publication_url()

Scrape NISRA stillbirths publication page to find the latest Excel file.

parse_stillbirths_file(file_path)

Parse NISRA monthly stillbirths Excel file into long-format DataFrame.

get_latest_stillbirths([force_refresh])

Get the latest monthly stillbirth registrations for Northern Ireland.

validate_stillbirths_data(df)

Validate stillbirths DataFrame for basic integrity.

get_stillbirths_by_year(df, year)

Filter stillbirths data to a specific year.

get_stillbirth_rate(stillbirths_df, births_df)

Calculate monthly stillbirth rate per 1,000 total births (live + still).

get_annual_summary(df)

Calculate annual totals and trends for stillbirths.

Module Contents

bolster.data_sources.nisra.stillbirths.logger[source]
bolster.data_sources.nisra.stillbirths.STILLBIRTHS_PUBLICATION_URL = 'https://www.nisra.gov.uk/publications/monthly-stillbirths'[source]
bolster.data_sources.nisra.stillbirths.MONTH_ORDER = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September',...[source]
bolster.data_sources.nisra.stillbirths.get_latest_stillbirths_publication_url()[source]

Scrape NISRA stillbirths publication page to find the latest Excel file.

Returns:

URL of the latest monthly stillbirths Excel file

Raises:

NISRADataNotFoundError – If publication or file not found

Return type:

str

bolster.data_sources.nisra.stillbirths.parse_stillbirths_file(file_path)[source]

Parse NISRA monthly stillbirths Excel file into long-format DataFrame.

The file has a single “Stillbirths” sheet with months as rows and years as columns (wide format). This function melts it into long format.

Parameters:

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

Returns:

  • date: Timestamp (first day of registration month)

  • year: int

  • month: str (e.g. “January”)

  • stillbirths: int

Return type:

DataFrame with columns

Raises:

NISRAValidationError – If file structure is unexpected

bolster.data_sources.nisra.stillbirths.get_latest_stillbirths(force_refresh=False)[source]

Get the latest monthly stillbirth registrations for Northern Ireland.

Parameters:

force_refresh (bool) – If True, bypass cache and download fresh data

Returns:

  • date: Timestamp (first of registration month)

  • year: int

  • month: str

  • stillbirths: int

Return type:

DataFrame with columns

Raises:
  • NISRADataNotFoundError – If latest publication cannot be found

  • NISRAValidationError – If file structure is unexpected

Example

>>> df = get_latest_stillbirths()
>>> sorted(df.columns.tolist())
['date', 'month', 'stillbirths', 'year']
>>> annual = df.groupby('year')['stillbirths'].sum()
>>> len(annual) > 0
True
bolster.data_sources.nisra.stillbirths.validate_stillbirths_data(df)[source]

Validate stillbirths DataFrame for basic integrity.

Parameters:

df (pandas.DataFrame) – DataFrame from get_latest_stillbirths()

Returns:

True if validation passes

Raises:

NISRAValidationError – If validation fails

Return type:

bool

bolster.data_sources.nisra.stillbirths.get_stillbirths_by_year(df, year)[source]

Filter stillbirths data to a specific year.

Parameters:
  • df (pandas.DataFrame) – DataFrame from get_latest_stillbirths()

  • year (int) – Year to filter

Returns:

Filtered DataFrame

Return type:

pandas.DataFrame

Example

>>> df = get_latest_stillbirths()
>>> df_2024 = get_stillbirths_by_year(df, 2024)
>>> 'stillbirths' in df_2024.columns
True
bolster.data_sources.nisra.stillbirths.get_stillbirth_rate(stillbirths_df, births_df)[source]

Calculate monthly stillbirth rate per 1,000 total births (live + still).

Parameters:
  • stillbirths_df (pandas.DataFrame) – DataFrame from get_latest_stillbirths()

  • births_df (pandas.DataFrame) – DataFrame from births.get_latest_births(event_type=’registration’)

Returns:

date, year, month, stillbirths, live_births, total_births, stillbirth_rate

Return type:

DataFrame with columns

Example

>>> from bolster.data_sources.nisra import stillbirths, births
>>> sb = stillbirths.get_latest_stillbirths()
>>> lb = births.get_latest_births(event_type='registration')
>>> rate = stillbirths.get_stillbirth_rate(sb, lb)
bolster.data_sources.nisra.stillbirths.get_annual_summary(df)[source]

Calculate annual totals and trends for stillbirths.

Parameters:

df (pandas.DataFrame) – DataFrame from get_latest_stillbirths()

Returns:

year, total_stillbirths, yoy_change, yoy_pct_change

Return type:

DataFrame with columns

Example

>>> df = get_latest_stillbirths()
>>> summary = get_annual_summary(df)
>>> sorted(summary.columns.tolist())
['total_stillbirths', 'year', 'yoy_change', 'yoy_pct_change']