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

refactor: simplify ungrouped epix_slide #517

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Conversation

dshemetov
Copy link
Contributor

@dshemetov dshemetov commented Aug 23, 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

Mostly just copied the existing epix_slide code, but removed the group_by concerns. The function is simpler and a bit more readable now.

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

  • Resolves #{issue number}

@brookslogan
Copy link
Contributor

Sorry, behind on PR reviews. This sounds nice for thinking about things, but scary for maintenance (code duplication & having to update multiple places). I would prefer if we maybe tagged this or, if group agrees, removed the grouping features, so we only have to update 1 epix_slide per update.

@dshemetov
Copy link
Contributor Author

FWIW, when it comes to updating code in two or three places, I'm not that against it on principle, as long as the code comments point to similar code. But I'd also be happy to consider removing the grouped features.

@dsweber2
Copy link
Contributor

dsweber2 commented Sep 12, 2024

Probably better to build shared functions and then call those twice (e.g. check_epix_slide_inputs eating all the things that are... checking inputs... would cover like 90% of the redundancy here with 0 code duplication).

@dshemetov dshemetov force-pushed the lcb/slide-improvements-2024-06 branch 7 times, most recently from 2b63c52 to 8202c0e Compare September 26, 2024 22:01
Base automatically changed from lcb/slide-improvements-2024-06 to dev September 30, 2024 19:03
Comment on lines -846 to -851
# We want a slide on ungrouped archives to output something
# ungrouped, rather than retaining the trivial (0-variable)
# grouping applied above. So we `ungroup()`. However, the current
# `dplyr` implementation automatically ignores/drops trivial
# groupings, so this is just a no-op for now.
ungroup()
Copy link
Contributor

@brookslogan brookslogan Oct 2, 2024

Choose a reason for hiding this comment

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

note: (if we don't merge this PR) this comment and ungroup() don't make sense now, since we stopped grouping the epix_slide output a while ago.

# `dplyr` implementation automatically ignores/drops trivial
# groupings, so this is just a no-op for now.
ungroup()
### START Copy pasta from grouped_epi_archive ###
Copy link
Contributor

@brookslogan brookslogan Oct 2, 2024

Choose a reason for hiding this comment

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

idea: also cross-ref in epix_slide.grouped_epi_archive if not already, to remind we need to update here? Though it's easy to miss such comments in such a long function.

Sorry, I've let this PR get out of sync with slide updates, so this copy-pasta would need updated as well, rather than along the way. I was hoping we'd decide on whether to remove grouping capabilities first, but that got punted. You feel strongly that the alternative code here is worth the copy-pasta?

Copy link
Contributor Author

@dshemetov dshemetov Oct 2, 2024

Choose a reason for hiding this comment

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

We'll see, maybe I'll make a wrapper like david suggests or I'll add a comment back in the grouped version, but first we'll need to rebase. I probably won't get to this PR until the end of next week, since I'm focusing on docs this week and will be on PTO Mon - Wed next week.

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.

3 participants