Skip to content

Dev - #76

Merged
sedv8808 merged 11 commits into
productionfrom
dev
Nov 2, 2026
Merged

Dev#76
sedv8808 merged 11 commits into
productionfrom
dev

Conversation

@sedv8808

@sedv8808 sedv8808 commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

This pull request updates the neotoma2 R package to version 1.1.1, introducing several important improvements and maintenance changes. The update enhances API handling, adds new data fields, improves caching and error reporting, and makes the package more robust and user-friendly. It also refactors S4 class definitions for clarity and maintainability, and updates package metadata and build configuration.

API and Functionality Improvements:

  • Default request timeout is now set to 125 seconds to better align with the API gateway, and several improvements have been made to API request handling, retries, caching, error reporting, and support for new API server behaviors.
  • New fields have been added to the data structures returned by get_downloads(), and improvements made to how get_sites(), get_datasets(), and related functions handle large queries and pagination.
  • The get_taxa() and get_taxon() functions have been rewritten or improved to handle arguments more correctly and robustly.

S4 Class Refactoring and Data Model Updates:

  • All S4 class definitions in R/01_classDefinitions.R have been refactored for clarity, using explicit argument lists and improved formatting. This includes classes such as contact, author, publication, chronology, sample, repository, and specimen, as well as their container classes. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18]
  • The sample class now includes new fields: analysisunitnotes, analysisdate, and samplenotes. [1] [2]

Metadata and Build System Updates:

  • Package version updated to 1.1.1 in both DESCRIPTION and CITATION.cff, with the date updated in DESCRIPTION. [1] [2]
  • .Rbuildignore updated to ignore additional files and directories, including .Rcheck, .DS_Store, and .lintr. [1] [2]
  • Added a .lintr configuration file to specify linter exclusions for certain files and directories.

Namespace and Dependency Adjustments:

  • NAMESPACE updated to import httr::config and remove unnecessary import of stringr::str_extract_all. [1] [2]

Documentation and Changelog:

  • NEWS.md updated with a comprehensive changelog for version 1.1.1, describing all major user-facing changes and improvements. [1] [2]

These changes collectively improve the package's reliability, maintainability, and alignment with current Neotoma API practices.

Copilot AI balanced review requested due to automatic review settings November 2, 2026 22:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Cache keys can return results from the wrong server, while pagination ignores explicit taxon slices and no-data responses no longer return NULL.

5 open issues
What changed in this PR

This PR prepares neotoma2 1.1.1 with API-client improvements, expanded data fields, and release maintenance.

Changes:

  • Adds download batching and caching, table caching, and updated taxon retrieval.
  • Adds sample and collection-unit metadata, including GPS parsing.
  • Refreshes documentation, release metadata, and tests.

This pull request requires changes.

Review findings:

  • R/build_collunit.R:81 — P2, moderate; 1 vote: Null collectors can become NA and abort parsing. Treat missing or non-list collectors as empty and handle null entries.
  • R/build_collunit.R:26 — Nit; 1 vote: Add offline GPS parsing tests for coordinate order, CRS, altitude and error attributes, and an empty coordinate pair.
  • R/get_downloads.R:154 — Moderate; 4 votes: The cache key omits the selected server, allowing results to cross environments. Include APIPOINT, which takes precedence over use.
  • R/get_downloads.R:167 — Moderate; 4 votes: A no-data response returns an empty sites object instead of NULL. Check whether records were collected before parsing.
  • R/get_downloads.R:143 — P2, moderate; 1 vote: An offset disables batching without adding a limit, so requests with more than 200 IDs can be rejected. Apply the offset across bounded batches or otherwise respect the API limit.
  • R/get_downloads.R:123 — Moderate; 1 vote: Repeated requests of 21 or more batches can evict each remaining cached batch before it is read. Look up existing keys before inserting misses, or use another bounded strategy that preserves hits.
  • R/get_downloads.R:143 — Moderate; 1 vote: all_data = FALSE still fetches every ID batch rather than only the first page. Apply the page limit across the entire ID list.
  • R/get_table.R:22 — Moderate; 4 votes: The cache key omits the selected API server. Include it to prevent cached tables crossing environments.
  • R/get_taxon.R:69 — Moderate; 4 votes: Default pagination overwrites explicit limit and offset values. Preserve explicit slicing when choosing the pagination mode.
  • R/get_taxon.R:124 — Moderate; 1 vote: On the older production server, GET batches of up to 100 IDs can return only the first 25 taxa. Limit each GET to 25 IDs or paginate each batch, and test the legacy behavior.
  • R/toWide.R:18 — Nit; 4 votes: A line break changes the example’s dataset type to vertebrate\nfauna. Keep the string on one line and regenerate the Rd file.
