1 of 115

ConTESSA

A shiny app to help EVALUATE THE IMPACT OF COVID-19 TEST-TRACE-ISOLATE PROGRAMS

Lucy D’Agostino McGowan

Wake Forest University

@LucyStats

2 of 115

lucymcgowan.com/talk

3 of 115

4 of 115

The test-trace-isolate model behind the scenes

Some key aspects of the shiny application

The tti package to implement the model

A demonstration of how it works

01. The model

03. The Shiny App

02. The R package

04. Demo

5 of 115

The goal of this work

Test-trace-isolate programs are an essential part of COVID-19 control that offer a more targeted approach than many other non-pharmaceutical interventions.

Effective use of such programs requires methods to estimate their current and anticipated impact.

6 of 115

The model

01.

The test-trace-isolate model behind the scenes

7 of 115

https://doi.org/10.1101/2020.09.02.20186916

8 of 115

A mathEmatical framework

for estimating the effective reproductive number given a test-trace-isolate program

9 of 115

Reproductive Number

The average number of onward transmissions an infected individual is expected to make

10 of 115

Compartments

Infections detected through testing & subsequently isolated

Infections in the community (undetected)

Infections among quarantined contacts of identified cases

Detect

Community

Quarantine

11 of 115

Compartments

Infections detected through testing and subsequently isolated

Infections in the community (undetected)

Infections among quarantined contacts of identified cases

Detect

Community

Quarantine

12 of 115

Compartments

Infections detected through testing and subsequently isolated

Infections in the community (undetected)

Infections among quarantined contacts of identified cases

Detect

Community

Quarantine

13 of 115

Compartments

Infections detected through testing and subsequently isolated

Infections in the community (undetected)

Infections among quarantined contacts of identified cases

Detect

Community

Quarantine

14 of 115

Proportion of infections in each Compartment at time t

Detect

Community

Quarantine

15 of 115

Proportion of infections in each Compartment at time t

0.2

0.7

0.1

Detect

Community

Quarantine

16 of 115

Reproductive Number

The average number of onward transmissions an infected individual is expected to make

17 of 115

Reproductive Number

RD = 2

RC = 2.5

RQ = 1

Detect

Community

Quarantine

18 of 115

Grantz, K. H., Lee, E. C., D’Agostino McGowan, L.., Lee, K. H., Metcalf, C. J. E., Gurley, E. S., & Lessler, J. (2020). Maximizing and evaluating the impact of test-trace-isolate programs. medRxiv.

19 of 115

Reproductive Number

RDDRC

RC

RQQRC

Detect

Community

Quarantine

20 of 115

Reproductive Number

RDDRC

RC

RQQRC

Detect

Community

Quarantine

21 of 115

Reproductive Number

RDDRC

RC

RQQRC

Detect

Community

Quarantine

22 of 115

Reproductive Number

RDDRC

RC

RQQRC

Detect

Community

Quarantine

Time from symptom onset to isolation

23 of 115

Reproductive Number

RDDRC

RC

RQQRC

Detect

Community

Quarantine

Time from symptom onset to isolation

infectiousness distribution

24 of 115

Reproductive Number

RDDRC

RC

RQQRC

Detect

Community

Quarantine

25 of 115

Reproductive Number

RDDRC

RC

RQQRC

Detect

Community

Quarantine

Time from symptom onset of case to quarantine of contacts

26 of 115

Reproductive Number

RDDRC

RC

RQQRC

Detect

Community

Quarantine

Time from symptom onset of case to quarantine of contacts

infectiousness distribution

27 of 115

Reproductive Number

RD = 2

RC = 2.5

RQ = 1

Detect

Community

Quarantine

28 of 115

Infection matrix

Infected by

Someone detected

Someone in quarantine

Someone in the community

2

0

0

0

1

0

0

0

2.5

29 of 115

New infections at time t

2

0

0

0

1

0

0

0

2.5

0.2

