ConTESSA
A shiny app to help EVALUATE THE IMPACT OF COVID-19 TEST-TRACE-ISOLATE PROGRAMS
Lucy D’Agostino McGowan
Wake Forest University
@LucyStats
lucymcgowan.com/talk
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
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.
The model
01.
The test-trace-isolate model behind the scenes
https://doi.org/10.1101/2020.09.02.20186916
A mathEmatical framework
for estimating the effective reproductive number given a test-trace-isolate program
Reproductive Number
The average number of onward transmissions an infected individual is expected to make
Compartments
Infections detected through testing & subsequently isolated
Infections in the community (undetected)
Infections among quarantined contacts of identified cases
Detect
Community
Quarantine
Compartments
Infections detected through testing and subsequently isolated
Infections in the community (undetected)
Infections among quarantined contacts of identified cases
Detect
Community
Quarantine
Compartments
Infections detected through testing and subsequently isolated
Infections in the community (undetected)
Infections among quarantined contacts of identified cases
Detect
Community
Quarantine
Compartments
Infections detected through testing and subsequently isolated
Infections in the community (undetected)
Infections among quarantined contacts of identified cases
Detect
Community
Quarantine
Proportion of infections in each Compartment at time t
Detect
Community
Quarantine
Proportion of infections in each Compartment at time t
0.2
0.7
0.1
Detect
Community
Quarantine
Reproductive Number
The average number of onward transmissions an infected individual is expected to make
Reproductive Number
RD = 2
RC = 2.5
RQ = 1
Detect
Community
Quarantine
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.
Reproductive Number
RD =γDRC
RC
RQ =γQRC
Detect
Community
Quarantine
Reproductive Number
RD =γDRC
RC
RQ =γQRC
Detect
Community
Quarantine
Reproductive Number
RD =γDRC
RC
RQ =γQRC
Detect
Community
Quarantine
Reproductive Number
RD =γDRC
RC
RQ =γQRC
Detect
Community
Quarantine
Time from symptom onset to isolation
Reproductive Number
RD =γDRC
RC
RQ =γQRC
Detect
Community
Quarantine
Time from symptom onset to isolation
infectiousness distribution
Reproductive Number
RD =γDRC
RC
RQ =γQRC
Detect
Community
Quarantine
Reproductive Number
RD =γDRC
RC
RQ =γQRC
Detect
Community
Quarantine
Time from symptom onset of case to quarantine of contacts
Reproductive Number
RD =γDRC
RC
RQ =γQRC
Detect
Community
Quarantine
Time from symptom onset of case to quarantine of contacts
infectiousness distribution
Reproductive Number
RD = 2
RC = 2.5
RQ = 1
Detect
Community
Quarantine
Infection matrix
Infected by
Someone detected
Someone in quarantine
Someone in the community
2 | 0 | 0 |
0 | 1 | 0 |
0 | 0 | 2.5 |
New infections at time t
2 | 0 | 0 |
0 | 1 | 0 |
0 | 0 | 2.5 |
0.2 | 0.1 | 0.7 |
x
New infections at time t
Detect
Community
Quarantine
0.2
0.7
0.1
New infections from time t
Detect
Community
Quarantine
0.2 x 2
0.7 x 2.5
0.1 x 1
How are they detected?
Infected by
Someone detected
Someone in quarantine
Someone in the community
| | |
| | |
| | |
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)
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)
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 |
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-ρ) |
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
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-ρ) |
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
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-ρ) |
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
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) |
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)
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.
Proportion of infections at time t+1
x
Proportion of infections at time t
Infect matrix
x
Detect matrix
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
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)
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)
Proportion of infections at time t+1
0.18
0.70
0.12
Detect
Community
Quarantine
Effective reproductive number at time t+1
Detect
Community
Quarantine
0.18 x 2
0.70 x 2.5
0.12 x 1
+
+
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
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)
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)
Proportion of infections at time t+1
0.44
0.44
0.22
Detect
Community
Quarantine
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
The R
package
02.
The tti R package can be found on GitHub and CRAN
installation
install.packages(“tti”)
devtools::install_github(“HopkinsIDD/tti”)
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
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
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
The main function
get_r_effective_df()
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.
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.
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.
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
The shiny application
03.
Behind the scenes of ConTESSA
github.com/hopkinsidd/contessa
Shiny application
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody()
)
server <- function(input, output) {
}
shinyApp(ui, server)
Shiny application
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody()
)
server <- function(input, output) {
}
shinyApp(ui, server)
Shiny application
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody()
)
server <- function(input, output) {
}
shinyApp(ui, server)
Shiny application
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody()
)
server <- function(input, output) {
}
shinyApp(ui, server)
Shiny application
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody()
)
server <- function(input, output) {
}
shinyApp(ui, server)
Shiny application
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody()
)
server <- function(input, output) {
}
shinyApp(ui, server)
Shiny application
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody()
)
server <- function(input, output) {
}
shinyApp(ui, server)
Shiny application
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody()
)
server <- function(input, output) {
...
}
shinyApp(ui, server)
Shiny application
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody()
)
server <- function(input, output) {
}
shinyApp(ui, server)
Report (RMD)
---
title: “Your title”
params:
a: NA
b: NA
---
```{r}
print(params$a)
print(params$b)
```
Report (RMD)
---
title: “Your title”
params:
a: NA
b: NA
---
```{r}
print(params$a)
print(params$b)
```
Report (RMD)
---
title: “Your title”
params:
a: NA
b: NA
---
```{r}
print(params$a)
print(params$b)
```
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())
)
})
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())
)
})
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())
)
})
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())
)
})
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())
)
})
Report (ui)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
downloadButton("report", "Generate report")
),
dashboardBody()
)
Report (ui)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
downloadButton("report", "Generate report")
),
dashboardBody()
)
Report (ui)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
downloadButton("report", "Generate report")
),
dashboardBody()
)
Report (ui)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
downloadButton("report", "Generate report")
),
dashboardBody()
)
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)
}
)
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)
}
)
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)
}
)
The
Demo
04.
Demonstration of the ConTESSA Application in Action
iddynamicsjhu.shinyapps.io/contessa-v2/