updated new cases method
This commit is contained in:
parent
ed5b0d0e27
commit
04b8e91639
4 changed files with 16 additions and 13 deletions
|
|
@ -431,7 +431,7 @@ def manufacture_alternative_scenarios(form: VirusFormData) -> typing.Dict[str, m
|
|||
scenarios['Neither ventilation nor masks'] = without_mask_or_vent.build_mc_model()
|
||||
|
||||
else:
|
||||
no_short_range_alternative = dataclass_utils.replace(form, short_range_interactions=[])
|
||||
no_short_range_alternative = dataclass_utils.replace(form, short_range_interactions=[], total_people=form.total_people - form.short_range_total_people)
|
||||
scenarios['Base scenario without short-range interactions'] = no_short_range_alternative.build_mc_model()
|
||||
|
||||
return scenarios
|
||||
|
|
|
|||
|
|
@ -56,16 +56,15 @@
|
|||
<div class="tab-pane show active" id="results" role="tabpanel" aria-labelledby="results-tab" style="padding: 1%">
|
||||
{% set long_range_prob_inf = prob_inf %}
|
||||
{% set long_range_expected_cases = expected_new_cases %}
|
||||
{% set total_expected_new_cases = expected_new_cases %}
|
||||
|
||||
{# Update values if short range option is "short_range_yes" #}
|
||||
{% if form.short_range_option == "short_range_yes" %}
|
||||
{% set scenario = alternative_scenarios.stats.values() | first %}
|
||||
{# Probability of infection values #}
|
||||
{% set long_range_prob_inf = scenario.probability_of_infection %}
|
||||
{% set long_range_expected_cases = scenario.expected_new_cases %}
|
||||
{# Expected new case values #}
|
||||
{% set total_expected_new_cases = scenario.expected_new_cases + expected_new_cases %}
|
||||
{% set long_range_expected_cases = scenario.expected_new_cases %}
|
||||
|
||||
{% if form.exposure_option == 'p_probabilistic_exposure' %}
|
||||
{% set long_range_prob_probabilistic_exposure = scenario.prob_probabilistic_exposure %}
|
||||
{% endif %}
|
||||
|
|
@ -134,12 +133,12 @@
|
|||
{% block report_summary %}
|
||||
<div class="flex-row align-self-center">
|
||||
<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 (i.e. without short-range interactions), 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 {{ total_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 (i.e. without short-range interactions), 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_cases | float_format }}</b>*.
|
||||
</div>
|
||||
{% if form.short_range_option == "short_range_yes" %}
|
||||
<br>
|
||||
<div class="align-self-center alert alert-dark mb-0" role="alert">
|
||||
In this scenario, assuming <b>short-range interactions</b> occur, the <b>probability of one exposed occupant getting infected can go as high as {{ prob_inf | non_zero_percentage }}</b>.
|
||||
In this scenario, assuming <b>short-range interactions</b> occur, the <b>probability of one exposed occupant getting infected can go as high as {{ prob_inf | non_zero_percentage }}</b> and the <b>expected number of new cases is {{ expected_new_cases | float_format }}</b>.
|
||||
</div>
|
||||
{% endif %}
|
||||
{% block probabilistic_exposure_probability %}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
<div class="alert alert-success mb-0" role="alert">
|
||||
<strong>Acceptable:</strong>
|
||||
{% endif %}
|
||||
Taking into account the uncertainties tied to the model variables, in this scenario and assuming all occupants are exposed equally (i.e. without short-range interactions), 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>*.
|
||||
Taking into account the uncertainties tied to the model variables, in this scenario and assuming all occupants are exposed equally (i.e. without short-range interactions), 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_cases | float_format }}</b>*.
|
||||
</div>
|
||||
{% if form.short_range_option == "short_range_yes" %}
|
||||
<br>
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
<div class="alert alert-success mb-0" role="alert">
|
||||
<strong>Acceptable:</strong>
|
||||
{% endif %}
|
||||
In this scenario, assuming <b>short-range interactions</b> occur, the <b>probability of one exposed occupant getting infected can go as high as {{prob_inf | non_zero_percentage}}</b>.
|
||||
In this scenario, assuming <b>short-range interactions</b> occur, the <b>probability of one exposed occupant getting infected can go as high as {{prob_inf | non_zero_percentage}}</b> and the <b>expected number of new cases is {{ expected_new_cases | float_format }}</b>.
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
|
|
|||
|
|
@ -1817,13 +1817,17 @@ class ExposureModel:
|
|||
"with dynamic occupancy")
|
||||
|
||||
"""
|
||||
The expect_new_cases should always take the long-range infection_probability and multiply by the occupants exposed to long-range.
|
||||
The expected_new_cases has two different use case scenarios:
|
||||
1) Long-range only: take the infection_probability and multiply by the occupants exposed to long-range.
|
||||
2) Short- and long-range: take the infection_probability of long-range multiplied by the occupants exposed to long-range only, added
|
||||
to the infection_probability of short- and long-range multiplied by the occupants exposed to short-range only.
|
||||
"""
|
||||
# If short-range interaction are defined, the total exposed people
|
||||
# is only those of the short-range interactions.
|
||||
exposed = self.exposed_to_short_range if self.short_range != () else self.exposed.number
|
||||
|
||||
return self.infection_probability() * exposed / 100
|
||||
if self.short_range != ():
|
||||
new_cases_long_range = nested_replace(self, {'short_range': (),}).infection_probability() * (self.exposed.number - self.exposed_to_short_range)
|
||||
return (new_cases_long_range + (self.infection_probability() * self.exposed_to_short_range)) / 100
|
||||
|
||||
return self.infection_probability() * self.exposed.number / 100
|
||||
|
||||
def reproduction_number(self) -> _VectorisedFloat:
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue