Refactor of Incoming admission predictor API
Incoming admission predictor API
Highlights
This release refactors yet-to-arrive (incoming) admission predictors so prediction is explicit at call time and a single fitted model can be reused for different horizons and targets without refitting.
Incoming admission predictors (DirectAdmissionPredictor, ParametricIncomingAdmissionPredictor, EmpiricalIncomingAdmissionPredictor)
fit()no longer owns the prediction window. It fits a full 24-hour arrival profile;prediction_window/prediction_timesonfit()are deprecated (withDeprecationWarning) and retained only as a temporary fallback.predict()andpredict_mean()now take the prediction window and prediction time as explicit keyword arguments, and (where applicable)filter_keysfor choosing one or more hospital services (model weights keys) in predict(), orfilter_keyfor choosing the single service used by predict_mean()- Passing a nested
prediction_contextdict is deprecated; callers should migrate to the flat arguments. Deprecated paths remain for compatibility but may be removed in a future major version. - Time handling is centralised:
_resolve_prediction_window, snapping toyta_time_intervalboundaries (with aUserWarningwhen times are adjusted), and helpers to normalise prediction instants. The oldfind_nearest_previous_prediction_timehelper is removed.
Integration points
Call sites are updated so the new API is threaded through aggregate (e.g. survival-curve probability paths), predict.emergency_demand, and predict.service (including safe mean prediction). Obsolete window-mismatch checks tied to the old fit()-time window are dropped. Training utilities (train.incoming_admission_predictor) no longer forward the deprecated fit() window kwargs by default.
Breaking changes
- Serialised models produced by older versions are not supported with this predictor stack; retrain or rebuild for the new fitting and prediction contract.
- Any custom code that relied on
find_nearest_previous_prediction_timeor on fixing the prediction window only atfit()must be updated to passprediction_window(and related arguments) onpredict()/predict_mean().
Upgrade path
- Refit incoming admission models if you load pickled or otherwise stored models from before this change.
- Replace
fit(..., prediction_window=...)withfit()(or rely on deprecation only briefly) and passprediction_window=on eachpredict()/predict_mean(). - Replace dict-style
prediction_contextwithprediction_time,prediction_window, andfilter_keys/filter_keyas appropriate.