From ac15f4ce73f753cdf47759ef506b64a20f388b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Fri, 10 Oct 2025 11:16:57 -0700 Subject: [PATCH 01/22] =?UTF-8?q?=F0=9F=9B=91=F0=9F=A7=AA=20Fail=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/testthat/test-BL_data_format.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/testthat/test-BL_data_format.R b/tests/testthat/test-BL_data_format.R index 41377fc..e872f10 100644 --- a/tests/testthat/test-BL_data_format.R +++ b/tests/testthat/test-BL_data_format.R @@ -28,6 +28,11 @@ describe("Construct BL table", { obtained_columns <- colnames(obtained_bl_table) expect_true(all(expected_columns %in% obtained_columns)) }) + it("Round coordinates", { + obtained_latitued <- obtained_bl_table[[1, "latitude"]] + expected_latitude <- 29.110365 + expect_equal(obtained_latitued, expected_latitude) + }) it("Classify breed stage from joined data", { expected_breed_stage <- "chick-rearing" obtained_breed_stage <- obtained_bl_table[[1, "breed_stage"]] From 4b30587734d135637eb2877c869aae4f99fad29d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Fri, 10 Oct 2025 11:28:01 -0700 Subject: [PATCH 02/22] =?UTF-8?q?=F0=9F=9B=91=F0=9F=A7=AA=20Fail=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/testthat/test-BL_data_format.R | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test-BL_data_format.R b/tests/testthat/test-BL_data_format.R index e872f10..c750c05 100644 --- a/tests/testthat/test-BL_data_format.R +++ b/tests/testthat/test-BL_data_format.R @@ -28,10 +28,11 @@ describe("Construct BL table", { obtained_columns <- colnames(obtained_bl_table) expect_true(all(expected_columns %in% obtained_columns)) }) + are_all_rounded <- function(x, digits = 6) { + all(round(x, digits) == x, na.rm = TRUE) + } it("Round coordinates", { - obtained_latitued <- obtained_bl_table[[1, "latitude"]] - expected_latitude <- 29.110365 - expect_equal(obtained_latitued, expected_latitude) + expect_true(are_all_rounded(obtained_bl_table$latitude, 6)) }) it("Classify breed stage from joined data", { expected_breed_stage <- "chick-rearing" From fd03be10ced12e56b2325d2e0ec21f318099f8fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Fri, 10 Oct 2025 11:28:24 -0700 Subject: [PATCH 03/22] =?UTF-8?q?=E2=9C=85=20Pass=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/BL_data_format.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/BL_data_format.R b/R/BL_data_format.R index 5d1d477..4ab84bf 100644 --- a/R/BL_data_format.R +++ b/R/BL_data_format.R @@ -23,6 +23,7 @@ construct_bl_table <- function(breeding_status, tracking_data, config_content) { data_table_with_trips@data |> rename(time_gmt = time, latitude = Latitude, longitude = Longitude, track_id = tripID) |> + mutate(latitude = round(latitude, 6)) |> select(all_of(ordered_columns)) } From 7bc428e52904e6570927710245cf6283a9d019c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Fri, 10 Oct 2025 11:30:05 -0700 Subject: [PATCH 04/22] =?UTF-8?q?=F0=9F=9B=91=F0=9F=A7=AA=20Fail=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/testthat/test-BL_data_format.R | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/testthat/test-BL_data_format.R b/tests/testthat/test-BL_data_format.R index c750c05..7cc2c2f 100644 --- a/tests/testthat/test-BL_data_format.R +++ b/tests/testthat/test-BL_data_format.R @@ -33,6 +33,7 @@ describe("Construct BL table", { } it("Round coordinates", { expect_true(are_all_rounded(obtained_bl_table$latitude, 6)) + expect_true(are_all_rounded(obtained_bl_table$longitude, 6)) }) it("Classify breed stage from joined data", { expected_breed_stage <- "chick-rearing" From 3f4c06ef054795dbafeec4892d40596465715703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Fri, 10 Oct 2025 11:34:55 -0700 Subject: [PATCH 05/22] =?UTF-8?q?=E2=9C=85=20Pass=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/BL_data_format.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/BL_data_format.R b/R/BL_data_format.R index 4ab84bf..7ebae3e 100644 --- a/R/BL_data_format.R +++ b/R/BL_data_format.R @@ -23,7 +23,7 @@ construct_bl_table <- function(breeding_status, tracking_data, config_content) { data_table_with_trips@data |> rename(time_gmt = time, latitude = Latitude, longitude = Longitude, track_id = tripID) |> - mutate(latitude = round(latitude, 6)) |> + mutate(latitude = round(latitude, 6), longitude = round(longitude, 6)) |> select(all_of(ordered_columns)) } From 274df148593b97f648a75a6144f990a304d17276 Mon Sep 17 00:00:00 2001 From: Mario Villasante Date: Fri, 10 Oct 2025 11:36:04 -0700 Subject: [PATCH 06/22] =?UTF-8?q?=E2=9A=97=EF=B8=8F=F0=9F=97=82=EF=B8=8F?= =?UTF-8?q?=20update=20data=20for=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/data/gps-albatros-guadalupe.csv | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/data/gps-albatros-guadalupe.csv b/tests/data/gps-albatros-guadalupe.csv index 4b631e2..fbf752a 100644 --- a/tests/data/gps-albatros-guadalupe.csv +++ b/tests/data/gps-albatros-guadalupe.csv @@ -16,8 +16,8 @@ date,latitude,longitude,name,time 2014-02-16,28.884113,-118.292143,LAAL05,13:00:00 2014-02-17,28.884217,-118.291543,LAAL05,14:00:00 2017-02-15,29.390127,-118.315544,1,11:00:00 -2017-02-17,32.203983,-118.396667,1,12:00:00 -2017-02-17,32.380726,-118.869003,1,13:00:00 +2017-02-17,32.203983000001,-118.396667,1,12:00:00 +2017-02-17,32.380726000001,-118.869003,1,13:00:00 2017-02-21,28.884108,-118.291504,2,14:00:00 2017-02-21,28.884073,-118.291519,2,15:00:00 2017-02-22,28.884121,-118.291504,2,16:00:00 @@ -28,11 +28,11 @@ date,latitude,longitude,name,time 2018-01-29,42.574684,-139.830383,4E8,12:00:00 2018-01-29,42.460968,-139.748444,4E8,13:00:00 2018-01-29,42.431324,-139.639725,4E8,14:00:00 -2016-01-29,42.168236,-140.09169,4E8,10:00:00 +2016-01-29,42.168236,-140.091690000001,4E8,10:00:00 2016-01-29,42.574684,-139.830383,4E8,11:00:00 -2016-01-29,42.460968,-139.748444,4E8,12:00:00 +2016-01-29,42.460968,-139.74844400000001,4E8,12:00:00 2016-01-29,42.431324,-139.639725,4E8,13:00:00 2017-12-31,42.168236,-140.09169,4E8,22:00:00 2017-12-31,42.574684,-139.830383,4E8,23:00:00 2018-01-01,42.460968,-139.748444,4E8,00:01:00 -2018-01-01,42.431324,-139.639725,4E8,01:00:00 +2018-01-01,42.431324,-139.63972500000001,4E8,01:00:00 From e80f16d3d7e711436559904656aea1af68befa94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Fri, 10 Oct 2025 11:43:42 -0700 Subject: [PATCH 07/22] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=20Refactor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/BL_data_format.R | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/R/BL_data_format.R b/R/BL_data_format.R index 7ebae3e..5e83779 100644 --- a/R/BL_data_format.R +++ b/R/BL_data_format.R @@ -4,6 +4,10 @@ construct_bl_table <- function(breeding_status, tracking_data, config_content) { data_table <- join_seabird_breeding_status_with_tracking_data(breeding_status, tracking_data) |> mutate(track_id = bird_id, age = "adult", equinox = NA, argos_quality = NA) + data_table_with_trips <- data_table |> + classify_breed_stage() |> + bycatch::get_trips(config_content) + ordered_columns <- c( "bird_id", "sex", @@ -17,15 +21,15 @@ construct_bl_table <- function(breeding_status, tracking_data, config_content) { "equinox", "argos_quality" ) - data_table_with_trips <- data_table |> - classify_breed_stage() |> - bycatch::get_trips(config_content) - data_table_with_trips@data |> rename(time_gmt = time, latitude = Latitude, longitude = Longitude, track_id = tripID) |> - mutate(latitude = round(latitude, 6), longitude = round(longitude, 6)) |> + round_coordinates(6) |> select(all_of(ordered_columns)) } +round_coordinates <- function(data, digits = 6) { + data |> + mutate(latitude = round(latitude, digits), longitude = round(longitude, digits)) +} join_seabird_breeding_status_with_tracking_data <- function(breeding_status, tracking_data) { tracking_data_with_season <- tracking_data |> From 3ebd023e2b1343cb5a6cce09a6b0a2b3525c2bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Fri, 10 Oct 2025 11:48:58 -0700 Subject: [PATCH 08/22] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor:=20?= =?UTF-8?q?=F0=9F=A7=91=F0=9F=8F=BD=E2=80=8D=F0=9F=92=BB=20deprecation=20m?= =?UTF-8?q?essage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/cli.R | 12 +++++++++++- tests/testthat/test-cli.R | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/R/cli.R b/R/cli.R index fa9cadf..d9f2a11 100644 --- a/R/cli.R +++ b/R/cli.R @@ -1,5 +1,5 @@ #' @export -write_bl_table <- function(options) { +write_birdlife_table <- function(options) { breeding_status <- read_csv(options[["breeding-status-path"]], show_col_types = FALSE) tracking_data <- read_csv(options[["tracking-data-path"]], show_col_types = FALSE) config_content <- read_config(options[["config-path"]]) @@ -7,6 +7,16 @@ write_bl_table <- function(options) { write_csv(bl_table, options[["output-path"]]) } +#' @export +write_bl_table <- function(options) { + lifecycle::deprecate_warn( + when = "1.2.0", + what = "write_bl_table()", + with = "write_birdlife_table()" + ) + write_birdlife_table(options) +} + #' @export get_domain_specific_options <- function() { breeding_status_path <- geci.optparse::character_option(c("-b", "--breeding-status-path"), default = "/workdir/breeding_status.csv", help = "File path of the breeding_status_database") diff --git a/tests/testthat/test-cli.R b/tests/testthat/test-cli.R index 8ef7cc8..280e588 100644 --- a/tests/testthat/test-cli.R +++ b/tests/testthat/test-cli.R @@ -9,7 +9,7 @@ describe("write_bl_table", { "tracking-data-path" = "/workdir/tests/data/gps-albatros-guadalupe.csv", "output-path" = output_path ) - write_bl_table(options_list) + write_birdlife_table(options_list) expect_true(testtools::exist_output_file(output_path)) }) }) From 7b23f7a10c09a6a012f917e2ebecc51b4b9ae411 Mon Sep 17 00:00:00 2001 From: Mario Villasante Date: Fri, 10 Oct 2025 12:01:25 -0700 Subject: [PATCH 09/22] =?UTF-8?q?=F0=9F=94=A8=20add=20argument=20to=20Refa?= =?UTF-8?q?ctor=20phony?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e3585ca..4e8433c 100755 --- a/Makefile +++ b/Makefile @@ -65,6 +65,6 @@ green: format refactor: format Rscript -e "devtools::test(stop_on_failure = TRUE)" \ - && (git add R/*.R tests/testthat/*.R && git commit -m "♻️ Refactor") \ + && (git add R/*.R tests/testthat/*.R && git commit -m "♻️ Refactor: ${message}") \ || git restore R/*.R tests/testthat/*.R chmod g+w -R . From 8fdb0c82dd17448f5d4a56c13212758572852853 Mon Sep 17 00:00:00 2001 From: Mario Villasante Date: Fri, 10 Oct 2025 12:02:24 -0700 Subject: [PATCH 10/22] =?UTF-8?q?=F0=9F=87=B7=20use=20lyfecycle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DESCRIPTION | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6c6b187..01e5cd4 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -13,12 +13,13 @@ Imports: bycatch, dplyr, geci.optparse, + lifecycle, lubridate, R6, readr, rjson, stringr, - tidyverse, + tidyverse LazyData: true License: AGPL-3.0-or-later Roxygen: list(markdown = TRUE) From 8f042f2e14ef66513af0370af2b20a92214ce13f Mon Sep 17 00:00:00 2001 From: Mario Villasante Date: Fri, 10 Oct 2025 12:03:16 -0700 Subject: [PATCH 11/22] =?UTF-8?q?=F0=9F=86=99=F0=9F=90=9B=20upgrade=20patc?= =?UTF-8?q?h=20number?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5657064..77711cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added ### Fixed -- `classify_breed_stage()` takes into account "breeding fail" option. ### Changed ### Removed +## [1.1.1] - 2025-10-10 +### Added +- Deprecation warning for `write_bl_table()` function. + +### Fixed +- `classify_breed_stage()` takes into account "breeding fail" option. +- `construct_bl_table()` round coordinates to 6 decimal places to avoid floating point issues. + ## [1.1.0] - 2025-09-09 ### Added - `classify_breed_stage()` use the hatching and brood end dates to classify @@ -30,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - `clean_gps_from_txt()` deprecated. Use `clean_gps()` with `.txt` file instead. -[unreleased]: https://github.com/IslasGECI/templater/compare/v1.1.0...HEAD +[unreleased]: https://github.com/IslasGECI/templater/compare/v1.1.1...HEAD +[1.1.0]: https://github.com/IslasGECI/templater/compare/v1.1.0...v1.1.1 [1.1.0]: https://github.com/IslasGECI/templater/compare/v1.0.0...v1.1.0 [1.0.0]: https://github.com/IslasGECI/templater/releases/tag/v1.0.0 From 71dee0795ea56ba4b50e182fbda7ee613d4f6b89 Mon Sep 17 00:00:00 2001 From: Mario Villasante Date: Fri, 10 Oct 2025 12:03:46 -0700 Subject: [PATCH 12/22] =?UTF-8?q?=F0=9F=87=B7=F0=9F=A7=91=F0=9F=8F=BD?= =?UTF-8?q?=E2=80=8D=F0=9F=92=BB=20use=20lyfecycle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/seabird.tracking-package.R | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 R/seabird.tracking-package.R diff --git a/R/seabird.tracking-package.R b/R/seabird.tracking-package.R new file mode 100644 index 0000000..425b3c1 --- /dev/null +++ b/R/seabird.tracking-package.R @@ -0,0 +1,7 @@ +#' @keywords internal +"_PACKAGE" + +## usethis namespace: start +#' @importFrom lifecycle deprecated +## usethis namespace: end +NULL From 62832b22707caf0be4994c079c83f103a6a1db7d Mon Sep 17 00:00:00 2001 From: Mario Villasante Date: Fri, 10 Oct 2025 12:50:53 -0700 Subject: [PATCH 13/22] =?UTF-8?q?=F0=9F=9A=9A=20rename=20files:=20no=20abb?= =?UTF-8?q?reviations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/{BL_data_format.R => birdlife_data_format.R} | 0 .../{test-BL_data_format.R => test-birdlife_data_format.R} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename R/{BL_data_format.R => birdlife_data_format.R} (100%) rename tests/testthat/{test-BL_data_format.R => test-birdlife_data_format.R} (100%) diff --git a/R/BL_data_format.R b/R/birdlife_data_format.R similarity index 100% rename from R/BL_data_format.R rename to R/birdlife_data_format.R diff --git a/tests/testthat/test-BL_data_format.R b/tests/testthat/test-birdlife_data_format.R similarity index 100% rename from tests/testthat/test-BL_data_format.R rename to tests/testthat/test-birdlife_data_format.R From f4e31cc6bdc7a2813a2440bc1bbd5db4b39fca0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Fri, 10 Oct 2025 12:52:05 -0700 Subject: [PATCH 14/22] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/testthat/test-cli.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-cli.R b/tests/testthat/test-cli.R index 280e588..5672367 100644 --- a/tests/testthat/test-cli.R +++ b/tests/testthat/test-cli.R @@ -1,6 +1,6 @@ describe("write_bl_table", { it("construct_bl_table ", { - output_path <- "/workdir/tests/data/bl_albatross_guadalupe.csv" + output_path <- "/workdir/tests/data/birdlife_albatross_guadalupe.csv" config_path <- "/workdir/tests/data/trips_config.json" testtools::if_exist_remove(output_path) options_list <- list( From 4064549bac8b63b501797092d7ac6a13babeee40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Fri, 10 Oct 2025 13:39:25 -0700 Subject: [PATCH 15/22] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/testthat/test_version.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test_version.R b/tests/testthat/test_version.R index eca9625..e7ecc62 100644 --- a/tests/testthat/test_version.R +++ b/tests/testthat/test_version.R @@ -1,6 +1,6 @@ describe("Get version of the module", { - it("The version is 1.1.0", { - expected_version <- c("1.1.0") + it("The version is 1.2.0", { + expected_version <- c("1.2.0") obtained_version <- packageVersion("seabird.tracking") version_are_equal <- expected_version == obtained_version expect_true(version_are_equal) From 34fd27856269052d7a7f7bcf0ea066ca34117267 Mon Sep 17 00:00:00 2001 From: Mario Villasante Date: Fri, 10 Oct 2025 13:42:50 -0700 Subject: [PATCH 16/22] =?UTF-8?q?=F0=9F=86=99=E2=9C=8D=F0=9F=8F=BC=20fix?= =?UTF-8?q?=20version=20following=20semver?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 +++--- DESCRIPTION | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77711cb..3caff26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed -## [1.1.1] - 2025-10-10 +## [1.2.0] - 2025-10-10 ### Added - Deprecation warning for `write_bl_table()` function. @@ -37,7 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - `clean_gps_from_txt()` deprecated. Use `clean_gps()` with `.txt` file instead. -[unreleased]: https://github.com/IslasGECI/templater/compare/v1.1.1...HEAD -[1.1.0]: https://github.com/IslasGECI/templater/compare/v1.1.0...v1.1.1 +[unreleased]: https://github.com/IslasGECI/templater/compare/v1.2.0...HEAD +[1.2.0]: https://github.com/IslasGECI/templater/compare/v1.1.0...v1.2.0 [1.1.0]: https://github.com/IslasGECI/templater/compare/v1.0.0...v1.1.0 [1.0.0]: https://github.com/IslasGECI/templater/releases/tag/v1.0.0 diff --git a/DESCRIPTION b/DESCRIPTION index 01e5cd4..20d56e7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -34,4 +34,4 @@ Suggests: testthat, testtools, Type: Package -Version: 1.1.0 +Version: 1.2.0 From ceddd8bc24b687d8b3d04a693f931788749ebad7 Mon Sep 17 00:00:00 2001 From: Mario Villasante Date: Mon, 13 Oct 2025 12:50:49 -0700 Subject: [PATCH 17/22] =?UTF-8?q?=E2=9C=8D=F0=9F=8F=BC=20add=20documentati?= =?UTF-8?q?on=20to=20exported=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/cli.R | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/R/cli.R b/R/cli.R index d9f2a11..044acf2 100644 --- a/R/cli.R +++ b/R/cli.R @@ -1,4 +1,29 @@ +#' Write a CSV with the tracking data as Seabird tracking Database requires. +#' +#' Reads breeding status data, tracking data, and configuration data, constructs a BirdLife (BL) table, +#' and writes the resulting table to a CSV file. All input and output paths are provided via the `options` list. +#' +#' @param options A named list of file paths. Must contain: +#' \itemize{ +#' \item \code{breeding-status-path}: Path to the breeding status CSV file. +#' \item \code{tracking-data-path}: Path to the tracking data CSV file. +#' \item \code{config-path}: Path to the configuration JSON file. +#' \item \code{output-path}: Path where the output CSV will be written. +#' } +#' +#' @return Invisibly returns \code{NULL}. Called for its side effect of writing a CSV file. #' @export +#' +#' @examples +#' \dontrun{ +#' options <- list( +#' "breeding-status-path" = "breeding_status.csv", +#' "tracking-data-path" = "gps-albatros-guadalupe.csv", +#' "config-path" = "config_file.json", +#' "output-path" = "result.csv" +#' ) +#' write_birdlife_table(options) +#' } write_birdlife_table <- function(options) { breeding_status <- read_csv(options[["breeding-status-path"]], show_col_types = FALSE) tracking_data <- read_csv(options[["tracking-data-path"]], show_col_types = FALSE) From 0c57d1c2c666570c136c7a6765de180baff17ff7 Mon Sep 17 00:00:00 2001 From: Mario Villasante Date: Mon, 13 Oct 2025 12:51:15 -0700 Subject: [PATCH 18/22] =?UTF-8?q?=E2=9C=A8=20add=20citation=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CITATION.cff | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 CITATION.cff diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..255f584 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,23 @@ +cff-version: 1.2.0 +message: "If you use this software, please cite it using the following metadata." +title: "seabird_tracking" +authors: +- family-names: "Olvera" + given-names: "Guillermo" + github: "MemoOlv" + orcid: "https://orcid.org/0000-0002-6900-5315" +- family-names: "Villasante-Barahona" + given-names: "Mario" + orcid: "https://orcid.org/0009-0001-7867-8570" + github: "mvillasante" +- family-names: "Rojas-Mayoral" + given-names: Evaristo + orcid: "https://orcid.org/0000-0001-6812-9562" + github: devarops +repository-code: "https://github.com/IslasGECI/seabird_tracking" +keywords: + - seabird + - tracking + - R + - ecology +license: "MIT" From b3ac7a85132c1c820c9f1e28cff905dc9a2d52b5 Mon Sep 17 00:00:00 2001 From: Mario Villasante Date: Mon, 13 Oct 2025 12:55:48 -0700 Subject: [PATCH 19/22] =?UTF-8?q?=20=20=E2=9C=8D=F0=9F=8F=BC=20add=20docum?= =?UTF-8?q?entation=20to=20exported=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/cli.R | 65 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/R/cli.R b/R/cli.R index 044acf2..339b9a4 100644 --- a/R/cli.R +++ b/R/cli.R @@ -17,43 +17,60 @@ #' @examples #' \dontrun{ #' options <- list( -#' "breeding-status-path" = "breeding_status.csv", -#' "tracking-data-path" = "gps-albatros-guadalupe.csv", -#' "config-path" = "config_file.json", -#' "output-path" = "result.csv" +#' "breeding-status-path" = "breeding_status.csv", +#' "tracking-data-path" = "gps-albatros-guadalupe.csv", +#' "config-path" = "config_file.json", +#' "output-path" = "result.csv" #' ) #' write_birdlife_table(options) #' } write_birdlife_table <- function(options) { - breeding_status <- read_csv(options[["breeding-status-path"]], show_col_types = FALSE) - tracking_data <- read_csv(options[["tracking-data-path"]], show_col_types = FALSE) - config_content <- read_config(options[["config-path"]]) - bl_table <- construct_bl_table(breeding_status, tracking_data, config_content) - write_csv(bl_table, options[["output-path"]]) + breeding_status <- read_csv(options[["breeding-status-path"]], show_col_types = FALSE) + tracking_data <- read_csv(options[["tracking-data-path"]], show_col_types = FALSE) + config_content <- read_config(options[["config-path"]]) + bl_table <- construct_bl_table(breeding_status, tracking_data, config_content) + write_csv(bl_table, options[["output-path"]]) } #' @export write_bl_table <- function(options) { - lifecycle::deprecate_warn( - when = "1.2.0", - what = "write_bl_table()", - with = "write_birdlife_table()" - ) - write_birdlife_table(options) + lifecycle::deprecate_warn( + when = "1.2.0", + what = "write_bl_table()", + with = "write_birdlife_table()" + ) + write_birdlife_table(options) } +#' Get command-line options for domain-specific input files and output +#' +#' Constructs a set of command-line options for specifying file paths relevant to the seabird tracking domain, +#' including breeding status data, tracking data, configuration, and output location. +#' +#' @return A named list of options with file paths for: +#' \itemize{ +#' \item \code{breeding-status-path}: Breeding status CSV file +#' \item \code{tracking-data-path}: Tracking data CSV file +#' \item \code{config-path}: Configuration JSON file +#' \item \code{output-path}: Output CSV file +#' } +#' The returned options are typically used to configure file locations for downstream data processing functions. #' @export +#' +#' @examples +#' opts <- get_domain_specific_options() +#' opts[["breeding-status-path"]] get_domain_specific_options <- function() { - breeding_status_path <- geci.optparse::character_option(c("-b", "--breeding-status-path"), default = "/workdir/breeding_status.csv", help = "File path of the breeding_status_database") - tracking_path <- geci.optparse::character_option(c("-t", "--tracking-data-path"), default = "/workdir/gps-albatros-guadalupe.csv", help = "File path of the tracking database") - config_path <- geci.optparse::character_option(c("-c", "--config-path"), default = "/workdir/reports/non-tabular/config_file.json", help = "File path of the configuration") - output_path <- geci.optparse::character_option(c("-o", "--output-path"), default = "/workdir/reports/tables/result.csv", help = "File path of the desire output") - option_names <- c(breeding_status_path, tracking_path, config_path, output_path) - geci.optparse::get_options_from_vec(option_names) + breeding_status_path <- geci.optparse::character_option(c("-b", "--breeding-status-path"), default = "/workdir/breeding_status.csv", help = "File path of the breeding_status_database") + tracking_path <- geci.optparse::character_option(c("-t", "--tracking-data-path"), default = "/workdir/gps-albatros-guadalupe.csv", help = "File path of the tracking database") + config_path <- geci.optparse::character_option(c("-c", "--config-path"), default = "/workdir/reports/non-tabular/config_file.json", help = "File path of the configuration") + output_path <- geci.optparse::character_option(c("-o", "--output-path"), default = "/workdir/reports/tables/result.csv", help = "File path of the desire output") + option_names <- c(breeding_status_path, tracking_path, config_path, output_path) + geci.optparse::get_options_from_vec(option_names) } read_config <- function(config_path) { - json_content <- rjson::fromJSON(file = config_path) - json_content$colony <- tibble::tibble(Longitude = json_content$lon_colony, Latitude = json_content$lat_colony) - return(json_content) + json_content <- rjson::fromJSON(file = config_path) + json_content$colony <- tibble::tibble(Longitude = json_content$lon_colony, Latitude = json_content$lat_colony) + return(json_content) } From a79d4159b6517ef5164dc023bb110aec6c78eb50 Mon Sep 17 00:00:00 2001 From: Mario Villasante Date: Mon, 13 Oct 2025 12:57:11 -0700 Subject: [PATCH 20/22] =?UTF-8?q?=F0=9F=A7=91=F0=9F=8F=BD=E2=80=8D?= =?UTF-8?q?=F0=9F=8E=A8=20pass=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/cli.R | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/R/cli.R b/R/cli.R index 339b9a4..f37d09b 100644 --- a/R/cli.R +++ b/R/cli.R @@ -17,29 +17,29 @@ #' @examples #' \dontrun{ #' options <- list( -#' "breeding-status-path" = "breeding_status.csv", -#' "tracking-data-path" = "gps-albatros-guadalupe.csv", -#' "config-path" = "config_file.json", -#' "output-path" = "result.csv" +#' "breeding-status-path" = "breeding_status.csv", +#' "tracking-data-path" = "gps-albatros-guadalupe.csv", +#' "config-path" = "config_file.json", +#' "output-path" = "result.csv" #' ) #' write_birdlife_table(options) #' } write_birdlife_table <- function(options) { - breeding_status <- read_csv(options[["breeding-status-path"]], show_col_types = FALSE) - tracking_data <- read_csv(options[["tracking-data-path"]], show_col_types = FALSE) - config_content <- read_config(options[["config-path"]]) - bl_table <- construct_bl_table(breeding_status, tracking_data, config_content) - write_csv(bl_table, options[["output-path"]]) + breeding_status <- read_csv(options[["breeding-status-path"]], show_col_types = FALSE) + tracking_data <- read_csv(options[["tracking-data-path"]], show_col_types = FALSE) + config_content <- read_config(options[["config-path"]]) + bl_table <- construct_bl_table(breeding_status, tracking_data, config_content) + write_csv(bl_table, options[["output-path"]]) } #' @export write_bl_table <- function(options) { - lifecycle::deprecate_warn( - when = "1.2.0", - what = "write_bl_table()", - with = "write_birdlife_table()" - ) - write_birdlife_table(options) + lifecycle::deprecate_warn( + when = "1.2.0", + what = "write_bl_table()", + with = "write_birdlife_table()" + ) + write_birdlife_table(options) } #' Get command-line options for domain-specific input files and output @@ -61,16 +61,16 @@ write_bl_table <- function(options) { #' opts <- get_domain_specific_options() #' opts[["breeding-status-path"]] get_domain_specific_options <- function() { - breeding_status_path <- geci.optparse::character_option(c("-b", "--breeding-status-path"), default = "/workdir/breeding_status.csv", help = "File path of the breeding_status_database") - tracking_path <- geci.optparse::character_option(c("-t", "--tracking-data-path"), default = "/workdir/gps-albatros-guadalupe.csv", help = "File path of the tracking database") - config_path <- geci.optparse::character_option(c("-c", "--config-path"), default = "/workdir/reports/non-tabular/config_file.json", help = "File path of the configuration") - output_path <- geci.optparse::character_option(c("-o", "--output-path"), default = "/workdir/reports/tables/result.csv", help = "File path of the desire output") - option_names <- c(breeding_status_path, tracking_path, config_path, output_path) - geci.optparse::get_options_from_vec(option_names) + breeding_status_path <- geci.optparse::character_option(c("-b", "--breeding-status-path"), default = "/workdir/breeding_status.csv", help = "File path of the breeding_status_database") + tracking_path <- geci.optparse::character_option(c("-t", "--tracking-data-path"), default = "/workdir/gps-albatros-guadalupe.csv", help = "File path of the tracking database") + config_path <- geci.optparse::character_option(c("-c", "--config-path"), default = "/workdir/reports/non-tabular/config_file.json", help = "File path of the configuration") + output_path <- geci.optparse::character_option(c("-o", "--output-path"), default = "/workdir/reports/tables/result.csv", help = "File path of the desire output") + option_names <- c(breeding_status_path, tracking_path, config_path, output_path) + geci.optparse::get_options_from_vec(option_names) } read_config <- function(config_path) { - json_content <- rjson::fromJSON(file = config_path) - json_content$colony <- tibble::tibble(Longitude = json_content$lon_colony, Latitude = json_content$lat_colony) - return(json_content) + json_content <- rjson::fromJSON(file = config_path) + json_content$colony <- tibble::tibble(Longitude = json_content$lon_colony, Latitude = json_content$lat_colony) + return(json_content) } From b7c475c795947c52dbf81f82c64d3b7bc0e03bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Evaristo=20Rojas=20=E2=80=A2=20GECI?= Date: Thu, 16 Oct 2025 13:53:12 -0700 Subject: [PATCH 21/22] =?UTF-8?q?=E2=86=95=F0=9F=94=A4=20Sort=20authos=20a?= =?UTF-8?q?phabetically?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CITATION.cff | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 255f584..9dbc40a 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,23 +1,24 @@ cff-version: 1.2.0 message: "If you use this software, please cite it using the following metadata." title: "seabird_tracking" +type: software authors: -- family-names: "Olvera" - given-names: "Guillermo" - github: "MemoOlv" - orcid: "https://orcid.org/0000-0002-6900-5315" -- family-names: "Villasante-Barahona" - given-names: "Mario" - orcid: "https://orcid.org/0009-0001-7867-8570" - github: "mvillasante" -- family-names: "Rojas-Mayoral" - given-names: Evaristo - orcid: "https://orcid.org/0000-0001-6812-9562" - github: devarops + - family-names: "Olvera-Guerrero" + given-names: "Guillermo" + github: "MemoOlv" + orcid: "https://orcid.org/0000-0002-6900-5315" + - family-names: "Rojas-Mayoral" + given-names: Evaristo + orcid: "https://orcid.org/0000-0001-6812-9562" + github: devarops + - family-names: "Villasante-Barahona" + given-names: "Mario" + orcid: "https://orcid.org/0009-0001-7867-8570" + github: "mvillasante" repository-code: "https://github.com/IslasGECI/seabird_tracking" keywords: + - ecology + - R - seabird - tracking - - R - - ecology -license: "MIT" +license: "agpl-3.0-only" From f9a0acdb59c4eaf292d56b222187f48be30d2096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Evaristo=20Rojas=20=E2=80=A2=20GECI?= Date: Thu, 16 Oct 2025 14:01:33 -0700 Subject: [PATCH 22/22] =?UTF-8?q?=F0=9F=93=9D=20Add=20brief=20description?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9606653..9f300a9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ -# Template for R projects - -## Step to use +# Seabird Tracking Data Processing +**seabird_tracking** is a set of utilities to process raw seabird tracking data and construct standardized datasets for the Seabird Tracking Database.