The following guide walks you through the basic steps to set up, build and deploy your own Cancer InFocus (CIF) applications. The end result is the “default” version. Additional tutorials will be available to help you customize CIF applications to meet your specific needs.


1. Folder Structure

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 applications you choose to create. Our suggested naming convention for these subfolders are:

We will use these conventions throughout the document. Each application 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/

2. Downloading Files

Download the data for your catchment area from CancerInFocus.org. This will give you a zip file with a name in the form of \(\textit{ca}\).zip, where \(\textit{ca}\) is the catchment short name attached to your catchment area. For instance, the catchment short name for Markey Cancer Center’s catchment area is uky, so the resulting file is uky.zip. Extract the contents of this zip file into a folder named \(\textit{ca}\)_catchment_data (e.g. uky_catchment_data)

Next, download the following files from GitHub,

and place them into the ShinyCIF folder you created. Download the measure_dictionary_v4.csv file into the ShinyCIF/www subfolder (e.g. the www folder contained within the ShinyCIF folder.)

If you plan to build CIF Profiles, download cif_profiles_create_app_v4.R into ShinyCIFProfiles and CIFReport.Rmd into ShinyCIFProfiles/www.

If you plan to build CIF\(^2\) (Bivariate), download the file cif2_create_app_v4.R into ShinyCIFBivar and scatterplot_example.png into ShinyCIFBivar/www.

At this point, you file directory should look like this.

.
|-- uky_catchment_data/
|   |-- (extracted data files from CancerInFocus.org download)
|   |-- ...
|   `-- ...
|-- ShinyCIF/
|   |-- CIFvars.R
|   |-- cif_create_shapefiles_v4.R
|   |-- cif_geocode_facilities_v4.R
|   |-- cif_create_app_v4.R
|   `-- www/
|       `-- measure_dictionary_v4.csv
|-- ShinyCIFProfiles/
|   |-- cif_profiles_create_app_v4.R
|   `-- www/
|       `-- CIFReport.Rmd
`-- ShinyCIFBivar/
    |-- cif2_create_app_v4.R
    `-- www/
        |-- scatterplot_example.png

The first section, ShinyCIF, will be required, while the ShinyCIFProfiles, and ShinyCIFBivar 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.)


3. Add Logo Files

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.

After placing the logo files in their proper folders, your directory should resemble this, depending on how many applications you are working with.

.
|-- uky_catchment_data/
|   |-- (extracted data files from CancerInFocus.org download)
|   |-- ...
|   `-- ...
|-- ShinyCIF/
|   |-- CIFvars.R
|   |-- cif_create_shapefiles_v4.R
|   |-- cif_geocode_facilities_v4.R
|   |-- cif_create_app_v4.R
|   `-- www/
|       |-- measure_dictionary_v4.csv
|       `-- cif_uky_big_logo_light_tm.png
|-- ShinyCIFProfiles/
|   |-- cif_profiles_create_app_v4.R
|   `-- www/
|       |-- CIFReport.Rmd
|       |-- cif_profiles_uky_light.png
|       `-- cif_uky_big_logo_tm.png
`-- ShinyCIFBivar/
    |-- cif2_create_app_v4.R
    `-- www/
        |-- cif_uky2_big_logo_light_tm.png
        `-- scatterplot_example.png

Again, the first section, ShinyCIF, will be required, while the ShinyCIFProfiles, and ShinyCIFBivar 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.)


4. Adjust & Run ‘CIFvars.R’

Open CIFvars.R, change the noted items inside the Sys.setenv() function (marked with #!), and run. Make sure you are using the same catchment area name for the \(\textit{ca}\) variable as you see on your datasets (e.g. for Kentucky, all datasets start with the phrase “uky_...” , so in this case, we set the \(\textit{ca}\) variable to ca = "uky").

CIFvars.R will run the cif_create_shapefiles_v4.R and cif_geocode_facilities_v4.R files to add shapefiles and coordinates to your data and will also place them in the appropriate /www subfolders for the applications you plan to build.

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.


5. Building the Main CIF Application

Open cif_create_app_v4.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 Cancer InFocus Shiny app.

If you want to include the version that allows users to upload custom data to the application, download and work with the cif_create_app_v4_with_custom.R file instead of the cif_create_app_v4.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: Both the main CIF application and CIF\(^2\) require the package capture, which can be installed by using the following R code.

install.packages("remotes")
remotes::install_github("dreamRs/capture")

6. Building the CIF Profiles Application

Similar to step 5, open the cif_profiles_create_app.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 as in all previous steps.

Within the CIFReport.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 Shiny App.


7. Building the CIF\(^2\) (Bivariate) Application

Open the file cif2_create_app_v4.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) Shiny app.


8. Deploying Online

These details refer to how to set up and deploy the main Cancer InFocus application. For CIF Profiles and the CIF\(^2\) (Bivariate) applications, the instructions are the same, but the initial file names change.


By following these steps you will hopefully be able to get your initial CIF applications out into the world. If you run into any issues, or have any comments for improving this tutorial, please contact us at .