bolster.data_sources.nisra.drug_related_deaths
NISRA Drug-Related and Drug Misuse Deaths Data Source.
Provides access to NISRA’s annual statistics on drug-related deaths and deaths due to drug misuse in Northern Ireland via the NISRA PxStat API. Two geographic breakdowns are available: HSC Trust and Local Government District.
NISRA distinguishes two related measures:
Drug-related deaths (
DRDCOUNT): All deaths where a drug was implicated, including prescription medicines, controlled drugs, and accidental/intentional poisonings.Drug misuse deaths (
MISUSECOUNT): A narrower subset where the underlying cause is drug abuse/dependence or the death involved a controlled substance.
- Original data source:
https://www.nisra.gov.uk/statistics/death-statistics/drug-related-and-drug-misuse-deaths
- PxStat matrices used:
DTHSDRHSCT — annual deaths by HSC Trust (6 trusts + NI total)
DTHSDRLGD — annual deaths by LGD (11 districts + NI total)
Update Frequency: Annual (typically May) Geographic Coverage: Northern Ireland
Example
>>> from bolster.data_sources.nisra import drug_related_deaths as drd
>>> df = drd.get_latest_drug_related_deaths()
>>> {"year", "geography", "statistic", "value"}.issubset(df.columns)
True
>>> len(df) > 0
True
Attributes
Functions
|
Download and return the latest NISRA drug-related deaths data. |
|
Validate a parsed drug-related deaths DataFrame. |
Module Contents
- bolster.data_sources.nisra.drug_related_deaths.get_latest_drug_related_deaths(dimension='all', force_refresh=False)[source]
Download and return the latest NISRA drug-related deaths data.
Fetches data from the NISRA PxStat API. Both available geographic breakdowns are returned for
dimension='all'.Note
force_refreshis accepted for API compatibility but is ignored — the PxStat API is called directly with no local cache layer.- Parameters:
dimension (DimensionType) –
Geographic breakdown to return. One of:
"hsct"— 5 HSC Trusts + NI total"lgd"— 11 Local Government Districts + NI total"all"— dict containing both breakdowns (default)
force_refresh (bool) – Ignored. Retained for API compatibility.
- Returns:
DataFrame with columns:
year: Registration year (int)geography_code: geography identifier codegeography: geography name labelstatistic:"drug_related"or"drug_misuse"value: Count of deaths (int, NaN where suppressed)
For
"all":{"hsct": DataFrame, "lgd": DataFrame}- Return type:
For
"hsct"or"lgd"- Raises:
ValueError – If
dimensionis not a supported value.
Example
>>> df = get_latest_drug_related_deaths("hsct") >>> {"year", "geography", "statistic", "value"}.issubset(df.columns) True >>> data = get_latest_drug_related_deaths("all") >>> sorted(data.keys()) ['hsct', 'lgd']
- bolster.data_sources.nisra.drug_related_deaths.validate_data(df)[source]
Validate a parsed drug-related deaths DataFrame.
- Parameters:
df (pandas.DataFrame) – DataFrame from
get_latest_drug_related_deaths()with a single geographic dimension.- Returns:
True if validation passes, False otherwise.
- Return type:
Example
>>> import pandas as pd >>> validate_data(pd.DataFrame()) False