]>
nmode's Git Repositories - Rnaught/blob - R/ui.R
63e21eb5304fc82f618d9843172cf8ad80b1e743
4 shiny
:: titlePanel ( shiny
:: HTML ( paste0 ( "Rnaught: an estimation suite for R" , shiny
:: tags$
sub ( "0" )))),
8 # Sidebar. Hidden if the 'About' tab is selected.
9 shiny
:: conditionalPanel ( condition
= "input.tabset != 'About'" ,
10 shiny
:: sidebarPanel ( id
= "sidebar" ,
12 shiny
:: conditionalPanel ( condition
= "input.tabset == 'Data'" ,
13 shiny
:: h4 ( "Enter data" ),
14 # Data input method selection.
15 shiny
:: radioButtons ( inputId
= "dataInputMethod" , label
= "" , choices
= list ( "Manually" = 1 , "Upload a .csv file" = 2 , "Paste a .csv file" = 3 )),
16 # Option 1: Manual entry.
17 shiny
:: conditionalPanel ( condition
= "input.dataInputMethod == '1'" ,
18 shiny
:: textInput ( inputId
= "dataName" , label
= "Dataset name" ),
19 shiny
:: span ( shiny
:: textOutput ( outputId
= "dataNameWarn" ), style
= "color: red" ),
21 shiny
:: column ( 8 , shiny
:: textInput ( inputId
= "dataCounts" , label
= shiny
:: HTML ( paste0 ( "Case counts" , shiny
:: tags$
sup ( id
= "dataCountsHelp" , "[?]" ))))),
22 shiny
:: column ( 4 , shiny
:: selectInput ( inputId
= "dataUnits" , label
= "Reporting frequency" , choices
= list ( "Daily" , "Weekly" )))
24 shinyBS
:: bsTooltip ( id
= "dataCountsHelp" , "Enter as a comma-separated list of positive integers, with at least two entries. Ex: 1,1,2,3,5,8" , placement
= "right" , trigger
= "hover" ),
25 shiny
:: span ( shiny
:: textOutput ( outputId
= "dataCountsWarn" ), style
= "color: red" )
27 # Option 2: Upload .csv file.
28 shiny
:: conditionalPanel ( condition
= "input.dataInputMethod == '2'" ,
29 shiny
:: fileInput ( inputId
= "dataUpload" , label
= "" , accept
= c ( "text/csv" , "text/comma-separated-values,text/plain" , ".csv" )),
31 # Option 3: Paste .csv file.
32 shiny
:: conditionalPanel ( condition
= "input.dataInputMethod == '3'" ,
33 shiny
:: textAreaInput ( inputId
= "dataPaste" , label
= "" , rows
= 8 , resize
= "none" ),
35 # Warning text for .csv upload / paste.
36 shiny
:: conditionalPanel ( condition
= "['2', '3'].includes(input.dataInputMethod)" ,
37 shiny
:: span ( shiny
:: textOutput ( outputId
= "dataCSVWarn" ), style
= "color: red" ),
40 shiny
:: actionButton ( inputId
= "addData" , label
= "Add" ),
42 # Estimators tab sidebar
43 shiny
:: conditionalPanel ( condition
= "input.tabset == 'Estimators'" ,
44 shiny
:: h4 ( "Estimators" ),
45 # Collapsible menu for estimation methods.
46 shinyBS
:: bsCollapse ( id
= "estCollapse" ,
47 # WHITE & PANAGO (WP).
48 shinyBS
:: bsCollapsePanel ( title
= "White & Panago (WP)" ,
49 "This is a description of the method." ,
50 shiny
:: br (), shiny
:: br (),
51 shiny
:: radioButtons ( inputId
= "serialWPKnown" , label
= "Is the mean serial interval known?" , inline
= TRUE , choices
= list ( "Yes" = 1 , "No" = 2 )),
52 # Known serial interval.
53 shiny
:: conditionalPanel ( condition
= "input.serialWPKnown == '1'" ,
55 shiny
:: column ( 8 , shiny
:: textInput ( inputId
= "serialWPInput" , label
= "Mean Serial Interval" )),
56 shiny
:: column ( 4 , shiny
:: selectInput ( inputId
= "serialWPUnits" , label
= "Time units" , choices
= list ( "Days" , "Weeks" )))
58 shiny
:: span ( shiny
:: textOutput ( outputId
= "serialWPWarn" ), style
= "color: red" )
60 # Unknown serial interval.
61 shiny
:: conditionalPanel ( condition
= "input.serialWPKnown == '2'" ,
62 shiny
:: h5 ( "Grid Search Parameters" ),
64 shiny
:: column ( 4 , shiny
:: textInput ( inputId
= "gridLengthInput" , label
= "Grid length" , value
= "100" )),
65 shiny
:: column ( 4 , shiny
:: textInput ( inputId
= "gridShapeInput" , label
= "Max. shape" , value
= "10" )),
66 shiny
:: column ( 4 , shiny
:: textInput ( inputId
= "gridScaleInput" , label
= "Max. scale" , value
= "10" ))
69 shiny
:: column ( 4 , shiny
:: span ( shiny
:: textOutput ( outputId
= "gridLengthWarn" ), style
= "color: red" )),
70 shiny
:: column ( 4 , shiny
:: span ( shiny
:: textOutput ( outputId
= "gridShapeWarn" ), style
= "color: red" )),
71 shiny
:: column ( 4 , shiny
:: span ( shiny
:: textOutput ( outputId
= "gridScaleWarn" ), style
= "color: red" ))
74 shiny
:: actionButton ( inputId
= "addWP" , label
= "Add" )
76 # SEQUENTIAL BAYES (seqB).
77 shinyBS
:: bsCollapsePanel ( title
= "Sequential Bayes (seqB)" ,
78 "This is a description of the method." ,
79 shiny
:: br (), shiny
:: br (),
81 shiny
:: column ( 8 , shiny
:: textInput ( inputId
= "serialseqBInput" , label
= "Mean Serial Interval" )),
82 shiny
:: column ( 4 , shiny
:: selectInput ( inputId
= "serialseqBUnits" , label
= "Time units" , choices
= list ( "Days" , "Weeks" )))
84 shiny
:: span ( shiny
:: textOutput ( outputId
= "serialseqBWarn" ), style
= "color: red" ),
85 shiny
:: textInput ( inputId
= "kappaInput" , label
= shiny
:: HTML ( paste0 ( "Maximum value of the uniform prior" , shiny
:: tags$
sup ( id
= "kappaTool" , "[?]" ))), value
= "20" ),
86 shinyBS
:: bsTooltip ( id
= "kappaTool" , "Some information. By default, this is set to 20." , placement
= "right" , trigger
= "hover" ),
87 shiny
:: span ( shiny
:: textOutput ( outputId
= "kappaWarn" ), style
= "color: red" ),
88 shiny
:: actionButton ( inputId
= "addseqB" , label
= "Add" )
90 # INCIDENCE DECAY (ID).
91 shinyBS
:: bsCollapsePanel ( title
= "Incidence Decay (ID)" ,
92 "This is a description of the method." ,
93 shiny
:: br (), shiny
:: br (),
95 shiny
:: column ( 8 , shiny
:: textInput ( inputId
= "serialIDInput" , label
= "Mean Serial Interval" )),
96 shiny
:: column ( 4 , shiny
:: selectInput ( inputId
= "serialIDUnits" , label
= "Time units" , choices
= list ( "Days" , "Weeks" )))
98 shiny
:: span ( shiny
:: textOutput ( outputId
= "serialIDWarn" ), style
= "color: red" ),
99 shiny
:: actionButton ( inputId
= "addID" , label
= "Add" )
101 # INCIDENCE DECAY & EXPONENTIAL ADJUSTEMENT (IDEA).
102 shinyBS
:: bsCollapsePanel ( title
= "Incidence Decay and Exponential Adjustement (IDEA)" ,
103 "This is a description of the method." ,
104 shiny
:: br (), shiny
:: br (),
106 shiny
:: column ( 8 , shiny
:: textInput ( inputId
= "serialIDEAInput" , label
= "Mean Serial Interval" )),
107 shiny
:: column ( 4 , shiny
:: selectInput ( inputId
= "serialIDEAUnits" , label
= "Time units" , choices
= list ( "Days" , "Weeks" )))
109 shiny
:: span ( shiny
:: textOutput ( outputId
= "serialIDEAWarn" ), style
= "color: red" ),
110 shiny
:: actionButton ( inputId
= "addIDEA" , label
= "Add" )
117 shiny
:: mainPanel ( id
= "main" ,
118 shiny
:: tabsetPanel ( id
= "tabset" , type
= "tabs" ,
119 shiny
:: tabPanel ( "About" , shiny
:: br (), "Hello" ),
120 shiny
:: tabPanel ( "Data" , shiny
:: br (), shiny
:: dataTableOutput ( outputId
= "dataTable" ), shiny
:: tags$
style ( type
= "text/css" , '#dataTable tfoot {display:none;}' )),
121 shiny
:: tabPanel ( "Estimators" , shiny
:: br (),
122 shiny
:: dataTableOutput ( outputId
= "estTable" ),
123 shiny
:: tags$
style ( type
= "text/css" , "#estTable tfoot {display:none;}" ),
124 shiny
:: downloadButton ( outputId
= "downloadEst" , label
= "Download table as .csv" )