The following guide walks you through the basic steps to set up, build and deploy your own Cancer InFocus (CIF) dashboards using the v5-2 release. The end result is the “default” version of the Cancer InFocus dashboards. Additional tutorials will be available to help you customize CIF dashboards to meet your specific needs.
First, you’ll want to set up a folder in your working directory to house all of your R files (name this whatever you want). You’ll need separate subfolders for each of the Cancer InFocus dashboards you choose to create. Our suggested naming convention for these subfolders are:
ShinyCIF
– for the main CIF dashboardShinyCIFProfiles
– for CIF ProfilesShinyCIFBivar
– for CIF\(^2\) (Bivariate)ShinyCIFHotspots
– for CIF Hot SpotsWe will use these conventions throughout the document. Each dashboard
folder should also be given one subfolder named www
.
Your final folder setup, or directory, should look like this.
.
|-- ShinyCIF/
| `-- www/
|-- ShinyCIFProfiles/
| `-- www/
|-- ShinyCIFBivar/
| `-- www/
`-- ShinyCIFHotspots/
`-- www/
Download the following files from GitHub,
CIFvars_v5-2.R
data_download_v5-2.R
cif_create_shapefiles_v5-2.R
cif_geocode_facilities_v5-2.R
cif_create_app_v5-2.R
and place them into the ShinyCIF
folder you created.
If you plan to build CIF Profiles, download
cif_profiles_create_app_v5-2.R
into
ShinyCIFProfiles
and CIFReport_v5-2.Rmd
into
ShinyCIFProfiles/www
.
If you plan to build CIF\(^2\)
(Bivariate), download the file cif2_create_app_v5-2.R
into
ShinyCIFBivar
and scatterplot_example.png
into
ShinyCIFBivar/www
.
If you plan to build CIF Hot Spots, download the file
cif_hotspots_create_app_v5-2.R
into
ShinyCIFHotspots
.
At this point, you file directory should look like this.
.
|-- ShinyCIF/
| |-- CIFvars_v5-2.R
| |-- data_download_v5-2.R
| |-- cif_create_shapefiles_v5-2.R
| |-- cif_geocode_facilities_v5-2.R
| |-- cif_create_app_v5-2.R
| `-- www/
|-- ShinyCIFProfiles/
| |-- cif_profiles_create_app_v5-2.R
| `-- www/
| `-- CIFReport_v5-2.Rmd
|-- ShinyCIFBivar/
| |-- cif2_create_app_v5-2.R
| `-- www/
| |-- scatterplot_example.png
`-- ShinyCIFHotspots/
|-- cif_hotspots_create_app_v5-2.R
`-- www/
The first section, ShinyCIF
, will be required, while the
ShinyCIFProfiles
, ShinyCIFBivar
, and
ShinyCIFHotspots
sections will depend on your build
choices.
Also, replace each case of uky
with your organization’s
corresponding catchment area short name (e.g. Maryland = ‘umd’ , Wake
Forest = ‘wake’, etc.)
You will now place the logo files you’ve received into their
appropriate /www
subfolders.
You should receive the following logos files with the following phrases in the name.
...big_logo_light...
for the CIF main
dashboard...profiles...
AND
...big_logo...
(no ‘light’) for CIF profiles...2_big_logo_light...
for CIF\(^2\) (Bivariate)...._hotspots...
for CIF Hot Spots.After placing the logo files in their proper folders, your directory should resemble this, depending on how many dashboards you are working with.
.
|-- ShinyCIF/
| |-- CIFvars_v5-2.R
| |-- data_download_v5-2.R
| |-- cif_create_shapefiles_v5-2.R
| |-- cif_geocode_facilities_v5-2.R
| |-- cif_create_app_v5-2.R
| `-- www/
| `-- cif_uky_big_logo_light_tm.png
|-- ShinyCIFProfiles/
| |-- cif_profiles_create_app_v5-2.R
| `-- www/
| |-- CIFReport_v5-2.Rmd
| |-- cif_profiles_uky_light.png
| `-- cif_uky_big_logo_tm.png
|-- ShinyCIFBivar/
| |-- cif2_create_app_v5-2.R
| `-- www/
| |-- cif_uky2_big_logo_light_tm.png
| `-- scatterplot_example.png
`-- ShinyCIFHotspots/
|-- cif_hotspots_create_app_v5-2.R
`-- www/
`-- cif_hotspots_uky_big_light.png
Again, the first section, ShinyCIF
, will be required,
while the ShinyCIFProfiles
, ShinyCIFBivar
, and
ShinyCIFHotspots
sections will depend on your build
choices.
Also, replace each case of uky
with your organization’s
corresponding abbreviation (e.g. Maryland = umd
, Wake
Forest = wake
, etc.)
Open CIFvars_v5-2.R
, change the noted items inside the
Sys.setenv()
function (marked with #!
), and
run. CIFvars_v5-2.R
will run the
data_download_v5-2.R
,
cif_create_shapefiles_v5-2.R
and
cif_geocode_facilities_v5-2.R
files to download your
catchment area data and add shapefiles and coordinates to your data.
They will also place your prepared in the appropriate /www
subfolders for the dashboards you plan to build. Unlike previous
versions, you do not need to download your catchment area data from
CancerInFocus.org beforehand. Instead, by using the appropriate
catchment area short name for the \(\textit{ca}\) variable, the
data_download_v5-2.R
script will automatically download and
begin processing the data for you.
This will likely take a few minutes to run, depending on the size of your catchment area. You should receive progress updates in your console in RStudio.
Open cif_create_app_v5-2.R
, change the noted items under
### ITEMS TO ADJUST----
(marked with #!
), and
run the R file. Make sure to use the same catchment area name for the
\(\textit{ca}\) variable as in all
previous steps.
If all of the steps above have been completed successfully, running this program will result in a browser window opening with your main Cancer InFocus dashboard.
If you want to include the version that allows users to upload custom
data to the dashboard, download and work with the
cif_create_app_v5-2_with_custom.R
file instead of the
cif_create_app_v5-2.R
file.
Note: Custom data uploaded by users is NOT written to permanent storage and is NOT available to other users. When a user closes the app (or goes inactive), any custom data they may have uploaded is erased. Nevertheless, your organization may want to perform their own risk assessment before building this option.
Note: The main CIF dashboard, CIF\(^2\), and CIF Hot Spots require the package
capture
, which can be from installed GitHub using the
following R code.
install.packages("remotes")
remotes::install_github("dreamRs/capture")
Similar to step 5, open the
cif_profiles_create_app_v5-2.R
file, change the noted items
under ### ITEMS TO ADJUST ----
, and run. As before, make
sure to use the same catchment area name for the \(\textit{ca}\) variable as in all previous
steps.
Within the CIFReport_v5-2.Rmd
file, locate the line
<!-- change to correct filename -->
and adjust the logo file name in parentheses to the dark colored Cancer InFocus logo you received.
If all of the steps above have been completed successfully, running this program will result in a browser window opening with your CIF Profiles dashboard.
Open the file cif2_create_app_v5-2.R
, change the noted
items under ### ITEMS TO ADJUST ----
, and run. As before,
make sure to use the same catchment area name for the \(\textit{ca}\) variable.
If all of the steps above have been completed successfully, running this program will result in a browser window opening with your CIF\(^2\) (Bivariate) dashboard.
Open the file cif_hotspots_create_app_v5-2.R
, change the
noted items under ### ITEMS TO ADJUST ----
, and run. As
before, make sure to use the same catchment area name for the \(\textit{ca}\) variable.
If all of the steps above have been completed successfully, running this program will result in a browser window opening with your CIF Hot Spots dashboard.
These details refer to how to set up and deploy the main Cancer InFocus dashboard. For the CIF Profiles, CIF\(^2\) (Bivariate), and CIF Hot Spots dashboards, the instructions are the same, but the initial file names change.
Create an app.R
file
Toward the top of the cif_create_app_v5-2.R
file, remove
or comment out the two lines of code noted by #!#!#!
, and
save the file as app.R
. Each dashboard
must be renamed to app.R
for Shiny servers
to recognize them.
Develop & Implement a Deployment Solution
A few options exist for deploying your Shiny dashboards. You can explore these in greater detail at https://shiny.rstudio.com/deploy/ , and decide which route is best for you in consultation with your informatics/IT teams.
By following these steps you will hopefully be able to get your initial CIF dashboards out into the world. If you run into any issues, or have any comments for improving this tutorial, please contact us at CancerInFocus@uky.edu.