Refactor prior API to idiomatic S4 accessors#81
Merged
TimothyWillard merged 1 commit intomainfrom Feb 27, 2026
Merged
Conversation
This change makes prior interaction with `SeverityEstimateModel` more idiomatic by moving users to explicit S4 getters/replacement setters while preserving a chainable pipeline workflow. It also removes direct public access to the low-level `prior` helper so external usage is funneled through stable, ergonomic APIs. The result is a cleaner public surface with less duplicated getter logic and aligned docs/tests. - Add S4 accessor/replacement APIs for all prior slots: `active_prior`, `passive_asymptomatic_prior`, `passive_symptomatic_prior`. - Add chainable public wrappers: `set_active_prior`, `set_passive_asymptomatic_prior`, `set_passive_symptomatic_prior`. - Keep setter internals delegated to `prior` & make `prior` to enforce official API usage. - Add internal `get_prior` helper and route all getter methods through it. - Standardize unset-getter behavior of warn and return default `c(alpha = 1.0, beta = 1.0)`. - Update prior documentation/man page to include all new getter/setter/wrapper entries under `@rdname prior`. - Update tests to validate public API behavior, including piping, and remove dependency on public `prior` calls. - Update `NEWS.md` example to use `set_*_prior` in pipelines.
feaa892 to
686285c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change makes prior interaction with
SeverityEstimateModelmore idiomatic by moving users to explicit S4 getters/replacement setters while preserving a chainable pipeline workflow. It also removes direct public access to the low-levelpriorhelper so external usage is funneled through stable, ergonomic APIs. The result is a cleaner public surface with less duplicated getter logic and aligned docs/tests.active_prior,passive_asymptomatic_prior,passive_symptomatic_prior.set_active_prior,set_passive_asymptomatic_prior,set_passive_symptomatic_prior.prior& makepriorto enforce official API usage.get_priorhelper and route all getter methods through it.c(alpha = 1.0, beta = 1.0).@rdname prior.priorcalls.NEWS.mdexample to useset_*_priorin pipelines.