Skip to content

Commit 8e71828

Browse files
committed
handled probabilistic exposure from review
1 parent 0d16888 commit 8e71828

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

caimira/apps/calculator/report_generator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def calculate_report_data(form: VirusFormData, model: models.ExposureModel, exec
171171
# Probabilistic exposure
172172
if form.exposure_option == "p_probabilistic_exposure" and form.occupancy_format == "static":
173173
prob_probabilistic_exposure = np.array(model.total_probability_rule()).mean()
174-
else: prob_probabilistic_exposure = -1
174+
else: prob_probabilistic_exposure = None
175175

176176
exposed_presence_intervals = [list(interval) for interval in model.exposed.presence_interval().boundaries()]
177177

caimira/apps/templates/base/calculator.report.html.j2

+16-12
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,23 @@
145145
{% if form.exposure_option == "p_probabilistic_exposure" %}
146146
<br>
147147
<div class="align-self-center alert alert-dark mb-0" role="alert">
148-
The above {{ "result assumes" if form.short_range_option == "short_range_no" else "results assume" }} that <b>{{ form.infected_people }}
149-
{{ "occupant is infected" if form.infected_people == 1 else "occupants are infected" }}
150-
</b> in the room.
151-
By taking into account the estimate of cases currently circulating in <b>{{ form.location_name }}</b>,
152-
the probability of on-site transmission, having at least 1 new infection in an <b>event
153-
with {{ form.total_people }} occupants</b>, is
154-
{% if form.short_range_option == 'short_range_yes' %}:
155-
<ul>
156-
<li><b>{{ long_range_prob_probabilistic_exposure | non_zero_percentage }}</b>, assuming all occupants are exposed equally (i.e. without short-range interactions).</li>
157-
<li><b>{{ prob_probabilistic_exposure | non_zero_percentage }}</b>, assuming short-range interactions occur with the infector(s).</li>
158-
</ul>
148+
{% if form.occupancy_format == "static" %}
149+
The above {{ "result assumes" if form.short_range_option == "short_range_no" else "results assume" }} that <b>{{ form.infected_people }}
150+
{{ "occupant is infected" if form.infected_people == 1 else "occupants are infected" }}
151+
</b> in the room.
152+
By taking into account the estimate of cases currently circulating in <b>{{ form.location_name }}</b>,
153+
the probability of on-site transmission, having at least 1 new infection in an <b>event
154+
with {{ form.total_people }} occupants</b>, is
155+
{% if form.short_range_option == 'short_range_yes' %}:
156+
<ul>
157+
<li><b>{{ long_range_prob_probabilistic_exposure | non_zero_percentage }}</b>, assuming all occupants are exposed equally (i.e. without short-range interactions).</li>
158+
<li><b>{{ prob_probabilistic_exposure | non_zero_percentage }}</b>, assuming short-range interactions occur with the infector(s).</li>
159+
</ul>
160+
{% else %}
161+
<b>{{ prob_probabilistic_exposure | non_zero_percentage }}</b>.
162+
{% endif %}
159163
{% else %}
160-
<b>{{ prob_probabilistic_exposure | non_zero_percentage }}</b>.
164+
<p><strong>Warning: </strong>Since dynamic occupancy was defined, the results for probabilistic exposure with incidence rates have not been computed.</p>
161165
{% endif %}
162166
</div>
163167
{% endif %}

caimira/tests/apps/calculator/test_report_generator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,5 +173,5 @@ def test_static_vs_dynamic_occupancy_from_form(baseline_form_data, data_registry
173173

174174
np.testing.assert_almost_equal(static_occupancy_report_data['prob_inf'], dynamic_occupancy_report_data['prob_inf'], 1)
175175
np.testing.assert_almost_equal(static_occupancy_report_data['expected_new_cases'], dynamic_occupancy_report_data['expected_new_cases'], 1)
176-
assert dynamic_occupancy_report_data['prob_probabilistic_exposure'] == -1
176+
assert dynamic_occupancy_report_data['prob_probabilistic_exposure'] == None
177177

0 commit comments

Comments
 (0)