Added long range interaction into the alternative scenarios

This commit is contained in:
Luis Aleixo 2022-05-02 10:31:13 +02:00
parent 971d9294de
commit 937ff8c2ed
3 changed files with 26 additions and 5 deletions

View file

@ -256,6 +256,10 @@ def manufacture_alternative_scenarios(form: FormData) -> typing.Dict[str, mc.Exp
without_mask_or_vent = dataclass_utils.replace(without_mask, ventilation_type='no_ventilation')
scenarios['No ventilation with Type I masks'] = with_mask_no_vent.build_mc_model()
scenarios['Neither ventilation nor masks'] = without_mask_or_vent.build_mc_model()
else:
no_short_range_alternative = dataclass_utils.replace(form, short_range_interactions=[])
scenarios['Base scenario without short-range interactions'] = no_short_range_alternative.build_mc_model()
return scenarios

View file

@ -46,6 +46,13 @@
<div class="tab-pane show active" id="results" role="tabpanel" aria-labelledby="results-tab" style="padding: 1%">
{% if form.short_range_option == "short_range_yes" %}
{% set scenario = alternative_scenarios.stats.values() | first %}
{% set long_range_prob_inf = scenario.probability_of_infection %}
{% else %}
{% set long_range_prob_inf = prob_inf %}
{% endif %}
{% block report_results %}
<div class="card bg-light mb-3" id="results-div">
<div class="card-header"><strong>Results </strong>
@ -63,7 +70,9 @@
<div class="card card-body align-self-center" style="text-align:center; max-width: 300px">
<h6 class="card-title">
<b>Probability of infection (%)</b><br>
{% if form.short_range_option == "short_range_yes" %} Without <b>short range interactions</b> {% endif %}
{% if form.short_range_option == "short_range_yes" %}
Without <b>short range interactions</b>
{% endif %}
</h6>
<br>
<img src="/static/images/1.png" class="align-middle mb-3">
@ -111,7 +120,7 @@
{% if form.short_range_option == "short_range_yes" %}
<br>
<div class="align-self-center alert alert-dark mb-0" role="alert">
Taking into account the uncertainties tied to the model variables, in this scenario and assuming all occupants are exposed equally, the <b>probability of one exposed occupant getting infected is {{ prob_inf | non_zero_percentage }}</b> and the <b>expected number of new cases is {{ expected_new_cases | float_format }}</b>*.
Taking into account the uncertainties tied to the model variables, in this scenario and assuming all occupants are exposed equally, the <b>probability of one exposed occupant getting infected is {{ prob_inf | non_zero_percentage }}</b>.
</div>
{% endif %}
</div>

View file

@ -2,7 +2,14 @@
{% set cern_level = 'green-1' %} <!-- green-1, yellow-2, orange-3, red-4 -->
{% if ((long_range_prob_inf > 10) or (long_range_expected_new_cases >= 1)) %} {% set long_range_scale_warning = 'red' %}
{% if form.short_range_option == "short_range_yes" %}
{% set scenario = alternative_scenarios.stats.values() | first %}
{% set long_range_prob_inf = scenario.probability_of_infection %}
{% else %}
{% set long_range_prob_inf = prob_inf %}
{% endif %}
{% if ((long_range_prob_inf > 10) or (expected_new_cases >= 1)) %} {% set long_range_scale_warning = 'red' %}
{% elif (2 <= long_range_prob_inf <= 10) %} {% set long_range_scale_warning = 'orange' %}
{% else %} {% set long_range_scale_warning = 'green' %}
{% endif %}
@ -23,6 +30,7 @@
{% elif long_range_scale_warning == 'orange' %} {% set long_range_warning_color = 'bg-warning' %}
{% elif long_range_scale_warning == 'green' %} {% set long_range_warning_color = 'bg-success' %}
{% endif %}
<div class="intro-banner-vdo-play-btn {{long_range_warning_color}} m-auto d-flex align-items-center justify-content-center">
<b>{{long_range_prob_inf | non_zero_percentage}}</b>
<i class="glyphicon glyphicon-play whiteText" aria-hidden="true"></i>
@ -47,7 +55,7 @@
{% endblock warning_animation %}
{% block report_summary %}
{% set long_range_report_message = "Taking into account the uncertainties tied to the model variables, in this scenario and assuming all occupants are exposed equally, the <b>probability of one exposed occupant getting infected is " + long_range_prob_inf | non_zero_percentage + "</b> and the <b>expected number of new cases is " + long_range_expected_new_cases | float_format + "</b>*." %}
{% set long_range_report_message = "Taking into account the uncertainties tied to the model variables, in this scenario and assuming all occupants are exposed equally, the <b>probability of one exposed occupant getting infected is " + long_range_prob_inf | non_zero_percentage + "</b> and the <b>expected number of new cases is " + expected_new_cases | float_format + "</b>*." %}
<div class="flex-row align-self-center">
<br>
{% if long_range_scale_warning == 'red' %}
@ -68,7 +76,7 @@
{% endif %}
{% if form.short_range_option == "short_range_yes" %}
<br>
{% set report_message = "Taking into account the uncertainties tied to the model variables, in this scenario and assuming all occupants are exposed equally, the <b>probability of one exposed occupant getting infected is " + prob_inf | non_zero_percentage + "</b> and the <b>expected number of new cases is " + expected_new_cases | float_format + "</b>*." %}
{% set report_message = "Taking into account the uncertainties tied to the model variables, in this scenario and assuming all occupants are exposed equally, the <b>probability of one exposed occupant getting infected is " + prob_inf | non_zero_percentage + "</b>." %}
{% if scale_warning == 'red' %}
<div class="alert alert-danger mb-0" role="alert">
<strong>Not Acceptable:</strong>