Skip to content

Issue #688 - Reorganise validate_forecast()#778

Merged
seabbs merged 19 commits intomainfrom
update-validate_forecast
Apr 5, 2024
Merged

Issue #688 - Reorganise validate_forecast()#778
seabbs merged 19 commits intomainfrom
update-validate_forecast

Conversation

@nikosbosse
Copy link
Collaborator

@nikosbosse nikosbosse commented Apr 4, 2024

Description

This PR closes #688.
This PR closes #689.
This PR closes #773.

In #688 and in particular in #753 we discussed the relationship between validate_forecast() and as_forecast() and decided on the following:

  • as_forecast() converts from a non-forecast object to a forecast object, validates it and returns the object
  • assert_forecast() re-validates an existing forecast object and returns invisble(NULL)
  • validate_forecast() is like assert_forecast(), but returns the object so it can be used in a pipe.

This PR

  • renames the current validate_forecast() to assert_forecast() and changed it to return invisble(NULL)
  • introduces a silent argument to validate_forecast() (that effectively prevents one single message from being thrown)
  • uses that new silent argument, e.g. when printing
  • creates a new validate_forecast() function that calls assert_forecast() and returns the data
  • has a change with a questionable relationship to this PR! <3
    • namely it renames validate_general() to assert_forecast_generic()
  • updates the News file
  • updates the manuscript
  • does not have any new tests. Should it? I had a vague feeling it should, but I'm also a bit unclear what to test....

Further question:
Should as_forecast() get a silent argument as well? We have quite a large number of suppressMessages() calls in our tests, which maybe is a hint...

[Describe the changes that you made in this pull request.]

Checklist

  • My PR is based on a package issue and I have explicitly linked it.
  • I have included the target issue or issues in the PR title as follows: issue-number: PR title
  • I have tested my changes locally.
  • I have added or updated unit tests where necessary.
  • I have updated the documentation if required.
  • I have built the package locally and run rebuilt docs using roxygen2.
  • My code follows the established coding standards and I have run lintr::lint_package() to check for style issues introduced by my changes.
  • I have added a news item linked to this PR.
  • I have reviewed CI checks for this PR and addressed them as far as I am able.

@codecov
Copy link

codecov bot commented Apr 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.60%. Comparing base (aa01cad) to head (573166d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #778      +/-   ##
==========================================
+ Coverage   95.53%   95.60%   +0.06%     
==========================================
  Files          21       21              
  Lines        1567     1569       +2     
==========================================
+ Hits         1497     1500       +3     
+ Misses         70       69       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@seabbs seabbs enabled auto-merge (rebase) April 4, 2024 16:26
Copy link
Contributor

@seabbs seabbs left a comment

Choose a reason for hiding this comment

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

I think I really like this. A few questions/comments

@seabbs
Copy link
Contributor

seabbs commented Apr 4, 2024

Should as_forecast() get a silent argument as well? We have quite a large number of suppressMessages() calls in our tests, which maybe is a hint...

I think if we rename it to be verbose then yes

@nikosbosse
Copy link
Collaborator Author

Latest update:

  • added missing importFrom for cli_warn()
  • changed silent to verbose
  • made sure those verbose statements actually get passed on to assert_forecast()
  • added new unit tests, in particular making sure that we get a warning when there are different numbers of quantiles, but no warning when printing (as assert_forecast() is in silent mode)
  • updated docs/namespace

@seabbs seabbs self-requested a review April 5, 2024 14:01
Copy link
Contributor

@seabbs seabbs left a comment

Choose a reason for hiding this comment

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

Nice.

auto-merge was automatically disabled April 5, 2024 14:03

Rebase failed

@seabbs seabbs merged commit 948f251 into main Apr 5, 2024
@seabbs seabbs deleted the update-validate_forecast branch April 5, 2024 14:03
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.

Rename validate_general() Should validate_forecast() within print() be silent? Roles of as_forecast() and validate_forecast()

2 participants