UI changes for probabilistic approach

This commit is contained in:
Luis Aleixo 2022-10-03 14:42:37 +01:00
parent 1b3ef45b00
commit 10d743c149
5 changed files with 25 additions and 24 deletions

View file

@ -60,7 +60,7 @@ class FormData:
geographic_population: int
geographic_cases: int
ascertainment_bias: str
p_recurrent_option: str
exposure_option: str
mask_type: str
mask_wearing_option: str
mechanical_ventilation_type: str
@ -123,7 +123,7 @@ class FormData:
'geographic_population': 0,
'geographic_cases': 0,
'ascertainment_bias': 'confidence_low',
'p_recurrent_option': 'p_recurrent_event',
'exposure_option': 'p_deterministic_exposure',
'mask_type': 'Type I',
'mask_wearing_option': 'mask_off',
'mechanical_ventilation_type': 'not-applicable',

View file

@ -311,7 +311,7 @@ def comparison_report(
else:
statistics = {}
if (form.short_range_option == "short_range_yes" and form.p_recurrent_option == "p_specific_event"):
if (form.short_range_option == "short_range_yes" and form.exposure_option == "p_probabilistic_exposure"):
specific_event = True
else:
specific_event = False

View file

@ -61,10 +61,10 @@ function require_fields(obj) {
case "hepa_no":
require_hepa(false);
break;
case "p_specific_event":
case "p_probabilistic_exposure":
require_population(true);
break;
case "p_recurrent_event":
case "p_deterministic_exposure":
require_population(false);
break;
case "mask_on":
@ -282,7 +282,7 @@ function on_hepa_option_change() {
}
function on_p_recurrent_change() {
p_recurrent = $('input[type=radio][name=p_recurrent_option]')
p_recurrent = $('input[type=radio][name=exposure_option]')
p_recurrent.each(function (index) {
if (this.checked) {
getChildElement($(this)).show();
@ -568,7 +568,7 @@ function validate_form(form) {
}
// Validate cases < population
if ($("#p_specific_event").prop('checked')) {
if ($("#p_probabilistic_exposure").prop('checked')) {
var geographicPopulationObj = document.getElementById("geographic_population");
var geographicCasesObj = document.getElementById("geographic_cases");
removeErrorFor(geographicCasesObj);
@ -911,9 +911,9 @@ $(document).ready(function () {
// Call the function now to handle forward/back button presses in the browser.
on_hepa_option_change();
// When the p_recurrent_option changes we want to make its respective
// When the exposure_option changes we want to make its respective
// children show/hide.
$("input[type=radio][name=p_recurrent_option]").change(on_p_recurrent_change);
$("input[type=radio][name=exposure_option]").change(on_p_recurrent_change);
// Call the function now to handle forward/back button presses in the browser.
on_p_recurrent_change();

View file

@ -303,7 +303,8 @@
<!-- Event Options -->
<b>Event data:</b>
<div data-tooltip="The total no. of occupants in the room and how many of them you assume are infected.">
<div data-tooltip="The total no. of occupants in the room. Probabilistic exposure occurring at a given time and location (e.g. meeting or conference), considering the incidence rate in the area.
Indicate the population in a given location and the rolling 7-day average of new reported cases. Specify the confidence level of the data.">
<span class="tooltip_text">?</span>
</div><br>
@ -312,20 +313,20 @@
<div class="col-sm-6 align-self-center"><input type="number" id="total_people" class="form-control" name="total_people" placeholder="Number" min=1 required></div>
</div>
<div class="form-group row">
<div class="col-sm-4" style="top: -2px"><label>Number of infected people: </label></div>
<div class="col-sm-6"><input type="number" id="infected_people" class="form-control" name="infected_people" min=1 value=1 required></div>
<div class="form-group mb-1">
<input type="radio" id="p_deterministic_exposure" name="exposure_option" value="p_deterministic_exposure" checked="checked">
<label for="p_deterministic_exposure">Deterministic exposure</label>
</div>
<input type="radio" id="p_recurrent_event" name="p_recurrent_option" value="p_recurrent_event" checked="checked">
<label for="p_recurrent_event">Recurrent exposure</label>
<input class="ml-2" type="radio" id="p_specific_event" name="p_recurrent_option" value="p_specific_event" data-enables="#DIVp_specific_event">
<label for="p_specific_event">Specific event</label>
<div data-tooltip="Specific event occurring at a given time (e.g. meeting or conference). Indicate the population in a given location and the cumulative 7-day average of new reported cases. Specify the confidence level for these figures.">
<span class="tooltip_text">?</span>
<div class="form-group">
<input type="radio" id="p_probabilistic_exposure" name="exposure_option" value="p_probabilistic_exposure" data-enables="#DIVp_probabilistic_exposure">
<label for="p_probabilistic_exposure">Probabilistic exposure (incidence rate)</label>
</div>
<div id="DIVp_specific_event" class="tabbed" style="display: none">
<div id="DIVp_probabilistic_exposure" class="tabbed" style="display: none">
<div class="form-group row">
<div class="col-sm-4"><label class="col-form-label">Number of infected people: </label></div>
<div class="col-sm-6 pl-0 align-self-center"><input type="number" id="infected_people" class="form-control" name="infected_people" min=1 value=1 required></div>
</div>
<div class="form-group row">
<div class="col-sm-4"><label class="col-form-label">Population:</label></div>
<div class="col-sm-6 pl-0 align-self-center"><input type="number" step="any" id="geographic_population" class="non_zero form-control" name="geographic_population" placeholder="Inhabitants (#)" min="0"></div>

View file

@ -57,7 +57,7 @@
{% if form.short_range_option == "short_range_yes" %}
{% set scenario = alternative_scenarios.stats.values() | first %}
{% set long_range_prob_inf = scenario.probability_of_infection %}
{% set long_range_prob_specific_event = scenario.prob_specific_event if form.p_recurrent_option == 'p_specific_event' %}
{% set long_range_prob_specific_event = scenario.prob_specific_event if form.exposure_option == 'p_probabilistic_exposure' %}
{% else %}
{% set long_range_prob_inf = prob_inf %}
{% endif %}
@ -132,7 +132,7 @@
</div>
{% endif %}
{% block specific_event_probability %}
{% if form.p_recurrent_option == "p_specific_event" %}
{% if form.exposure_option == "p_probabilistic_exposure" %}
<br>
<div class="align-self-center alert alert-dark mb-0" role="alert">
The above {{ "result assumes" if form.short_range_option == "short_range_no" else "results assume" }} that <b>{{ form.infected_people }}
@ -442,7 +442,7 @@
<li><p class="data_text">Number of attendees and infected people: {{ form.total_people }} in attendance, of whom {{ form.infected_people }}
{{ "is" if form.infected_people == 1 else "are" }}
infected.</p></li>
{% if form.p_recurrent_option == "p_specific_event" %}
{% if form.exposure_option == "p_probabilistic_exposure" %}
{% if form.ascertainment_bias == "confidence_high" %}
{% set conf_level = "High - Mandatory population surveillance." %}
{% elif form.ascertainment_bias == "confidence_medium" %}