@@ -3443,13 +3443,16 @@ def __init__(self, module, person_id, type_of_prep):
34433443 self .counter_for_drugs_not_available = 0
34443444 self .type_of_prep = type_of_prep
34453445
3446+ def get_prep_column (self ):
3447+ return 'hv_is_on_prep_oral' if self .type_of_prep == 'oral' else 'hv_is_on_prep_inj'
3448+
34463449 def apply (self , person_id , squeeze_factor ):
34473450 """Start PrEP for this person; or continue them on PrEP for 3 more months"""
34483451
34493452 df = self .sim .population .props
34503453 p = self .module .parameters
34513454 person = df .loc [person_id ]
3452- property = 'hv_is_on_prep_oral' if self .type_of_prep == 'oral' else 'hv_is_on_prep_inj'
3455+ prep_column = self .get_prep_column ()
34533456 days_on_prep_property = 'hv_days_on_oral_prep' if self .type_of_prep == 'oral' else 'hv_days_on_inj_prep'
34543457
34553458 # Do not run if the person is not alive or is diagnosed with hiv
@@ -3484,7 +3487,7 @@ def apply(self, person_id, squeeze_factor):
34843487 if self .get_consumables (
34853488 item_codes = {self .module .item_codes_for_consumables_required ['prep' ]: days_on_prep }
34863489 ):
3487- df .at [person_id , property ] = True
3490+ df .at [person_id , prep_column ] = True
34883491
34893492 if df .at [person_id , "li_is_sexworker" ]:
34903493 df .at [person_id , f'{ days_on_prep_property } _FSW' ] += days_on_prep
@@ -3504,7 +3507,7 @@ def apply(self, person_id, squeeze_factor):
35043507
35053508 else :
35063509 # If PrEP is not available, the person will default and not be on PrEP
3507- df .at [person_id , property ] = False
3510+ df .at [person_id , prep_column ] = False
35083511
35093512 self .counter_for_drugs_not_available += (
35103513 1 # The current appointment is included in the count.
@@ -3525,7 +3528,8 @@ def apply(self, person_id, squeeze_factor):
35253528 def never_ran (self ):
35263529 """This is called if this HSI was never run.
35273530 Default the person to being off PrEP"""
3528- self .sim .population .props .at [self .target , property ] = False
3531+ prep_column = self .get_prep_column ()
3532+ self .sim .population .props .at [self .target , prep_column ] = False
35293533
35303534
35313535class HSI_Hiv_StartOrContinueTreatment (HSI_Event , IndividualScopeEventMixin ):
0 commit comments