Skip to content

Commit

Permalink
utils, brc, co & hs: fix mistakes from rebase; TODO added
Browse files Browse the repository at this point in the history
  • Loading branch information
EvaJanouskova committed Nov 19, 2023
1 parent fc41cdb commit 5e29244
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/tlo/analysis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def get_multiplier(_draw, _run):
)['tlo.methods.population']['scaling_factor']['scaling_factor'].values[0]

if custom_generate_series is None:
# If there is no `custom_generate_series` provided, it implies that function required selects a the specified
# If there is no `custom_generate_series` provided, it implies that function required selects the specified
# column from the dataframe.
assert column is not None, "Must specify which column to extract"
else:
Expand Down
5 changes: 3 additions & 2 deletions src/tlo/methods/breast_cancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ class BreastCancerMainPollingEvent(RegularEvent, PopulationScopeEventMixin):

def __init__(self, module):
super().__init__(module, frequency=DateOffset(months=1))
# scheduled to run every 3 months: do not change as this is hard-wired into the values of all the parameters.
# scheduled to run every month: do not change as this is hard-wired into the values of all the parameters.

def apply(self, population):
df = population.props # shortcut to dataframe
Expand Down Expand Up @@ -645,7 +645,8 @@ def __init__(self, module, person_id):

self.TREATMENT_ID = "BreastCancer_Investigation"
self.EXPECTED_APPT_FOOTPRINT = self.make_appt_footprint({"Over5OPD": 1, "Mammography": 1})
self.ACCEPTED_FACILITY_LEVEL = '3' # Mammography only available at level 3 and above.
self.ACCEPTED_FACILITY_LEVEL = '3' # Biopsy only available at level 3 and above.
# TODO: but the appt footprints suggests mammography to be provided

def apply(self, person_id, squeeze_factor):
df = self.sim.population.props
Expand Down
6 changes: 4 additions & 2 deletions src/tlo/methods/contraception.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def avoid_sterilization_below30(probs):
# Increase prob of 'female_sterilization' in older women accordingly
probs_30plus = probs.copy()
probs_30plus['female_sterilization'] = (
probs.loc['female_sterilization'] /
probs.loc['female_sterilization'] /
self.ratio_n_females_30_49_to_15_49_in_2010
)
# Scale so that the probability of all outcomes sum to 1.0
Expand Down Expand Up @@ -633,7 +633,7 @@ def avoid_sterilization_below30(probs):
# Increase prob of 'female_sterilization' in older women accordingly
probs_30plus = probs.copy()
probs_30plus['female_sterilization'] = (
probs.loc['female_sterilization'] /
probs.loc['female_sterilization'] /
self.ratio_n_females_30_49_to_15_49_in_2010
)
# Scale so that the probability of all outcomes sum to 1.0
Expand Down Expand Up @@ -736,6 +736,7 @@ def get_item_code_for_each_contraceptive(self):
get_items_from_pkg = self.sim.modules['HealthSystem'].get_item_codes_from_package_name

_cons_codes = dict()
# items for each method that requires an HSI to switch to
_cons_codes['pill'] = get_items_from_pkg('Pill')
_cons_codes['male_condom'] = get_items_from_pkg('Male condom')
_cons_codes['other_modern'] = get_items_from_pkg('Female Condom')
Expand All @@ -745,6 +746,7 @@ def get_item_code_for_each_contraceptive(self):
_cons_codes['implant'] = get_items_from_pkg('Implant')
_cons_codes['female_sterilization'] = get_items_from_pkg('Female sterilization')
assert set(_cons_codes.keys()) == set(self.states_that_may_require_HSI_to_switch_to)
# items used when initiating a modern reliable method after not using or switching from non-reliable method
_cons_codes['co_initiation'] = get_items_from_pkg('Contraception initiation')

return _cons_codes
Expand Down
2 changes: 1 addition & 1 deletion src/tlo/methods/healthsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def initialise(self):
# If there are bed-days specified, add (if needed) the in-patient admission and in-patient day Appointment
# Types.
# (HSI that require a bed for one or more days always need such appointments, but this may have been
# missed in the declaration of the `EXPECTED_APPPT_FOOTPRINT` in the HSI.)
# missed in the declaration of the `EXPECTED_APPT_FOOTPRINT` in the HSI.)
# NB. The in-patient day Appointment time is automatically applied on subsequent days.
if sum(self.BEDDAYS_FOOTPRINT.values()):
self.EXPECTED_APPT_FOOTPRINT = health_system.bed_days.add_first_day_inpatient_appts_to_footprint(
Expand Down

0 comments on commit 5e29244

Please sign in to comment.