handled probabilistic exposure from review

This commit is contained in:
lrdossan 2024-09-03 14:32:27 +02:00
parent 3c20ed0306
commit e545d99190
3 changed files with 18 additions and 14 deletions

View file

@ -176,7 +176,7 @@ def calculate_report_data(form: VirusFormData, executor_factory: typing.Callable
# Probabilistic exposure
if form.exposure_option == "p_probabilistic_exposure" and form.occupancy_format == "static":
prob_probabilistic_exposure = np.array(model.total_probability_rule()).mean()
else: prob_probabilistic_exposure = -1
else: prob_probabilistic_exposure = None
exposed_presence_intervals = [list(interval) for interval in model.exposed.presence_interval().boundaries()]

View file

@ -145,6 +145,7 @@
{% if form.exposure_option == "p_probabilistic_exposure" %}
<br>
<div class="align-self-center alert alert-dark mb-0" role="alert">
{% if form.occupancy_format == "static" %}
The above {{ "result assumes" if form.short_range_option == "short_range_no" else "results assume" }} that <b>{{ form.infected_people }}
{{ "occupant is infected" if form.infected_people == 1 else "occupants are infected" }}
</b> in the room.
@ -159,6 +160,9 @@
{% else %}
<b>{{ prob_probabilistic_exposure | non_zero_percentage }}</b>.
{% endif %}
{% else %}
<p><strong>Warning: </strong>Since dynamic occupancy was defined, the results for probabilistic exposure with incidence rates have not been computed.</p>
{% endif %}
</div>
{% endif %}
{% endblock probabilistic_exposure_probability %}

View file

@ -181,5 +181,5 @@ def test_static_vs_dynamic_occupancy_from_form(baseline_form_data, data_registry
np.testing.assert_almost_equal(static_occupancy_report_data['prob_inf'], dynamic_occupancy_report_data['prob_inf'], 1)
np.testing.assert_almost_equal(static_occupancy_report_data['expected_new_cases'], dynamic_occupancy_report_data['expected_new_cases'], 1)
assert dynamic_occupancy_report_data['prob_probabilistic_exposure'] == -1
assert dynamic_occupancy_report_data['prob_probabilistic_exposure'] == None