-
Notifications
You must be signed in to change notification settings - Fork 5
In patient Bed Days
HSI Events may require in-patient care to be delivered. This can be specified as a number of “Bed Days”. There are three types of "Bed Days":
- “high_dependancy_bed”: this may be requested but the space is limited; if not available another bed type may be allocated.
- “general_bed”: this may be requested but the space is limited; if not available another bed type may be allocated.
- “non_bed_space”: this may not be requested, but may be allocated if other beds are not available.
An HSI declares its requirements of in-patient bed-days in a ‘footprint’, which is provided alongside its declaration of other information about the HSI Event at __init__
:
BEDDAYS_FOOTPRINT = self.make_beddays_footprint({'general_bed': 4, 'high_dependency_bed': 1})
N.B. (1) The number of bed-days is given in terms of ‘whole days’: the numbers provided in the footprint must be integer values.
N.B. (2) You can drop any of the terms and an implicit value 0 of that type of bed-days is assumed.
N.B. (3) You do not need to specify any footprint, in which case it is assumed that 0 bed-days of all types of bed are needed.
N.B. (4) The "bed-days" request is evaluated in conjunction with the declaration of ACCEPTED_FACILITY_LEVEL
. This will mean that if the HSI requests 'high_dependency_beds' and ACCEPTED_FACILITY_LEVEL=0
, there will not be an error, but no such beds will be available.
The health-system keeps track of usage of bed-days. The first day on which a bed-day is consumed is the day on which the HSI is run. If more than one type of bed-days is specified, then it assumed that they run on consecutive days, in order of decreasing intensity (i.e. ‘high_dependancy_bed > general_bed > non_bed_space). If more than one HSI requests in-patient days at any one time, usages of each bed-type are assumed to run concurrently, whilst preserving the appropriate sequence of bed-use (see above). When a person dies, the bed-days allocated to that person are automatically released with immediate effect.
The HSI Event will be run irrespective of the number of the bed-days available. When the HSI Event is running, its property self.bed_days_allocated_to_this_event
, informs on the bed-days that have been allocated to the HSI_Event. For each type of bed, this will range between 0 and the number specified in the footprint.
A helper function self.is_all_beddays_allocated()
returns True/False to indicate whether or not the bed-days requested in the BEDDAYS_FOOTPRINT
have been allocated in full.
It can then be determined if the outcomes of the patients will be affected by the days of in-patient care that are available.
See here for a basic example:
class HSI_Dummy(HSI_Event, IndividualScopeEventMixin):
def __init__(self, module, person_id):
super().__init__(module, person_id=person_id)
self.TREATMENT_ID = 'Dummy'
self.EXPECTED_APPT_FOOTPRINT = self.make_appt_footprint({'Over5OPD': 1})
self.ACCEPTED_FACILITY_LEVEL = 1
self.ALERT_OTHER_DISEASES = []
self.BEDDAYS_FOOTPRINT = self.make_beddays_footprint({
'high_dependency_bed': 10,
'general_bed': 5,
'non_bed_space': 2})
def apply(self, person_id, squeeze_factor):
print(f'squeeze-factor is {squeeze_factor}')
print(f'Bed-days allocated to this event: {self.bed_days_allocated_to_this_event}')
# check if the entire footprint requested is allocated
if all([self.bed_days_allocated_to_this_event[k] == self.BEDDAYS_FOOTPRINT[k] for k in self.BEDDAYS_FOOTPRINT]):
print('The entire footprint is allocated')
# equivalently, use the helper function
if self.is_all_beddays_allocated()
print('The entire footprint is allocated')
A property in the main population.props
data-frame called bd_is_inpatient
is a bool
that indicates whether or not the person is currently an in-patient.
The rules for the allocation of beds to an HSI are as follows:
- For each type of bed required by the HSI, check if there are sufficient bed-days available of that type in the relevant facility;
- If Yes, allocate the beds to that HSI and move to the next type of bed in the footprint.
- If No, allocate as many consecutive bed-days as possible to this HSI and consider that the remainder can be placed in a bed of the next type. Move to the next type.
TLO Model Wiki