Coder Social home page Coder Social logo

the-strategy-unit / experiencesdashboard Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 4.0 33.11 MB

Shiny dashboard visualising and analysing patient experience data from the NHS England Friends and Family Test (https://www.england.nhs.uk/fft/)

Home Page: https://connect.strategyunitwm.nhs.uk/qdc_public/

License: Other

R 0.27% CSS 0.01% HTML 99.73% JavaScript 0.01%
patient-experience shiny golem

experiencesdashboard's Introduction

experiencesdashboard

Lifecycle: experimental

About

This read me is based on version 0.7.2

The Experience dashboard is the front end tool (Shiny App) for the Patient Experience Qualitative Data Categorisation project, funded by NHS England and hosted by Nottinghamshire Healthcare NHS Foundation Trust. It ties a machine learning back-end, the Pxtextmining, to the data source via an API and present metrics and graphs to help clinical staffs and managers quickly gain insight from patient experience data collected via the NHS England Friends and Family Test.

Link to hosted version. Please note that some of the data has been modified for the purposes of demonstration so it should NOT be used for reporting and is not accurate in several important ways.

Folder Stucture

This shiny app is built using golem and follows the advised folder structure. Because a golem application is an R package, this package incorporates all the benefits that comes with R package development and management process.

Below is the folder structure and general description of the content of each important folder.

fs::dir_tree(recurse = 0)
experiencesdashboard
├── .github/workflows
├── LICENSE
├── LICENSE.md
├── NEWS.md
├── README.md
├── CODE_OF_CONDUCT.md
├── app.R
├── DESCRIPTION
├── NAMESPACE
├── vignettes/
├── R/
├── dev/
├── inst/
├── tests/
├── data/
├── data-raw/
├── man/
└── rsconnect/

Name Link Description
.github/workflows [Link] Github Action workflow files that automate the R CMD check and deployment process
app.R [Link] A golem file that contains the set of functions needed to deploy the app on any platform such as Posit Connect, etc
DESCRIPTION [Link] A standard R package file containing series of metadata about the package including the package dependencies required to run the app. It forms a key part of the dependency management
NAMESPACE [Link] A standard R package file that contains functions to import and from which package and what functions to export
R/ [Link] Standard R package folder holding all the package functions. It contains the functions required for the app core functionality such as the Server function app_server.R, UI function app_ui.R, all the modules mod_* files and utilitarian/business logic functions fct_*.R or *utils*.R/ or other .R files. It also contains an important file, run_app.R, which in turn contains the run_app() function that is called to launch the app
dev/ [Link] This folder contains utilitarian files used during development phase only and not core functionalities of the app.
inst/ [Link] It contains the golem-config.yml file and inst/app/www/ files. inst/app/www/ contains all files that are made available at application run time, while golem-config.yml is an important yaml file to configure the app.
test/ [Link] This folder contains the codes for the unit test infrastructure
data/ [Link] Contains .rda data used by the app during runtime
data-raw/ [Link] It contains scripts to prepare dataset in the data folder. We also store some data in there that are not required at runtime
man/ [Link] This is a standard R package folder containing automatically filled files for function documentations
rsconnect/ [Link] Contains posit connect deployment files

Built With

Using this Solution

The implementation you will follow will depend on your use case and if you have access to the project database (for internal users).

A. Installation:

Follow this approach if you have the right access to this project database

Install the package

{experiencesdashboard} is not currently on CRAN, so you will have to install it directly from Github.

# install.packages("devtools")
devtools::install_github("CDU-data-science-team/experiencesdashboard")

Run the app

library(experiencesdashboard) # load the package
# usethis::edit_r_environ() # add the environment variables to connect to the database. see `get_pool()`
Sys.setenv("R_CONFIG_ACTIVE" = "my_config") # set the configuration to use inline with the `golem-config.yml` file
run_app() # run the app

B. Local Implementation with your own data

This package uses data from a database to populate the dashboard. The get_pool() set up the DB connection. To use this package locally and on your own dataset, you will need to do the following:

  1. Clone the repo. cloning-a-repository

  2. Connect your data either
    a. Via Database Connection: Set the environmental variables needed to establish a Database connection (see get_pool())

    b. Via Local file: Read in your data into the db_data object in the app_server.R by replacing db_data <- get_db_data(pool, get_golem_config("trust_name"))) with e.g. db_data <- read.csv(''my_data_path.csv). With this you can safely ignore the preceding codes that creates the db connection.

  3. Set up your data/app configuration: If you need to use this app locally, then you will need to set up a configuration for your use case in the golem-config.yml (get help here)

  4. choose your configuration: run Sys.setenv("R_CONFIG_ACTIVE" = "my_config") and run the app with run_app(). please see sample code in the run_dev.R

