@@ -126,6 +126,7 @@ def __init__(self, name=None, resourcefilepath=None, run_with_checks=False):
126
126
"hv_last_test_date" : Property (Types .DATE , "Date of last HIV test" ),
127
127
"hv_date_inf" : Property (Types .DATE , "Date infected with HIV" ),
128
128
"hv_date_treated" : Property (Types .DATE , "date hiv treatment started" ),
129
+ "hv_date_last_ART" : Property (Types .DATE , "date of last ART dispensation" ),
129
130
}
130
131
131
132
PARAMETERS = {
@@ -374,6 +375,10 @@ def __init__(self, name=None, resourcefilepath=None, run_with_checks=False):
374
375
Types .REAL ,
375
376
"probability of death if aids and tb, person on treatment for tb" ,
376
377
),
378
+ "dispensation_period_months" : Parameter (
379
+ Types .REAL ,
380
+ "length of prescription for ARVs in months, same for all PLHIV" ,
381
+ ),
377
382
}
378
383
379
384
def read_parameters (self , data_folder ):
@@ -750,7 +755,7 @@ def split_into_vl_and_notvl(all_idx, prob):
750
755
# all those on ART need to have event scheduled for continuation/cessation of treatment
751
756
# this window is 1-90 days (3-monthly prescribing)
752
757
for person in art_idx :
753
- days = self .rng .randint (low = 1 , high = 90 , dtype = np .int64 )
758
+ days = self .rng .randint (low = 1 , high = self . parameters [ 'dispensation_period_months' ] * 30.5 , dtype = np .int64 )
754
759
self .sim .schedule_event (
755
760
Hiv_DecisionToContinueTreatment (person_id = person , module = self ),
756
761
self .sim .date + pd .to_timedelta (days , unit = "days" ),
@@ -2438,6 +2443,12 @@ def apply(self, person_id, squeeze_factor):
2438
2443
# Confirm that the person is diagnosed (this should not run if they are not)
2439
2444
assert person ["hv_diagnosed" ]
2440
2445
2446
+ # check whether person had Rx at least 3 months ago and is now due repeat prescription
2447
+ # alternate routes into testing/tx may mean person already has recent ARV dispensation
2448
+ if person ['hv_date_last_ART' ] >= (
2449
+ self .sim .date - pd .DateOffset (months = self .module .parameters ['dispensation_period_months' ])):
2450
+ return self .sim .modules ["HealthSystem" ].get_blank_appt_footprint ()
2451
+
2441
2452
if art_status_at_beginning_of_hsi == "not" :
2442
2453
2443
2454
assert person [
@@ -2452,14 +2463,18 @@ def apply(self, person_id, squeeze_factor):
2452
2463
2453
2464
# if ART is available (1st item in drugs_were_available dict)
2454
2465
if drugs_were_available .get ('art' , False ):
2466
+ df .at [person_id , 'hv_date_last_ART' ] = self .sim .date
2467
+
2455
2468
# If person has been placed/continued on ART, schedule 'decision about whether to continue on Treatment
2456
2469
self .sim .schedule_event (
2457
2470
Hiv_DecisionToContinueTreatment (
2458
2471
person_id = person_id , module = self .module
2459
2472
),
2460
- self .sim .date + pd .DateOffset (months = 3 ),
2473
+ self .sim .date + pd .DateOffset (months = self . module . parameters [ 'dispensation_period_months' ] ),
2461
2474
)
2475
+
2462
2476
else :
2477
+
2463
2478
# logger for drugs not available
2464
2479
person_details_for_tx = {
2465
2480
'age' : person ['age_years' ],
@@ -2471,57 +2486,57 @@ def apply(self, person_id, squeeze_factor):
2471
2486
}
2472
2487
logger .info (key = 'hiv_arv_NA' , data = person_details_for_tx )
2473
2488
2474
- # As drugs were not available, the person will default to being off ART (...if they were on ART at the
2475
- # beginning of the HSI.)
2476
- # NB. If the person was not on ART at the beginning of the HSI, then there is no need to stop them (which
2477
- # causes a new AIDSOnsetEvent to be scheduled.)
2478
- self .counter_for_drugs_not_available += 1 # The current appointment is included in the count.
2489
+ # As drugs were not available, the person will default to being off ART (...if they were on ART at the
2490
+ # beginning of the HSI.)
2491
+ # NB. If the person was not on ART at the beginning of the HSI, then there is no need to stop them (which
2492
+ # causes a new AIDSOnsetEvent to be scheduled.)
2493
+ self .counter_for_drugs_not_available += 1 # The current appointment is included in the count.
2479
2494
2480
- if art_status_at_beginning_of_hsi != "not" :
2481
- self .module .stops_treatment (person_id )
2495
+ if art_status_at_beginning_of_hsi != "not" :
2496
+ self .module .stops_treatment (person_id )
2482
2497
2483
- p = self .module .parameters ["probability_of_seeking_further_art_appointment_if_drug_not_available" ]
2498
+ p = self .module .parameters ["probability_of_seeking_further_art_appointment_if_drug_not_available" ]
2484
2499
2485
- if self .module .rng .random_sample () >= p :
2500
+ if self .module .rng .random_sample () >= p :
2486
2501
2487
- # add in referral straight back to tx
2488
- # if defaulting, seek another treatment appointment in 6 months
2502
+ # add in referral straight back to tx
2503
+ # if defaulting, seek another treatment appointment in 6 months
2504
+ self .sim .modules ["HealthSystem" ].schedule_hsi_event (
2505
+ hsi_event = HSI_Hiv_StartOrContinueTreatment (
2506
+ person_id = person_id , module = self .module ,
2507
+ facility_level_of_this_hsi = "1a" ,
2508
+ ),
2509
+ topen = self .sim .date + pd .DateOffset (months = 6 ),
2510
+ priority = 0 ,
2511
+ )
2512
+
2513
+ else :
2514
+ # If person 'decides to' seek another treatment appointment,
2515
+ # schedule a new HSI appointment for next month
2516
+ # NB. With a probability of 1.0, this will keep occurring,
2517
+ # if person has already tried unsuccessfully to get ART at level 1a 2 times
2518
+ # then refer to level 1b
2519
+ if self .counter_for_drugs_not_available <= 2 :
2520
+ # repeat attempt for ARVs at level 1a
2489
2521
self .sim .modules ["HealthSystem" ].schedule_hsi_event (
2490
2522
hsi_event = HSI_Hiv_StartOrContinueTreatment (
2491
2523
person_id = person_id , module = self .module ,
2492
- facility_level_of_this_hsi = "1a" ,
2524
+ facility_level_of_this_hsi = "1a"
2493
2525
),
2494
- topen = self .sim .date + pd .DateOffset (months = 6 ),
2526
+ topen = self .sim .date + pd .DateOffset (months = 1 ),
2495
2527
priority = 0 ,
2496
2528
)
2497
2529
2498
2530
else :
2499
- # If person 'decides to' seek another treatment appointment,
2500
- # schedule a new HSI appointment for next month
2501
- # NB. With a probability of 1.0, this will keep occurring,
2502
- # if person has already tried unsuccessfully to get ART at level 1a 2 times
2503
- # then refer to level 1b
2504
- if self .counter_for_drugs_not_available <= 2 :
2505
- # repeat attempt for ARVs at level 1a
2506
- self .sim .modules ["HealthSystem" ].schedule_hsi_event (
2507
- hsi_event = HSI_Hiv_StartOrContinueTreatment (
2508
- person_id = person_id , module = self .module ,
2509
- facility_level_of_this_hsi = "1a"
2510
- ),
2511
- topen = self .sim .date + pd .DateOffset (months = 1 ),
2512
- priority = 0 ,
2513
- )
2514
-
2515
- else :
2516
- # refer to higher facility level
2517
- self .sim .modules ["HealthSystem" ].schedule_hsi_event (
2518
- hsi_event = HSI_Hiv_StartOrContinueTreatment (
2519
- person_id = person_id , module = self .module ,
2520
- facility_level_of_this_hsi = "2"
2521
- ),
2522
- topen = self .sim .date + pd .DateOffset (days = 1 ),
2523
- priority = 0 ,
2524
- )
2531
+ # refer to higher facility level
2532
+ self .sim .modules ["HealthSystem" ].schedule_hsi_event (
2533
+ hsi_event = HSI_Hiv_StartOrContinueTreatment (
2534
+ person_id = person_id , module = self .module ,
2535
+ facility_level_of_this_hsi = "2"
2536
+ ),
2537
+ topen = self .sim .date + pd .DateOffset (days = 1 ),
2538
+ priority = 0 ,
2539
+ )
2525
2540
2526
2541
# also screen for tb
2527
2542
if "Tb" in self .sim .modules :
0 commit comments