Update date range in batch pipeline and enhance area unit preference handling

This commit is contained in:
Timon 2026-02-24 15:12:03 +01:00
parent 83951efca2
commit 442d1ac46c
2 changed files with 15 additions and 4 deletions

View file

@ -12,8 +12,8 @@ suppressPackageStartupMessages({
# Configuration # Configuration
PROJECT <- "aura" PROJECT <- "aura"
START_DATE <- as.Date("2026-01-21") START_DATE <- as.Date("2026-01-26")
END_DATE <- as.Date("2026-02-18") END_DATE <- as.Date("2026-02-23")
OFFSET <- 7 OFFSET <- 7
# Generate date sequence (every 7 days) # Generate date sequence (every 7 days)

View file

@ -46,8 +46,19 @@ DAH_MATURITY_THRESHOLD <- 240
# ============================================================================ # ============================================================================
# Unit preference for area reporting: "hectare" or "acre" # Unit preference for area reporting: "hectare" or "acre"
# This cascades through all KPI calculations, exports, and reports # This cascades through all KPI calculations, exports, and reports
# Future: can be overridden per-project from Laravel database (preferred_area_unit column) #
AREA_UNIT_PREFERENCE <- "acre" # Options: "hectare", "acre" # Priority order:
# 1. AREA_UNIT environment variable (set by shell scripts from Laravel)
# 2. Default: "hectare"
#
# Set by shell wrappers: export AREA_UNIT="<project_preferred_unit>"
AREA_UNIT_PREFERENCE <- tolower(Sys.getenv("AREA_UNIT", unset = "hectare"))
# Validate area unit value
if (!AREA_UNIT_PREFERENCE %in% c("hectare", "acre")) {
warning(paste0("Invalid AREA_UNIT env var: '", AREA_UNIT_PREFERENCE, "'. Using 'hectare'."))
AREA_UNIT_PREFERENCE <- "hectare"
}
#' Get area unit label for display #' Get area unit label for display
#' #'