-
Notifications
You must be signed in to change notification settings - Fork 5
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
Generate HSI_Contraception_FamilyPlanningAppt.EXPECTED_APPT_FOOTPRINT
at class initialisation
#1524
base: master
Are you sure you want to change the base?
Conversation
HSI_Contraception_FamilyPlanningAppt.EXPECTED_APPT_FOOTPRINT
at class initialisation
From running the tests locally it looks like these changes break at least one test in
I am not entirely sure what this test is meant to be checking. The full output of the call
with the last condition (subsequent elements after first blank) failing. |
My understanding of why the test is failing is that the HSI event reschedules itself if a lack of consumables meant the change to contraception method could not be enacted TLOmodel/src/tlo/methods/contraception.py Lines 1266 to 1269 in 4a67b48
with the reschedule function passing in TLOmodel/src/tlo/methods/contraception.py Lines 1276 to 1282 in 4a67b48
This means in any subsequent runs of HSI event I believe the intended interface for communicating changes to the appointment footprint from the initial expected footprint at the point of scheduling is for the TLOmodel/src/tlo/methods/contraception.py Line 1271 in 4a67b48
to the end of the I initially also added a line TLOmodel/src/tlo/methods/contraception.py Lines 1256 to 1262 in 4a67b48
so that
so I am assuming the actual appointment footprint should be based on the current contraception method at the point HSI event is being run not after it has run (and the method has potentially changed). |
/run profiling |
Hi Matt, thanks for the neat and clear change and careful checks. I think the changes you've made look fine and agree with your saying that "actual appointment footprint should be based on the current contraception method at the point HSI event is being run not after it has run (and the method has potentially changed)". Would be grateful if Eva @EvaJanouskova could double check the logic. |
Resolves #1467
Changes
HSI_Contraception_FamilyPlanningAppt.EXPECTED_APPT_FOOTPRINT
from being a property to a static attribute, with the value evaluated when the class (HSI event) is initialised (scheduled).This may change the value associated with
EXPECTED_APPT_FOOTPRINT
as it is now depends on the targets properties (specifically the current contraception method indicated by the categoricalco_contraception
property) at the time of scheduling rather than evaluation ofEXPECTED_APPT_FOOTPRINT
. Marking this as draft for now as will need @EvaJanouskova and/or @BinglingICL to verify if this change in behaviour is reasonable.As discussed in #1467 repeated dataframe accesses when dynamically evaluating
EXPECTED_APPT_FOOTPRINT
for this HSI event where becoming a significant performance bottleneck - from some short profiled runs locally the changes here give around a 20% reduction in run time.