File Description
tests/​testthat/​test_toWide.R Reformats wide-table tests.
tests/​testthat/​test_taxa.R Normalizes file formatting.
tests/​testthat/​test_summary.R Reformats summary tests.
tests/​testthat/​test_speleothems.R Reformats speleothem tests.
tests/​testthat/​test_specimens.R Reformats specimen tests.
tests/​testthat/​test_set_speleothem.R Reformats setter tests.
tests/​testthat/​test_set_site.R Reformats site setter tests.
tests/​testthat/​test_set_server.R Normalizes file formatting.
tests/​testthat/​test_set_sample.R Reformats sample setter tests.
tests/​testthat/​test_set_publication.R Reformats publication setter tests.
tests/​testthat/​test_set_default.R Normalizes file formatting.
tests/​testthat/​test_set_dataset.R Reformats dataset setter tests.
tests/​testthat/​test_set_contact.R Reformats contact tests.
tests/​testthat/​test_set_collunit.R Reformats collection-unit tests.
tests/​testthat/​test_set_chronology.R Reformats chronology tests.
tests/​testthat/​test_samples.R Reformats sample extraction tests.
tests/​testthat/​test_plot.R Normalizes file formatting.
tests/​testthat/​test_pingNeotoma.R Reformats server ping tests.
tests/​testthat/​test_parse_speleothem.R Reformats parser tests.
tests/​testthat/​test_parse_site.R Reformats site parser tests.
tests/​testthat/​test_parse_location.R Adds lint suppressions.
tests/​testthat/​test_length.R Reformats length tests.
tests/​testthat/​test_group_data.R Reformats response-grouping tests.
tests/​testthat/​test_getids.R Reformats identifier tests.
tests/​testthat/​test_get_taxon.R Adds offline taxon-query tests.
tests/​testthat/​test_get_table.R Adds table-cache tests.
tests/​testthat/​test_get_stats.R Reformats statistics tests.
tests/​testthat/​test_get_speleothems.R Adds lint suppressions.
tests/​testthat/​test_get_sites.R Adds lint suppressions.
tests/​testthat/​test_get_publications.R Normalizes file formatting.
tests/​testthat/​test_get_manual.R Reformats manual-opening test.
tests/​testthat/​test_get_documentation.R Reformats documentation-opening test.
tests/​testthat/​test_get_datasets.R Reformats dataset-query tests.
tests/​testthat/​test_get_contacts.R Reformats contact-query tests.
tests/​testthat/​test_examples.R Reformats example runner.
tests/​testthat/​test_doi.R Reformats DOI tests.
tests/​testthat/​test_datasets.R Reformats dataset accessor tests.
tests/​testthat/​test_coordinates.R Reformats coordinate tests.
tests/​testthat/​test_collunits.R Reformats collection-unit tests.
tests/​testthat/​test_clean.R Reformats cleaning tests.
tests/​testthat/​test_cite_data.R Reformats citation tests.
tests/​testthat/​test_chronologies.R Reformats chronology tests.
tests/​testthat/​test_chroncontrols.R Reformats control tests.
tests/​testthat/​test_c.R Reformats concatenation tests.
tests/​testthat/​test_add_chronology.R Reformats chronology-addition test.
tests/​testthat/​setup.R Reformats API test setup.
README.md Adds the 1.1.1 release summary.
R/​utils-pipe.R Normalizes file formatting.
R/​use_na.R Reformats missing-value handling.
R/​toWide.R Reformats implementation and example.
R/​testNull.R Reformats internal documentation.
R/​taxa.R Reformats taxa methods.
R/​speleothems.R Reformats speleothem methods.
R/​speleothemdetails.R Reformats detail methods.
R/​set_speleothem.R Normalizes setter formatting.
R/​set_site.R Persists site area.
R/​set_server.R Reformats server selection.
R/​set_sample.R Adds sample metadata arguments.
R/​set_publication.R Reformats publication setter.
R/​set_dataset.R Reformats dataset setter.
R/​set_contact.R Reformats contact documentation.
R/​set_collunit.R Adds collectors argument.
R/​set_chronology.R Normalizes documentation formatting.
R/​samples-methods.R Reformats sample methods.
R/​pubAuthors.R Reformats author construction.
R/​plotLeaflet.R Reformats map methods.
R/​pingNeotoma.r Reformats server ping.
R/​parseLocation.R Reformats location parsing.
R/​parse_speleothem.R Reformats speleothem parsing.
R/​group_data.R Normalizes response-grouping formatting.
R/​getids.r Reformats identifier extraction.
R/​get_taxon.R Updates taxon pagination and parsing.
R/​get_table.R Adds table caching and refresh.
R/​get_stats.R Reformats statistics queries.
R/​get_speleothems.R Reformats speleothem queries.
R/​get_specimens.R Reformats inactive code and lint annotations.
R/​get_sites.R Adds query guidance and formatting.
R/​get_params.R Reformats parameter discovery.
R/​get_manual.R Normalizes manual-opening code.
R/​get_downloads.R Adds batching and session caching.
R/​get_documentation.R Normalizes browser-opening code.
R/​get_contacts.R Reformats contact queries.
R/​contact-methods.R Reformats contact methods.
R/​cleanNULL.R Normalizes file formatting.
R/​clean.R Removes an unused variable and reformats.
R/​chroncontrols.R Reformats chronology-control methods.
R/​check_contacts.R Reformats contact checking.
R/​build_speleothem.R Reformats speleothem construction.
R/​build_specimen.R Reformats specimen construction.
R/​build_site.R Reformats site construction.
R/​build_sample.R Populates new sample fields.
R/​build_dataset.R Reformats dataset construction.
R/​build_collunit.R Reads GPS locations and collectors.
R/​build_chron.R Reformats chronology construction.
R/​02_genericDefinitions.R Reformats generic definitions.
NEWS.md Documents 1.1.1 changes.
NAMESPACE Updates imports.
man/​toWide.Rd Updates the wide-table example.
man/​sub-sub.Rd Reformats an indexing example.
man/​set_site.Rd Reformats the site example.
man/​set_sample.Rd Documents new sample fields.
man/​set_dataset.Rd Reformats the dataset example.
man/​set_contact.Rd Reformats contact documentation.
man/​set_collunit.Rd Documents collectors.
man/​publications_classes.Rd Reformats the publication example.
man/​plotLeaflet-sites-method.Rd Reformats the map example.
man/​get_taxa.Rd Expands taxa-query documentation.
man/​get_table.Rd Documents cache refresh.
man/​get_stats.Rd Reformats the statistics example.
man/​get_speleothems.Rd Reformats an example.
man/​get_sites.Rd Adds query guidance.
man/​get_publications.Rd Reformats publication examples.
man/​get_manual.Rd Reformats an example.
man/​get_downloads.Rd Documents batching and caching.
man/​get_documentation.Rd Reformats an example.
man/​get_datasets.Rd Adds query guidance.
man/​filter.Rd Reformats filter examples.
man/​count.Rd Reformats count documentation.
man/​contacts_classes.Rd Reformats a contact example.
man/​clean.Rd Reformats a cleaning example.
man/​author_classes.Rd Reformats an author example.
DESCRIPTION Updates package version and date.
cran-comments.md Adds release submission notes.
codemeta.json Updates package version.
CITATION.cff Updates citation version.
.Rbuildignore Excludes additional build artifacts.
.lintr Adds lint exclusions.

Review effort: Balanced

Comment thread R/get_downloads.R
"data/downloads?datasetid=",
paste0(batch, collapse = ",")
)
key <- paste(base_url, paste(names(dots), unlist(dots), collapse = "&"))
Comment thread R/get_downloads.R
Comment on lines +167 to 168
result <- list(status = 200, data = records, message = "Success")
if (!is.null(result[2]$data) || (length(result[2]$data) > 0)) {
Comment thread R/get_table.R
#' @export
get_table <- function(x, limit = 25, offset = 0) {
get_table <- function(x, limit = 25, offset = 0, refresh = FALSE) {
key <- paste("table", x, limit, offset, sep = "|")
Comment thread R/get_taxon.R
Comment on lines +69 to 72
if ("all_data" %in% names(cl)) {
all_data <- cl$all_data
} else {
all_data <- TRUE
Comment thread R/toWide.R
Comment on lines +18 to +19
#' fc_sites <- neotoma2::get_datasets(limit = 5, datasettype = "vertebrate
#' fauna")
@sedv8808
sedv8808 merged commit a9ae4a5 into production Nov 2, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants