Skip to content

Instantly share code, notes, and snippets.

@bart6114
Last active January 3, 2016 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bart6114/8504833 to your computer and use it in GitHub Desktop.
Save bart6114/8504833 to your computer and use it in GitHub Desktop.
Evolution hospital beds, resources and consumption
========================================================
```{r setup, echo=FALSE, message=FALSE, warning=FALSE}
imgur_insecure<-function (file, key = "75ace4c8e871b86")
{
if (!is.character(key))
stop("The Imgur API Key must be a character string!")
res = RCurl::postForm("https://api.imgur.com/3/image.xml",
image = RCurl::fileUpload(file), .opts = RCurl::curlOptions(httpheader = c(Authorization = paste("Client-ID",
key)),ssl.verifypeer = FALSE))
res = XML::xmlToList(res)
if (is.null(res$link))
stop("failed to upload ", file)
structure(res$link, XML = res)
}
opts_knit$set(upload.fun = imgur_insecure)
setInternet2(TRUE)
```
For this analysis publicly available data from the [OECD](http://stats.oecd.org/) is used. The time series run from 1975 to 2013 (where available).
Let's focus on Belgium, Germany, France, The Netherlands, United Kingdom, United States, Norway and Switzerland and have a look at their number of hospital beds per 1000 population. The blue line is a trend line (linear regression).
<center>
```{r hospital-beds, fig.height=10, echo=FALSE,message=FALSE,warning=FALSE}
require(ggplot2)
focus_countries = c("Belgium", "Germany", "France", "Netherlands", "United Kingdom", "United States", "Norway", "Switzerland")
# source: OECD 2014
hospital_beds<-
read.csv("https://gist.github.com/Bart6114/8504395/raw/61403a4418aa8af3d40508314a62ce17511d7975/OECDcareresources.csv")
# drop countries not in focus & years < 1975
hospital_beds<-
subset(hospital_beds, Country %in% focus_countries & Year>=1975)
ggplot(subset(hospital_beds, Unit=="Per 1 000 population"))+
aes(x=Year,y=Value)+
stat_smooth(method="glm")+
geom_line()+
geom_point(size=2.5)+
facet_wrap(~Country, ncol=2, as.table=F)+
ggtitle("Number of hospital beds per 1 000 population")
```
</center>
This already shows an interesting trend; all countries show a decrease in the number of hospital beds per 1 000 population. This most likely is the result from advances in medicine. This has made it possible to decrease the length of stay and transform some hospital stays to ambulatory care / ambulatory surgery.
### Nurse-to-bed ratio
<center>
```{r nurse-to-bed-ratio, fig.height=10, echo=FALSE,message=FALSE,warning=FALSE}
ggplot(subset(hospital_beds, Unit %in% c("Nurse-to-bed ratio (FTE)","Nurse-to-bed ratio (head counts)")))+
aes(x=Year,y=Value, group=Unit, pch=Unit)+
stat_smooth(method="glm")+
geom_line()+
geom_point(size=2.5)+
facet_wrap(~Country, ncol=2, as.table=F)+
ggtitle("Nurse-to-bed ratio")+
theme(legend.position="bottom")
```
</center>
On the other hand, the nurse-to-bed ratio seems to remain stable or is growing in most countries. It is important to note that the _number of nurses_ refers to all active nurses in these countries and not only those active in bed-side care.
### Number of discharges / consultations
Another important factor here is whether the need for care is growing. We can get a notion of this by looking at the number of discharges and consultations.
<center>
```{r inpatient-care-discharges, fig.height=10, echo=FALSE,message=FALSE,warning=FALSE}
care_amount<-
read.csv("https://gist.github.com/Bart6114/8504395/raw/732396c1f69a5ace56248a8e4a6017cb16b97a22/OECDcareutilization.csv")
care_amount<-
subset(care_amount, Country %in% focus_countries & Year>=1975)
ggplot(subset(care_amount,Unit=="Per 100 000 population"&Variable=="Inpatient care discharges (all hospitals)"))+
aes(x=Year, y=Value)+
stat_smooth(method="glm")+
geom_line()+
geom_point(size=2.5)+
facet_wrap(~Country, ncol=2, as.table=F)+
ggtitle("Inpatient care discharges (per 100 000 population)")
```
</center>
### Length-of-stay
The number of inpatient discharges seems to be growing overall. This is somewhat contra-intuitive with a decrease in the number of hospital beds. However, the overall decrease in length-of-stay probably offsets the decrease in hospital beds. Let's have a look at the evolution of the average length-of-stay.
<center>
```{r LOS, fig.height=10, echo=FALSE,message=FALSE,warning=FALSE}
ggplot(subset(care_amount,Unit=="Days"&Variable=="Inpatient care average length of stay (all hospitals)"))+
aes(x=Year, y=Value)+
stat_smooth(method="glm")+
geom_line()+
geom_point(size=2.5)+
facet_wrap(~Country, ncol=2, as.table=F)+
ggtitle("Average length-of-stay")
```
</center>
### Oupatient care
If there is indeed a shift from hospital based care towards outpatient / ambulatory care, the consultation data should and does show this:
<center>
```{r number-consultations, fig.height=10, echo=FALSE,message=FALSE,warning=FALSE}
ggplot(subset(care_amount,Unit=="Number per capita"&Variable %in% c("Outpatient consultations in hospital","Doctors consultations (in all settings)")))+
aes(x=Year, y=Value, pch=Variable, group=Variable)+
stat_smooth(method="glm")+
geom_line()+
geom_point(size=2.5)+
facet_wrap(~Country, ncol=2, as.table=F)+
ggtitle("Outpatient hospital consultations (per capita)")+
theme(legend.position="bottom")
```
</center>
## Summary
* Number of hospital beds per 1000 is decreasing overall
* Nurse-to-bed ratio: growing overall (fast in US and Norway)
* Number of discharges: slowing increasing overall
* Length-of-stay: strong decrease overall
* Outpatient care: steady to slow growth
The R analysis can be found here: ()[https://gist.github.com/Bart6114/8504833]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment