Skip to content

Refactor prior API to idiomatic S4 accessors#81

Merged
TimothyWillard merged 1 commit intomainfrom
s4-api
Feb 27, 2026
Merged

Refactor prior API to idiomatic S4 accessors#81
TimothyWillard merged 1 commit intomainfrom
s4-api

Conversation

@TimothyWillard
Copy link
Collaborator

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.

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.
@TimothyWillard TimothyWillard merged commit 68b9199 into main Feb 27, 2026
5 checks passed
@TimothyWillard TimothyWillard deleted the s4-api branch February 27, 2026 20:16
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.

1 participant