Repository navigation
Dev - #76
Merged
Merged
Dev#76
Conversation
CRAN update
Dev apicalls
…essages from the api
Contributor
There was a problem hiding this comment.
🟡 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 becomeNAand 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. IncludeAPIPOINT, which takes precedence overuse.R/get_downloads.R:167— Moderate; 4 votes: A no-data response returns an emptysitesobject instead ofNULL. 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 = FALSEstill 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 explicitlimitandoffsetvalues. 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 tovertebrate\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
| "data/downloads?datasetid=", | ||
| paste0(batch, collapse = ",") | ||
| ) | ||
| key <- paste(base_url, paste(names(dots), unlist(dots), collapse = "&")) |
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)) { |
| #' @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 on lines
+69
to
72
| if ("all_data" %in% names(cl)) { | ||
| all_data <- cl$all_data | ||
| } else { | ||
| all_data <- TRUE |
Comment on lines
+18
to
+19
| #' fc_sites <- neotoma2::get_datasets(limit = 5, datasettype = "vertebrate | ||
| #' fauna") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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:
get_downloads(), and improvements made to howget_sites(),get_datasets(), and related functions handle large queries and pagination.get_taxa()andget_taxon()functions have been rewritten or improved to handle arguments more correctly and robustly.S4 Class Refactoring and Data Model Updates:
R/01_classDefinitions.Rhave been refactored for clarity, using explicit argument lists and improved formatting. This includes classes such ascontact,author,publication,chronology,sample,repository, andspecimen, as well as their container classes. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18]sampleclass now includes new fields:analysisunitnotes,analysisdate, andsamplenotes. [1] [2]Metadata and Build System Updates:
DESCRIPTIONandCITATION.cff, with the date updated inDESCRIPTION. [1] [2].Rbuildignoreupdated to ignore additional files and directories, including.Rcheck,.DS_Store, and.lintr. [1] [2].lintrconfiguration file to specify linter exclusions for certain files and directories.Namespace and Dependency Adjustments:
NAMESPACEupdated to importhttr::configand remove unnecessary import ofstringr::str_extract_all. [1] [2]Documentation and Changelog:
NEWS.mdupdated 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.