Skip to content

Commit

Permalink
Minor edits, applied styler, added NHSRdatasets
Browse files Browse the repository at this point in the history
  • Loading branch information
Lextuga007 committed Oct 1, 2024
1 parent e49552b commit ae90f7f
Showing 1 changed file with 58 additions and 40 deletions.
98 changes: 58 additions & 40 deletions vignettes/synthetic_news_data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,102 +19,120 @@ knitr::opts_chunk$set(

This dataset is available from the [NHSRDatasets](https://CRAN.R-project.org/package=NHSRdatasets) package and similar comparisons can be made with the above. These examples can be used for data wrangling and data visualisation.

```{r}
library(NHSRdatasets)
NEWS_var <- NHSRdatasets::synthetic_news_data
```

For mode information about the [synthpop](http://gradientdescending.com/generating-synthetic-data-sets-with-synthpop-in-r/) package.

## What is NEWS?

NEWS is short for the National Early Warning Score. [NHS England have provided a detailed introduction here](https://www.england.nhs.uk/ourwork/clinical-policy/sepsis/nationalearlywarningscore/)

The latest iteration of the NEWS score is NEWS2
The latest iteration of the NEWS score is NEWS2.

The premise of NEWS is that physiology such as heart rate (pulse), respiration rate, consciousness (GCS or AVPU) are all routinely measured.

The premise of NEWS is that physiology such as heart rate (pulse), respiration rate, consciousness (GCS or AVPU) are all routinely measured.
GCS = Glasgow Coma Score (Categorical score 3-15) measuring the Eyes, verbal and motor responses.
AVPU = A categorical description of how concious a patient is A - Alert, V - Responds to voice, P - Responds to painful stimuli, U - Unresponsive
AVPU = A categorical description of how concious a patient is A - Alert, V - Responds to voice, P - Responds to painful stimuli, U - Unresponsive.

However there are a range of professional groups who use these measurements, and it can e challenging to recognise the deteriorating patient from the raw measurements alone especially if you do not often work with acutely unwell patients
However there are a range of professional groups who use these measurements, and it can e challenging to recognise the deteriorating patient from the raw measurements alone especially if you do not often work with acutely unwell patients.

NEWS(2) provides categorical classifications for distinct ranges of physiology. Each category is scored 0-3
NEWS(2) provides categorical classifications for distinct ranges of physiology. Each category is scored 0-3.

The more abnormal a measure of physiology the greater the categorical score attributed. The score is supposed to be calculated at the time the physiology is measured. In a hospital this is often when the nurse or healthcare assistant completes their observation rounds.

The categorical NEWS score then is linked to distinct actions that should be followed. These actions will typically be localised by organisations depending on the level of resource that is available to support medical emergencies.

### Criticisms of NEWS

There are some criticisms of NEWS that were addressed by NEWS2. These were that normal measures of Oxygen saturation (SpO2) were not universal and often meant over escalation of "normal" abnormal physiology in patients with respiratory diseases such as COPD. These were addressed though adjusted ranges for SpO2.

There have also been concerns that in some cases the NEWS score has been introduced to settings (often mandatory) where it has not been validated. The Score was developed by the Royal College of Physicians. They often represent clinical specialties who work in, in-patient medicine. As such the data that was used to develop the score was based on data from patients who were typically out of the acute phase of their illness and so abnormal physiology was a measure post therapeutic interventions. In most Cases NEWS has been shown to be robust to these criticisms.
There have also been concerns that in some cases the NEWS score has been introduced to settings (often mandatory) where it has not been validated. The Score was developed by the Royal College of Physicians. They often represent clinical specialties who work in-patient medicine. As such the data that was used to develop the score was based on data from patients who were typically out of the acute phase of their illness and so abnormal physiology was a measure post therapeutic interventions. In most Cases NEWS has been shown to be robust to these criticisms.

NEWS is more work for (typically nursing) staff to complete, NEWS is also not validated as an incomplete score for example where just a heart rate, Blood pressure and SpO2 are recorded which is a common set of measurements in most outpatient settings.

### Here are some code chunks for the calculation of NEWS sub scores:

#### Systolic Blood pressure
#### Systolic Blood pressure (column `syst`)

```{r}
sbp_news <- NEWS_var%>%
mutate (sbp = as.numeric(pulse)) %>%
library(NHSRdatasets)
library(dplyr)
sbp_news <- NEWS_var |>
mutate(sbp = as.numeric(syst)) |>
mutate(news = case_when(
sbp <= 90 | sbp >=220 ~ 3,
sbp <= 90 | sbp >= 220 ~ 3,
sbp %in% c(91:100) ~ 2,
sbp %in% c(101:110) ~ 1,
!is.numeric(pulse) ~ NA_real_,
TRUE ~ 0)
)
TRUE ~ 0
))
```

#### Heart Rate
#### Heart Rate (column `pulse`)

```{r}
hr_news <- NEWS_var%>%
mutate (pulse = as.numeric(pulse)) %>%
hr_news <- NEWS_var |>
mutate(pulse = as.numeric(pulse)) |>
mutate(news = case_when(
pulse <= 40 | pulse >=131 ~ 3,
pulse <= 40 | pulse >= 131 ~ 3,
pulse %in% c(111:130) ~ 2,
pulse %in% c(41:50,91:110) ~ 1,
pulse %in% c(41:50, 91:110) ~ 1,
!is.numeric(pulse) ~ NA_real_,
TRUE ~ 0)
)
TRUE ~ 0
))
```

#### Resp Rate
#### Resp Rate (column `resp`)

```{r}
rr_news <- NEWS_var%>%
mutate (resp_rate = as.numeric(resp_rate)) %>%
rr_news <- NEWS_var |>
mutate(resp_rate = as.numeric(resp)) |>
mutate(news = case_when(
resp_rate <= 8 | resp_rate >=25 ~ 3,
resp_rate <= 8 | resp_rate >= 25 ~ 3,
resp_rate %in% c(21:24) ~ 2,
resp_rate %in% c(9:11) ~ 1,
!is.numeric(resp_rate) ~ NA_real_,
TRUE ~ 0)
)
TRUE ~ 0
))
```

#### SpO2
#### SpO2 Oxygen Saturation (column `sat`)

```{r}
NEWS_var%>%
NEWS_var |>
mutate(news = case_when(
spo2 <= 91 ~3,
spo2 %in% c(92:93) ~2,
spo2 %in% c(94:95) ~1,
!is.numeric(spo2) ~ NA_real_,
sat <= 91 ~ 3,
sat %in% c(92:93) ~ 2,
sat %in% c(94:95) ~ 1,
!is.numeric(sat) ~ NA_real_,
TRUE ~ 0
))
```

#### Temperature
#### Temperature (column `temp`)

```{r}
NEWS_var%>%
NEWS_var |>
mutate(news = case_when(
temperature <= 35 ~ 3,
temperature >= 39.1 ~ 2,
temperature %in% c(38.1:39,35.1:36) ~ 1,
!is.numeric(temperature) ~ NA_real_,
TRUE ~ 0))
temp <= 35 ~ 3,
temp >= 39.1 ~ 2,
temp %in% c(38.1:39, 35.1:36) ~ 1,
!is.numeric(temp) ~ NA_real_,
TRUE ~ 0
))
```

In addition NEWS2 has altered ranges for patients with known respiratory diseases. These need additional logic on a per patient basis to implement.


## Summary

In many ways, synthetic data reflects George Boxs observation that all models are wrong, but some are useful while providing a useful approximation [of] those found in the real world,”
In many ways, synthetic data reflects George Box's observation that "all models are wrong, but some are useful" while providing a "useful approximation [of] those found in the real world".

The connection between the clinical outcomes of a patient visits and costs rarely exist in practice, so being able to assess these trade-offs in synthetic data allow for measurement and enhancement of the value of care – cost divided by outcomes.

Expand Down

0 comments on commit ae90f7f

Please sign in to comment.