From 8de05ce96828001e54558d8436879398e5a9366b Mon Sep 17 00:00:00 2001 From: Timon Date: Tue, 10 Feb 2026 19:17:12 +0100 Subject: [PATCH] modified: r_app/91_CI_report_with_kpis_cane_supply.Rmd --- r_app/91_CI_report_with_kpis_cane_supply.Rmd | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/r_app/91_CI_report_with_kpis_cane_supply.Rmd b/r_app/91_CI_report_with_kpis_cane_supply.Rmd index 483f716..085476d 100644 --- a/r_app/91_CI_report_with_kpis_cane_supply.Rmd +++ b/r_app/91_CI_report_with_kpis_cane_supply.Rmd @@ -396,6 +396,17 @@ if (!is.null(benchmarks)) { } ``` +```{r compute_total_acreage, include=FALSE, eval=TRUE} +# Precompute total acreage for use in cover page inline expression +# Safely extract and sum acreage from KPI data (may not exist until key_insights runs) +total_acreage <- 0 +if (exists("summary_data") && !is.null(summary_data) && "field_analysis" %in% names(summary_data)) { + field_analysis_df <- summary_data$field_analysis + total_acreage <- sum(field_analysis_df$Acreage, na.rm = TRUE) + if (is.na(total_acreage)) total_acreage <- 0 +} +``` + ::: {custom-style="Cover_title" style="text-align:center; margin-top:120px;"} @@ -408,19 +419,15 @@ if (!is.null(benchmarks)) { \newpage - - ## Report Generated **Farm Location:** `r toupper(project_dir)` Estate **Report Period:** Week `r current_week` of `r year` **Report Generated on:** `r format(Sys.time(), "%B %d, %Y at %H:%M")` -**Farm Size Included in Analysis:** `r toupper(total_acreage)` acres +**Farm Size Included in Analysis:** `r formatC(total_acreage, format="f", digits=1)` acres **Data Source:** Planet Labs Satellite Imagery **Analysis Type:** Chlorophyll Index (CI) Monitoring - - ## Key Insights ```{r key_insights, echo=FALSE, results='asis', eval=TRUE}