# Load environment file
source(here::here("setup_environment.R"))

# Read in SMR data, filtered on latest period/reported hospitals
smr_data          <- read_csv(paste0(data_folder, pub_day, "/output/", 
                 pub_day,  "_SMR-data.csv")) %>% 
  filter(period == 3 & location %in% c(hosp_filter, scot_filter)) %>%
  mutate(st_err = round_half_up(sqrt(1/round_half_up(pred, 8)), 8),
       z = if_else(location_type == "hospital",
                   round_half_up(((round_half_up(smr, 8) - 1)/round_half_up(st_err,8)), 8),
                   0)) %>%
  mutate(
    z_max = max(z),
    z_min = min(z),
    z_flag = case_when(z == z_max ~ 1,
                       z == z_min ~ -1,
                       TRUE ~ 0),
    z = if_else(z == z_max | z == z_min, 0, z),
    z_max = max(z),
    z_min = min(z),
    z = case_when(z_flag == 1 ~ z_max,
                  z_flag == -1 ~ z_min,
                  TRUE ~ z),
    z_flag = if_else(z != 0, 1, 0),
    w_score = round_half_up(sqrt(sum(round_half_up(z * z, 8))/sum(z_flag)),8)) %>%
  # Calculate funnel limits for funnel plot
  mutate(uwl = 1 + 1.96 * round_half_up(st_err * w_score,8),
         ucl = 1 + 3.09 * round_half_up(st_err * w_score,8),
         lwl = 1 - 1.96 * round_half_up(st_err * w_score,8),
         lcl = 1 - 3.09 * round_half_up(st_err * w_score,8)) %>%  

  # Create flag for where hospital sits on funnel plot
  mutate(flag = case_when(smr > ucl ~ "2",
                          smr > uwl & smr <= ucl ~ "1",
                          smr < lwl & smr >= lcl ~ "1",
                          TRUE ~ "0"))

#Create contact information
#contact1 <- "Isabella Tortora Brayda | Senior Information Analyst | <phs.QualityIndicators@phs.scot>" 
#contact2 <- "Paul Ogharanduku | Senior Information Analyst | <phs.QualityIndicators@phs.scot>"
contact1 <- "Charlotte Hill | Information Analyst | <phs.QualityIndicators@phs.scot>"
contact2 <- "Echo Lian | Senior Information Analyst | <phs.QualityIndicators@phs.scot>"
Hospital Standardised Mortality Ratios
`r yr(end_date)`
An Accredited official statistics release for Scotland
Publication date: `r format(pub_day, "%d %B %Y")`
RESTRICTED STATISTICS: embargoed to 09:30 `r format(pub_day, "%d/%m/%Y")`
About this release
This release by Public Health Scotland (PHS) provides information on Hospital Standardised Mortality Ratios (HSMRs) for the period `r format(start_date_trends, "%B %Y")` to `r format(end_date, "%B %Y")`. These statistics are updated on a quarterly basis and reflect the HSMR for the latest 12-month reporting period, whilst crude mortality data is presented by quarter and month to show trends.
Main points
`r funnel_text(smr_data, "above")[1]` `r funnel_text(smr_data, "below")[1]`
**HSMR for deaths within 30-days of admission, `r yr(end_date)` p**
![This chart shows each hospitals HSMR for the latest 12 month period plotted on a funnel plot.](Chart_1.png) \
Background
Hospital mortality measures have an important role to play in stimulating reflection on the quality and safety of patient care. HSMRs are based on all acute inpatient and day case patients admitted to all specialties in hospital (apart from obstetrics and psychiatry which are excluded). The calculation takes account of patients who died within 30 days from admission and includes deaths that occurred in the community as well as those occurring in hospitals. The Scottish HSMR is 1.00. If an HSMR value for a hospital is less than one, this means the number of deaths within 30 days of admission for this hospital is fewer than predicted. If an HSMR value for a hospital is greater than one, this means the number of deaths within 30 days for this hospital is more than predicted. If the number of deaths is more than predicted this does not necessarily mean that these were avoidable deaths (i.e. that they should not have happened), or that they were unexpected, or were attributable to failings in the quality of care. The methodology has been updated to ensure the diagnosis ICD-10 codes for COVID-19, U07.1 to U07.7, are included in the model. For more information please refer to the [HSMR COVID-19 Methodology Update paper ](https://publichealthscotland.scot/publications/hospital-standardised-mortality-ratios-hsmr-supporting-resources/). During the pandemic hospitals have had to adjust their normal ways of working to react to this healthcare emergency. As a result, there will be changes in the volumes of activity in some of the groups used to calculate the HSMRs, for example fewer elective admissions. Any changes in crude mortality trends and HSMRs should be considered in this context.
Contact
wzxhzdk:1 wzxhzdk:2 For all media enquiries please email or call 0131 275 6105.
Further information
Our statistical practice is regulated by the Office for Statistics Regulation (OSR). These official statistics were independently reviewed by the Office for Statistics Regulation in April 2013. They comply with the standards of trustworthiness, quality and value in the Code of Practice for Statistics and should be labelled ‘accredited official statistics’. [Accredited official statistics](https://osr.statisticsauthority.gov.uk/accredited-official-statistics/) are called National Statistics in the [Statistics and Registration Service Act 2007](https://www.legislation.gov.uk/ukpga/2007/18/contents). [Further information about our statistics and PHS as an Official Statistics producer.](https://publichealthscotland.scot/our-organisation/about-our-statistics/official-statistics/) Data from this publication are available from the [publication page](https://publichealthscotland.scot/publications/hospital-standardised-mortality-ratios) on our website. Open data from this publication is available from the [Scottish Health and Social Care Open Data platform (external website)](https://www.opendata.nhs.scot/dataset/hospital-standardised-mortality-ratios). A [Technical Document](https://publichealthscotland.scot/publications/hospital-standardised-mortality-ratios-hsmr-supporting-resources/) is available on how HSMR is calculated. A [Frequently Asked Questions](https://publichealthscotland.scot/publications/hospital-standardised-mortality-ratios-hsmr-supporting-resources/) document is also available. For more information on HSMR see [HSMR section of our website](https://publichealthscotland.scot/our-areas-of-work/acute-and-emergency-services/hospital-standardised-mortality-ratios-hsmr/hsmr-overview/). **HSMRs published from August 2019 onwards cannot be compared to prior releases using a different methodology**. For more information see [Research and Development](https://publichealthscotland.scot/our-areas-of-work/acute-and-emergency-services/hospital-standardised-mortality-ratios-hsmr/research-and-development/). The next release of this publication will be `r format(pub_date(end_date, "next"), "%d %B %Y")`. Other formats of this publication are available on request at: 0131 314 5300

Public-Health-Scotland/hsmr documentation built on June 24, 2024, 1:48 a.m.