-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add input validation #476
Add input validation #476
Conversation
@seabbs @sbfnk I've implemented a check for the input data to the various |
ffc0b28
to
0267355
Compare
I'm not sure we want this to be strictly integer as the method should work in principle with e.g. proportions. The check to me looks good, only think missing I think is a corresponding test. In the rest of the package we have mostly (although I don't think strictly) taken the approach of importing functions with |
Alright. I'll change it to check for numerics instead of integer.
Thanks. It's still a work in progress, hence the PR is a draft.
Noted. I'll make the change. |
102d8ee
to
4fe82c7
Compare
Noting that the test coverage PR was cancelled after 6 hours (didn't fail) - might be worth re-running to see if it's a transient GHA issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Please add yourself as an author to any function where you've made substantial additions.
If this is |
I'm not sure this test-coverage failure is related to the PR content. |
Sure. We can have a section on giving credit. We recently did similar for Epiverse here. I'm actually not sure what constitutes a substantial addition. I guess I would define it as a change without which the function would not do as promised? I would imagine that I would qualify as a co-author of these functions when I work on the S3 class structure for each of them. In that case, the return value of the function is the class with certain attributes, which I implemented, so I can consider myself a co-author. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks really nice. Looking forward to having this merged. Just a few comments about line breaks (exciting times) and we need a news update for this.
I think it's related but I'm not sure how - the corresponding action hasn't been failing on other PRs, e.g. That said I could not reproduce the timeouts running |
63a2d59
to
157b5c4
Compare
Same. It passes locally but with a warning and 3 notes. ❯ checking top-level files ... WARNING
A complete check needs the 'checkbashisms' script.
See section ‘Configure and cleanup’ in the ‘Writing R Extensions’
manual.
❯ checking installed package size ... NOTE
installed size is 12.3Mb
sub-directories of 1Mb or more:
doc 1.1Mb
extdata 2.1Mb
help 2.1Mb
libs 6.1Mb
❯ checking for GNU extensions in Makefiles ... NOTE
GNU make is a SystemRequirements.
❯ checking files in ‘vignettes’ ... NOTE
The following directory looks like a leftover from 'knitr':
‘figure’
Please remove from your package.
0 errors ✔ | 1 warning ✖ | 3 notes ✖ |
Could you try temporarily removing test-checks.r and see if that fixes it? |
Turns out this didn't do the trick. Next steps could be:
|
I'll create a backup branch and try the fixes there. Whichever works will then be applied here. |
0fecd22
to
4cb8892
Compare
Could this be a problem with the cache for this action? I just had this issue in |
I've removed them and re-run the action. Let's see if it fixes it. 🤞🏾 |
Maybe temporarily changing the action here to run |
d1fa59d
to
29b0f5b
Compare
This
|
I've been able to reproduce the issue using https://github.com/nektos/act (which is a great little tool for investigating GHA issues locally). Just looking at some runs I started before the weekend it looks like all the tests in To apply this fix in this PR you can:
|
29b0f5b
to
db0bfce
Compare
It's still a really strange issue that didn't occur when either of us ran |
🥳 |
This should be ready for merge now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing stuff! Nearly there.
This PR:
Adds input checking to 5 core functions:
estimate_infections()
,estimate_secondary()
,estimate_truncation()
,simulate_infections()
, andepinow()
.A function
check_reports_valid()
is added to validate thereports
dataset passed to the functions. Tests are added to check its functionality.The various
*_opts()
functions are assigned subclasses of the same name as the functions. These are tested against the assigned arguments to ensure the right*_opts()
is passed to the right argument. For example, theobs
argument inestimate_secondary()
is expected to only receive arguments passed throughobs_opts()
and will error otherwise.This PR closes #337.