Skip to content
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

Recurrence of HSI_Events in RTI module when consumables not available #1403

Closed
tbhallett opened this issue Jun 18, 2024 · 0 comments · Fixed by #1408
Closed

Recurrence of HSI_Events in RTI module when consumables not available #1403

tbhallett opened this issue Jun 18, 2024 · 0 comments · Fixed by #1408
Assignees

Comments

@tbhallett
Copy link
Collaborator

tbhallett commented Jun 18, 2024

In her analysis of the effects of consumables availability, @sakshimohan has noted that there are large numbers of recurring HSI_Events for the RTI module.

This appears to be due to logic in several of the HSI like this:

# check for availability of consumables 
if consumables_available:
    # do something
else:
   # reschedule this event instance for tomorrow
   return self.make_appt_footprint({})  # return of blank footprint shows that the HSI did not really take up any time

e.g.

if is_cons_available:
logger.debug(key='rti_general_message',
data=f"Hypovolemic shock treatment available for person {person_id}")
df.at[person_id, 'rt_in_shock'] = False
else:
self.sim.modules['RTI'].schedule_hsi_event_for_tomorrow(self)
return self.make_appt_footprint({})

This could be fixed by changing the logic in each place to be of the form:

# in __init__() of the HSI_Event
self._number_of_times_this_event_has_run = 0
self._maximum_number_times_event_should_run = self.module.parameters['Maximum_Number_Of_Times_HSI_Events_Should_Run']  # module declares this parameter (value could be 5)

# at the top of the apply() of the HSI_Event
self._number_of_times_this_event_has_run += 1

# check for availability of consumables 
if consumables_available:
    # do something
else:
   if  self._number_of_times_this_event_has_run < self._maximum_number_times_event_should_run:
       # reschedule this event instance for tomorrow
   return self.make_appt_footprint({})
@tbhallett tbhallett self-assigned this Jun 18, 2024
@thewati thewati linked a pull request Jul 1, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

Successfully merging a pull request may close this issue.

2 participants