The Stakeholder Metrics Dashboard is an Rshiny App currently being developed by RS + JP in order to provide real-time recruitment data visualizations to the C4CP stakeholders. The app is currently hosted on the dev server of Posit-Connect: https://appshare-dev.cancer.gov/
.
The main body of the dashboard is contained in the app.R
file, saved in the stakeholderMetrics/app
folder. This file is where all UI is defined and where all plots are called and aggregated. Each plot is contained in a separate file, which matches the function named within the file. All plots are generated from data saved in the table: nih-nci-dceg-connect-bq2-prod.StakeHolderMetrics_RS.complete_table
and nih-nci-dceg-connect-bq2-prod.StakeHolderMetrics_RS.invited_participants_complete
. This table is also a work-in-progress. Queries used to generate the variables within this table are located in the stakeholderMetrics/bq2_queries/
directory.
The application has 2 basic functions which generate the graphical interface. The server
function authenticates the user (this authentication code was written by D. Russ), pulls data from GCP, cleans the data (mostly labeling data, not much cleaning is done), filters data (if filters are used) and creates plots. The server
function is called exactly once when the app is started. However, the reactive
components, such as filtering data based on user-identified values, will be re-triggered, once the applyFilters
button is pressed. Plots will also be re-generated with the newly filtered data.
The second function of the app is the ui
component. This is where aesthetics and layouts for the dashboard are built. Every component built in the ui
function will be referenced in the server
function. If a plot is not showing up, its most likely not defined in both the ui
and server
components.
Finally, most of the aesthetics of the dashboard are housed in the customCSS.R
file. This file applies rules globally to the dashboard and its elements such as: dashboard and plot fonts, font sizes, plot bucket sizes, dashboard element color palette.
There is no installation or set up required for a user to begin editing the dashboard application code. There is however, set up required to access the app.
In order for a new user to access the application on Posit Connect:
- Navigate to:
https://appshare-dev.cancer.gov/
. NOTE: You must be on the VPN to see the app at this link. - Login using your NIH credentials
- Alert RS or JP that you have logged-in and are ready to be invited to the app
- RS/JP will add you to the approved user list
- You will receive an email from Posit about your app access
If you are tasked with making any changes to the dashboard, please assign yourself a specific, detailed issue and create a branch for that issue.
Stakeholder Metrics Dashboard Data Pipeline
Stakeholder Metrics Dashboard Scheduled Query Structure
Dashboard Tab | Datasource | Datasource Update Schedule |
---|---|---|
Verified | nih-nci-dceg-connect-bq2-prod.StakeHolderMetrics_RS.complete_table |
complete query , 12pm daily |
Verified | nih-nci-dceg-connect-bq2-prod.StakeHolderMetrics_RS.figure1_activity |
figure1_activity , 11am daily |
Verified | nih-nci-dceg-connect-bq2-prod.StakeHolderMetrics_RS.figure2_age |
figure2_age , 11am daily |
Verified | nih-nci-dceg-connect-bq2-prod.StakeHolderMetrics_RS.figure3_race |
figure3_race , 11am daily |
Invited | nih-nci-dceg-connect-bq2-prod.StakeHolderMetrics_RS.invited_participants_complete |
invited_participants_complete , updated 12pm daily |
Note Before publishing the app, ensure that Daniel Russ's OAuth code has been uncommented! Users must complete the OAuth dance. However, when editing the dashboard locally, comment this code as it is unnecessary and will break the app.
Note If you are publishing a new application on Posit, be sure to configure the Service key environment variable in the posit environment. This environment variable is passed to the DR OAuth code mentioned previously. You can create the environment variable in the application, in the RHS menu under "Variables". This variable name must match the variable name that is passed through to the OAuth code.
As of 3/12/24, we are publishing the app on the posit dev server: https://appshare-dev.cancer.gov/. The name of the app: Stakeholer Dashboard, Author: Rebecca Sansale. How to Publish the app from Rstudio:
-
Login to the VPN and Posit Connect.
-
Open the "app.R" file in Rstudio
-
A small drop-down menu with appear, if you see the "Stakeholder Dashboard" option, click that one.
-
A pop up window will appear. Check the name of the dashboard you are updating (middle right panel) and that the user account information is correct. Ensure all files that the app requires to run are selected in the left panel.
-
Click "publish"
-
Posit connect will open in your browser, directly to the app page.