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

Slather access workflow and test data & update layer_add_target_date() and layer_add_forecast_date() accordingly #220

Merged
merged 15 commits into from
Aug 12, 2023

Conversation

rachlobay
Copy link
Contributor

Fixes #108 and #109 by adding workflow and new_data to the signature of slather. Then used the max(new_data$time_value) as the default forecast date (and that + ahead for the default target date). Finally, updated the tests and documentation to reflect these new defaults.

@rachlobay rachlobay requested a review from dajmcdon as a code owner July 17, 2023 19:53
@rachlobay rachlobay linked an issue Jul 17, 2023 that may be closed by this pull request
@rachlobay rachlobay changed the title Slather access workflow and test data & update layer_add_target_date() and layer_add_forecast_date()` accordingly Slather access workflow and test data & update layer_add_target_date() and layer_add_forecast_date() accordingly Jul 17, 2023
R/epi_recipe.R Outdated Show resolved Hide resolved
R/layer_add_target_date.R Outdated Show resolved Hide resolved
components$mold <- workflows::extract_mold(object)
components$forged <- hardhat::forge(new_data,
blueprint = components$mold$blueprint)
components$keys <- grab_forged_keys(components$forged,
components$mold, new_data)
components <- apply_frosting(object, components, the_fit, the_recipe, ...)
components <- apply_frosting(object, components, new_data, ...)
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we still need the_fit and the_recipe? Am I missing something in the changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The epi_workflow (object) contains the recipe and fit, so it seemed unnecessary to include them separately.

Copy link
Contributor

@dajmcdon dajmcdon Aug 10, 2023

Choose a reason for hiding this comment

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

We might need some more tests then. I would think this would fail for sure.

I see now. You modified it in apply_frosting.epi_workflow().

For the future, when PRs touch lots of files like this one, it's helpful for me if your initial comment goes through the logic of the things you do. That way I can figure out where to look, and if there are simplifications that happen across multiple files, it's easier for me to understand the idea.

Copy link
Contributor

@dajmcdon dajmcdon left a comment

Choose a reason for hiding this comment

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

Everything looks good. A few further changes (these are minor, so I'm approving without them):

  1. There's also layer_unnest() which needs the slather() method correction.
  2. inst/templates/layer.R contains a helper for creating new layers that needs the same.

@rachlobay
Copy link
Contributor Author

Yes. Good catch for 2! I didn't think to look in inst/templates. So I've updated that, but I don't see 1 (the signature in slather.layer_unnest looks ok, but maybe something inside the function is off? Let me know).

@dajmcdon
Copy link
Contributor

Huh. For some reason, I didn't see the layer_unnest() as being edited earlier. Must have been an oversight.

Merge when ready.

@rachlobay rachlobay merged commit 1424f2b into main Aug 12, 2023
1 check passed
@rachlobay rachlobay deleted the 108-slather-access-workflow-test-dat branch August 12, 2023 00:22
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.

bug in layer_add_forecast_date() slather() needs access to the frosting object
2 participants