Exemple #1
0
def plot_hygiene_intervention_horizontal(baseline,
                                         column='Infected (symptomatic)',
                                         timing=True):
    folder_path = './model_outcomes/one_intervention/'
    if timing:
        selectedInterventions = load_interventions(folder_path,
                                                   prefix='hygiene0.7')
        selectedInterventions = {
            k: v
            for k, v in sorted(selectedInterventions.items(),
                               key=lambda item: int(item[0].split('-')[1]))
        }
        return plot_one_intervention_horizontal(column, baseline,
                                                selectedInterventions)
    else:
        selectedInterventions = load_interventions(folder_path,
                                                   prefix='hygiene',
                                                   suffix='200')
        selectedInterventions = {
            k: v
            for k, v in sorted(selectedInterventions.items(),
                               key=lambda item: float(item[0].split('-')[0].
                                                      split('giene')[1]))
        }
        return plot_one_intervention_horizontal(column, baseline,
                                                selectedInterventions)
def plot_iso_intervention_horizontal(baseline,column='Infected (symptomatic)',timing=True):
	folder_path='./model_outcomes/one_intervention/'
	if timing:
		selectedInterventions=load_interventions(folder_path,prefix='isolate50')
		selectedInterventions={k: v for k, v in sorted(selectedInterventions.items(), key=lambda item: int(item[0].split('-')[1]))}
		return plot_one_intervention_horizontal(column,baseline,selectedInterventions)
	else:
		selectedInterventions_100=load_interventions(folder_path,prefix='isolate100')
		selectedInterventions_50=load_interventions(folder_path,prefix='isolate50',suffix='40')
		selectedInterventions_10=load_interventions(folder_path,prefix='isolate10')
		selectedInterventions = {**selectedInterventions_100, **selectedInterventions_50,**selectedInterventions_10}
		selectedInterventions={k: v for k, v in sorted(selectedInterventions.items(), key=lambda item: int(item[0].split('-')[1]))}
		return plot_one_intervention_horizontal(column,baseline,selectedInterventions)
Exemple #3
0
def plot_onetype_intervention_horizontal(baseline,
                                         prefix,
                                         column='Infected (symptomatic)'):
    folder_path = './model_outcomes/one_intervention/'
    selectedInterventions = load_interventions(folder_path, prefix=prefix)
    return plot_one_intervention_horizontal(column, baseline,
                                            selectedInterventions)
Exemple #4
0
def plot_intervention_comparison_interactive(
        plot_intervention_comparison,
        baseline,
        folder_path='./model_outcomes/one_intervention/'):
    selectedInterventions = load_interventions(folder_path)
    selectedInterventions['do nothing'] = baseline
    first = widgets.Dropdown(options=selectedInterventions.keys(),
                             value='do nothing',
                             description='Compare:',
                             disabled=False)
    second = widgets.Dropdown(options=selectedInterventions.keys(),
                              description='With:',
                              disabled=False)
    category = widgets.Dropdown(options=[
        'Infected (symptomatic)', 'Hospitalised', 'Critical', 'Deaths'
    ],
                                description='Category:',
                                disabled=False)
    w = interactive(plot_intervention_comparison,
                    scenarioDict=fixed(selectedInterventions),
                    firstIntervention=first,
                    secondIntervention=second,
                    selectedCategory=category)
    controls = widgets.HBox(w.children[:-1],
                            layout=Layout(flex_flow='row wrap'))
    output = w.children[-1]
    words = widgets.Label(
        'Compare two different intervention strategies or compare a particular intervention strategy with do nothing scenario'
    )
    container = widgets.VBox([words, controls, output])
    container.layout.width = '100%'
    container.layout.border = '2px solid grey'
    container.layout.justify_content = 'space-around'
    container.layout.align_items = 'center'
    return container
Exemple #5
0
def plot_one_intervention_horizontal_interactive(
        plot_one_intervention_horizontal, baseline):
    folder_path = './model_outcomes/one_intervention/'
    one_intervention_dict = load_interventions(folder_path)
    #sort the collection of interventions by their keys
    one_intervention_dict = {
        k: v
        for k, v in sorted(one_intervention_dict.items(),
                           key=lambda item: item[0])
    }
    w = interactive(plot_one_intervention_horizontal,
                    column=widgets.Select(options=[
                        'Infected (symptomatic)', 'Hospitalised', 'Critical',
                        'Deaths'
                    ],
                                          value='Infected (symptomatic)',
                                          description='Category:'),
                    baseline=fixed(baseline),
                    one_intervention_dict=fixed(one_intervention_dict))
    words = widgets.Label(
        'Contrast the peak case count between do nothing and a single intervention strategy in place'
    )
    container = widgets.VBox([words, w])
    container.layout.width = '100%'
    container.layout.border = '2px solid grey'
    container.layout.justify_content = 'space-around'
    container.layout.align_items = 'center'
    return container
Exemple #6
0
def plot_onetype_intervention_vertical(prefix,
                                       column='Infected (symptomatic)',
                                       top_5=False):
    folder_path = './model_outcomes/one_intervention/'
    selectedInterventions = load_interventions(folder_path, prefix=prefix)
    return plot_one_intervention_vertical(column,
                                          selectedInterventions,
                                          top_5=top_5)
Exemple #7
0
def plot_iso_intervention_horizontal(baseline,
                                     column='Infected (symptomatic)',
                                     timing=True):
    folder_path = './model_outcomes/one_intervention/'
    if timing:
        selectedInterventions = load_interventions(folder_path,
                                                   prefix='isolate50')
        return plot_one_intervention_horizontal(column, baseline,
                                                selectedInterventions)
    else:
        selectedInterventions_100 = load_interventions(folder_path,
                                                       prefix='isolate100')
        selectedInterventions_50 = load_interventions(folder_path,
                                                      prefix='isolate50',
                                                      suffix='40')
        selectedInterventions_10 = load_interventions(folder_path,
                                                      prefix='isolate10')
        selectedInterventions = {
            **selectedInterventions_100,
            **selectedInterventions_50,
            **selectedInterventions_10
        }
        return plot_one_intervention_horizontal(column, baseline,
                                                selectedInterventions)
def plot_one_intervention_vertical_interactive(plot_one_intervention_vertical):
	folder_path='./model_outcomes/one_intervention/'
	one_intervention_dict=load_interventions(folder_path)
	w = interactive(plot_one_intervention_vertical,
					column=widgets.Select(
					options=['Infected (symptomatic)','Hospitalised','Critical','Deaths'],
					value='Infected (symptomatic)',
					description='Category:'
					),
					one_intervention_dict=fixed(one_intervention_dict),
					top_5=fixed(True))
	words = widgets.Label('Plot the case counts when one of the intervention is in place and the intervention plots are places by ascending order of effectiveness in reducing peak case counts')
	container=widgets.VBox([words,w])
	container.layout.width = '100%'
	container.layout.border = '2px solid grey'
	container.layout.justify_content = 'space-around'
	container.layout.align_items = 'center'
	return w