fixed the path that the excel is being saved to
This commit is contained in:
parent
951eb487b8
commit
0503a93bcd
|
|
@ -335,8 +335,8 @@ main <- function() {
|
|||
message("WORKFLOW: CALCULATING 6 FARM-LEVEL KPIs (Script 90 compatible)")
|
||||
message(strrep("=", 70))
|
||||
|
||||
# Prepare inputs for KPI calculation (already created by setup_project_directories)
|
||||
reports_dir_kpi <- setup$kpi_reports_dir
|
||||
# Prepare outputs and inputs for KPI calculation (already created by setup_project_directories)
|
||||
reports_dir_kpi <- file.path(setup$reports_dir, "kpis")
|
||||
cumulative_CI_vals_dir <- setup$cumulative_CI_vals_dir
|
||||
|
||||
# Load field boundaries for workflow (use data_dir from setup)
|
||||
|
|
|
|||
|
|
@ -678,13 +678,13 @@ export_field_analysis_excel <- function(field_df, summary_df, project_dir, curre
|
|||
NULL
|
||||
}
|
||||
|
||||
output_subdir <- file.path(reports_dir, "field_analysis")
|
||||
if (!dir.exists(output_subdir)) {
|
||||
dir.create(output_subdir, recursive = TRUE)
|
||||
output_dir <- file.path(reports_dir)
|
||||
if (!dir.exists(output_dir)) {
|
||||
dir.create(output_dir, recursive = TRUE)
|
||||
}
|
||||
|
||||
excel_filename <- paste0(project_dir, "_field_analysis_week", sprintf("%02d_%d", current_week, year), ".xlsx")
|
||||
excel_path <- file.path(output_subdir, excel_filename)
|
||||
excel_path <- file.path(output_dir, excel_filename)
|
||||
excel_path <- normalizePath(excel_path, winslash = "\\", mustWork = FALSE)
|
||||
|
||||
# Build sheets list dynamically
|
||||
|
|
@ -710,13 +710,13 @@ export_field_analysis_excel <- function(field_df, summary_df, project_dir, curre
|
|||
)
|
||||
|
||||
rds_filename <- paste0(project_dir, "_field_analysis_week", sprintf("%02d_%d", current_week, year), ".rds")
|
||||
rds_path <- file.path(output_subdir, rds_filename)
|
||||
rds_path <- file.path(output_dir, rds_filename)
|
||||
|
||||
saveRDS(kpi_data, rds_path)
|
||||
message(paste("✓ Field analysis RDS exported to:", rds_path))
|
||||
|
||||
csv_filename <- paste0(project_dir, "_field_analysis_week", sprintf("%02d_%d", current_week, year), ".csv")
|
||||
csv_path <- file.path(output_subdir, csv_filename)
|
||||
csv_path <- file.path(output_dir, csv_filename)
|
||||
write_csv(field_df_rounded, csv_path)
|
||||
message(paste("✓ Field analysis CSV exported to:", csv_path))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue