Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions resources/ResourceFile_Alri/Calculations.csv

This file was deleted.

3 changes: 0 additions & 3 deletions resources/ResourceFile_Alri/Lazzerini CFR.csv

This file was deleted.

4 changes: 2 additions & 2 deletions resources/ResourceFile_Alri/Parameter_values.csv
Git LFS file not shown
3 changes: 0 additions & 3 deletions resources/ResourceFile_Alri/Pathogen_specific.csv

This file was deleted.

43 changes: 36 additions & 7 deletions src/tlo/methods/alri.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,29 @@ class Alri(Module, GenericFirstAppointmentsMixin):
Parameter(Types.REAL,
'The probability for scheduling a follow-up appointment following treatment failure'
),

# Module configuration parameters -----
'main_polling_frequency':
Parameter(Types.INT,
'Frequency of main polling event in months'
),
'child_age_threshold':
Parameter(Types.INT,
'Maximum age in years for child classification'
),
'inpatient_bed_days':
Parameter(Types.INT,
'Number of bed days required for inpatient care of ALRI'
),
'treatment_window_days':
Parameter(Types.INT,
'Buffer window days that ALRI treatment event can be scheduled'
),
'follow_up_appointment_days':
Parameter(Types.INT,
'Days after which follow-up appointment is scheduled'
),

}

PROPERTIES = {
Expand Down Expand Up @@ -1372,7 +1395,8 @@ def do_at_generic_first_appt(
# Action taken when a child (under 5 years old) presents at a
# generic appointment (emergency or non-emergency) with symptoms
# of `cough` or `difficult_breathing`.
if individual_properties["age_years"] <= 5 and (
p = self.parameters
if individual_properties["age_years"] <= p['child_age_threshold'] and (
("cough" in symptoms) or ("difficult_breathing" in symptoms)
):
self.record_sought_care_for_alri()
Expand All @@ -1384,7 +1408,7 @@ def do_at_generic_first_appt(
schedule_hsi_event(
event,
topen=self.sim.date,
tclose=self.sim.date + pd.DateOffset(days=1),
tclose=self.sim.date + pd.DateOffset(days=p['treatment_window_days']),
priority=1,
)

Expand Down Expand Up @@ -1901,7 +1925,7 @@ class AlriPollingEvent(RegularEvent, PopulationScopeEventMixin):
age-groups. This is a small effect when the frequency of the polling event is high."""

def __init__(self, module):
super().__init__(module, frequency=DateOffset(months=2))
super().__init__(module, frequency=DateOffset(months=module.parameters['main_polling_frequency']))

@property
def fraction_of_year_between_polling_event(self):
Expand Down Expand Up @@ -2273,7 +2297,8 @@ def _as_in_patient(self, facility_level):
f'{self._treatment_id_stub}_Inpatient{"_Followup" if self.is_followup_following_treatment_failure else ""}'
self.EXPECTED_APPT_FOOTPRINT = self.make_appt_footprint({})
self.ACCEPTED_FACILITY_LEVEL = facility_level
self.BEDDAYS_FOOTPRINT = self.make_beddays_footprint({'general_bed': 7})
bed_days = self.module.parameters['inpatient_bed_days']
self.BEDDAYS_FOOTPRINT = self.make_beddays_footprint({'general_bed': bed_days})

def _refer_to_next_level_up(self):
"""Schedule this event to occur again today at the next level-up (if there is a next level-up)."""
Expand All @@ -2290,6 +2315,8 @@ def _next_in_sequence(seq: tuple, x: str):
_next_level_up = _next_in_sequence(self._facility_levels, self.ACCEPTED_FACILITY_LEVEL)

if _next_level_up is not None:
p = self.module.parameters

self.sim.modules['HealthSystem'].schedule_hsi_event(
HSI_Alri_Treatment(
module=self.module,
Expand All @@ -2298,7 +2325,7 @@ def _next_in_sequence(seq: tuple, x: str):
facility_level=_next_level_up
),
topen=self.sim.date,
tclose=self.sim.date + pd.DateOffset(days=1),
tclose=self.sim.date + pd.DateOffset(days=p['treatment_window_days']),
priority=0)

def _refer_to_become_inpatient(self):
Expand All @@ -2318,8 +2345,10 @@ def _refer_to_become_inpatient(self):
priority=0)

def _schedule_follow_up_following_treatment_failure(self):
"""Schedule a copy of this event to occur in 5 days time as a 'follow-up' appointment at this level
"""Schedule a copy of this event to occur as a 'follow-up' appointment at this level
(if above "0") and as an in-patient."""

p = self.module.parameters
self.sim.modules['HealthSystem'].schedule_hsi_event(
HSI_Alri_Treatment(
module=self.module,
Expand All @@ -2328,7 +2357,7 @@ def _schedule_follow_up_following_treatment_failure(self):
facility_level=self.ACCEPTED_FACILITY_LEVEL if self.ACCEPTED_FACILITY_LEVEL != "0" else "1a",
is_followup_following_treatment_failure=True,
),
topen=self.sim.date + pd.DateOffset(days=5),
topen=self.sim.date + pd.DateOffset(days=p['follow_up_appointment_days']),
tclose=None,
priority=0)

Expand Down