You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some instance of disease module writing instances of HSI_Events with a post_apply_hook method defined. This will over-write the method of the same name in the base class, preventing the functionality contained therein to operate (post_apply_hook in HSI_Event base class). It was a sort of "unwritten rule" (!) that the post_apply_hook part of an HSI_Event is reserved for use by the HSI_Event itself.
Examples of HSI_Event instance over-writing this method are:
A simple fix would be for this logic to be placed at the end of the apply function in the respective HSI_Event.
But, a better fix would be allow the disease module do over-write the post_apply_hook method and create another method that is only called by the HealthSystem. e.g. in the HSI_Event base class:
put the current content of the post_apply_hook into _run_after_hsi_event,
over-write run (from the Event base class) to run apply, then post_apply_hook, then _run_after_hsi_event
The text was updated successfully, but these errors were encountered:
Another option would be for any classes which do overwrite the base class implementation of post_apply_hook to have to call the base class implementation within their implementation using
super().post_apply_hook()
Overall though I think your proposed approach @tbhallett of creating a new 'private' method _run_after_hsi_event is probably nicer as it doesn't rely on people remembering to call the base class method in their implementation.
There are some instance of disease module writing instances of
HSI_Events
with apost_apply_hook
method defined. This will over-write the method of the same name in the base class, preventing the functionality contained therein to operate (post_apply_hook in HSI_Event base class). It was a sort of "unwritten rule" (!) that thepost_apply_hook
part of an HSI_Event is reserved for use by the HSI_Event itself.Examples of HSI_Event instance over-writing this method are:
TLOmodel/src/tlo/methods/tb.py
Line 2236 in 67c8058
TLOmodel/src/tlo/methods/contraception.py
Line 1215 in 67c8058
There may be others...!
A simple fix would be for this logic to be placed at the end of the
apply
function in the respective HSI_Event.But, a better fix would be allow the disease module do over-write the
post_apply_hook
method and create another method that is only called by the HealthSystem. e.g. in theHSI_Event
base class:post_apply_hook
into_run_after_hsi_event
,apply
, thenpost_apply_hook
, then_run_after_hsi_event
The text was updated successfully, but these errors were encountered: