Skip to content

Commit

Permalink
Remove temporary debugger class
Browse files Browse the repository at this point in the history
  • Loading branch information
willGraham01 committed Jun 7, 2024
1 parent 7a8541e commit 6ac1eff
Showing 1 changed file with 0 additions and 46 deletions.
46 changes: 0 additions & 46 deletions src/tlo/methods/bed_days.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,6 @@
if TYPE_CHECKING:
from tlo.logging.core import Logger

import os
class Debugger:

output_dir: str = ".wills-stuff/beddays/"

first_write: bool = True

@property
def output_file(self) -> str:
return self.output_dir + "exp-branch-log.log"

def __init__(self):
os.makedirs(self.output_dir, exist_ok=True)

def write(self, message: str) -> None:
if self.first_write:
self.first_write = False
if os.path.exists(self.output_file):
os.remove(self.output_file)
if not message.endswith("\n"):
message += "\n"
with open(self.output_file, "a") as f:
f.write(message)

DEBUGGER = Debugger()

@dataclass
class BedOccupancy:
"""
Expand Down Expand Up @@ -354,7 +328,6 @@ def set_max_capacities(
)
# Update new effective bed capacities
self.max_capacities = (self._raw_max_capacities * capacity_scaling_factor).apply(np.ceil).astype(int)
DEBUGGER.write(f"Setting max capacities:\n{self.max_capacities}")

def is_inpatient(self, patient_id: int) -> List[BedOccupancy]:
"""
Expand Down Expand Up @@ -788,15 +761,6 @@ def impose_beddays_footprint(
# (if they weren't already)
self.schedule_occupancies(*new_occupancies)

DEBUGGER.write(f"{first_day} scheduling for patient {patient_id} |")
for o in new_occupancies:
DEBUGGER.write(
f"\t{o.bed_type} freed on {o.freed_date}, at facility {o.facility}\n"
)
DEBUGGER.write("\tHaving received footprint:")
for bed_type, days in footprint.items():
DEBUGGER.write(f"\t\t{bed_type} : {days}")

def issue_bed_days_according_to_availability(
self, start_date: Date, facility_id: int, requested_footprint: BedDaysFootprint
) -> BedDaysFootprint:
Expand Down Expand Up @@ -873,16 +837,6 @@ def issue_bed_days_according_to_availability(
day_deficit = days_to_allocate - n_days_that_can_be_provided
days_allocated += n_days_that_can_be_provided

DEBUGGER.write(
f"{start_date} issuing for facility {facility_id} |"
)
for bed_type, n_days in available_footprint.items():
if bed_type in requested_footprint.keys():
wanted_days = requested_footprint[bed_type]
else:
wanted_days = 0
DEBUGGER.write(f"\t{bed_type} : {n_days} (wanted {wanted_days})")

return available_footprint

def on_end_of_day(self, day_that_is_ending: Date) -> None:
Expand Down

0 comments on commit 6ac1eff

Please sign in to comment.