Format your data for the app

Your data type must follow the schema in Database table schema before you can load the data into the app in step 2 above. Though not all the columns are required but to ignore any will depend on your configuration in step 3 above.

i. You can safely ignore these columns without any modification: 'extra_variable_1', 'extra_variable_2', 'extra_variable_3'

ii. To ignore the following columns 'location_2', 'location_3', 'sex', 'gender', 'age', 'ethnicity', 'sexuality', 'disability', 'religion', You need to set your configuration file accordingly. A sample configuation is this:

my_config:
  trust_name: my_config
  comment_1: Why did you answer this way?
  comment_2: What could be improved?
  question_1: fft
  location_1: Division

Please get in touch if you need additional help implementing this solution locally.

Code of Conduct

Please note that the experiencesdashboard project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

Distributed under a MIT License. See LICENSE.md for more information.

experiencesdashboard's People

Contributors

asegun-cod avatar chrisbeeley avatar dependabot[bot] avatar milanwiedemann avatar yiwen-h avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

experiencesdashboard's Issues

Can't load from devtools

When I run the code from README (or even try to build on my laptop) I get the following error:

devtools::install_github("CDU-data-science-team/experiencesdashboard")

Error

Downloading GitHub repo CDU-data-science-team/experiencesdashboard@HEAD
Error: Failed to install 'experiencesdashboard' from GitHub:
  Missing commas separating Remotes: 'CDU-data-science-team/nottshcMethods
    CDU-data-science-team/experienceAnalysis@development'

Local build error:

ERROR: dependencies 'dashboardthemes', 'waiter', 'shinyjqui', 'timevis', 'UpSetR', 'tibbletime', 'tidytext', 'experienceAnalysis', 'reticulate', 'Rdpack' are not available for package 'experiencesdashboard'

Add report on demographic features

Produce an integrated report that summarises numbers of different demographic groups in the survey as compared with the number in the service and the population well as different scores and comments for each demographic group

make these inputs generic

generate customisable reports

I'd like to be able to generate customisable reports in the app:

  1. first make some selections (e.g. date range, division, ...)
  2. then apply all these selections to differents parts of the shiny app that the user selects e.g.,
  • user1 selects these elements from the shiny app

    • generate table from tab1 (e.g. patient experiences)
    • generate plot from tab2 (e.g. staff experiences)
    • generate text summarising tab3 (e.g. complaints)
  • user2 selects these elements from the shiny app

    • generate plot from tab1 (e.g. patient experiences)
    • generate table from tab2 (e.g. staff experiences)
    • generate text summarising tab4 (e.g. compliments)

do you think this is a good idea @ChrisBeeley ? and do you think it's possible?

Add facility to download complex comments for review

It would be useful if users could download comments that are likely to be insufficiently described by one code so they can be manually reviewed. Examples of comments that would be included are:

  • Long comments
  • Comments where the document vector representations of the sentences within them are far apart
  • (if we adopted a probabilistic ML model) comments where there isn't a clear winner for which category they belong to

Report.Rmd not found

As can be seen in the following places:

754870a

dc331b6

2819195

I can't get the Rmd to be found when the package is installed from GitHub. I've tried moving it to inst/ and to inst/app/www and have not been able to resolve.

I would love some help with it, I feel like I've tried everything

Add to demo

Consider either removing the FFT and demographics tab from the demo, or adding in fake data automatically to make them work

add module for processing input data and help set up ui

I haven't thought about it in detail but I think we need a separate data module that does all this stuff- looks at the data in the application and figures out what everything is, what the date column is, where the location columns are, what they're called and how many there are, all that stuff. The data module can feed the other modules data as well as meta data (number of columns, number of categories...)

Originally posted by @ChrisBeeley in #2 (comment)

Add interactivity to upset plot

I was thinking an obvious improvement to the upset plot would be interactivity. Clicking on it would either bring up the relevant comments or flick to the comment tab and pre populate the controls to show those sentiments.

