Added mask option and fixed display in report

This commit is contained in:
gaazzopa 2020-11-10 16:32:34 +01:00
parent 050c9fd9ba
commit 5e26e0196e
5 changed files with 42 additions and 16 deletions

View file

@ -27,6 +27,7 @@ class FormData:
hepa_option: bool
infected_people: int
lunch_option: bool
mask_type: str
mask_wearing: str
mechanical_ventilation_type: str
opening_distance: float
@ -58,6 +59,7 @@ class FormData:
validation_tuples = [('activity_type', ACTIVITY_TYPES),
('event_type', EVENT_TYPES),
('mechanical_ventilation_type', MECHANICAL_VENTILATION_TYPES),
('mask_type', MASK_TYPES),
('mask_wearing', MASK_WEARING),
('ventilation_type', VENTILATION_TYPES),
('volume_type', VOLUME_TYPES),
@ -94,6 +96,7 @@ class FormData:
lunch_finish=time_string_to_minutes(form_data['lunch_finish']),
lunch_option=(form_data['lunch_option'] == '1'),
lunch_start=time_string_to_minutes(form_data['lunch_start']),
mask_type=form_data['mask_type'],
mask_wearing=form_data['mask_wearing'],
mechanical_ventilation_type=form_data['mechanical_ventilation_type'],
opening_distance=float(form_data['opening_distance']),
@ -228,9 +231,9 @@ def model_from_form(form: FormData) -> models.Model:
# Initializes the virus as SARS_Cov_2
virus = models.Virus.types['SARS_CoV_2']
# Initializes a mask of type 1 if mask wearing is "continuous", otherwise instantiates the mask attribute as
# Initializes the mask type if mask wearing is "continuous", otherwise instantiates the mask attribute as
# the "No mask"-mask
mask = models.Mask.types['Type I' if form.mask_wearing == "continuous" else 'No mask']
mask = models.Mask.types[form.mask_type if form.mask_wearing == "continuous" else 'No mask']
# A dictionary containing the mapping of activities listed in the UI to the activity level and expiration level
# of the infected and exposed occupants respectively.
@ -286,6 +289,7 @@ def baseline_raw_form_data():
'lunch_finish': '13:30',
'lunch_option': '1',
'lunch_start': '12:30',
'mask_type': 'type1',
'mask_wearing': 'removed',
'mechanical_ventilation_type': '',
'opening_distance': '0.2',
@ -307,6 +311,7 @@ def baseline_raw_form_data():
ACTIVITY_TYPES = {'office', 'training', 'workshop'}
EVENT_TYPES = {'single_event', 'recurrent_event'}
MECHANICAL_VENTILATION_TYPES = {'air_changes', 'air_supply', 'not-applicable'}
MASK_TYPES = {'Type I', 'FFP2'}
MASK_WEARING = {'continuous', 'removed'}
VENTILATION_TYPES = {'natural', 'mechanical', 'no-ventilation'}
VOLUME_TYPES = {'room_volume', 'room_dimensions'}

View file

@ -15,7 +15,6 @@ function on_ventilation_type_change() {
});
}
function getChildElement(elem) {
// Get the element named in the given element's data-enables attribute.
return $("#" + elem.data("enables"));
@ -63,6 +62,12 @@ function require_fields(obj) {
case "lunch_option_yes":
require_lunch(true);
break;
case "mask_on":
require_mask(true);
break;
case "mask_off":
require_mask(false);
break;
default:
break;
}
@ -122,6 +127,11 @@ function require_recurrent_event(option) {
function require_lunch(option) {
$("#lunch_start").prop('required', option);
$("#mask_ffp2").prop('required', option);
}
function require_lunch(option) {
$("#mask_type1").prop('required', option);
$("#lunch_finish").prop('required', option);
}
@ -136,7 +146,6 @@ $(function () {
});
});
function show_disclaimer() {
var dots = document.getElementById("dots");
var moreText = document.getElementById("more");
@ -203,8 +212,7 @@ function parseValToNumber(obj) {
return parseInt(obj.val().replace(':',''), 10);
}
/* ------ On Load ---------- */
/* -------On Load------- */
$(document).ready(function () {
// When the document is ready, deal with the fact that we may be here
// as a result of a forward/back browser action. If that is the case, update
@ -230,7 +238,6 @@ $(document).ready(function () {
if (radioValue.val()) {
require_fields(radioValue.get(0));
}
});
/* -------Debugging------- */

View file

@ -69,6 +69,15 @@ Beta v1.0.0 <span style="float:right; font-weight:bold">Please send feedback to
<input type="radio" id="hepa_filter" name="hepa_option" value=0 checked="checked">
<label for="hepa_filter">No</label>
<hr width="80%">
<b>Face masks:</b><br>
Are masks worn when occupants are at workstations?
<input type="radio" id="mask_on" name="mask_wearing" value="continuous" required>Yes
<input type="radio" id="mask_off" name="mask_wearing" value="removed" required checked="checked">No<br>
Type of masks used:
<input type="radio" id="mask_type1" name="mask_type" value="Type I" checked="checked" onclick="require_fields(this)">Type 1
<input type="radio" id="mask_ffp2" name="mask_type" value="FFP2" onclick="require_fields(this)">FFP2<br>
<hr width="80%">
</div>
<div style="width: 33%; float:left;">
@ -79,6 +88,7 @@ Beta v1.0.0 <span style="float:right; font-weight:bold">Please send feedback to
Total number of occupants: <input type="number" id="total_people" name="total_people" min=1 required><br>
Number of infected people: <input type="number" id="infected_people" name="infected_people" min=1 required><br>
<hr width="80%">
Activity type: <select id="activity_type" name="activity_type">
<option value="office">Office/Meeting</option>
<option value="workshop">Workshop</option>
@ -91,8 +101,8 @@ Beta v1.0.0 <span style="float:right; font-weight:bold">Please send feedback to
Start: <input type="time" id="infected_start" name="infected_start" value="09:00" required> &nbsp;&nbsp;
Finish: <input type="time" id="infected_finish" class="finish_time" name="infected_finish" value="18:00" required>
<span id="infected_time_error" class="red_text" hidden>Finish time must be after start</span><br>
<hr width="80%">
When is the event?<br>
<input type="radio" id="event_type_single" name="event_type" value="single_event" onclick="require_fields(this)" required></input>
<label for="event_type_single">Single event</label> &nbsp;&nbsp;
@ -116,6 +126,7 @@ Beta v1.0.0 <span style="float:right; font-weight:bold">Please send feedback to
<option value="December">December</option>
</select><br>
<hr width="80%">
<!-- Lunch Options -->
Lunch break:
<input type="radio" id="lunch_option_no" name="lunch_option" value=0 checked="checked" onclick="require_fields(this)">
@ -147,13 +158,8 @@ Beta v1.0.0 <span style="float:right; font-weight:bold">Please send feedback to
<option value="30">30</option>
</select><br>
Coffee breaks are spread evenly throughout the day.
<br>
<hr width="80%">
Face masks: <br>
Are masks worn when occupants are at workstations? <br>
<input type="radio" id="continuous" name="mask_wearing" value="continuous" required>Yes
<input type="radio" id="removed" name="mask_wearing" value="removed" required checked="checked">No
</div>
<div style="width: 33%; float:left;">

View file

@ -113,9 +113,12 @@
<p class="data_title">Mask wearing:</p>
<ul>
<li><p class="data_text">Masks worn at workstations?
{{ "No" if form.mask_wearing == "removed" else "Yes" }}
</p></li>
<li><p class="data_text">Mask type: Type 1</p></li>
{% if form.mask_wearing == "continuous" %}
Yes </p></li>
<li><p class="data_text">Mask type: {{ form.mask_type }}</p></li>
{% else %}
No </p></li>
{% endif %}
</ul>
<p class="result_title">Results:</p>

View file

@ -338,6 +338,11 @@ Mask.types = {
η_leaks=0.15, # (Huang 2007)
η_inhale=0.3, # (Browen 2010)
),
'FFP2': Mask(
η_exhale=0.95, # (same outward effect as type 1 - Asadi 2020)
η_leaks=0.15, # (same outward effect as type 1 - Asadi 2020)
η_inhale=0.865, # (94% penetration efficiency + 8% max inward leakage -> EN 149)
),
}