-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshiny.R
1635 lines (1515 loc) · 83.9 KB
/
shiny.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
app_logger <- "shinyapp"
source("load_tool_environment.R")
# set up logging at info level
basicConfig(level = 20)
addHandler(writeToFile, logger=app_logger, file="logging/applogs.log")
ui <- fluidPage(
tags$head(
tags$style(HTML("hr {border-top: 1px solid #000000;}"))
),
# Allows for the use of notifications.
useShinyjs(),
titlePanel("PV System Disturbance Analysis"),
# Input Bar
tabsetPanel(
tabPanel("Main", fluid = TRUE,
sidebarLayout(
sidebarPanel(id = "side_panel",
h4("Settings input file selection"),
textInput("settings_file", "Select JSON file for loading inputs (optional).",
value = "C:/Users/NGorman/Documents/GitHub/DER_disturbance_analysis/test.json"
),
shinyFilesButton("load_settings", "Choose File", "Select settings file ...", multiple = FALSE),
tags$hr(),
h4("File selection"),
textInput("database_name", "SQLite database file",
value = "C:/Users/NGorman/Documents/GitHub/DER_disturbance_analysis/data/20201203/20201203.db"
),
fluidRow(
div(style="display:inline-block", shinyFilesButton("choose_database", "Choose File",
"Select database file ...", multiple = FALSE)),
div(style="display:inline-block", actionButton("load_file_from_settings", "Load from settings file")),
div(style="display:inline-block", actionButton("connect_to_database", "Connect"))),
tags$hr(),
uiOutput("load_date"),
uiOutput("load_time_start"),
uiOutput("load_time_end"),
radioButtons("region_to_load", label = strong("Regions"),
choices = list("QLD","NSW", "VIC", "SA", "TAS", "WA"), selected = "TAS", inline = TRUE),
uiOutput("duration"),
HTML("<br><br>"),
textInput("frequency_data", "Frequency data file",
value = ""
),
shinyFilesButton("choose_frequency_data", "Choose File", "Select fequency data file ...", multiple = FALSE),
HTML("<br><br>"),
actionButton("load_first_filter_settings", "Load from settings file"),
actionButton("load_data", "Load data"),
tags$hr(),
h4("Category Filter"),
uiOutput("cleaned"),
uiOutput("StdVersion"),
uiOutput("size_groupings"),
uiOutput("responses"),
uiOutput("zones"),
uiOutput("compliance"),
uiOutput("compliance_2020"),
uiOutput("reconnection_compliance"),
uiOutput("postcodes"),
uiOutput("manufacturers"),
uiOutput("models"),
uiOutput("sites"),
uiOutput("circuits"),
uiOutput("offsets"),
tags$hr(),
h4("Chart specific filters"),
materialSwitch("norm_power_filter_off_at_t0",
label = strong("Normalised power chart: filter out off at t0 circuits:"),
status = "primary", value = TRUE),
tags$hr(),
h4("Grouping Categories"),
materialSwitch("standard_agg", label=strong("AS4777:"), status="primary", value=TRUE),
materialSwitch("grouping_agg", label=strong("Size Grouping:"), status="primary", value=TRUE),
materialSwitch("response_agg", label=strong("Response Grouping:"), status="primary", value=FALSE),
materialSwitch("pst_agg", label=strong("Postcodes:"), status="primary", value=FALSE),
materialSwitch("manufacturer_agg", label=strong("Manufacturer:"),status="primary", value=FALSE),
materialSwitch("model_agg", label=strong("Models:"), status="primary", value=FALSE),
materialSwitch("circuit_agg", label=strong("Circuits:"), status="primary", value=FALSE),
materialSwitch("zone_agg", label=strong("Zones:"), status="primary", value=FALSE),
materialSwitch("compliance_agg", label=strong("Compliance:"), status="primary", value=FALSE),
materialSwitch("compliance_2020_agg", label=strong("Compliance 2020:"), status="primary", value=FALSE),
materialSwitch("reconnection_compliance_agg", label=strong("Reconnection Compliance:"), status="primary", value=FALSE),
materialSwitch("v_excursion_agg", label=strong("Voltage excursion:"), status="primary", value=FALSE),
tags$hr(),
h4("Additional Processing"),
radioButtons("confidence_category", label = strong("Grouping category to calculate confidence interval for,
must be a Grouping Category"),
choices = list("none", "response_category", "compliance_status", "compliance_status_2020",
"reconnection_compliance_status"), selected = "none", inline = TRUE),
materialSwitch(inputId="raw_upscale", label=strong("Upscaled Data"), status="primary", right=FALSE),
tags$hr(),
h4("Event information"),
uiOutput("event_date"),
uiOutput("pre_event_interval"),
uiOutput("window_length"),
uiOutput("post_event_ufls_window_length"),
uiOutput("event_latitude"),
uiOutput("event_longitude"),
uiOutput("zone_one_radius"),
uiOutput("zone_two_radius"),
uiOutput("zone_three_radius"),
tags$hr(),
uiOutput("update_plots"),
actionButton("load_second_filter_settings", "Load from settings file"),
shinySaveButton("save_settings", "Save settings file", "Save file as ...", filetype=list('json'))
),
#Output
mainPanel(
plotlyOutput(outputId="PlotlyTest"),
uiOutput("save_agg_power"),
HTML("<br>"),
uiOutput("save_underlying"),
HTML("<br>"),
uiOutput("save_circuit_summary"),
HTML("<br>"),
uiOutput("batch_save"),
HTML("<br>"),
uiOutput("save_ideal_response"),
HTML("<br>"),
uiOutput("save_ideal_response_downsampled"),
HTML("<br>"),
uiOutput("save_ideal_response_2020"),
HTML("<br>"),
uiOutput("save_ideal_response_downsampled_2020"),
HTML("<br>"),
uiOutput("save_manufacturer_disconnection_summary"),
HTML("<br>"),
uiOutput("save_manufacturer_disconnection_summary_with_separate_ufls_counts"),
HTML("<br>"),
uiOutput("save_upscaled_disconnection_summary"),
HTML("<br>"),
uiOutput("save_upscaled_disconnection_summary_with_separate_ufls_counts"),
HTML("<br>"),
uiOutput("save_voltage_excursion_summary"),
HTML("<br><br>"),
plotlyOutput(outputId="NormPower"),
plotlyOutput(outputId="Frequency"),
plotlyOutput(outputId="Voltage"),
plotlyOutput(outputId="ResponseCount"),
uiOutput("save_response_count"),
plotlyOutput(outputId="distance_response"),
uiOutput(outputId="save_distance_response"),
plotlyOutput(outputId="ZoneCount"),
uiOutput("save_zone_count"),
plotlyOutput(outputId="map"),
HTML("<br><br>"),
dataTableOutput("sample_count_table"),
HTML("<br><br>"),
uiOutput("save_sample_count")
)
)
),
tabPanel("Data Cleaning", fluid=TRUE,
mainPanel(
plotlyOutput("site_plot"),
h4("Editing the tables below changes the connected database, to use these changes in the analysis data must
be reloaded on the main tab."),
h4("Cleaned site data (select to view trace)"),
DTOutput('site_details_editor'),
h4("Cleaned Circuit data (select to view trace)"),
DTOutput('circuit_details_editor')
)
),
tabPanel("Manual compliance", fluid=TRUE,
mainPanel(
plotlyOutput("compliance_plot"),
h4("Editing the compliance value changes the connected database, to use these changes in the analysis data must
be reloaded on the main tab."),
uiOutput("manual_compliance_type"),
uiOutput("compliance_cleaned_or_raw"),
uiOutput("compliance_circuits"),
uiOutput("set_c_id_compliance"),
fluidRow(
div(style="display:inline-block", uiOutput("get_previous_c_id")),
div(style="display:inline-block", uiOutput("get_next_c_id")))
)
),
tabPanel("Settings", fluid=TRUE,
sidebarLayout(
sidebarPanel(id="side_panel",
h3("Droop response compliance settings"),
numericInput("compliance_threshold",
label = strong('Compliance threshold'),
value = 0.5, max=1, min=0),
numericInput("start_buffer",
label = strong('Start buffer, allowed time to reach compliance threshold, in seconds.'),
value = 60),
numericInput("end_buffer",
label = strong('End buffer, allowed time for system ending response early, in seconds.'),
value = 60),
numericInput("end_buffer_responding",
label = strong('Response time, window length for systems to be considered Non Compliant Responding, in seconds.'),
value = 120),
h3("Over-frequency droop response compliance settings AS4777.2:2020"),
numericInput("compliance_threshold_2020",
label = strong('Compliance threshold'),
value = 0.5, max=1, min=0),
numericInput("start_buffer_2020",
label = strong('Start buffer, allowed time to reach compliance threshold, in seconds.'),
value = 10),
numericInput("end_buffer_2020",
label = strong('End buffer, allowed time for system ending response early, in seconds.
Note, AS4777.2:2020 ideal response profile is calculated separately to the 2015 response profile.'),
value = 0),
numericInput("end_buffer_responding_2020",
label = strong('Response time, window length for systems to be considered Non Compliant Responding, in seconds.'),
value = 120),
h3("Reconnection compliance settings"),
numericInput("reconnection_threshold",
label = strong('The level at which a circuit is considered to have reconnected.'),
value = 0.95, max = 1, min = 0),
numericInput("ramp_rate_threshold",
label = strong('Reconnection ramp rate threshold for assessing compliance, in pct/min.'), value = 0.333),
numericInput("total_ramp_threshold_for_compliance",
label = strong('Total ramp threshold for compliance, in pct'), value = 0.125),
numericInput("total_ramp_threshold_for_non_compliance",
label = strong('Toatl ramp threshold for non compliance, in pct'), value = 0.25),
numericInput("ramp_rate_change_resource_limit_threshold",
label = strong('Ramp rate change threshold for detecting resource limitation, in pct/min'), value = -0.1),
h3("UFLS settings"),
numericInput("pre_event_ufls_window_length",
label = strong('Pre-event UFLS Window: The time window before the
event used to determine if the connection with a
device is stable enough to determine its UFLS status,
in minutes.'),
value = 5),
numericInput("pre_event_ufls_stability_threshold",
label = strong('The fraction of the Pre-event UFLS Window that needs to be
sampled for the connection with a device to be considered
stable enough to determine its UFLS status.'),
value = 0.6, max = 1, min = 0),
h3("Misc settings"),
numericInput("disconnecting_threshold",
label = strong('Disconnecting threshold, level below which circuit is considered to
have disconnected. Note that this value is used in the compliance
calculations but NOT the response categorisation.'),
value = 0.05, max = 1, min = 0),
numericInput("NED_threshold",
label = strong('Minimum proportion of sampled seconds allowed within post event interval to not have a 6 Not enough data response'),
value = 0.8, max = 1, min = 0),
materialSwitch("exclude_solar_edge", label = strong("Exclude solar edge from reconnection summary."),
status = "primary", value = FALSE),
materialSwitch("exclude_islanded_circuits", label = strong("Exclude islanded circuits from figures and results"),
status = "primary", value = TRUE),
actionButton("load_backend_settings", "Load from settings file")
),
mainPanel()
)
),
tabPanel("Assumptions and Methodology", fluid=TRUE, documentation_panel())
),
useShinyalert()
)
reset_sidebar <- function(input, output, session, stringsAsFactors) {
output$cleaned <- renderUI({})
output$postcodes <- renderUI({})
output$manufacturers <- renderUI({})
output$models <- renderUI({})
output$sites <- renderUI({})
output$circuits <- renderUI({})
output$size_groupings <- renderUI({})
output$StdVersion <- renderUI({})
output$responses <- renderUI({})
output$zones <- renderUI({})
output$compliance <- renderUI({})
output$compliance_2020 <- renderUI({})
output$reconnection_compliance <- renderUI({})
output$offsets <- renderUI({})
shinyjs::hide("norm_power_filter_off_at_t0")
shinyjs::hide("standard_agg")
shinyjs::hide("raw_upscale")
shinyjs::hide("pst_agg")
shinyjs::hide("grouping_agg")
shinyjs::hide("grouping_agg")
shinyjs::hide("manufacturer_agg")
shinyjs::hide("response_agg")
shinyjs::hide("circuit_agg")
shinyjs::hide("zone_agg")
shinyjs::hide("compliance_agg")
shinyjs::hide("compliance_2020_agg")
shinyjs::hide("reconnection_compliance_agg")
shinyjs::hide("v_excursion_agg")
shinyjs::hide("save_settings")
shinyjs::hide("load_second_filter_settings")
shinyjs::hide("confidence_category")
output$event_date <- renderUI({})
output$pre_event_interval <- renderUI({})
output$window_length <- renderUI({})
output$post_event_ufls_window_length <- renderUI({})
output$event_latitude <- renderUI({})
output$event_longitude <- renderUI({})
output$zone_one_radius <- renderUI({})
output$zone_two_radius <- renderUI({})
output$zone_three_radius <- renderUI({})
output$update_plots <- renderUI({})
}
reset_chart_area <- function(input, output, session, stringsAsFactors) {
output$PlotlyTest <- renderPlotly({})
output$save_agg_power <- renderUI({})
output$save_underlying <- renderUI({})
output$save_circuit_summary <- renderUI({})
output$sample_count_table <- renderDataTable({})
output$save_sample_count <- renderUI({})
output$NormPower <- renderPlotly({})
output$ResponseCount <- renderPlotly({})
output$save_response_count <- renderUI({})
output$ZoneCount <- renderPlotly({})
output$save_zone_count <- renderUI({})
output$Frequency <- renderPlotly({})
output$Voltage <- renderPlotly({})
output$distance_response <- renderPlotly({})
output$save_distance_response <- renderUI({})
output$map <- renderPlotly({})
}
reset_data_cleaning_tab <- function(input, output, session, stringsAsFactors) {
output$circuit_details_editor <- renderDT({})
output$site_details_editor <- renderDT({})
output$site_plot <- renderPlotly({})
}
server <- function(input,output,session){
# Create radio button dyamically so label can be updated
output$duration <- renderUI({radioButtons("duration", label=strong("Sampled duration (seconds), select one."),
choices = list("5","30","60"),
selected = "60", inline = TRUE)})
# Hide these inputs by default, they are shown once data is loaded.
hide("frequency_data")
hide("choose_frequency_data")
hide("region_to_load")
hide("duration")
hide("load_first_filter_settings")
hide("perform_clean")
hide("keep_raw")
hide("load_data")
hide("standard_agg")
hide("raw_upscale")
hide("pst_agg")
hide("grouping_agg")
hide("response_agg")
hide("manufacturer_agg")
hide("model_agg")
hide("circuit_agg")
hide("zone_agg")
hide("compliance_agg")
hide("compliance_2020_agg")
hide("reconnection_compliance_agg")
hide("v_excursion_agg")
hide("save_settings")
hide("load_second_filter_settings")
hide("norm_power_filter_off_at_t0")
hide("confidence_category")
options(DT.options = list(pageLength = 3))
# Get input from GUI
settings_file <- reactive({input$settings_file})
database_name <- reactive({input$database_name})
frequency_data_file <- reactive({input$frequency_data})
region_to_load <- reactive({input$region_to_load})
duration <- reactive({input$duration})
standards <- reactive({input$StdVersion})
responses <- reactive({input$responses})
postcodes <- reactive({input$postcodes})
manual_compliance_type <- reactive({input$manual_compliance_type})
compliance_circuits <- reactive({input$compliance_circuits})
compliance_cleaned_or_raw <- reactive({input$compliance_cleaned_or_raw})
set_c_id_compliance <- reactive({input$set_c_id_compliance})
manufacturers <- reactive({input$manufacturers})
models <- reactive({input$models})
sites <- reactive({input$sites})
circuits <- reactive({input$circuits})
zones <- reactive({input$zones})
compliance <- reactive({input$compliance})
compliance_2020 <- reactive({input$compliance_2020})
reconnection_compliance <- reactive({input$reconnection_compliance})
offsets <- reactive({input$offsets})
size_groupings <- reactive({input$size_groupings})
clean <- reactive({input$cleaned})
raw_upscale <- reactive({input$raw_upscale})
pst_agg <- reactive({input$pst_agg})
grouping_agg <- reactive({input$grouping_agg})
response_agg <- reactive({input$response_agg})
manufacturer_agg <- reactive({input$manufacturer_agg})
perform_clean <- reactive({input$perform_clean})
keep_raw <- reactive({input$keep_raw})
model_agg <- reactive({input$model_agg})
circuit_agg <- reactive({input$circuit_agg})
zone_agg <- reactive({input$zone_agg})
compliance_agg <- reactive({input$compliance_agg})
compliance_2020_agg <- reactive({input$compliance_2020_agg})
reconnection_compliance_agg <- reactive({input$reconnection_compliance_agg})
v_excursion_agg <- reactive({input$v_excursion_agg})
load_date <- reactive({
date_as_str <- as.character(input$load_date[1])
})
load_start_date <- reactive({
date_as_str <- as.character(input$load_date[1])
})
load_end_date <- reactive({
date_as_str <- as.character(input$load_date[2])
})
load_start_time <- reactive({
date_as_str <- as.character(input$load_date[1])
time_as_str <- substr(input$load_time_start, 12,19)
start_time_as_str <- paste(date_as_str, time_as_str)
})
load_end_time <- reactive({
date_as_str <- as.character(input$load_date[2])
time_as_str <- substr(input$load_time_end, 12,19)
end_time_as_str <- paste(date_as_str, time_as_str)
})
start_time <- reactive({
date_as_str <- as.character(input$date[1])
time_as_str <- substr(input$time_start, 12,19)
start_time_as_str <- paste(date_as_str, time_as_str)
start_date_time <- strptime(start_time_as_str, format="%Y-%m-%d %H:%M:%S", tz="Australia/Brisbane")
start_date_time
})
end_time <- reactive({
date_as_str <- as.character(input$date[2])
time_as_str <- substr(input$time_end, 12,19)
end_time_as_str <- paste(date_as_str, time_as_str)
end_date_time <- strptime(end_time_as_str, format="%Y-%m-%d %H:%M:%S", tz="Australia/Brisbane")
end_date_time
})
pre_event_interval <- reactive({
date_as_str <- as.character(input$event_date)
time_as_str <- substr(input$pre_event_interval, 12, 19)
date_time_as_str <- paste(date_as_str, time_as_str)
pre_event_interval_date_time <- strptime(date_time_as_str, format="%Y-%m-%d %H:%M:%S", tz="Australia/Brisbane")
pre_event_interval_date_time
})
agg_on_standard <- reactive({input$standard_agg})
window_length <- reactive({input$window_length})
post_event_ufls_window_length <- reactive({input$post_event_ufls_window_length})
event_latitude <- reactive({input$event_latitude})
event_longitude <- reactive({input$event_longitude})
zone_one_radius <- reactive({input$zone_one_radius})
zone_two_radius <- reactive({input$zone_two_radius})
zone_three_radius <- reactive({input$zone_three_radius})
norm_power_filter_off_at_t0 <- reactive({input$norm_power_filter_off_at_t0})
confidence_category <- reactive({input$confidence_category})
# Values from settings tab
compliance_threshold <- reactive({input$compliance_threshold})
start_buffer <- reactive({input$start_buffer})
end_buffer <- reactive({input$end_buffer})
end_buffer_responding <- reactive({input$end_buffer_responding})
compliance_threshold_2020 <- reactive({input$compliance_threshold_2020})
start_buffer_2020 <- reactive({input$start_buffer_2020})
end_buffer_2020 <- reactive({input$end_buffer_2020})
end_buffer_responding_2020 <- reactive({input$end_buffer_responding_2020})
reconnection_threshold <- reactive({input$reconnection_threshold})
reconnection_time_threshold_for_compliance <- reactive({input$reconnection_time_threshold_for_compliance})
ramp_rate_threshold <- reactive({input$ramp_rate_threshold})
total_ramp_threshold_for_compliance <- reactive({input$total_ramp_threshold_for_compliance})
total_ramp_threshold_for_non_compliance <- reactive({input$total_ramp_threshold_for_non_compliance})
ramp_rate_change_resource_limit_threshold <- reactive({input$ramp_rate_change_resource_limit_threshold})
pre_event_ufls_window_length <- reactive({input$pre_event_ufls_window_length})
pre_event_ufls_stability_threshold <- reactive({input$pre_event_ufls_stability_threshold})
NED_threshold <- reactive({input$NED_threshold})
disconnecting_threshold <- reactive({input$disconnecting_threshold})
exclude_solar_edge <- reactive({input$exclude_solar_edge})
exclude_islanded_circuits <- reactive({input$exclude_islanded_circuits})
# Store the main data table in a reactive value so it is accessable outside
# the observe event that creates it.
v <- reactiveValues(combined_data = data.frame(),
combined_data_no_ac_filter = data.frame(),
agg_power = data.frame(),
agg_norm_power = data.frame(),
install_data = data.frame(),
site_details = data.frame(),
circuit_details = data.frame(),
circuit_details_for_editing = data.frame(),
site_details_raw = data.frame(),
site_details_for_editing = data.frame(),
proxy_site_details_editor = 1,
proxy_circuit_details_editor = 1,
combined_data_after_clean = data.frame(),
time_series_data = data.frame(),
sample_count_table = data.frame(),
combined_data_f = data.frame(),
performance_factors = data.frame(),
postcode_data = data.frame(),
response_count = data.frame(),
zone_count = data.frame(),
distance_response = data.frame(),
frequency_data = data.frame(),
unique_offsets = c(),
circuit_summary = data.frame(),
region_frequency = data.frame(),
trigger_update_manual_compliance_tab = FALSE
)
observeEvent(input$connect_to_database, {
v$db <- DBInterface$new()
good_connection = FALSE
tryCatch({
v$db$connect_to_existing_database(database_name())
good_connection = TRUE
},
error = function(cond) {
shinyalert("An error occured while connecting to the database.", cond$message)
})
if (good_connection) {
min_timestamp <- v$db$get_min_timestamp()
max_timestamp <- v$db$get_max_timestamp()
output$load_time_start <- renderUI({
timeInput("load_time_start", label = strong('Enter start time'),
value = min_timestamp)
})
output$load_time_end <- renderUI({
timeInput("load_time_end", label = strong('Enter end time'),
value = max_timestamp)
})
output$load_date <- renderUI({
dateRangeInput("load_date", label = strong('Date range (yyyy-mm-dd):'),
start = strftime(min_timestamp, format = "%Y-%m-%d"),
end = strftime(min_timestamp, format = "%Y-%m-%d"),
min = strftime(min_timestamp, format = "%Y-%m-%d"),
max = strftime(max_timestamp, format = "%Y-%m-%d"),
startview = "year")
})
shinyjs::show("frequency_data")
shinyjs::show("choose_frequency_data")
shinyjs::show("region_to_load")
shinyjs::show("duration")
shinyjs::show("load_data")
shinyjs::show("load_first_filter_settings")
}
})
# This is the event that runs when the "Load data" button on the GUI is
# Clicked.
observeEvent(input$load_data, {
id <- showNotification("Loading data", duration = 1000)
# setup loading inputs
data <- reactiveValuesToList(v)
settings <- get_current_settings()
# load data
loaded <- load_data(data, settings)
data <- loaded$data
errors <- loaded$errors
rm(loaded)
for (d_name in names(data)) {
v[[d_name]] <- data[[d_name]]
}
removeNotification(id)
# -------- UI Code --------
# show errors & warnings on tool dash
if (length(errors$warnings) > 0) {
for (warning in errors$warnings) {
shinyalert(warning$title, warning$body)
logging::logwarn(paste(warning$title, warning$body), logger=app_logger)
}
}
# do not proceed if errors have been raised
if (length(errors$errors) > 0) {
for (error in errors$errors) {
shinyalert(error$title, error$body)
logging::logerror(paste(error$title, error$body), logger=app_logger)
}
} else {
if (v$db$check_if_table_exists('site_details_cleaned')){
v$site_details_for_editing <- v$db$get_site_details_cleaning_report()
v$site_details_for_editing <- filter(v$site_details_for_editing, s_state == settings$region_to_load)
output$site_details_editor <- renderDT(isolate(v$site_details_for_editing), selection='single', rownames=FALSE,
editable=TRUE)
v$proxy_site_details_editor <- dataTableProxy('site_details_editor')
}
if (v$db$check_if_table_exists('circuit_details_cleaned')){
v$circuit_details_for_editing <- v$db$get_circuit_details_cleaning_report()
v$circuit_details_for_editing <- filter(v$circuit_details_for_editing, site_id %in% v$site_details_for_editing$site_id)
output$circuit_details_editor <- renderDT(isolate(v$circuit_details_for_editing), selection='single',
rownames=FALSE, editable=TRUE)
v$proxy_circuit_details_editor <- dataTableProxy('circuit_details_editor')
}
# Filtering option widgets are rendered after the data is loaded, this is
# because they are only usable once there is data to filter. Additionally
# The data loaded can then be used to create the appropraite options for
# filtering.
output$postcodes <- renderUI({
selectizeInput("postcodes", label=strong("Select postcodes"), choices = sort(unique(v$site_details$s_postcode)),
multiple=TRUE)
})
output$manufacturers <- renderUI({
selectizeInput("manufacturers", label=strong("Select manufacturers"),
choices = sort(unique(v$site_details$manufacturer)), multiple=TRUE)
})
output$models <- renderUI({
selectizeInput("models", label=strong("Select models"), choices = sort(unique(v$site_details$model)), multiple=TRUE)
})
output$sites <- renderUI({
selectizeInput("sites", label=strong("Select Sites"), choices = sort(unique(v$site_details$site_id)), multiple=TRUE)
})
output$circuits <- renderUI({
selectizeInput("circuits", label=strong("Select Circuits"), choices = sort(unique(v$circuit_details$c_id)),
multiple=TRUE)
})
shinyjs::show("standard_agg")
output$size_groupings <- renderUI({
checkboxGroupButtons(inputId="size_groupings", label=strong("Size Groupings"),
choices=list("30-100kW", "<30 kW"), selected=list("30-100kW", "<30 kW"),
justified=TRUE, status="primary", individual=TRUE,
checkIcon=list(yes=icon("ok", lib="glyphicon"),no=icon("remove", lib="glyphicon")),
direction = "vertical")
})
output$cleaned <- renderUI({
checkboxGroupButtons(inputId="cleaned",
label=strong("Data sets"), choices=list("clean", "raw"),
selected=list("clean"),
justified=TRUE, status="primary", individual=TRUE,
checkIcon=list(yes=icon("ok", lib="glyphicon"), no=icon("remove", lib="glyphicon")),
direction = "vertical")
})
output$StdVersion <- renderUI({
checkboxGroupButtons(inputId="StdVersion",
label=strong("AS47777 Version:"), choices=list("AS4777.3:2005", "Transition",
"AS4777.2:2015", "AS4777.2:2015 VDRT",
"Transition 2020-21", "AS4777.2:2020"),
selected=list("AS4777.3:2005", "Transition", "AS4777.2:2015", "AS4777.2:2015 VDRT",
"Transition 2020-21", "AS4777.2:2020"),
justified=TRUE, status="primary", individual=TRUE,
checkIcon=list(yes=icon("ok", lib="glyphicon"), no=icon("remove", lib="glyphicon")),
direction = "vertical")
})
output$responses <- renderUI({
checkboxGroupButtons(inputId="responses",
label=strong("Select Responses:"),
choices=list("1 Ride Through", "2 Curtail", "3 Drop to Zero", "4 Disconnect","5 Off at t0",
"6 Not enough data", "7 UFLS Dropout", "Undefined", NA),
selected=list("1 Ride Through", "2 Curtail", "3 Drop to Zero", "4 Disconnect",
"5 Off at t0", "6 Not enough data", "7 UFLS Dropout", "Undefined", NA),
justified=TRUE, status="primary", individual=TRUE,
checkIcon=list(yes=icon("ok", lib="glyphicon"), no=icon("remove", lib="glyphicon")),
direction = "vertical")
})
output$zones <- renderUI({
checkboxGroupButtons(inputId="zones", label=strong("Zones"),
choices=list("1 Zone", "2 Zone", "3 Zone", "Undefined", NA),
selected=list("1 Zone", "2 Zone", "3 Zone", "Undefined", NA),
justified=TRUE, status="primary", individual=TRUE,
checkIcon=list(yes=icon("ok", lib="glyphicon"), no=icon("remove", lib="glyphicon")),
direction = "vertical")
})
output$compliance <- renderUI({
checkboxGroupButtons(inputId="compliance", label=strong("Compliance"),
choices=list("Compliant", "Non-compliant Responding",
"Non-compliant", "UFLS Dropout", "Disconnect/Drop to Zero",
"Off at t0", "Not enough data", "Undefined", NA),
selected=list("Compliant", "Non-compliant Responding",
"Non-compliant", "UFLS Dropout", "Disconnect/Drop to Zero",
"Off at t0", "Not enough data", "Undefined", NA),
justified=TRUE, status="primary", individual=TRUE,
checkIcon=list(yes=icon("ok", lib="glyphicon"), no=icon("remove", lib="glyphicon")),
direction = "vertical")
})
output$compliance_2020 <- renderUI({
checkboxGroupButtons(inputId="compliance_2020", label=strong("Compliance 2020"),
choices=list("Compliant", "Non-compliant Responding",
"Non-compliant", "UFLS Dropout", "Disconnect/Drop to Zero",
"Off at t0", "Not enough data", "Undefined", NA),
selected=list("Compliant", "Non-compliant Responding",
"Non-compliant", "UFLS Dropout", "Disconnect/Drop to Zero",
"Off at t0", "Not enough data", "Undefined", NA),
justified=TRUE, status="primary", individual=TRUE,
checkIcon=list(yes=icon("ok", lib="glyphicon"), no=icon("remove", lib="glyphicon")),
direction = "vertical")
})
output$reconnection_compliance <- renderUI({
checkboxGroupButtons(inputId="reconnection_compliance", label=strong("Reconnection Compliance"),
choices=list("Compliant", "Non Compliant",
"Unsure", "Cannot be set", NA),
selected=list("Compliant", "Non Compliant",
"Unsure", "Cannot be set", NA),
justified=TRUE, status="primary", individual=TRUE,
checkIcon=list(yes=icon("ok", lib="glyphicon"), no=icon("remove", lib="glyphicon")),
direction = "vertical")
})
sample_counts <- get_offset_sample_counts(v$combined_data, v$unique_offsets)
unique_offsets_filter_label <- make_offset_filter_label(sample_counts, v$unique_offsets)
output$offsets <- renderUI({
checkboxGroupButtons(inputId="offsets", label=unique_offsets_filter_label,
choices=v$unique_offsets, selected=c(v$unique_offsets[which.max(sample_counts)]) ,
justified=TRUE, status="primary", individual=TRUE,
checkIcon=list(yes=icon("ok", lib="glyphicon"), no=icon("remove", lib="glyphicon")),
direction = "vertical")
})
shinyjs::show("raw_upscale")
shinyjs::show("pst_agg")
shinyjs::show("grouping_agg")
shinyjs::show("grouping_agg")
shinyjs::show("manufacturer_agg")
shinyjs::show("response_agg")
shinyjs::show("circuit_agg")
shinyjs::show("zone_agg")
shinyjs::show("compliance_agg")
shinyjs::show("compliance_2020_agg")
shinyjs::show("reconnection_compliance_agg")
shinyjs::show("v_excursion_agg")
shinyjs::show("save_settings")
shinyjs::show("load_second_filter_settings")
shinyjs::show("norm_power_filter_off_at_t0")
shinyjs::show("confidence_category")
output$event_date <- renderUI({
dateInput("event_date", label=strong('Event date (yyyy-mm-dd):'),
value=strftime(floor_date(get_mode(v$combined_data$ts), "day"), format="%Y-%m-%d"), startview="year")
})
output$pre_event_interval <- renderUI({
timeInput("pre_event_interval", label=strong('Pre-event time interval'),
value = as.POSIXct("12:13:55",format="%H:%M:%S"))
})
output$window_length <- renderUI({
numericInput("window_length", label=strong('Set window length (min),
Only data in this window is used for response analysis.'),
value=5, min = 1, max = 100, step = 1)
})
output$post_event_ufls_window_length <- renderUI({
numericInput("post_event_ufls_window_length", label=strong('Set post event UFLS window length (min)'),
value=5, min = 1, max = 100, step = 1)
})
output$event_latitude <- renderUI({
numericInput("event_latitude", label=strong('Set event latitude'), value=-28.838132)
})
output$event_longitude <- renderUI({
numericInput("event_longitude", label=strong('Set event longitude'), value=151.096832)
})
output$zone_one_radius <- renderUI({
numericInput("zone_one_radius", label=strong('Set zone one outer radius (km)'), value=200)
})
output$zone_two_radius <- renderUI({
numericInput("zone_two_radius", label=strong('Set zone two outer radius (km)'), value=600)
})
output$zone_three_radius <- renderUI({
numericInput("zone_three_radius", label=strong('Set zone three outer radius (km)'), value=1000)
})
output$update_plots <- renderUI({
actionButton("update_plots", "Update plots")
})
}
removeNotification(id)
})
# Create plots when update plots button is clicked.
observeEvent(input$update_plots, {
id <- showNotification("Updating plots", duration=1000)
logdebug("update_plots event triggered", logger=app_logger)
data <- reactiveValuesToList(v)
settings <- get_current_settings()
analysis_results <- run_analysis(data, settings)
data <- analysis_results$data
errors <- analysis_results$errors
rm(analysis_results)
for (d_name in names(data)) {
v[[d_name]] <- data[[d_name]]
}
# make any required warning or error notifications
if (length(errors$warnings) > 0) {
for (warning in errors$warnings) {
shinyalert(warning$title, warning$body)
logging::logwarn(paste(warning$title, warning$body), logger=app_logger)
}
}
if (length(errors$errors) > 0) {
for (error in errors$errors) {
shinyalert(error$title, error$body)
logging::logerror(paste(error$title, error$body), logger=app_logger)
}
}
no_grouping <- check_grouping(settings)
if ((sum(v$sample_count_table$sample_count)<1000 & no_grouping) |
(length(v$sample_count_table$sample_count)<1000 & !no_grouping)){
if(length(v$combined_data_f$ts) > 0){
# Create plots on main tab
logdebug('create plots', logger=app_logger)
# -------- Render plots and save buttons --------
# inputs:v$agg_power, v$sample_count_table, ideal_response_to_plot, agg_norm_power, v$response_count, v$zone_count, v$agg_power, v$distance_response, geo_data, v$combined_data_f
# outputs: output$...
# dependencies: event_longitude(), event_latitude(), zone_one_radius(), pre_event_interval(), duration()
output$PlotlyTest <- renderPlotly({
plot_ly(v$agg_power, x=~Time, y=~Power_kW, color=~series, type="scattergl") %>%
layout(yaxis = list(title = "Aggregate Power (kW)"))})
output$save_agg_power <- renderUI({
shinySaveButton("save_agg_power", "Save Aggregated Results", "Save file as ...", filetype=list(xlsx="csv"))
})
output$save_underlying <- renderUI({
shinySaveButton("save_underlying", "Save Underlying Data", "Save file as ...", filetype=list(xlsx="csv"))
})
output$save_circuit_summary <- renderUI({
shinySaveButton("save_circuit_summary", "Save Circuit Summary", "Save file as ...", filetype=list(xlsx="csv"))
})
output$batch_save <- renderUI({
shinySaveButton("batch_save", "Batch save", "Save file as ...", filetype=list(xlsx="csv"))
})
output$save_ideal_response <- renderUI({
shinySaveButton("save_ideal_response", "Save response", "Choose directory for report files ...",
filetype=list(xlsx="csv"))
})
output$save_ideal_response_downsampled <- renderUI({
shinySaveButton("save_ideal_response_downsampled", "Save downsampled response",
"Choose directory for report files ...", filetype=list(xlsx="csv"))
})
output$save_ideal_response_2020 <- renderUI({
shinySaveButton("save_ideal_response_2020", "Save response 2020", "Choose directory for report files ...",
filetype=list(xlsx="csv"))
})
output$save_ideal_response_downsampled_2020 <- renderUI({
shinySaveButton("save_ideal_response_downsampled_2020", "Save downsampled response 2020",
"Choose directory for report files ...", filetype=list(xlsx="csv"))
})
output$save_manufacturer_disconnection_summary <- renderUI({
shinySaveButton("save_manufacturer_disconnection_summary", "Save manufacturer disconnection summary",
"Choose directory for report files ...", filetype=list(xlsx="csv"))
})
output$save_manufacturer_disconnection_summary_with_separate_ufls_counts <- renderUI({
shinySaveButton("save_manufacturer_disconnection_summary_with_separate_ufls_counts",
"Save manufacturer disconnection summary with separate ufls counts",
"Choose directory for report files ...", filetype=list(xlsx="csv"))
})
output$save_upscaled_disconnection_summary <- renderUI({
shinySaveButton("save_upscaled_disconnection_summary", "Save upscaled disconnection summary",
"Choose directory for report files ...", filetype=list(xlsx="csv"))
})
output$save_upscaled_disconnection_summary_with_separate_ufls_counts <- renderUI({
shinySaveButton("save_upscaled_disconnection_summary_with_separate_ufls_counts",
"Save upscaled disconnection summary with separate ufls counts",
"Choose directory for report files ...", filetype=list(xlsx="csv"))
})
output$save_voltage_excursion_summary <- renderUI({
shinySaveButton("save_voltage_excursion_summary",
"Save voltage excursion summary",
"Choose directory for report files ...", filetype=list(xlsx="csv"))
})
if ("width" %in% names(v$sample_count_table)) {
sample_count_table <- datatable(v$sample_count_table) %>% formatStyle(
"width", background = styleColorBar(c(0, 1), 'red'))
} else {
sample_count_table <- v$sample_count_table
}
output$sample_count_table <- renderDataTable({sample_count_table})
output$save_sample_count <- renderUI({shinySaveButton("save_sample_count", "Save data", "Save file as ...",
filetype=list(xlsx="csv"))
})
if(dim(v$ideal_response_to_plot)[1]>0){
output$NormPower <- renderPlotly({
plot_ly(v$agg_norm_power, x=~Time, y=~c_id_norm_power, color=~series, type="scattergl") %>%
add_trace(x=~v$ideal_response_to_plot$ts, y=~v$ideal_response_to_plot$norm_power, name='Ideal Response',
mode='markers', inherit=FALSE) %>%
add_trace(x=~v$ideal_response_downsampled$time_group, y=~v$ideal_response_downsampled$norm_power,
name='Ideal Response Downsampled', mode='markers', inherit=FALSE) %>%
add_trace(x=~v$ideal_response_to_plot_2020$ts, y=~v$ideal_response_to_plot_2020$norm_power, name='Ideal Response 2020',
mode='markers', inherit=FALSE) %>%
add_trace(x=~v$ideal_response_downsampled_2020$time_group, y=~v$ideal_response_downsampled_2020$norm_power,
name='Ideal Response Downsampled 2020', mode='markers', inherit=FALSE) %>%
layout(yaxis=list(title="Circuit power normalised to value of pre-event interval, \n aggregated by averaging"))
})
} else {
output$NormPower <- renderPlotly({
plot_ly(v$agg_norm_power, x=~Time, y=~c_id_norm_power, color=~series, type="scattergl",
mode = 'lines+markers') %>%
layout(yaxis=list(title="Circuit power normalised to value of pre-event interval, \n aggregated by averaging"))
})
}
output$ResponseCount <- renderPlotly({
plot_ly(v$response_count, x=~series_x, y=~sample_count, color=~series_y, type="bar") %>%
layout(yaxis = list(title = 'Fraction of circuits \n (denominator is count post filtering)'),
xaxis = list(title = 'Response categories'),
barmode = 'stack')
})
output$save_response_count <- renderUI({
shinySaveButton("save_response_count", "Save data", "Save file as ...", filetype=list(xlsx="csv"))
})
output$ZoneCount <- renderPlotly({
plot_ly(v$zone_count, x=~series_x, y=~sample_count, color=~series_y, type="bar") %>%
layout(yaxis = list(title = 'Fraction of zone circuits \n (denominator is count post filtering)'),
xaxis = list(title = 'Zone categories'), barmode = 'stack')
})
output$save_zone_count <- renderUI({
shinySaveButton("save_zone_count", "Save data", "Save file as ...", filetype=list(xlsx="csv"))
})
if(dim(v$frequency_data)[1]>0){
output$Frequency <- renderPlotly({
plot_ly(v$agg_power, x=~Time, y=~Frequency, color=~series, type="scattergl")%>%
add_trace(x=~v$region_frequency$ts, y=~v$region_frequency$f, name='High Speed Data',
mode='markers', inherit=FALSE) %>%
layout(yaxis=list(title="Average frequency (Hz)"))
})
} else {
output$Frequency <- renderPlotly({
plot_ly(v$agg_power, x=~Time, y=~Frequency, color=~series, type="scattergl")%>%
layout(yaxis=list(title="Average frequency (Hz)"))
})
}
output$Voltage <- renderPlotly({plot_ly(v$agg_power, x=~Time, y=~Voltage, color=~series, type="scattergl") %>%
layout(yaxis=list(title="Average volatge (V)"))
})
output$distance_response <- renderPlotly({
plot_ly(v$distance_response, x=~distance, y=~percentage, color=~series, type="scattergl") %>%
layout(yaxis=list(title="Cumlative disconnects / Cumulative circuits \n (Includes response categories 3 and 4)"),
xaxis=list(title="Distance from event (km)"))
})
output$save_distance_response <- renderUI({
shinySaveButton("save_distance_response", "Save data", "Save file as ...", filetype=list(xlsx="csv"))
})
z1 <- data.frame(circle.polygon(event_longitude(), event_latitude(), zone_one_radius(), sides = 20, units='km', poly.type = "gc.earth"))
z2 <- data.frame(circle.polygon(event_longitude(), event_latitude(), zone_two_radius(), sides = 20, units='km', poly.type = "gc.earth"))
z3 <- data.frame(circle.polygon(event_longitude(), event_latitude(), zone_three_radius(), sides = 20, units='km', poly.type = "gc.earth"))
output$map <- renderPlotly({plot_geo(v$geo_data, lat=~lat, lon=~lon, color=~percentage_disconnect) %>%
add_polygons(x=~z1$lon, y=~z1$lat, inherit=FALSE, fillcolor='transparent',
line=list(width=2,color="grey"), hoverinfo = "none", showlegend=FALSE) %>%
add_polygons(x=~z2$lon, y=~z2$lat, inherit=FALSE, fillcolor='transparent',
line=list(width=2,color="grey"), hoverinfo = "none", showlegend=FALSE) %>%
add_polygons(x=~z3$lon, y=~z3$lat, inherit=FALSE, fillcolor='transparent',
line=list(width=2,color="grey"), hoverinfo = "none", showlegend=FALSE) %>%
add_markers(x=~v$geo_data$lon, y=~v$geo_data$lat, inherit=FALSE,
hovertext=~v$geo_data$info, legendgroup = list(title = "Percentage Disconnects"),
marker=list(color=~percentage_disconnect, colorbar=list(title='Percentage \n Disconnects'),
colorscale='Bluered')) %>%
layout(annotations =
list(x = 1, y = -0.1, text = "Note: pecentage disconnects includes categories 3 and 4.",
showarrow = F, xref='paper', yref='paper',
xanchor='right', yanchor='auto', xshift=0, yshift=0))
})
output$compliance_cleaned_or_raw <-
renderUI({radioButtons("compliance_cleaned_or_raw",
label=strong("Choose data set"),
choices = list("clean","raw"),
selected = v$combined_data_f$clean[1],
inline = TRUE)})
v$reconnection_profile <- create_reconnection_profile(pre_event_interval(), ramp_length_minutes = 6,
time_step_seconds = as.numeric(duration()))
removeNotification(id)
# --------
} else {
# If there is no data left after filtering alert the user and create an empty plot.
shinyalert("Opps", "There is no data to plot")
reset_chart_area(input, output, session)
removeNotification(id)
}
} else {
shinyalert("Wow", "You are trying to plot more than 1000 series, maybe try
narrowing down those filters and agg settings")
reset_chart_area(input, output, session)
removeNotification(id)
}
logdebug('Update plots completed', logger=app_logger)
})
observeEvent(input$compliance_cleaned_or_raw, {
if(compliance_cleaned_or_raw() %in% v$combined_data_f$clean) {
# Setting up manual compliance tab.
circuit_options <- filter(v$combined_data_f, clean == compliance_cleaned_or_raw())
set.seed(002)
v$c_id_vector <- sample(unique(circuit_options$c_id))
set.seed(NULL)
v$compliance_counter <- 1
message <- paste0("Select circuit (now viewing circuit ", v$compliance_counter, ' of ', length(v$c_id_vector) ,")")
circuit_to_view <- v$c_id_vector[[v$compliance_counter]]
output$compliance_circuits <- renderUI({selectizeInput("compliance_circuits", label=strong(message), choices=as.list(v$c_id_vector),
multiple=FALSE, selected=circuit_to_view)})
output$get_next_c_id <- renderUI({actionButton("get_next_c_id", "Next")})
output$get_previous_c_id <- renderUI({actionButton("get_previous_c_id", "Previous")})
} else {
output$compliance_cleaned_or_raw <- renderUI({radioButtons("compliance_cleaned_or_raw",
label=strong("Choose data set"),
choices = list("clean","raw"),
selected = v$combined_data_f$clean[1],
inline = TRUE)})