# Department for redundancy department results of staff survey questionnaire

Figure 1: The first figure

It’s reasonably clear, so it passes the first test, but really the decimal places are redundant, as are the frequency counts. Much nicer in a bar chart, of course:

```
barplot(c(23.6, 24.2, 26.4, 20.2, 6.2),
names.arg = c("Not at all", "Not entirely", "Ambivalent", "Somewhat", "Very"),
col = heat.colors(5), ylab="%", main = "Happiness with new PDPR procedure")

```

Voila!

# Shiny application in a morning

Sort of apropos of nothing, really, this, but I was doing some research with some colleagues the other day and to help out I built a shiny application in a morning. Munging the data etc. took ages as it always does but once I actually had everything clean and tidy and working laying an interface on top was the easy bit. What a fantastic tool it really is, completely changed the way we work with data now we can just throw stuff on the internet and let people play around just in the morning. My sincere thanks to all the devs at RStudio.

Nothing Earth shattering really, just a few tick boxes and some binomial distribution numbers, but should prove useful. It’s here, in case you’re curious, source code below (I’ll just post the server.R and ui.R files on top of each other for simplicity, you get the idea.

```
### server.R

library(shiny)
library(xtable)

rm(list=ls())

variables = names(shinyData)[4:19]

shinyServer(function(input, output) {

myValues = reactive({

if(length(input\$prison) > 0){

subData = subset(shinyData, Prison %in% input\$prison)

} else {

subData = shinyData

}

if(length(input\$traits) > 0){

for(z in input\$traits){

subData = subData[which(subData[,z] == 1),]

}

}

subData

})

output\$outTable <- renderTable({

Results = sapply(variables, function(x) rbind(prop.table(table(factor(myValues()[,x], levels=0:1))) * 100))[2,]

CI = 100-sapply(variables, function(y) binom.test(table(factor(myValues()[,y], levels = 0:1)))[["conf.int"]])*100

finalTab = data.frame("Estimate" = Results, t(CI[2:1,]))

names(finalTab)[2:3] = c("Low CI", "High CI")

xtable(finalTab, digits=1)

})

output\$nResponses = renderText({

paste("n = ", nrow(myValues()))

})

})

### ui.R

library(shiny)

shinyUI(pageWithSidebar(

# Application title

sidebarPanel(

checkboxGroupInput("prison",
"Area",
c("A", "B", "C"),
selected = c("A", "B", "C")
),

checkboxGroupInput("traits",
"Characteristics",
c("Drug", "Psychosis", "Depression",
"Anxiety", "BPD", "Alcohol", "PTSD", "OCD", "Bipolar", "Paranoid.PD",
"Dependent.PD", "Dissocial.PD", "PD", "Referral", "Any", "NonDrug"),
selected = c(NULL)
)

),

mainPanel(
tableOutput("outTable"),
textOutput("nResponses")
)
))
```

# It’s alive!

Well, it finally launched today, the patient feedback website that we created as part of the Patient Feedback Challenge. The evaluation section was part of a partnership with the Involvement Centre of Nottinghamshire Healthcare NHS Trust and the web design agency Numiko to build a website which can help us to collect feedback data, summarise and report on it and share the actions and learning which have resulted. Go have a look.

Part of the philosophy of the feedback challenge was that the good practice should be “spreadable” and the website is all built using free and open source technologies (Linux servers, all data and graphs processed using R etc.). We plan to roll it out in as many Trusts as possible and will charge a small sum for redesigns and changes to data processing which will allow us to repurpose it for different Trusts as well as supporting further development of the site.

The use of free tools as well as the relative simplicity of the data processing ensures that we can add features relatively easily and over the next year we plan to overhaul the site in response to user feedback to make sure it meets the needs of Nottinghamshire Healthcare Trust staff, service users, and carers, as well as members of the public. Putting our feedback on the internet so anybody can view it and making archived data searchable is a powerful tool in ensuring the quality and accountability of services, as well as allowing the Trust to demonstrate its high levels of user satisfaction to other public bodies and members of the public.

There were two bits of coding work that made up the majority of my contribution, the quarterly report function which summarises feedback at all levels of the organisation in a series of hyperlinked webpages and the custom search function which uses the very simple Shiny package to allow users to query different types of data and search by service type, demographic feature, keyword, etc. The code for both can be found at my GitHub page. I hope to make time to comment the code a little better soon when I have a bit of spare time.

Feedback about the site is very welcome and contributions are actively being sought in order to include in a work plan for the site over the next year. First job- rewrite the custom search function to reflect changes in the shiny library since I started the project!