-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfct_select_area.R
More file actions
135 lines (95 loc) · 3.6 KB
/
fct_select_area.R
File metadata and controls
135 lines (95 loc) · 3.6 KB
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
functional_areas <- R6Class(
classname = "functional_areas",
# 1. Define the initial values ---------------------------------------------------------------------------------------
public = list(
base_model = 0,
fine_tuning = 0,
efpmpedia = 0,
# 2. Initialise the unique IDs -------------------------------------------------------------------------------------
initialize = \() {
init("base_model_click")
init("fine_tuning_click")
init("efpmpedia_click")
},
# 3. Define the increment_ functions -------------------------------------------------------------------------------
increment_base_model = function() {
self$base_model <- self$base_model + 1
trigger("base_model_click")
},
increment_fine_tuning = function() {
self$fine_tuning <- self$fine_tuning + 1
trigger("fine_tuning_click")
},
increment_efpmpedia = function() {
self$efpmpedia <- self$efpmpedia + 1
trigger("efpmpedia_click")
}
)
)
select_function_area <- function(function_area, base_model_ui, fine_tuning_ui, efpmpedia_ui) {
# 1. Logic of the base model -----------------------------------------------------------------------------------------
observeEvent(watch("base_model_click"), {
if (function_area$base_model == 1) {
nav_insert(
id = "tabs",
target = "Overview",
position = "after",
select = TRUE,
nav = nav_panel(title = "Base Model", base_model_ui)
)
} else {
nav_select(id = "tabs", selected = "Base Model")
}
})
# 2. Logic of the Fine-Tuning model ----------------------------------------------------------------------------------
observeEvent(watch("fine_tuning_click"), {
if (function_area$fine_tuning == 1 & function_area$base_model == 0) {
nav_insert(
id = "tabs",
target = "Overview",
position = "after",
select = TRUE,
nav = nav_panel(title = "Fine-Tuning", fine_tuning_ui)
)
} else if (function_area$fine_tuning == 1 & function_area$base_model == 1) {
nav_insert(
id = "tabs", # Match the id from navset_bar
target = "Base Model",
position = "after",
select = TRUE,
nav = nav_panel(title = "Fine-Tuning", fine_tuning_ui))
} else {
nav_select(id = "tabs", selected = "Fine-Tuning")
}
})
# 3. Logic of the EFPMpedia model ------------------------------------------------------------------------------------
observeEvent(watch("efpmpedia_click"), {
if (function_area$base_model == 0 & function_area$fine_tuning == 0 & function_area$efpmpedia == 1) {
nav_insert(
id = "tabs",
target = "Overview",
position = "after",
select = TRUE,
nav = nav_panel(title = "EFPMpedia", efpmpedia_ui)
)
} else if (function_area$base_model >= 1 & function_area$fine_tuning == 0 & function_area$efpmpedia == 1) {
nav_insert(
id = "tabs",
target = "Base Model",
position = "after",
select = TRUE,
nav = nav_panel(title = "EFPMpedia", efpmpedia_ui)
)
} else if (function_area$base_model >= 0 & function_area$fine_tuning >= 1 & function_area$efpmpedia == 1) {
nav_insert(
id = "tabs", # Match the id from navset_bar
target = "Fine-Tuning",
position = "after",
select = TRUE,
nav = nav_panel(title = "EFPMpedia", efpmpedia_ui)
)
} else {
nav_select(id = "tabs", selected = "EFPMpedia")
}
})
}