From 74707f87b7902bb304f440e141e9c937fc6c6678 Mon Sep 17 00:00:00 2001 From: Bruce Delo Date: Tue, 9 Apr 2024 15:01:07 -0300 Subject: [PATCH] A few more pieces added to the detections processing bit. --- R/imos_to_otn_detections.R | 31 ++++++++++++++++++++----------- R/otn_imos_column_map.R | 2 +- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/R/imos_to_otn_detections.R b/R/imos_to_otn_detections.R index 1d10cd4..f955d94 100644 --- a/R/imos_to_otn_detections.R +++ b/R/imos_to_otn_detections.R @@ -12,31 +12,40 @@ #' @export #' -imos_to_otn_detections <- function(detection_dataframe) { +imos_to_otn_detections <- function(detection_dataframe, coll_code = NULL) { det_return <- detection_dataframe %>% dplyr::select( detection_datetime, receiver_name, - receiver_id, transmitter_id, - transmitter_sensor_raw_value, + transmitter_sensor_value, transmitter_sensor_unit, + transmitter_sensor_type, station_name, + receiver_project_name, receiver_deployment_latitude, - receiver_deployment_longitude + receiver_deployment_longitude, + species_scientific_name, + species_common_name, + ends_with("_QC"), ) %>% mutate( - transmitter_name = NA, - transmitter_serial = NA, + sensorname = transmitter_id, + detectedby = receiver_project_name, + collectioncode = coll_code, ) %>% rename( - date_ane_time = detection_datetime, + date_and_time = detection_datetime, receiver = receiver_name, - transmitter = transmitter_id, - sensor_value = transmitter_sensor_raw_value, - sensor_unit = transmitter_sensor_unit, + tagname = transmitter_id, + sensorvalue = transmitter_sensor_value, + sensorunit = transmitter_sensor_unit, latitude = receiver_deployment_latitude, - longitude = receiver_deployment_longitude + longitude = receiver_deployment_longitude, + scientificname = species_scientific_name, + commonname = species_common_name, + sensortype = transmitter_sensor_type, + station = station_name, ) return(det_return) diff --git a/R/otn_imos_column_map.R b/R/otn_imos_column_map.R index be3c99d..c701052 100644 --- a/R/otn_imos_column_map.R +++ b/R/otn_imos_column_map.R @@ -103,7 +103,7 @@ otn_imos_column_map <- function(det_dataframe, rcvr_dataframe = NULL, tag_datafr transmitter_sensor_unit = NA, transmitter_status = NA, transmitter_estimated_battery_life = NA, - transmitter_sensor_raw_value = NA, + transmitter_sensor_value = NA, embargo_date = NA, transmitter_deployment_latitude = NA, transmitter_deployment_longitude = NA,