Skip to content

Should slide() for epi_archive be given access to less than the most up-to-date snapshots? #49

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

Closed
ryantibs opened this issue Feb 24, 2022 · 6 comments
Assignees
Labels
enhancement New feature or request P0 high priority

Comments

@ryantibs
Copy link
Member

Currently the slide() method for the epi_archive class only uses the most up-to-date values of each signal as of the reference time for the sliding computation. To do this, it calls the as_of() method for the epi_archive class.

Some computations, e.g., backcasting or nowcasting, will want to access more than just the most up-to-date signal values. Should we extend slide() and as_of() to accommodate this? We could do it with an extra argument all_versions = TRUE. The default should be FALSE so the methods continue to behave as-is.

Or should these be separate functions entirely and keep slide() and as_of() so that they just consider/deliver the most recent snapshots?

@lcbrooks @elray1 @dajmcdon @jacobbien Do you guys have opinions?

@brookslogan
Copy link
Contributor

brookslogan commented Feb 24, 2022

I'd lean toward separate functions, but not too strongly.

Pro for using parameter: doesn’t crowd package namespace

Pro for using separate functions: keeps the types involved a little more consistent:

  • as_of : fn (epi_archive, version_type) -> epi_df
  • archive_as_of : fn (epi_archive, version_type) -> epi_archive
  • slide: fn (epi_archive, formula/tidymutation of epi_df) -> epi_df
  • slide_by_archive: fn (epi_archive, formula/tidymutation of epi_archive) -> epi_df
  • slide_by_archive_different_semantics: fn (epi_archive, fn (epi_archive) -> epi_df) -> epi_archive
    Rather than expecting/producing different types based on the value of a string argument.

The interface is the most important, but code-wise we might also think that the parameter approach might provide more immediate input validation or avoid repeated validation of the same inputs, while the separate-functions approach would have simpler control flow (no branching on the string argument; instead, we’d probably have as_of call archive_as_of internally, and slide call slide_by_archive internally).

@ryantibs
Copy link
Member Author

ryantibs commented Mar 3, 2022

Thanks! Reading what you wrote, and thinking about it myself, I'm actually favoring implementing it as a parameter all_versions. I think that would be very simple to do.

@dajmcdon @jacobbien @elray1 Opinions?

@dshemetov dshemetov added the question Further information is requested label Mar 9, 2022
@ryantibs ryantibs added enhancement New feature or request and removed question Further information is requested labels Apr 15, 2022
@dshemetov dshemetov added the P0 high priority label Apr 18, 2022
@brookslogan
Copy link
Contributor

The all_versions approach already seems to have been implemented. Closing.

@ryantibs
Copy link
Member Author

Just curious, which branch/PR?

@brookslogan
Copy link
Contributor

Sorry, good catch. Got mixed up with all_rows.

@nmdefries
Copy link
Contributor

Closed by #259

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P0 high priority
Projects
None yet
Development

No branches or pull requests

4 participants