0.1

0.7

x

30 of 115

New infections at time t

Detect

Community

Quarantine

0.2

0.7

0.1

31 of 115

New infections from time t

Detect

Community

Quarantine

0.2 x 2

0.7 x 2.5

0.1 x 1

32 of 115

How are they detected?

Infected by

Someone detected

Someone in quarantine

Someone in the community

33 of 115

How are they detected?

Infected by

Someone detected

Someone in quarantine

Someone in the community

End up detected

End up in quarantine

End up in the

community (undetected)

34 of 115

How are they detected?

Infected by

Someone detected

Someone in quarantine

Someone in the community

Infected by D -> D

Infected by D -> Q

Infected By D -> C

Infected by Q -> D

Infected by Q -> Q

Infected By Q-> C

Infected by C -> D

--

Infected By C -> C

End up detected

End up in quarantine

End up in the

community (undetected)

35 of 115

How are they detected?

Infected by D -> D

Infected by D -> Q

Infected By D -> C

Infected by Q -> D

Infected by Q -> Q

Infected By Q-> C

Infected by C -> D

--

Infected By C -> C

36 of 115

How are they detected?

Infected by D -> D

Infected by D -> Q

Infected By D -> C

Infected by Q -> D

Infected by Q -> Q

Infected By Q-> C

Infected by C -> D

--

Infected By C -> C

(1-ωD

ωD

(1-ωD)(1-ρ)

(1-ωQ

ωQ

(1-ωQ)(1-ρ)

ρ

0

(1-ρ)

37 of 115

How are they detected?

Infected by D -> D

Infected by D -> Q

Infected By D -> C

Infected by Q -> D

Infected by Q -> Q

Infected By Q-> C

Infected by C -> D

--

Infected By C -> C

(1-ωD

ωD

(1-ωD)(1-ρ)

(1-ωQ

ωQ

(1-ωQ)(1-ρ)

ρ

0

(1-ρ)

ωD: probability that a contact of a detected individual in the detect compartment is traced and quarantined

38 of 115

How are they detected?

Infected by D -> D

Infected by D -> Q

Infected By D -> C

Infected by Q -> D

Infected by Q -> Q

Infected By Q-> C

Infected by C -> D

--

Infected By C -> C

(0.5)ρ

0.5

(0.5)(1-ρ)

(1-ωQ

ωQ

(1-ωQ)(1-ρ)

ρ

0

(1-ρ)

39 of 115

How are they detected?

Infected by D -> D

Infected by D -> Q

Infected By D -> C

Infected by Q -> D

Infected by Q -> Q

Infected By Q-> C

Infected by C -> D

--

Infected By C -> C

(1-ωD

ωD

(1-ωD)(1-ρ)

(1-ωQ

ωQ

(1-ωQ)(1-ρ)

ρ

0

(1-ρ)

ωQ: probability that a contact of a detected individual in the quarantine compartment is traced and quarantined

40 of 115

How are they detected?

Infected by D -> D

Infected by D -> Q

Infected By D -> C

Infected by Q -> D

Infected by Q -> Q

Infected By Q-> C

Infected by C -> D

--

Infected By C -> C

(0.5)ρ

0.5

(0.5)(1-ρ)

(0.3)ρ

0.7

(0.3)(1-ρ)

ρ

0

(1-ρ)

41 of 115

How are they detected?

Infected by D -> D

Infected by D -> Q

Infected By D -> C

Infected by Q -> D

Infected by Q -> Q

Infected By Q-> C

Infected by C -> D

--

Infected By C -> C

(1-ωD

ωD

(1-ωD)(1-ρ)

(1-ωQ

ωQ

(1-ωQ)(1-ρ)

ρ

0

(1-ρ)

ρ: probability that a community infection is detected and isolated

42 of 115

How are they detected?

Infected by D -> D

Infected by D -> Q

Infected By D -> C

Infected by Q -> D

Infected by Q -> Q

Infected By Q-> C

Infected by C -> D

--

Infected By C -> C

(0.5)0.2

0.5

(0.5)(0.8)

(0.3)0.2

0.7

(0.3)(0.8)

0.2

0

(0.8)

43 of 115

Detection Matrix

Infected by

Someone detected

Someone in quarantine

Someone in the community

0.5 x 0.2

0.5

0.5 x 0.8

0.3 x 0.2

0.7

0.3 x 0.8

0.2

0

0.8

End up detected

End up in quarantine

End up in the

community (undetected)

44 of 115

Grantz, K. H., Lee, E. C., D’Agostino McGowan, L.., Lee, K. H., Metcalf, C. J. E., Gurley, E. S., & Lessler, J. (2020). Maximizing and evaluating the impact of test-trace-isolate programs. medRxiv.

45 of 115

Proportion of infections at time t+1

x

Proportion of infections at time t

Infect matrix

x

Detect matrix

46 of 115

Proportion of infections at time t+1

2

0

0

0

1

0

0

0

2.5

0.2

0.1

0.7

x

Proportion of infections at time t

Infect matrix

x

0.1

0.5

0.4

0.06

0.7

0.24

0.2

0

0.8

Detect matrix

47 of 115

Proportion of infections at time t+1

2

0

0

0

1

0

0

0

2.5

0.2

0.1

0.7

x

Proportion of infections at time t

Infect matrix

x

0.1

0.5

0.4

0.06

0.7

0.24

0.2

0

0.8

Detect matrix

(Normalized)

48 of 115

Proportion of infections at time t+1

2

0

0

0

1

0

0

0

2.5

0.2

0.1

0.7

x

Proportion of infections at time t

Infect matrix

x

0.1

0.5

0.4

0.06

0.7

0.24

0.2

0

0.8

Detect matrix

(Normalized) divide by ∑DQC(Infect)

49 of 115

Proportion of infections at time t+1

0.18

0.70

0.12

Detect

Community

Quarantine

50 of 115

Effective reproductive number at time t+1

Detect

Community

Quarantine

0.18 x 2

0.70 x 2.5

0.12 x 1

+

+

51 of 115

Effective reproductive number at time t+1

Detect

Community

Quarantine

0.18 x 2

0.70 x 2.5

0.12 x 1

+

+

2.23

52 of 115

Detection Matrix

Infected by

Someone detected

Someone in quarantine

Someone in the community

0.5 x 0.5

0.5

0.5 x 0.5

0.3 x 0.5

0.7

0.3 x 0.5

0.5

0

0.5

End up detected

End up in quarantine

End up in the

community (undetected)

53 of 115

Proportion of infections at time t+1

2

0

0

0

1

0

0

0

2.5

0.2

0.1

0.7

x

Proportion of infections at time t

Infect matrix

x

0.25

0.5

0.25

0.15

0.7

0.15

0.5

0

0.5

Detect matrix

(Normalized) divide by ∑DQC(Infect)

54 of 115

Proportion of infections at time t+1

0.44

0.44

0.22

Detect

Community

Quarantine

55 of 115

Effective reproductive number at time t+1

Detect

Community

Quarantine

0.44 x 2

0.44 x 2.5

0.22 x 1

+

+

2.1

56 of 115

The R

package

02.

The tti R package can be found on GitHub and CRAN

57 of 115

installation

install.packages(“tti”)

devtools::install_github(“HopkinsIDD/tti”)

58 of 115

Default compartments

Ds: Detected and symptomatic�Da: Detected and asymptomatic�Qcds: Quarantined community contact infected by a symptomatic person�Qhds: Quarantined household contact infected by a symptomatic person�Qcda: Quarantined community contact infected by an asymptomatic person�Qhda: Quarantined household contact infected by an asymptomatic person�Qq: Quarantined contact infected by a quarantined person�Cs: In the community and symptomatic�Ca: In the community and asymptomatic

59 of 115

Default compartments

Ds: Detected and symptomaticDa: Detected and asymptomaticQcds: Quarantined community contact infected by a symptomatic person�Qhds: Quarantined household contact infected by a symptomatic person�Qcda: Quarantined community contact infected by an asymptomatic person�Qhda: Quarantined household contact infected by an asymptomatic person�Qq: Quarantined contact infected by a quarantined person�Cs: In the community and symptomaticCa: In the community and asymptomatic

60 of 115

Default compartments

Ds: Detected and symptomatic�Da: Detected and asymptomatic�Qcds: Quarantined community contact infected by a symptomatic person�Qhds: Quarantined household contact infected by a symptomatic person�Qcda: Quarantined community contact infected by an asymptomatic person�Qhda: Quarantined household contact infected by an asymptomatic person�Qq: Quarantined contact infected by a quarantined person�Cs: In the community and symptomatic�Ca: In the community and asymptomatic

61 of 115

The main function

get_r_effective_df()

62 of 115

parameters

alpha

The probability of an asymptomatic infection.

R

Reproductive number.

kappa

Relative transmissibility of an asymptomatic individual compared to a symptomatic individual.

eta

Probability contact is a household contact.

nu

Relative risk of infection for a household contact compared to a community contact.

63 of 115

parameters

t_ds

Time delay from symptom onset to isolation in detected symptomatic person.

t_da

Time delay from symptom onset to isolation in detected asymptomatic person.

t_qcs

Time delay from symptomatic index cases's symptom onset to quarantine of community contacts.

t_qca

Time delay from asymptomatic index cases's symptom onset to quarantine of community contacts.

t_qhs

Time delay from symptomatic index cases's symptom onset to quarantine of household contacts.

t_qha

Time delay from asymptomatic index cases's symptom onset to quarantine of community contacts.

t_q

Time delay from quarantined index cases's symptom onset to quarantine of contacts.

64 of 115

parameters

omega_c

The probability of being traced and quarantined given community contact of a person.

omega_h

The probability of being traced and quarantined given household contact of a person.

omega_q

The probability of being traced and quarantined given quarantine contact of a person.

quarantine_days

The number of days contacts are told to quarantine.

rho_s

The probability of detection and isolation given symptomatic.

rho_a

The probability of detection and isolation given asymptomatic.

65 of 115

parameters

offset

Offset of infectiousness compared to symptoms onset. Default is -2.31.

shape

Shape of the gamma distribution of infectious period. Default is 1.65.

rate

Rate of the gamma distribution of infectious period. Default is 0.5.

stoch

Whether to run stochastic model with overdispersion.

theta

Overdispersion parameter for negative binomial distribution.

n_inf

Number of infections (or effective population size of infected individuals).

n_iter

Number of iterations of stochastic model to run for each unique parameter value.

66 of 115

The main function

> get_r_effective_df(alpha = 0.3)

# A tibble: 1 x 20

r_effective prop_identified alpha R kappa eta nu t_ds t_da t_qcs

<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>

1 2.37 0.120 0.3 2.5 0.5 0.5 4 3 3 3

# … with 10 more variables: t_qca <dbl>, t_qhs <dbl>, t_qha <dbl>, t_q <dbl>,

# omega_c <dbl>, omega_h <dbl>, omega_q <dbl>, quarantine_days <dbl>,

# rho_s <dbl>, rho_a <dbl>

67 of 115

The main function

> get_r_effective_df(alpha = 0.3)

# A tibble: 1 x 20

r_effective prop_identified alpha R kappa eta nu t_ds t_da t_qcs

<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>

1 2.37 0.120 0.3 2.5 0.5 0.5 4 3 3 3

# … with 10 more variables: t_qca <dbl>, t_qhs <dbl>, t_qha <dbl>, t_q <dbl>,

# omega_c <dbl>, omega_h <dbl>, omega_q <dbl>, quarantine_days <dbl>,

# rho_s <dbl>, rho_a <dbl>

68 of 115

The main function

> get_r_effective_df(alpha = 0.3)

# A tibble: 1 x 20

r_effective prop_identified alpha R kappa eta nu t_ds t_da t_qcs

<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>

1 2.37 0.120 0.3 2.5 0.5 0.5 4 3 3 3

# … with 10 more variables: t_qca <dbl>, t_qhs <dbl>, t_qha <dbl>, t_q <dbl>,

# omega_c <dbl>, omega_h <dbl>, omega_q <dbl>, quarantine_days <dbl>,

# rho_s <dbl>, rho_a <dbl>

69 of 115

The main function

> get_r_effective_df(alpha = c(0, 0.2, 0.3))

# A tibble: 3 x 20

r_effective prop_identified alpha R kappa eta nu t_ds t_da t_qcs

<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>

1 2.35 0.138 0 2.5 0.5 0.5 4 3 3 3

2 2.36 0.126 0.2 2.5 0.5 0.5 4 3 3 3

3 2.37 0.120 0.3 2.5 0.5 0.5 4 3 3 3

# … with 10 more variables: t_qca <dbl>, t_qhs <dbl>, t_qha <dbl>, t_q <dbl>,

# omega_c <dbl>, omega_h <dbl>, omega_q <dbl>, quarantine_days <dbl>,

# rho_s <dbl>, rho_a <dbl>

70 of 115

The main function

> get_r_effective_df(alpha = c(0, 0.2, 0.3))

# A tibble: 3 x 20

r_effective prop_identified alpha R kappa eta nu t_ds t_da t_qcs

<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>

1 2.35 0.138 0 2.5 0.5 0.5 4 3 3 3

2 2.36 0.126 0.2 2.5 0.5 0.5 4 3 3 3

3 2.37 0.120 0.3 2.5 0.5 0.5 4 3 3 3

# … with 10 more variables: t_qca <dbl>, t_qhs <dbl>, t_qha <dbl>, t_q <dbl>,

# omega_c <dbl>, omega_h <dbl>, omega_q <dbl>, quarantine_days <dbl>,

# rho_s <dbl>, rho_a <dbl>

71 of 115

The main function

> get_r_effective_df(alpha = c(0, 0.2, 0.3))

# A tibble: 3 x 20

r_effective prop_identified alpha R kappa eta nu t_ds t_da t_qcs

<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>

1 2.35 0.138 0 2.5 0.5 0.5 4 3 3 3

2 2.36 0.126 0.2 2.5 0.5 0.5 4 3 3 3

3 2.37 0.120 0.3 2.5 0.5 0.5 4 3 3 3

# … with 10 more variables: t_qca <dbl>, t_qhs <dbl>, t_qha <dbl>, t_q <dbl>,

# omega_c <dbl>, omega_h <dbl>, omega_q <dbl>, quarantine_days <dbl>,

# rho_s <dbl>, rho_a <dbl>

72 of 115

The main function

> get_r_effective_df(alpha = c(0, 0.2, 0.3))

# A tibble: 3 x 20

r_effective prop_identified alpha R kappa eta nu t_ds t_da t_qcs

<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>

1 2.35 0.138 0 2.5 0.5 0.5 4 3 3 3

2 2.36 0.126 0.2 2.5 0.5 0.5 4 3 3 3

3 2.37 0.120 0.3 2.5 0.5 0.5 4 3 3 3

# … with 10 more variables: t_qca <dbl>, t_qhs <dbl>, t_qha <dbl>, t_q <dbl>,

# omega_c <dbl>, omega_h <dbl>, omega_q <dbl>, quarantine_days <dbl>,

# rho_s <dbl>, rho_a <dbl>

73 of 115

The main function

> get_r_effective_df(alpha = c(0, 0.2, 0.3))

# A tibble: 3 x 20

r_effective prop_identified alpha R kappa eta nu t_ds t_da t_qcs

<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>

1 2.35 0.138 0 2.5 0.5 0.5 4 3 3 3

2 2.36 0.126 0.2 2.5 0.5 0.5 4 3 3 3

3 2.37 0.120 0.3 2.5 0.5 0.5 4 3 3 3

# … with 10 more variables: t_qca <dbl>, t_qhs <dbl>, t_qha <dbl>, t_q <dbl>,

# omega_c <dbl>, omega_h <dbl>, omega_q <dbl>, quarantine_days <dbl>,

# rho_s <dbl>, rho_a <dbl>

74 of 115

The main function

> get_r_effective_df(alpha = c(0, 0.2, 0.3))

# A tibble: 3 x 20

r_effective prop_identified alpha R kappa eta nu t_ds t_da t_qcs

<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>

1 2.35 0.138 0 2.5 0.5 0.5 4 3 3 3

2 2.36 0.126 0.2 2.5 0.5 0.5 4 3 3 3

3 2.37 0.120 0.3 2.5 0.5 0.5 4 3 3 3

# … with 10 more variables: t_qca <dbl>, t_qhs <dbl>, t_qha <dbl>, t_q <dbl>,

# omega_c <dbl>, omega_h <dbl>, omega_q <dbl>, quarantine_days <dbl>,

# rho_s <dbl>, rho_a <dbl>

75 of 115

The main function

> get_r_effective_df(alpha = c(0, 0.3), R = c(2, 2.5))

# A tibble: 4 x 20

r_effective prop_identified alpha R kappa eta nu t_ds t_da t_qcs

<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>

1 1.88 0.138 0 2 0.5 0.5 4 3 3 3

2 2.35 0.138 0 2.5 0.5 0.5 4 3 3 3

3 1.89 0.120 0.3 2 0.5 0.5 4 3 3 3

4 2.37 0.120 0.3 2.5 0.5 0.5 4 3 3 3

# … with 10 more variables: t_qca <dbl>, t_qhs <dbl>, t_qha <dbl>, t_q <dbl>,

# omega_c <dbl>, omega_h <dbl>, omega_q <dbl>, quarantine_days <dbl>,

# rho_s <dbl>, rho_a <dbl>

76 of 115

The main function

> get_r_effective_df(alpha = c(0, 0.3), R = c(2, 2.5))

# A tibble: 4 x 20

r_effective prop_identified alpha R kappa eta nu t_ds t_da t_qcs

<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>

1 1.88 0.138 0 2 0.5 0.5 4 3 3 3

2 2.35 0.138 0 2.5 0.5 0.5 4 3 3 3

3 1.89 0.120 0.3 2 0.5 0.5 4 3 3 3

4 2.37 0.120 0.3 2.5 0.5 0.5 4 3 3 3

# … with 10 more variables: t_qca <dbl>, t_qhs <dbl>, t_qha <dbl>, t_q <dbl>,

# omega_c <dbl>, omega_h <dbl>, omega_q <dbl>, quarantine_days <dbl>,

# rho_s <dbl>, rho_a <dbl>

77 of 115

The main function

> get_r_effective_df(alpha = c(0, 0.3), R = c(2, 2.5))

# A tibble: 4 x 20

r_effective prop_identified alpha R kappa eta nu t_ds t_da t_qcs

<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>

1 1.88 0.138 0 2 0.5 0.5 4 3 3 3

2 2.35 0.138 0 2.5 0.5 0.5 4 3 3 3

3 1.89 0.120 0.3 2 0.5 0.5 4 3 3 3

4 2.37 0.120 0.3 2.5 0.5 0.5 4 3 3 3

# … with 10 more variables: t_qca <dbl>, t_qhs <dbl>, t_qha <dbl>, t_q <dbl>,

# omega_c <dbl>, omega_h <dbl>, omega_q <dbl>, quarantine_days <dbl>,

# rho_s <dbl>, rho_a <dbl>

78 of 115

The main function

> get_r_effective_df(alpha = c(0, 0.3), R = c(2, 2.5))

# A tibble: 4 x 20

r_effective prop_identified alpha R kappa eta nu t_ds t_da t_qcs

<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>

1 1.88 0.138 0 2 0.5 0.5 4 3 3 3

2 2.35 0.138 0 2.5 0.5 0.5 4 3 3 3

3 1.89 0.120 0.3 2 0.5 0.5 4 3 3 3

4 2.37 0.120 0.3 2.5 0.5 0.5 4 3 3 3

# … with 10 more variables: t_qca <dbl>, t_qhs <dbl>, t_qha <dbl>, t_q <dbl>,

# omega_c <dbl>, omega_h <dbl>, omega_q <dbl>, quarantine_days <dbl>,

# rho_s <dbl>, rho_a <dbl>

79 of 115

The shiny application

03.

Behind the scenes of ConTESSA

80 of 115

github.com/hopkinsidd/contessa

81 of 115

82 of 115

83 of 115

84 of 115

85 of 115

86 of 115

Shiny application

library(shiny)

library(shinydashboard)

ui <- dashboardPage(

dashboardHeader(),

dashboardSidebar(),

dashboardBody()

)

server <- function(input, output) {

}

shinyApp(ui, server)

87 of 115

Shiny application

library(shiny)

library(shinydashboard)

ui <- dashboardPage(

dashboardHeader(),

dashboardSidebar(),

dashboardBody()

)

server <- function(input, output) {

}

shinyApp(ui, server)

88 of 115

Shiny application

library(shiny)

library(shinydashboard)

ui <- dashboardPage(

dashboardHeader(),

dashboardSidebar(),

dashboardBody()

)

server <- function(input, output) {

}

shinyApp(ui, server)

89 of 115

Shiny application

library(shiny)

library(shinydashboard)

ui <- dashboardPage(

dashboardHeader(),

dashboardSidebar(),

dashboardBody()

)

server <- function(input, output) {

}

shinyApp(ui, server)

90 of 115

Shiny application

library(shiny)

library(shinydashboard)

ui <- dashboardPage(

dashboardHeader(),

dashboardSidebar(),

dashboardBody()

)

server <- function(input, output) {

}

shinyApp(ui, server)

91 of 115

Shiny application

library(shiny)

library(shinydashboard)

ui <- dashboardPage(

dashboardHeader(),

dashboardSidebar(),

dashboardBody()

)

server <- function(input, output) {

}

shinyApp(ui, server)

92 of 115

Shiny application

library(shiny)

library(shinydashboard)

ui <- dashboardPage(

dashboardHeader(),

dashboardSidebar(),

dashboardBody()

)

server <- function(input, output) {

}

shinyApp(ui, server)

93 of 115

Shiny application

library(shiny)

library(shinydashboard)

ui <- dashboardPage(

dashboardHeader(),

dashboardSidebar(),

dashboardBody()

)

server <- function(input, output) {

...

}

shinyApp(ui, server)

94 of 115

Shiny application

library(shiny)

library(shinydashboard)

ui <- dashboardPage(

dashboardHeader(),

dashboardSidebar(),

dashboardBody()

)

server <- function(input, output) {

}

shinyApp(ui, server)

95 of 115

96 of 115

Report (RMD)

---

title: “Your title”

params:

a: NA

b: NA

---

```{r}

print(params$a)

print(params$b)

```

97 of 115

Report (RMD)

---

title: “Your title”

params:

a: NA

b: NA

---

```{r}

print(params$a)

print(params$b)

```

98 of 115

Report (RMD)

---

title: “Your title”

params:

a: NA

b: NA

---

```{r}

print(params$a)

print(params$b)

```

99 of 115

Report (server)

output$report <- downloadHandler(

filename = "report.pdf",

content <- function(file) {

tmp <- file.path(tempdir(), "report.Rmd")

file.copy("report.Rmd", tmp, overwrite = TRUE)

params <- list(a = input$a, b = input$b)

rmarkdown::render(

tmp,

output_file = file,

params = params,

envir = new.env(parent = globalenv())

)

})

100 of 115

Report (server)

output$report <- downloadHandler(

filename = "report.pdf",

content <- function(file) {

tmp <- file.path(tempdir(), "report.Rmd")

file.copy("report.Rmd", tmp, overwrite = TRUE)

params <- list(a = input$a, b = input$b)

rmarkdown::render(

tmp,

output_file = file,

params = params,

envir = new.env(parent = globalenv())

)

})

101 of 115

Report (server)

output$report <- downloadHandler(

filename = "report.pdf",

content <- function(file) {

tmp <- file.path(tempdir(), "report.Rmd")

file.copy("report.Rmd", tmp, overwrite = TRUE)

params <- list(a = input$a, b = input$b)

rmarkdown::render(

tmp,

output_file = file,

params = params,

envir = new.env(parent = globalenv())

)

})

102 of 115

Report (server)

output$report <- downloadHandler(

filename = "report.pdf",

content <- function(file) {

tmp <- file.path(tempdir(), "report.Rmd")

file.copy("report.Rmd", tmp, overwrite = TRUE)

params <- list(a = input$a, b = input$b)

rmarkdown::render(

tmp,

output_file = file,

params = params,

envir = new.env(parent = globalenv())

)

})

103 of 115

Report (server)

output$report <- downloadHandler(

filename = "report.pdf",

content <- function(file) {

tmp <- file.path(tempdir(), "report.Rmd")

file.copy("report.Rmd", tmp, overwrite = TRUE)

params <- list(a = input$a, b = input$b)

rmarkdown::render(

tmp,

output_file = file,

params = params,

envir = new.env(parent = globalenv())

)

})

104 of 115

Report (ui)

ui <- dashboardPage(

dashboardHeader(),

dashboardSidebar(

downloadButton("report", "Generate report")

),

dashboardBody()

)

105 of 115

Report (ui)

ui <- dashboardPage(

dashboardHeader(),

dashboardSidebar(

downloadButton("report", "Generate report")

),

dashboardBody()

)

106 of 115

Report (ui)

ui <- dashboardPage(

dashboardHeader(),

dashboardSidebar(

downloadButton("report", "Generate report")

),

dashboardBody()

)

107 of 115

Report (ui)

ui <- dashboardPage(

dashboardHeader(),

dashboardSidebar(

downloadButton("report", "Generate report")

),

dashboardBody()

)

108 of 115

109 of 115

Save Inputs (server)

output$save <- downloadHandler(

filename <- function() {

glue("{input$file_name}.yaml")

},

content <- function(file) {

inputs <- reactiveValuesToList(input)

input_yaml <- as.yaml(inputs)

write_yaml(input_yaml, file = file)

}

)

110 of 115

Save Inputs (server)

output$save <- downloadHandler(

filename <- function() {

glue("{input$file_name}.yaml")

},

content <- function(file) {

inputs <- reactiveValuesToList(input)

input_yaml <- as.yaml(inputs)

write_yaml(input_yaml, file = file)

}

)

111 of 115

Save Inputs (server)

output$save <- downloadHandler(

filename <- function() {

glue("{input$file_name}.yaml")

},

content <- function(file) {

inputs <- reactiveValuesToList(input)

input_yaml <- as.yaml(inputs)

write_yaml(input_yaml, file = file)

}

)

112 of 115

The

Demo

04.

Demonstration of the ConTESSA Application in Action

113 of 115

114 of 115

iddynamicsjhu.shinyapps.io/contessa-v2/

115 of 115

THANKS!

@LucyStats

CREDITS: This presentation template was created by Slidesgo, including icons by Flaticon, and infographics & images by Freepik