Skip to content

Commit

Permalink
use bool for tclose_overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
tbhallett committed Jul 28, 2023
1 parent cbe3822 commit 625102d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tlo/methods/healthsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ class HealthSystem(Module):
" for specific treatments"),

'tclose_overwrite': Parameter(
Types.INT, "Decide whether to overwrite tclose variables assigned by disease modules"),
Types.BOOL, "Decide whether to overwrite tclose variables assigned by disease modules"),

'tclose_days_offset_overwrite': Parameter(
Types.INT, "Offset in days from topen at which tclose will be set by the healthsystem for all HSIs"
Expand Down Expand Up @@ -833,7 +833,7 @@ def pre_initialise_population(self):
availability=self.get_cons_availability()
)

self.tclose_overwrite = self.parameters['tclose_overwrite']
self.tclose_overwrite = bool(self.parameters['tclose_overwrite']) # coerce to bool (0 is falsey, 1 is truthy)
self.tclose_days_offset_overwrite = self.parameters['tclose_days_offset_overwrite']

# Determine name of policy to be considered **at the start of the simulation**.
Expand Down Expand Up @@ -1287,7 +1287,7 @@ def schedule_hsi_event(
"""
# If there is no specified tclose time then set this to a week after topen.
# This should be a boolean, not int! Still struggling to get a boolean variable from resource file
if self.tclose_overwrite == 1:
if self.tclose_overwrite:
tclose = topen + pd.to_timedelta(self.tclose_days_offset_overwrite, unit='D')
else:
if tclose is None:
Expand Down

0 comments on commit 625102d

Please sign in to comment.