Interactivity seems difficult/ impossible (?) with UpsetR and ggupset but looks simple with {upsetjs} https://cran.r-project.org/web/packages/upsetjs/

I don't really understand upset plots but if you can plot it with upsetjs I can handle the interactivity?

Fix demographics

Real demographic data from trust C is not working well. Clean and fix

Add "give feedback about bad codes" button

It would be useful if users could interact with a comment that is badly tagged and send that information back to us. Probably the control would just open an email with the text in, nothing more complex than that

Produce demo version for cloud

It would be useful to have a dummy version of the application in the cloud so anybody could put their data in and see the results come back

Ensure that sentiment and weighting plots have sensible defaults

At present the sentiment/ weighting tab allows selection of themes which are not present in the data, and doesn't always land on a combination of themes which are present in the data. Themes which don't exist in the current selection should be removed so users can't click on things that don't do anything

Use {nottshc} package to download the data from our Trust

The experience data for nottshc is now available from the {nottshc} package so it would be good to use that to load the data from.

In theory the data could be pulled live off the server rather than relying on .rda files as at present but we'd have to see what this did to the speed of the app (it may speed it up since otherwise the full version will download 12 years of data)

Extend the choices for the SPC chart

SPC XMR type charts are required- the default should be monthly, but there may need to be extra options that can be used when there are fewer data points available.

Error running the app

I've loaded the package and dependencies and when I run the app it appears but then shuts down with an error:

> shiny::runApp()
Loading required package: shiny
Warning in loadSupport(appDir, renv = sharedEnv, globalrenv = NULL) :
  Loading R/ subdirectory for Shiny application, but this directory appears to contain an R package. Sourcing files in R/ may cause unexpected behavior.
i Loading experiencesdashboard

Listening on http://127.0.0.1:4255
Warning: Error in : nanodbc/nanodbc.cpp:1021: IM002: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified 
  62: <Anonymous>
Error : nanodbc/nanodbc.cpp:1021: IM002: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified 

I've tried reloading the package when on the VPN as that sometimes helps but I still get the same error.

Produce a better search tool

Improve text searching- allow multiple selections, excluding text, and maybe a semantic search (this could even use document vectors if we want to get really clever)

Add simple downloadable reports

#7 references reports but is quite a complicated implementation of them in the 0.3 release. We need some simple reports in the 0.2 release so the partner trusts can use and review example reports.

They could just consist of:

  • an SPC for the FFT question (see #17 )
  • A table summarising the % of each theme
  • A table summarising the +ve -ve level of criticality/ sentiment
  • Maybe a table that cross tabs theme and criticality/ sentiment

It will kick off a conversation even if it's not quite what they want

Rapid prototyping with shinipsum

I think we're missing a trick by not prototyping with {shinipsum} https://cran.r-project.org/web/packages/shinipsum/index.html

I'm going to rebuild the whole thing with a data module for #5 and throw up some wireframes with shinipsum. This will help us to at least have placeholder stuff in when we talk to our partners, even if the output isn't built. Then we can talk about the structure and flesh out the components at the same time.

Add demographic features

Report number of surveys from different demographic groups and compare with the population in the service and the community population

Remove automatic population of filter boxes

Many filter boxes automatically populate with random data, this was done for dev purposes and is now unhelpful. All filters should start empty and default to returning all data

Word clouds

Everyone loves word clouds 😄

(well, most people do 😉 )

Let's include word clouds somewhere too

Extend upload to multiple comments

Upload functionality only currently works for single comments. Extend it to allow multiple comments to be uploaded and tagged simultaneously

Produce downloadable version

There was a downloadable version, but it doesn't work now because the app works with MySQL rather than data/.

Add a downloadable version

Add "upload new data" button

In live use users are likely going to want to add new data, which they will need to do with a spreadsheet in a particular format.

The button will upload the data, run it through the classification algorithm via reticulate, and then write the data back to the database. This issue will add the button and allow nonsense categories to be written to the database, a linked issue will add the reticulate pipeline

SPC for FFT question

Lots of trusts seem to have SPC charts for the ticky box FFT question (although ours doesn't). We should add it as an option.

For the purposes of the repo we can make fake FFT data because we don't need to publish actual FFT data on here

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.