Skip to contents

Creates a new site record with auto-generated site code and default values. The site code is generated using either a base code or a default "SITE_" prefix, followed by a zero-padded three-digit number.

The record structure follows eDataDRF::initialise_sites_tibble(). Default values for geographic feature, coordinate system, and altitude unit are drawn from the relevant controlled vocabularies.

Usage

create_new_site(site_number = 1, base_code = "", session)

Arguments

site_number

Integer. The site number to use in the site code. Default is 1.

base_code

Character. Optional prefix for the site code. If empty or NULL, defaults to "SITE_". Default is "".

session

Shiny session object. Used to extract the ENTERED_BY value from session$userData$reactiveValues$campaignData$ENTERED_BY.

Value

A tibble with one row containing the new site record, initialized with default values according to the eDataDRF sites schema (eDataDRF::initialise_sites_tibble()).

Examples

if (FALSE) { # \dontrun{
  # session is the Shiny session object from the module server function
  new_site <- create_new_site(site_number = 1, base_code = "FJORD", session = session)
  new_site$SITE_CODE
} # }