Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update revision_summary #540

Conversation

brookslogan
Copy link
Contributor

@brookslogan brookslogan commented Oct 10, 2024

Checklist

Please:

  • [-] Make sure this PR is against "dev", not "main" (unless this is a release
    PR).
  • [-] Request a review from one of the current main reviewers:
    brookslogan, nmdefries.
  • [-] Makes sure to bump the version number in DESCRIPTION. Always increment
    the patch version number (the third number), unless you are making a
    release PR from dev to main, in which case increment the minor version
    number (the second number).
  • [-] Describe changes made in NEWS.md, making sure breaking changes
    (backwards-incompatible changes to the documented interface) are noted.
    Collect the changes under the next release number (e.g. if you are on
    1.7.2, then write your changes under the 1.8 heading).
  • See DEVELOPMENT.md for more information on the development
    process.

Change explanations for reviewer

  • Update revision_summary to use new key_colnames.epi_archive.
  • Fix&tweak some tidyeval stuff in revision_summary.
  • Tweak some naming in revision_summary.

Other work

  • todo: tests for additional revision_summary() adjustments
  • todo: break into 2 dependent PRs

Magic GitHub syntax to mark associated Issue(s) as resolved when this is merged into the default branch

@brookslogan brookslogan force-pushed the lcb/update-key_colnames.epi_archive branch from 97fdc29 to 052854f Compare October 10, 2024 19:27
@brookslogan brookslogan force-pushed the lcb/update-key_colnames.epi_archive branch from 592c3a2 to 1353df9 Compare October 22, 2024 21:24
@brookslogan brookslogan force-pushed the lcb/update-key_colnames.epi_archive branch 7 times, most recently from 95b3c02 to 02a679c Compare December 20, 2024 06:13
@brookslogan brookslogan force-pushed the lcb/update-key_colnames.epi_archive branch 3 times, most recently from e9b86d4 to bde7d83 Compare January 9, 2025 00:54
* Produce error rather than default selection when user provides a tidyselection
  in ... but it selects zero columns.
* Change time_within_x_latest to take `values` as a vector
* Use `.data` instead of `pick` etc. in some places
So it is not misinterpreted as "the amount of time that it has been near the latest".
* This may fix some behaviors and emit more sensible error messages on
  yearmonths given yearmonth-incompatible settings.
* This should express time differences for weekly data in terms of weeks,
  and may emit errors given weekly-"incompatible" settings.
* This appears to be computationally faster (vs. `as.integer(version) -
  as.integer(time_value)`).
It's probably best to immediately ungroup after performing grouped operations in
our documentation, as leaving things grouped accidentally is a source of errors.
Sometime we should consider an overhaul to use `by =` and `.by =` where
appropriate (sorting effects not needed) and available (not all operations
support this syntax yet).

There were already 0s in the example data, so "highlight" with words the effects
of completion + note one potential surprise in other applications.
- Note `...` optional in args of slide comp fn.
- Push toward computations returning tibbles rather than vanilla data.frames.
- Highlight `na.rm = TRUE`'s operation (not the only type of 7dsum/7dav),
  mention we also show sum.
- Immediately ungroup output + save a line using new autogroup-ungroup behavior
  of epi_slide_opt&co.
So that naming, docs, and implementation all match.
@dsweber2
Copy link
Contributor

yes, I'm no longer in 100% forecast pipeline mode. I'll put this as high priority

Copy link
Contributor

@dsweber2 dsweber2 left a comment

Choose a reason for hiding this comment

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

I added a commit with some minor logic refactors and comments for things I found unclear (some of which came from stuff I wrote long enough ago). lag is definitely a better name for a bunch of these columns than time.

I think committing to using weeks or months for version comes with some assumptions about versioning behavior that we may not want to be making. What happens with weekly data released at a daily cadence, for example?

I do think we could probably put these utilities to use elsewhere, but I'm not sure this is the PR for them.

R/archive.R Outdated Show resolved Hide resolved
R/time-utils.R Show resolved Hide resolved
R/revision_analysis.R Show resolved Hide resolved
R/revision_analysis.R Show resolved Hide resolved
R/revision_analysis.R Show resolved Hide resolved
R/revision_analysis.R Show resolved Hide resolved
R/time-utils.R Show resolved Hide resolved
R/utils.R Outdated Show resolved Hide resolved
@brookslogan
Copy link
Contributor Author

I think committing to using weeks or months for version comes with some assumptions about versioning behavior that we may not want to be making. What happens with weekly data released at a daily cadence, for example?

Definitely. But that's what we've already assumed in the archive construction. I was hoping to just make multiple time types work given our current assumptions and handle relaxing this assumption later. Maybe there are two options here:

  • Try to excise some of the time type stuff from this PR, relax the assumptions first, then re-introduce time type stuff to this function after we've done that.
  • Work with this PR as-is, and as we relax the assumptions later, revisit the design of some of the time helpers / their usage here.

Preferences / other options?

@dsweber2
Copy link
Contributor

oh right, I forgot that typically when I'm working with weekly data I'm actually working with "daily" data with 7 day gaps. Given that, I don't see strong reasons to not include it.

Fix length -> vec_size.

Combining (logical/generic) NA with Dates is apparently slow.  Slice with
NA_integer_ index instead.

Fix docs: dplyr 1.1.0 should also have a generalized dplyr::lag. Removing some
dplyr::lag features for speed might be another motivation, but we seem to be
faster for some ptypes x sizes and slower for others.

Also, don't export this function; we don't need to.
@brookslogan brookslogan force-pushed the lcb/update-key_colnames.epi_archive branch from 075b608 to 0208a96 Compare January 14, 2025 00:44
Various iterations of vec_position_lag seem to be trading off performance and
whether they beat dplyr::lag for different classes. dplyr::lag appears to be
better-performing than many/all variants tested so far for lagging very long
Date and character vectors, like we would do during compactification. We might
try speeding up compactification by iterating on some of these variants,
something inspired by `check_ukey_unique()`, etc., but that's not the present
goal, so just use `dplyr::lag()` for now.
Plus add some pluralization and capitalization features.
@brookslogan brookslogan force-pushed the lcb/update-key_colnames.epi_archive branch from db4688e to a4f498b Compare January 15, 2025 23:23
@brookslogan brookslogan requested a review from dsweber2 January 16, 2025 00:06
Copy link
Contributor

@dsweber2 dsweber2 left a comment

Choose a reason for hiding this comment

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

looks good to me! A few docs suggestions you can take or leave

DESCRIPTION Show resolved Hide resolved
R/key_colnames.R Outdated Show resolved Hide resolved
R/key_colnames.R Outdated Show resolved Hide resolved
R/key_colnames.R Outdated Show resolved Hide resolved
Base automatically changed from lcb/rework-key_colnames to lcb/key_colnames-revision_summary-age_agg-updates January 24, 2025 07:46
@brookslogan brookslogan merged commit 81582cb into lcb/key_colnames-revision_summary-age_agg-updates Jan 24, 2025
1 check passed
@brookslogan brookslogan deleted the lcb/update-key_colnames.epi_archive branch January 24, 2025 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment