Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
38f34f3
feat: make all pickerInput in mod_board_simulation module alphabetica…
elaouniyassine Oct 6, 2025
c6e14e7
feat: make all pickerInput in mod_board_comparaison module alphabetic…
elaouniyassine Oct 6, 2025
7c1f256
feat: make all pickerInput in mod_scenario module alphabetical and se…
elaouniyassine Oct 6, 2025
3c2fabe
feat: make all pickerInput in mod_params_db module alphabetical and s…
elaouniyassine Oct 6, 2025
27b3624
feat: add data validation warnings for livestock time
elaouniyassine Oct 8, 2025
18d1276
feat: Add validation warnings for crop areas and residue management t…
elaouniyassine Oct 8, 2025
3a4c049
feat: Add clone feature
elaouniyassine Oct 9, 2025
b5eb015
feat: Improve parameter database tables usability
elaouniyassine Oct 10, 2025
907cf07
feat: improve table navigation flow and overall user experience
elaouniyassine Oct 10, 2025
49ba364
chore: clean and document new features
elaouniyassine Oct 10, 2025
af2f895
feat: improve livestock time validation
elaouniyassine Oct 20, 2025
eaba139
feat: improve crop and residue validation warnings
elaouniyassine Oct 20, 2025
027a86b
refactor: improve parameter tables readability
elaouniyassine Oct 20, 2025
5c6401a
fix: prevent live-search reset
elaouniyassine Oct 21, 2025
80c1919
fix: make dropdown fully visible in modals
elaouniyassine Oct 21, 2025
08e8d98
fix: Improve dropdown menu text in modals
elaouniyassine Oct 22, 2025
fd7dc62
fix: Improve modal responsiveness on sub-1300px
elaouniyassine Oct 22, 2025
8c7d7dc
fix: enhance validation warning
elaouniyassine Oct 24, 2025
67485d9
fix: add-row edit pagination offset
elaouniyassine Oct 24, 2025
d8a086d
Improve modal size and warning font size
elaouniyassine Oct 26, 2025
fc17c74
Merge pull request #4 from APPLITICS/feature/ui-priority-change-requests
elaouniyassine Dec 1, 2025
75b39c2
chore: Replace "Delete" with "Remove" in Seasons tab
elaouniyassine Dec 6, 2025
9e1a721
Implement data checks for Area tab inputs
elaouniyassine Dec 10, 2025
9a5672f
Implement data checks for waste tab
elaouniyassine Dec 10, 2025
147f536
Sort validation errors by field order
elaouniyassine Dec 10, 2025
b919d89
Implement data checks for Manure/Fertilizer tab inputs
elaouniyassine Dec 10, 2025
7be55fa
Fix input type for Manure/Fertilizer fields
elaouniyassine Dec 10, 2025
f9cc796
Restructure validation module documentation
elaouniyassine Dec 11, 2025
ec3b7ad
Add live validation for Livestock Feeding tab
elaouniyassine Dec 11, 2025
945951c
Restrict unselected fertilizers in crop inputs
elaouniyassine Dec 21, 2025
58d5fbf
Add warning on missing fertilizers in Crop Inputs
elaouniyassine Dec 21, 2025
957baff
Remove custom pagination logic
elaouniyassine Dec 21, 2025
53b6855
Add header freeze in parameter tables
elaouniyassine Dec 21, 2025
88359f3
Merge pull request #19 from APPLITICS/feature/data-validation-warnings
elaouniyassine Dec 21, 2025
ddc5305
Add column search feature to parameter DB tables
elaouniyassine Dec 23, 2025
5735bb9
Rename `Feedtype` to `Crops` across codebase
elaouniyassine Dec 23, 2025
4bbe03b
Remove `n_fixation` column from `lkp_feedtype`
elaouniyassine Dec 23, 2025
3cfb3c8
Auto-generate unique codes for add row feature
elaouniyassine Dec 23, 2025
7012081
Disable buttons and code editing in Livetype table
elaouniyassine Dec 26, 2025
8df12fa
Reposition 'Edit Parameters' button
elaouniyassine Dec 24, 2025
0fdfead
Update the form link
elaouniyassine Dec 24, 2025
9cc7242
Fix clone/delete targeting after sorting
elaouniyassine Dec 23, 2025
55ae392
Rename 'lkp_feedtype' to 'lkp_crops'
elaouniyassine Dec 23, 2025
5343afa
Add duplicate code validation to params tables
elaouniyassine Dec 24, 2025
a82dec7
Clean feeditem tables: remove V8/V9 & 'de'
elaouniyassine Dec 24, 2025
9ae0c5a
Remove unnecessary variables
elaouniyassine Dec 24, 2025
7f14295
Change variable names across the app&database
elaouniyassine Dec 24, 2025
886a604
Fix header redisplay bug on cell edit
elaouniyassine Dec 25, 2025
72ea0a2
Improve Feeditems tab UX
elaouniyassine Dec 28, 2025
f8c56fb
Reorder feeditem dataset columns
elaouniyassine Dec 28, 2025
2b0dc72
Remove sub-climate & Update Climate PickerInputa
elaouniyassine Dec 28, 2025
fa95efb
Fix crop_code hiding for default DB
elaouniyassine Dec 28, 2025
baa6659
Remove unnecesary 'lkp_climate2.csv' file
elaouniyassine Dec 28, 2025
da76ff7
Improve scenario and parameters db tabs layout
elaouniyassine Jan 3, 2026
cd6236d
Improve livetype disabling logic code
elaouniyassine Jan 3, 2026
7fd5258
Merge pull request #23 from APPLITICS/feature/ux-improvements-part2
elaouniyassine Jan 3, 2026
239e3c2
remove unnecessary req
elaouniyassine Jan 3, 2026
2acb2d4
reinforce fertilizer warning message logic
elaouniyassine Jan 3, 2026
1522ed0
merge staging
elaouniyassine Jan 5, 2026
8681d0d
remove old pagination code
elaouniyassine Jan 5, 2026
c1700b7
Change variable milk_fat_content to fat_milkcontent
elaouniyassine Jan 7, 2026
b36bcdb
Remove unused variables (part 2)
elaouniyassine Jan 17, 2026
4e008bc
Fix table performance and scrollbar visibility issues
elaouniyassine Jan 18, 2026
b28f636
Auto-jump after adding a row
elaouniyassine Jan 18, 2026
90011d0
Reduce code column's width
elaouniyassine Jan 18, 2026
b3b7059
Freeze key columns in Crops & Livetype
elaouniyassine Jan 18, 2026
c390a24
save vertical scroll position
elaouniyassine Jan 26, 2026
dd94816
Implement new default parameters database
elaouniyassine Feb 16, 2026
0dbd9c1
restore onboarding code logic
elaouniyassine Feb 16, 2026
d03e042
Remove extra livestock colnames
elaouniyassine Feb 17, 2026
eb06cd4
remove extra comma
elaouniyassine Feb 19, 2026
1380b6c
code improvements
elaouniyassine Feb 19, 2026
85f6c07
remove commented code
elaouniyassine Feb 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
141 changes: 63 additions & 78 deletions R/10_mod_board_simulation_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ board_simulation_server <- function(
shinyWidgets::updatePickerInput(
session = session,
inputId = "json_file_name",
choices = list.files(
path = file.path(session$userData$user_folder, "study_objects"),
full.names = FALSE
choices = sort(
list.files(
path = file.path(session$userData$user_folder, "study_objects"),
full.names = FALSE
)
),
selected = list.files(
path = file.path(session$userData$user_folder, "study_objects"),
Expand All @@ -23,9 +25,11 @@ board_simulation_server <- function(
shinyWidgets::updatePickerInput(
session = session,
inputId = "scenario_name",
choices = list.files(
path = file.path(session$userData$user_folder, "scenarios"),
full.names = FALSE
choices = sort(
list.files(
path = file.path(session$userData$user_folder, "scenarios"),
full.names = FALSE
)
),
selected = character(0)
)
Expand Down Expand Up @@ -53,9 +57,11 @@ board_simulation_server <- function(
shinyWidgets::updatePickerInput(
session,
"json_file_name",
choices = list.files(
path = file.path(session$userData$user_folder, "study_objects"),
full.names = FALSE
choices = sort(
list.files(
path = file.path(session$userData$user_folder, "study_objects"),
full.names = FALSE
)
),
selected = input$json_file_name
)
Expand All @@ -64,9 +70,11 @@ board_simulation_server <- function(
shinyWidgets::updatePickerInput(
session,
"scenario_name",
choices = list.files(
path = file.path(session$userData$user_folder, "scenarios"),
full.names = FALSE
choices = sort(
list.files(
path = file.path(session$userData$user_folder, "scenarios"),
full.names = FALSE
)
),
selected = character(0)
)
Expand All @@ -78,9 +86,11 @@ board_simulation_server <- function(
cat(file = stderr(), "10 - Update json_file_name choices\n")
shinyWidgets::updatePickerInput(
inputId = "json_file_name",
choices = list.files(
path = file.path(session$userData$user_folder, "study_objects"),
full.names = FALSE
choices = sort(
list.files(
path = file.path(session$userData$user_folder, "study_objects"),
full.names = FALSE
)
),
selected = list.files(
path = file.path(session$userData$user_folder, "study_objects"),
Expand Down Expand Up @@ -129,20 +139,19 @@ board_simulation_server <- function(
observeEvent(list(input$run_scenario, input$scenario_name), {
cat(file = stderr(), "10 - Display warning text\n")
shinyjs::hide(selector = jns("warning_scenario_text"))
req(input$scenario_name)
# according to the scenario data
if (!is.null(input$scenario_name)) {
warning_msg <- readRDS(
warning_msg <- readRDS(
file.path(
session$userData$user_folder, "scenarios",
input$scenario_name, "scenario_data.rds"
)
)$warning_msg
if (!is.null(warning_msg$warning_text)) {
shinyjs::show(id = "warning_scenario_text")
shinyjs::html(
id = "warning_scenario_text", html = warning_msg$warning_text
)
}
if (!is.null(warning_msg$warning_text)) {
shinyjs::show(id = "warning_scenario_text")
shinyjs::html(
id = "warning_scenario_text", html = warning_msg$warning_text
)
}
}, ignoreInit = FALSE)

Expand Down Expand Up @@ -237,7 +246,7 @@ board_simulation_server <- function(
land_required = land_required,
nitrogen_balance = nitrogen_balance
)

# Add dry matter intake checks -----------------------------------------
# Convert to daily intake
dmi_per_day <- energy_required$annual_results$dmi_tot / 365
Expand Down Expand Up @@ -329,8 +338,10 @@ board_simulation_server <- function(
# update choices for scenario_name and scenario_results_comp input
shinyWidgets::updatePickerInput(
inputId = "scenario_name",
choices = list.files(
file.path(session$userData$user_folder, "scenarios"), full.names = FALSE
choices = sort(
list.files(
file.path(session$userData$user_folder, "scenarios"), full.names = FALSE
)
),
selected = sub("\\.json$", "", input$json_file_name[1])
)
Expand Down Expand Up @@ -441,15 +452,19 @@ board_simulation_server <- function(
shinyWidgets::updatePickerInput(
session = session,
"scenario_name",
choices = list.files(
file.path(session$userData$user_folder, "scenarios"), full.names = FALSE
choices = sort(
list.files(
file.path(session$userData$user_folder, "scenarios"), full.names = FALSE
)
),
selected = character(0)
)
shinyWidgets::updatePickerInput(
inputId = "scenario_results_comp",
choices = list.files(
file.path(session$userData$user_folder, "scenarios"), full.names = FALSE
choices = sort(
list.files(
file.path(session$userData$user_folder, "scenarios"), full.names = FALSE
)
),
selected = list.files(
file.path(session$userData$user_folder, "scenarios"), full.names = FALSE
Expand All @@ -461,67 +476,46 @@ board_simulation_server <- function(
)
})

# ------ PLOT GHG emission ---------------------------------------------------
output$plot_ghg_emission <- renderGirafe({

# ------ Cached scenario data (read RDS once, shared by all 4 plots) ----------
scenario_plot_data <- reactive({
req(input$scenario_name)
req(session$userData$run_scenario_counter())
cat(file = stderr(), "10 - Plot GHG emission\n")

# Read the data
on_farm_table <- readRDS(
readRDS(
file.path(
session$userData$user_folder, "scenarios",
input$scenario_name,
"scenario_data.rds"
input$scenario_name, "scenario_data.rds"
)
)[["on_farm_table"]]

)
})

# ------ PLOT GHG emission ---------------------------------------------------
output$plot_ghg_emission <- renderGirafe({
cat(file = stderr(), "10 - Plot GHG emission\n")
scenario_data <- scenario_plot_data()
on_farm_table <- scenario_data[["on_farm_table"]]
unit <- graphs_desc[graphs_desc$indicator == "ghg_emission", ]$unit
plot_ghg_emissions(on_farm_table, unit)
})

# ------ PLOT N BALANCE ------------------------------------------------------
output$plot_n_balance <- renderGirafe({

req(input$scenario_name)
req(session$userData$run_scenario_counter())
cat(file = stderr(), "10 - Plot N Balance\n")

# Read the data
nitrogen_balance <- readRDS(
file.path(
session$userData$user_folder,
"scenarios",
input$scenario_name,
"scenario_data.rds"
)
)[["nitrogen_balance"]]

scenario_data <- scenario_plot_data()
nitrogen_balance <- scenario_data[["nitrogen_balance"]]
unit <- graphs_desc[graphs_desc$indicator == "n_balance", ]$unit
plot_n_balance(nitrogen_balance, unit)
})

# ------ PLOT LAND REQUIRED --------------------------------------------------
output$plot_land_req <- renderGirafe({

req(session$userData$run_scenario_counter())
req(input$scenario_name)
cat(file = stderr(), "10 - Plot Land Required\n")

# hide all the seasons legend items
lapply(1:max_seasons, function(i) {
shinyjs::hide(id = paste0("Seasons_LegendItemtxt_", i))
})

# Read the data
land_required <- readRDS(
file.path(
session$userData$user_folder,
"scenarios", input$scenario_name,
"scenario_data.rds"
)
)[["land_required"]]
scenario_data <- scenario_plot_data()
land_required <- scenario_data[["land_required"]]

# unique seasons
seasons <- unique(land_required$season_name)
Expand All @@ -539,23 +533,14 @@ board_simulation_server <- function(

# ----- PLOT WATER USE PER FEED ----------------------------------------------
output$plot_water_feed <- renderGirafe({

req(session$userData$run_scenario_counter())
req(input$scenario_name)
cat(file = stderr(), "10 - Plot Water Use per Feed\n")

# hide all the feeds legend items
lapply(1:max_feed_items, function(i) {
shinyjs::hide(id = paste0("Feeds_LegendItemtxt_", i))
})

# Read the data
water_use_per_feed_item <- readRDS(
file.path(
session$userData$user_folder, "scenarios",
input$scenario_name, "scenario_data.rds"
)
)[["water_use_per_feed_item"]]
scenario_data <- scenario_plot_data()
water_use_per_feed_item <- scenario_data[["water_use_per_feed_item"]]

# unique feeds
feeds <- unique(water_use_per_feed_item$feed)
Expand Down
4 changes: 3 additions & 1 deletion R/10_mod_board_simulation_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ board_simulation_ui <- function(id) {
choices = NULL,
multiple = TRUE,
options = list(
`live-search` = TRUE,
`selected-text-format` = "count",
`count-selected-text` = "{0}/{1} Scenarios"
)
Expand Down Expand Up @@ -98,7 +99,8 @@ board_simulation_ui <- function(id) {
inputId = ns("scenario_name"),
label = NULL,
choices = NULL,
multiple = FALSE
multiple = FALSE,
options = list(`live-search` = TRUE)
)
)
),
Expand Down
Loading