def sweep_coverages(cb, coverage): add_health_seeking(cb, start_day=0, drug=['DHA', 'Piperaquine'], targets=[{ 'trigger': 'NewClinicalCase', 'coverage': coverage[0], 'agemin': 0, 'agemax': 5, 'seek': 1, 'rate': 0.3 }, { 'trigger': 'NewClinicalCase', 'coverage': coverage[1], 'agemin': 10, 'agemax': 200, 'seek': 1, 'rate': 0.3 }, { 'trigger': 'NewSevereCase', 'coverage': 0.30, 'agemin': 0, 'agemax': 200, 'seek': 1, 'rate': 0.3 }]), return {'coverage_pair': coverage}
def fn(self, cb): with open(self.reffname) as fin: cov = json.loads(fin.read()) for hscov in cov['hscov']: targets = [{ 'trigger': 'NewClinicalCase', 'coverage': 1, 'agemin': 15, 'agemax': 200, 'seek': hscov['coverage'], 'rate': 0.3 }, { 'trigger': 'NewClinicalCase', 'coverage': 1, 'agemin': 0, 'agemax': 15, 'seek': min([1, hscov['coverage'] * 1.5]), 'rate': 0.3 }, { 'trigger': 'NewSevereCase', 'coverage': 1, 'seek': 0.8, 'rate': 0.5 }] add_health_seeking(cb, start_day=self.start, targets=targets, nodes={ 'Node_List': hscov['nodes'], "class": "NodeSetNodeList" })
def add_healthseeking_by_coverage(cb, coverage=1.0, rate=0.15, drugname="AL"): drugs = { "AL": ["Artemether", "Lumefantrine"], "DP": ["DHA", "Piperaquine"] } add_health_seeking(cb, targets=[{ "trigger": "NewClinicalCase", "coverage": coverage, "agemin": 0, "agemax": 100, "seek": 1.0, "rate": rate }], drug=drugs[drugname], dosing="FullTreatmentNewDetectionTech", nodes={"class": "NodeSetAll"}, repetitions=1, tsteps_btwn_repetitions=365, broadcast_event_name="Received_Treatment") return { "CM_Coverage": coverage, "CM_Daily_Prob": rate, "CM_Drug": drugname }
def fn(self, cb): add_health_seeking( cb, start_day=self.start, drug=self.drug, targets=self.targets, nodes=self.nodes, drug_ineligibility_duration=self.durg_ineligibility_duration, node_property_restrictions=self.node_property_restrictions) cb.update_params({'PKPD_Model': 'CONCENTRATION_VERSUS_TIME'})
def seasonal_health_seeking(self, cb): with open(self.fname) as fin: cov = json.loads(fin.read()) for i, hscov in enumerate(cov[self.channel]): code = 'group%d' % i ad_cov = hscov['coverage'] kid_cov = min([1, hscov['coverage'] * 1.5]) sev_cov = 0.8 for start_month in range(len(self.scale_by_month)): start_day = int(self.date + np.cumsum(self.days_in_month)[start_month]) duration = self.days_in_month[start_month + 1] scale = self.scale_by_month[start_month] targets = [{ 'trigger': 'NewClinicalCase', 'coverage': 1, 'agemin': 15, 'agemax': 200, 'seek': min([1, ad_cov * scale]), 'rate': 0.3 }, { 'trigger': 'NewClinicalCase', 'coverage': 1, 'agemin': 0, 'agemax': 15, 'seek': min([1, kid_cov * scale]), 'rate': 0.3 }, { 'trigger': 'NewSevereCase', 'coverage': 1, 'seek': min([1, max([sev_cov * scale, kid_cov * scale])]), 'rate': 0.5 }] add_health_seeking(cb, start_day=start_day, targets=targets, duration=duration, repetitions=self.duration_years + 1, drug_ineligibility_duration=14, node_property_restrictions=[{ self.prop_name: code }])
def fn(self, cb): with open(self.reffname) as fin: cov = json.loads(fin.read()) for hscov in cov['hscov']: ad_cov = hscov['coverage'] kid_cov = min([1, hscov['coverage'] * 1.5]) sev_cov = 0.8 for start_month in range(len(self.scale_by_month)): start_day = self.start + np.cumsum( self.days_in_month)[start_month] duration = self.days_in_month[start_month + 1] scale = self.scale_by_month[start_month] targets = [{ 'trigger': 'NewClinicalCase', 'coverage': 1, 'agemin': 15, 'agemax': 200, 'seek': min([1, ad_cov * scale]), 'rate': 0.3 }, { 'trigger': 'NewClinicalCase', 'coverage': 1, 'agemin': 0, 'agemax': 15, 'seek': min([1, kid_cov * scale]), 'rate': 0.3 }, { 'trigger': 'NewSevereCase', 'coverage': 1, 'seek': min([1, max([sev_cov * scale, kid_cov * scale])]), 'rate': 0.5 }] add_health_seeking(cb, start_day=start_day, targets=targets, duration=duration, repetitions=-1, drug_ineligibility_duration=14, nodes={ 'Node_List': hscov['nodes'], "class": "NodeSetNodeList" })
def configure_health_seeking(cb, pull_from_serialization, village_nodes, set_forest_HS=True) : if pull_from_serialization : add_health_seeking(cb, start_day=0, drug=['Artemether', 'Lumefantrine'], nodes=village_nodes, targets=[ {'trigger': 'NewClinicalCase', 'coverage': 0.8, 'agemin': 0, 'agemax': 10, 'seek': 1, 'rate': 0.3}, {'trigger': 'NewClinicalCase', 'coverage': 0.7, 'agemin': 10, 'agemax': 100, 'seek': 1, 'rate': 0.3}, {'trigger': 'NewSevereCase', 'coverage': 0.95, 'agemin': 0, 'agemax': 100, 'seek': 1, 'rate': 0.3}], ind_property_restrictions=[{'ForestGoing' : 'HatesForest'}] ) if set_forest_HS : add_health_seeking(cb, start_day=0, drug=['Artemether', 'Lumefantrine'], nodes=village_nodes, targets=[ {'trigger': 'NewClinicalCase', 'coverage': 0.4, 'seek': 1, 'rate': 0.2}], ind_property_restrictions=[{'ForestGoing': 'LovesForest'}] ) else : add_health_seeking(cb, start_day=0, drug=['Artemether', 'Lumefantrine'], nodes=village_nodes, targets=[ {'trigger': 'NewClinicalCase', 'coverage': 0.4, 'agemin': 0, 'agemax': 5, 'seek': 1, 'rate': 0.3}, {'trigger': 'NewClinicalCase', 'coverage': 0.2, 'agemin': 5, 'agemax': 100, 'seek': 1, 'rate': 0.3}, {'trigger': 'NewSevereCase', 'coverage': 0.5, 'agemin': 0, 'agemax': 100, 'seek': 1, 'rate': 0.3}] )
def add_simple_hs(cb, u5_hs_rate, o5_hs_rate=-1, start_day=1, duration=-1): if o5_hs_rate == -1: o5_hs_rate = u5_hs_rate * 0.5 target_list = [{ 'trigger': 'NewClinicalCase', 'coverage': u5_hs_rate, 'agemin': 0, 'agemax': 5, 'seek': 1, 'rate': 0.3 }, { 'trigger': 'NewClinicalCase', 'coverage': o5_hs_rate, 'agemin': 5, 'agemax': 100, 'seek': 1, 'rate': 0.3 }, { 'trigger': 'NewSevereCase', 'coverage': 0.9, 'agemin': 0, 'agemax': 5, 'seek': 1, 'rate': 0.5 }, { 'trigger': 'NewSevereCase', 'coverage': 0.8, 'agemin': 5, 'agemax': 100, 'seek': 1, 'rate': 0.5 }] add_health_seeking(cb, start_day=start_day, targets=target_list, drug=['Artemether', 'Lumefantrine'], duration=duration)
def add_simple_hs(cb, u5_hs_rate, o5_hs_rate=-1): if o5_hs_rate == -1: o5_hs_rate = u5_hs_rate * 0.5 add_health_seeking(cb, start_day=1, targets=[{'trigger': 'NewClinicalCase', 'coverage': u5_hs_rate, 'agemin': 0, 'agemax': 5, 'seek': 1, 'rate': 0.3}, {'trigger': 'NewClinicalCase', 'coverage': o5_hs_rate, 'agemin': 5, 'agemax': 100, 'seek': 1, 'rate': 0.3}, {'trigger': 'NewSevereCase', 'coverage': 0.9, 'agemin': 0, 'agemax': 5, 'seek': 1, 'rate': 0.5}, {'trigger': 'NewSevereCase', 'coverage': 0.8, 'agemin': 5, 'agemax': 100, 'seek': 1, 'rate': 0.5}], drug=['Artemether', 'Lumefantrine'], dosing='FullTreatmentNewDetectionTech') return {"u5_hs_rate": u5_hs_rate, "o5_hs_rate": o5_hs_rate}
def add_hs(cb, events_df): hs_field_list = [ "cov_newclin_youth", "cov_newclin_adult", "cov_severe_youth", "cov_severe_adult", "duration" ] binned_intervene_events, binned_and_grouped, data_fields = try_campaign_compression( events_df, hs_field_list) for table, group in binned_and_grouped: table_dict = dict(zip((data_fields), table)) node_list = sorted(group['grid_cell']) node_dict = {"class": "NodeSetNodeList", "Node_List": node_list} add_health_seeking(cb, start_day=table_dict['simday'], targets=[{ 'trigger': 'NewClinicalCase', 'coverage': float(table_dict['cov_newclin_youth']), 'agemin': 0, 'agemax': 5, 'seek': 1, 'rate': 0.3 }, { 'trigger': 'NewClinicalCase', 'coverage': float(table_dict['cov_newclin_adult']), 'agemin': 5, 'agemax': 100, 'seek': 1, 'rate': 0.3 }, { 'trigger': 'NewSevereCase', 'coverage': float(table_dict['cov_severe_youth']), 'agemin': 0, 'agemax': 5, 'seek': 1, 'rate': 0.5 }, { 'trigger': 'NewSevereCase', 'coverage': float(table_dict['cov_severe_adult']), 'agemin': 5, 'agemax': 100, 'seek': 1, 'rate': 0.5 }], drug=['Artemether', 'Lumefantrine'], dosing='FullTreatmentNewDetectionTech', nodes=node_list, duration=table_dict['duration'])
vector_stats_report = 0 malaria_summary_report = 0 add_reporters(cb, vector_genetics_report=vector_genetics_report) ############################## HEALTH SEEKING ########################################### # Health seeking add_health_seeking(cb, targets=[{'trigger': 'NewClinicalCase', 'coverage': 0.5, 'agemin': 0, 'agemax': 100, 'seek': 1, 'rate': 0.3}, {'trigger': 'NewSevereCase', 'coverage': 0.8, 'agemin': 0, 'agemax': 100, 'seek': 1, 'rate': 0.5} ], drug=['Artemether', 'Lumefantrine'], start_day=0, broadcast_event_name='Received_Treatment') ########################################################################################## run_sim_args = {'config_builder': cb, 'exp_name': exp_name, 'exp_builder': builder}
def add_intervention(cb, intervention, coverage, target, ivm_duration) : IPR = [{'HomeVillage' : 'Village1'}] if target == 'vill1' else None if intervention == 'ivermectin_to_forest' : add_ivermectin(cb, box_duration=ivm_duration, coverage=coverage, start_days=[365], trigger_condition_list=['Immigrating'], nodeIDs=forest_nodes, target_group={'agemin': 5, 'agemax': 200, 'gender': 'Male'}, target_residents_only=False, ind_property_restrictions=IPR ) elif intervention == 'drug_to_forest' : add_drug_campaign(cb, 'MDA', 'DP', coverage=coverage, start_days=[365], repetitions=1, trigger_condition_list=['Immigrating'], nodeIDs=forest_nodes, target_residents_only=False, ind_property_restrictions=IPR ) elif intervention == 'drug_MDA' : add_drug_campaign(cb, 'MDA', 'DP', coverage=coverage, start_days=[365 + 152], repetitions=3, tsteps_btwn_repetitions=30, nodeIDs=village_nodes, target_residents_only=False, ind_property_restrictions=IPR ) elif intervention == 'drug_ivermectin_MDA' : add_drug_campaign(cb, 'MDA', 'DP', coverage=coverage, start_days=[365 + 152], repetitions=3, tsteps_btwn_repetitions=30, nodeIDs=village_nodes, target_residents_only=False, ind_property_restrictions=IPR ) add_ivermectin(cb, box_duration=ivm_duration, coverage=1, start_days=[365], trigger_condition_list=['Received_Campaign_Drugs'], target_group={'agemin': 5, 'agemax': 200, 'gender': 'Male'}, nodeIDs=village_nodes, target_residents_only=False ) add_ivermectin(cb, box_duration=ivm_duration, coverage=1, start_days=[365], trigger_condition_list=['Received_Campaign_Drugs'], target_group={'agemin': 51, 'agemax': 200, 'gender': 'Female'}, nodeIDs=village_nodes, target_residents_only=False ) add_ivermectin(cb, box_duration=ivm_duration, coverage=1, start_days=[365], trigger_condition_list=['Received_Campaign_Drugs'], target_group={'agemin': 5, 'agemax': 12, 'gender': 'Female'}, nodeIDs=village_nodes, target_residents_only=False ) elif intervention == 'ivermectin_MDA' : add_ivermectin(cb, box_duration=ivm_duration, coverage=coverage, start_days=[365 + 152 + 30 * x for x in range(3)], nodeIDs=village_nodes, target_group={'agemin': 5, 'agemax': 200, 'gender': 'Male'}, target_residents_only=False, ind_property_restrictions=IPR ) add_ivermectin(cb, box_duration=ivm_duration, coverage=coverage, start_days=[365 + 152 + 30 * x for x in range(3)], nodeIDs=village_nodes, target_group={'agemin': 51, 'agemax': 200, 'gender': 'Female'}, target_residents_only=False, ind_property_restrictions=IPR ) add_ivermectin(cb, box_duration=ivm_duration, coverage=coverage, start_days=[365 + 152 + 30 * x for x in range(3)], nodeIDs=village_nodes, target_group={'agemin': 5, 'agemax': 12, 'gender': 'Female'}, target_residents_only=False, ind_property_restrictions=IPR ) forest_HS_coverage = coverage if intervention == 'forest_HS' else 0.4 add_health_seeking(cb, start_day=0, drug=['Artemether', 'Lumefantrine'], nodes=village_nodes, targets=[ {'trigger': 'NewClinicalCase', 'coverage': forest_HS_coverage, 'seek': 1, 'rate': 0.2}], ind_property_restrictions=[{'ForestGoing': 'LovesForest'}] ) event_trigger_list=['Received_Treatment'] if 'ivermectin' in intervention : event_trigger_list.append('Received_Ivermectin') if 'drug' in intervention : event_trigger_list.append('Received_Campaign_Drugs') add_event_counter_report(cb, event_trigger_list=event_trigger_list) return { 'intervention' : intervention, 'coverage' : coverage, 'target' : target, 'IVM duration' : ivm_duration}