Repository navigation
Conversation
Add a function to remove measurements based on their download time, recorded in the cache table's time_dl field. For every cached time range downloaded before the given date, the measurements of the station between the range start and end (inclusive) are removed. When no measurements for a station remain, the station is also removed from the location table. The processed cache record is removed and a named list describing the removed ranges is returned. Includes a roxygen2 header, generated documentation, testthat tests and a new "Remove data" chapter in the vignette. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
jspijker
commented
Sep 1, 2026
jspijker
left a comment
Collaborator
Author
There was a problem hiding this comment.
See comments in code, please fix the issues
- Make the cutoff inclusive: select cached ranges with time_dl <= date and update the roxygen header wording accordingly. - Update the vignette "Remove data" chapter to say "before or equal to". - Move the seed_ test helpers into tests/testthat/helper.R and add a test for a range downloaded exactly at the cutoff. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
Closes #30.
What
Adds
remove_time_ranges_before(date, conn), which removes measurements from the database based on their download time (thetime_dlfield in the cache table).For every cached time range downloaded before the given
date, the function:startandend, inclusive of the endpoints;locationtable;cachetable.It returns a named list keyed by station, each with the
start/endof the removed range and aremovedboolean indicating whether the station was dropped from the location table.Changes
R/remove_time_ranges_before.R— new function with a roxygen2 header.man/remove_time_ranges_before.Rd,NAMESPACE— generated docs / export.tests/testthat/test-remove_time_ranges_before.R— tests for input validation, inclusive removal, station retention/removal, cutoff handling and return shape.vignettes/ATdatabase.Rmd— new "Remove data" chapter (after "Using the data") explaining the function with an example.Testing
devtools::test()— all pass (116 assertions, 22 new).Based on
develop.