Skip to content

Commit

Permalink
Added Cab availability flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
pineapple-cat committed Nov 14, 2024
1 parent f461a44 commit 78a7c74
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/hivpy/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def __init__(self, **kwargs):
date(self.p_data.date_prep_cab_intro),
date(self.p_data.date_prep_len_intro),
date(self.p_data.date_prep_vr_intro)]
self.cab_available = True
self.prob_risk_informed_prep = self.p_data.prob_risk_informed_prep
self.prob_greater_risk_informed_prep = self.p_data.prob_greater_risk_informed_prep
self.prob_suspect_risk_prep = self.p_data.prob_suspect_risk_prep
Expand Down Expand Up @@ -198,7 +199,6 @@ def prep_preference(self, pop: Population):
self.set_prep_preference(pop, self.date_prep_intro[PrEPType.Oral],
self.prep_oral_pref_beta, col.PREP_ORAL_PREF)
# injectable prep pref
# FIXME: should Cab be controlled by an availability flag instead of introduction date?
self.set_prep_preference(pop, self.date_prep_intro[PrEPType.Cabotegravir],
self.prep_cab_pref_beta, col.PREP_CAB_PREF)
self.set_prep_preference(pop, self.date_prep_intro[PrEPType.Lenacapavir],
Expand Down Expand Up @@ -313,8 +313,9 @@ def calc_favoured_prep(self, oral_rank, cab_rank, len_rank, vr_rank,
for prep_type in sorted_dict:
willing = sorted_dict[prep_type]
if self.date >= self.date_prep_intro[prep_type] and willing:
favoured_prep = prep_type
break
if PrEPType(prep_type) is not PrEPType.Cabotegravir or self.cab_available:
favoured_prep = prep_type
break

return favoured_prep

Expand Down Expand Up @@ -728,7 +729,7 @@ def restart_prep(self, pop: Population, time_step):
eligible = pop.get_sub_pop(AND(COND(col.HIV_DIAGNOSED, op.eq, False),
COND(col.PREP_ELIGIBLE, op.eq, True),
COND(col.EVER_PREP, op.eq, True),
COND(col.LAST_PREP_STOP_DATE, op.lt, pop.date), # FIXME: is this right?
COND(col.LAST_PREP_STOP_DATE, op.lt, pop.date),
COND(col.LAST_TEST_DATE, op.eq, pop.date)))

if len(eligible) > 0:
Expand Down

0 comments on commit 78a7c74

Please sign in to comment.