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

Add onset-to-recovery delays to simulation #99

Merged
merged 11 commits into from
Apr 25, 2024
Merged

Conversation

joshwlambert
Copy link
Member

This PR addresses a feature request from #36 to add explicit onset-to-recovery time delays. This feature adds the onset_to_recovery argument to the sim_linelist() and sim_outbreak() functions, which by default is NA to not provide explicit recovery dates as this is thought to be the most common scenario when collecting line list information. The onset_to_recovery argument works identically to onset_to_death and onset_to_hosp, whereby it can be an <epidist> object, or an anonymous function to parameterise the delay distribution.

There is a breaking change as part of this PR with respect to the output line list <data.frame> from sim_linelist() and sim_outbreak(). The $date_death column has been replace with two columns, $outcome and $date_outcome. Currently the $outcome column is a character string with either "died" or "recovered". The $date_outcome column contains the date of the corresponding event (in the same row). This was decided from discussions in #36.

The Visualising line list data vignette (vis-linelist.Rmd) is updated to aggregate the new line list structure, and now includes a code chunk that uses {tidyr}. As a result, {tidyr} is added as a suggested package dependency.

The .add_death() function has been updated and renamed to .add_outcome() to deal with deaths and recoveries.

.cross_check_sim_input() is updated to return compound warnings or errors if necessary instead of returning multiple warnings or stopping on the first error.

Tests have been updated in line with the updates to exported and internal functions, including updating the tests/testthat/testdata/.

Copy link

This pull request:

  • Adds 4 new dependencies (direct and indirect)
  • Adds 2 new system dependencies
  • Removes 0 existing dependencies (direct and indirect)
  • Removes 0 existing system dependencies

(Note that results may be inacurrate if you branched from an outdated version of the target branch.)

Copy link

This pull request:

  • Adds 4 new dependencies (direct and indirect)
  • Adds 2 new system dependencies
  • Removes 0 existing dependencies (direct and indirect)
  • Removes 0 existing system dependencies

(Note that results may be inacurrate if you branched from an outdated version of the target branch.)

@Bisaloo
Copy link
Member

Bisaloo commented Apr 10, 2024

I haven't reviewed the PR, I trust you with the implementation. Just a reminder to update the NEWS.md with this change before merging 😉

@joshwlambert
Copy link
Member Author

This PR has been reviewed as part of PR #101 which builds on top of this feature branch. I will now merge both of these PRs.

I will update the NEWS.md in a follow-up PR before releasing the package.

@joshwlambert joshwlambert merged commit c073d76 into main Apr 25, 2024
9 checks passed
@joshwlambert joshwlambert deleted the onset-to-recovery branch April 25, 2024 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants