# Chapter 14 Disease surveillance with **SpatialEpiApp**

**SpatialEpiApp** (Moraga 2018b) is an R package that contains a Shiny web application to visualize spatial and spatio-temporal disease data, estimate disease risk and detect clusters. **SpatialEpiApp** may be useful for many researchers and practicioners working in public health and lacking the adequate statistical and programming skills to effectively use the statistical software required to conduct disease surveillance analyses. With **SpatialEpiApp**, users simply need to upload a map and disease data, and then click the buttons that create the input files required, analyze the data, and process the output to generate tables and plots with the results.

**SpatialEpiApp** allows to fit Bayesian hierarchical models to obtain disease risk estimates and their uncertainty by using **R-INLA** (Rue et al. 2018), and to detect clusters by using the scan statistics implemented in the `SaTScan`

software (Kulldorff 2006). Moreover, the application allows user interaction and includes interactive visualizations by using the packages **leaflet** for rendering maps (Cheng, Karambelkar, and Xie 2018), **dygraphs** for plotting time series (Vanderkam et al. 2018), and **DT** for displaying data objects (Xie 2018a). It also enables the generation of reports containing the analyses performed by using R Markdown (Allaire et al. 2018). In this chapter we describe the main components of **SpatialEpiApp**. Moraga (2017) can be seen for more details about its use, methods and examples.

## 14.1 Installation

The development version of **SpatialEpiApp** can be installed from GitHub by using the `install_github()`

function of the **devtools** package (Wickham, Hester, and Chang 2019).

```
library(devtools)
install_github("Paula-Moraga/SpatialEpiApp")
```

Then, the application can be launched by loading the package and executing the `run_app()`

function.

```
library(SpatialEpiApp)
run_app()
```

## 14.2 Use of **SpatialEpiApp**

**SpatialEpiApp** consists of three pages, namely, ‘Inputs’, ‘Analysis’ and ‘Help’.

### 14.2.1 ‘Inputs’ page

The ‘Inputs’ page is the first page we see when we launch the application (Figure 14.1). In this page we can upload the map and the disease data, and select the type of analysis to be conducted.

- The map is a shapefile with the areas of the study region. The shapefile needs to contain the id and the name of the areas.
- The data is a CSV file that contains the cases and population for each area, time, and individual level covariates (e.g., age, sex). If areal level covariates are used, the data need to specify the cases and population for each area and time, and the values of the covariates (e.g., socio economic index).

Note that the ids of the areas in the CSV file need to be the same as the ids of the areas in the shapefile so the data and the map can be linked. Time can be year, month or day, and all dates need to be consecutive. For example, if we work with years from 2000 to 2010, we need to provide information of all years 2000, 2001, 2002, \(\ldots\) 2010. The application does not work if we have, for example, only years 2000, 2005 and 2010. Once we have uploaded the map and the data, we need to select the type of analysis by specifying the temporal unit, the date range, and the type of analysis which can be spatial or spatio-temporal.

### 14.2.2 ‘Analysis’ page

In the ‘Analysis’ page we can visualize the data, perform the statistical analyses, and generate reports (Figure 14.2). On the top of the page there are four buttons:

- ‘Edit Inputs’ which is used when we wish to return to the ‘Inputs’ page to modify the analysis options or upload new data,
- ‘Maps Pop O E SIR’ that creates plots of the population, observed, expected and SIR variables,
- ‘Estimate risk’ which is used to estimate the disease risk and their uncertainty,
- ‘Detect clusters’ used for the detection of disease clusters.

To obtain disease risk estimates we need to install the **R-INLA** package. To detect clusters, we need to download and install the `SaTScan`

software from http://www.satscan.org. Then we need to locate the folder where the `SaTScan`

software is installed an copy the `SaTScanBatch64`

executable in the `SpatialEpiApp/SpatialEpiApp/ss`

folder which is located in the R library path. Note that the R library path can be obtained by typing `.libPaths()`

.

The ‘Analysis’ page also contains four tabs called ‘Interactive’, ‘Maps’, ‘Clusters’ and ‘Report’ that include tables and plots with the results. The ‘Maps’ tab (Figure 14.3) shows the results obtained by clicking the ‘Map Pop O E SIR’ and the ‘Estimate risk’ buttons. Specifically, it shows a summary table, maps, and time plots of the population, observed number of cases, expected number of cases, SIR, disease risk, and lower and upper limits of 95% credible intervals.

The ‘Clusters’ tab (Figure 14.4) shows the results of the cluster analysis. Specifically, it shows a map with the clusters detected for each of the times of the study period, and a plot with all clusters over time. This tab also includes a table with the information relative to each of the clusters such as the areas that form the clusters and their significance.

In the ‘Report’ tab (Figure 14.5) we can download a PDF document with the results of our analysis. The report includes maps and tables summarizing the population, observed number of cases, expected number of cases, SIR, disease risk, and lower and upper limits of the 95% credible intervals, as well as the clusters detected.

### 14.2.3 ‘Help’ page

Finally, the ‘Help’ button redirects to the ‘Help’ page which shows information about the use of **SpatialEpiApp**, as well as the statistiscal methodology and the R packages employed to build the application.

### References

Moraga, Paula. 2018b. *SpatialEpiApp: A Shiny Web Application for the Analysis of Spatial and Spatio-Temporal Disease Data*. https://github.com/Paula-Moraga/SpatialEpiApp.

Rue, Havard, Finn Lindgren, Daniel Simpson, Sara Martino, Elias Teixeira Krainski, Haakon Bakka, Andrea Riebler, and Geir-Arne Fuglstad. 2018. *INLA: Full Bayesian Analysis of Latent Gaussian Models Using Integrated Nested Laplace Approximations*.

Kulldorff, Martin. 2006. “SaTScan(TM) V. 7.0. Software for the Spatial and Space-Time Scan Statistics.” http://www.satscan.org.

Cheng, Joe, Bhaskar Karambelkar, and Yihui Xie. 2018. *Leaflet: Create Interactive Web Maps with the Javascript ’Leaflet’ Library*. https://CRAN.R-project.org/package=leaflet.

Vanderkam, Dan, JJ Allaire, Jonathan Owen, Daniel Gromer, and Benoit Thieurmel. 2018. *Dygraphs: Interface to ’Dygraphs’ Interactive Time Series Charting Library*. https://CRAN.R-project.org/package=dygraphs.

Xie, Yihui. 2018a. *DT: A Wrapper of the Javascript Library ’Datatables’*. https://CRAN.R-project.org/package=DT.

Allaire, JJ, Yihui Xie, Jonathan McPherson, Javier Luraschi, Kevin Ushey, Aron Atkins, Hadley Wickham, Joe Cheng, and Winston Chang. 2018. *Rmarkdown: Dynamic Documents for R*. https://CRAN.R-project.org/package=rmarkdown.

Moraga, Paula. 2017. “SpatialEpiApp: A Shiny Web Application for the analysis of Spatial and Spatio-Temporal Disease Data.” *Spatial and Spatio-Temporal Epidemiology* 23: 47–57. doi:https://doi.org/10.1016/j.sste.2017.08.001.

Wickham, Hadley, Jim Hester, and Winston Chang. 2019. *Devtools: Tools to Make Developing R Packages Easier*. https://CRAN.R-project.org/package=devtools.