From 5e26e0196e4e1b60705e00de474e5017df0cec1b Mon Sep 17 00:00:00 2001 From: gaazzopa Date: Tue, 10 Nov 2020 16:32:34 +0100 Subject: [PATCH 1/8] Added mask option and fixed display in report --- cara/apps/calculator/model_generator.py | 9 +++++++-- cara/apps/calculator/static/js/form.js | 17 ++++++++++++----- .../templates/calculator.form.html.j2 | 18 ++++++++++++------ cara/apps/calculator/templates/report.html.j2 | 9 ++++++--- cara/models.py | 5 +++++ 5 files changed, 42 insertions(+), 16 deletions(-) diff --git a/cara/apps/calculator/model_generator.py b/cara/apps/calculator/model_generator.py index 2d65089b..a0acb095 100644 --- a/cara/apps/calculator/model_generator.py +++ b/cara/apps/calculator/model_generator.py @@ -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'} diff --git a/cara/apps/calculator/static/js/form.js b/cara/apps/calculator/static/js/form.js index 33106522..39625947 100644 --- a/cara/apps/calculator/static/js/form.js +++ b/cara/apps/calculator/static/js/form.js @@ -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------- */ diff --git a/cara/apps/calculator/templates/calculator.form.html.j2 b/cara/apps/calculator/templates/calculator.form.html.j2 index d255f814..0fee0598 100644 --- a/cara/apps/calculator/templates/calculator.form.html.j2 +++ b/cara/apps/calculator/templates/calculator.form.html.j2 @@ -69,6 +69,15 @@ Beta v1.0.0 Please send feedback to
+ + Face masks:
+ Are masks worn when occupants are at workstations? + Yes + No
+ Type of masks used: + Type 1 + FFP2
+
@@ -79,6 +88,7 @@ Beta v1.0.0 Please send feedback to Total number of occupants:
Number of infected people:

+ Activity type:    Finish:
-
+ When is the event?
   @@ -116,6 +126,7 @@ Beta v1.0.0 Please send feedback to

+ Lunch break: @@ -147,13 +158,8 @@ Beta v1.0.0 Please send feedback to
Coffee breaks are spread evenly throughout the day. -

- Face masks:
- Are masks worn when occupants are at workstations?
- Yes - No
diff --git a/cara/apps/calculator/templates/report.html.j2 b/cara/apps/calculator/templates/report.html.j2 index aab7f3dc..f5f714cc 100644 --- a/cara/apps/calculator/templates/report.html.j2 +++ b/cara/apps/calculator/templates/report.html.j2 @@ -113,9 +113,12 @@

Mask wearing:

  • Masks worn at workstations? - {{ "No" if form.mask_wearing == "removed" else "Yes" }} -

  • -
  • Mask type: Type 1

  • + {% if form.mask_wearing == "continuous" %} + Yes

    +
  • Mask type: {{ form.mask_type }}

  • + {% else %} + No

    + {% endif %}

Results:

diff --git a/cara/models.py b/cara/models.py index 61a2182d..10ff25c8 100644 --- a/cara/models.py +++ b/cara/models.py @@ -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) + ), } From 7af010d2f5f495665bc8f6ecafa10e0c2dd08463 Mon Sep 17 00:00:00 2001 From: gaazzopa Date: Tue, 10 Nov 2020 16:33:23 +0100 Subject: [PATCH 2/8] Added debug option in form --- cara/apps/calculator/templates/calculator.form.html.j2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cara/apps/calculator/templates/calculator.form.html.j2 b/cara/apps/calculator/templates/calculator.form.html.j2 index 0fee0598..b59b28c8 100644 --- a/cara/apps/calculator/templates/calculator.form.html.j2 +++ b/cara/apps/calculator/templates/calculator.form.html.j2 @@ -1,6 +1,7 @@ {% extends "layout.html.j2" %} {% set CALCULATOR_ACTIVE=1 %} +{% set DEBUG=False %} {% block extra_headers %} @@ -21,7 +22,11 @@ Beta v1.0.0 Please send feedback to CARA-dev@cern.ch

CARA Covid Airborne Risk Assessment tool

+{% if DEBUG %} +
+{% else %} +{% endif %}
From 154754000e28ce017222e27afdc9a72703767819 Mon Sep 17 00:00:00 2001 From: gaazzopa Date: Tue, 10 Nov 2020 16:44:03 +0100 Subject: [PATCH 3/8] Fixed mask type in baseline model --- cara/apps/calculator/model_generator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cara/apps/calculator/model_generator.py b/cara/apps/calculator/model_generator.py index a0acb095..3dc25625 100644 --- a/cara/apps/calculator/model_generator.py +++ b/cara/apps/calculator/model_generator.py @@ -289,7 +289,7 @@ def baseline_raw_form_data(): 'lunch_finish': '13:30', 'lunch_option': '1', 'lunch_start': '12:30', - 'mask_type': 'type1', + 'mask_type': 'Type I', 'mask_wearing': 'removed', 'mechanical_ventilation_type': '', 'opening_distance': '0.2', From 1cc73d4fbc9256ff5eabe1e53523eac7d64e3bc8 Mon Sep 17 00:00:00 2001 From: gaazzopa Date: Tue, 10 Nov 2020 16:59:05 +0100 Subject: [PATCH 4/8] Added HEPA amount option to form --- cara/apps/calculator/static/js/form.js | 10 ++++++++++ cara/apps/calculator/templates/calculator.form.html.j2 | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/cara/apps/calculator/static/js/form.js b/cara/apps/calculator/static/js/form.js index 39625947..a15f403f 100644 --- a/cara/apps/calculator/static/js/form.js +++ b/cara/apps/calculator/static/js/form.js @@ -68,6 +68,12 @@ function require_fields(obj) { case "mask_off": require_mask(false); break; + case "hepa_yes": + require_hepa(true); + break; + case "hepa_no": + require_hepa(false); + break; default: break; } @@ -135,6 +141,10 @@ function require_lunch(option) { $("#lunch_finish").prop('required', option); } +function require_hepa(option) { + $("#hepa_amount").prop('required', option); +} + function setMaxInfectedPeople() { $("#infected_people").attr("max", $("#total_people").val()); } diff --git a/cara/apps/calculator/templates/calculator.form.html.j2 b/cara/apps/calculator/templates/calculator.form.html.j2 index b59b28c8..32e666fc 100644 --- a/cara/apps/calculator/templates/calculator.form.html.j2 +++ b/cara/apps/calculator/templates/calculator.form.html.j2 @@ -68,11 +68,11 @@ Beta v1.0.0 Please send feedback to
HEPA filtration: - - - - + + + +
Face masks:
From 824ad5886bd37d20ea24298e5af9355b66bcf8fc Mon Sep 17 00:00:00 2001 From: gaazzopa Date: Tue, 10 Nov 2020 17:08:07 +0100 Subject: [PATCH 5/8] Added HEPA amount to model and report --- cara/apps/calculator/model_generator.py | 5 ++++- cara/apps/calculator/templates/report.html.j2 | 11 ++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cara/apps/calculator/model_generator.py b/cara/apps/calculator/model_generator.py index 3dc25625..032748ad 100644 --- a/cara/apps/calculator/model_generator.py +++ b/cara/apps/calculator/model_generator.py @@ -24,6 +24,7 @@ class FormData: coffee_duration: int event_type: str floor_area: float + hepa_amount: float hepa_option: bool infected_people: int lunch_option: bool @@ -91,6 +92,7 @@ class FormData: coffee_duration=int(form_data['coffee_duration']), event_type=form_data['event_type'], floor_area=float(form_data['floor_area']), + hepa_amount=float(form_data['hepa_amount']), hepa_option=(form_data['hepa_option'] == '1'), infected_people=int(form_data['infected_people']), lunch_finish=time_string_to_minutes(form_data['lunch_finish']), @@ -154,7 +156,7 @@ class FormData: active=always_on, q_air_mech=self.air_supply) if self.hepa_option: - hepa = models.HEPAFilter(active=always_on, q_air_mech=250.) + hepa = models.HEPAFilter(active=always_on, q_air_mech=self.hepa_amount) return models.MultipleVentilation((ventilation,hepa)) else: return ventilation @@ -282,6 +284,7 @@ def baseline_raw_form_data(): 'coffee_duration': '10', 'event_type': 'recurrent_event', 'floor_area': '', + 'hepa_amount': '250', 'hepa_option': '0', 'infected_finish': '18:00', 'infected_people': '1', diff --git a/cara/apps/calculator/templates/report.html.j2 b/cara/apps/calculator/templates/report.html.j2 index f5f714cc..88a91c52 100644 --- a/cara/apps/calculator/templates/report.html.j2 +++ b/cara/apps/calculator/templates/report.html.j2 @@ -55,7 +55,11 @@ No

{% endif %}
  • HEPA Filtration: {{ 'Yes' if form.hepa_option else 'No' }}

  • - + {% if form.hepa_option %} +
      +
    • HEPA amount: {{ form.hepa_amount }}

    • +
    + {% endif %}

    Event data:

    @@ -112,12 +116,9 @@

    Mask wearing:

      -
    • Masks worn at workstations? +

    • Masks worn at workstations? {{ 'Yes' if form.mask_wearing == "continuous" else 'No' }}

    • {% if form.mask_wearing == "continuous" %} - Yes

    • Mask type: {{ form.mask_type }}

    • - {% else %} - No

      {% endif %}
    From ec6ef6a156360e20dd5fcb4cd70370beba8eb90b Mon Sep 17 00:00:00 2001 From: gaazzopa Date: Tue, 10 Nov 2020 17:19:30 +0100 Subject: [PATCH 6/8] Bumped up version and centralised version setting --- cara/apps/calculator/model_generator.py | 3 +++ cara/apps/calculator/report_generator.py | 3 +-- cara/apps/calculator/templates/calculator.form.html.j2 | 5 ++++- cara/apps/calculator/templates/report.html.j2 | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cara/apps/calculator/model_generator.py b/cara/apps/calculator/model_generator.py index 032748ad..7e4a95c3 100644 --- a/cara/apps/calculator/model_generator.py +++ b/cara/apps/calculator/model_generator.py @@ -31,6 +31,7 @@ class FormData: mask_type: str mask_wearing: str mechanical_ventilation_type: str + model_version: str opening_distance: float recurrent_event_month: str room_number: str @@ -101,6 +102,7 @@ class FormData: mask_type=form_data['mask_type'], mask_wearing=form_data['mask_wearing'], mechanical_ventilation_type=form_data['mechanical_ventilation_type'], + model_version=form_data['model_version'], opening_distance=float(form_data['opening_distance']), recurrent_event_month=form_data['recurrent_event_month'], room_number=form_data['room_number'], @@ -295,6 +297,7 @@ def baseline_raw_form_data(): 'mask_type': 'Type I', 'mask_wearing': 'removed', 'mechanical_ventilation_type': '', + 'model_version': 'BetaV1.1.0', 'opening_distance': '0.2', 'recurrent_event_month': 'January', 'room_number': '123', diff --git a/cara/apps/calculator/report_generator.py b/cara/apps/calculator/report_generator.py index 93d07d01..ee9aa22e 100644 --- a/cara/apps/calculator/report_generator.py +++ b/cara/apps/calculator/report_generator.py @@ -87,8 +87,7 @@ def build_report(model: models.Model, form: FormData): 'model': model, 'request': request, 'form': form, - 'creation_date': time, - 'model_version': 'Beta v1.0.0', + 'creation_date': time, } context.update(calculate_report_data(model)) diff --git a/cara/apps/calculator/templates/calculator.form.html.j2 b/cara/apps/calculator/templates/calculator.form.html.j2 index 32e666fc..d41ae4d6 100644 --- a/cara/apps/calculator/templates/calculator.form.html.j2 +++ b/cara/apps/calculator/templates/calculator.form.html.j2 @@ -1,5 +1,6 @@ {% extends "layout.html.j2" %} +{% set MODEL_VERSION="BetaV1.1.0" %} {% set CALCULATOR_ACTIVE=1 %} {% set DEBUG=False %} @@ -19,7 +20,7 @@
    -Beta v1.0.0 Please send feedback to CARA-dev@cern.ch +{{ MODEL_VERSION }} Please send feedback to CARA-dev@cern.ch

    CARA Covid Airborne Risk Assessment tool

    {% if DEBUG %} @@ -28,6 +29,8 @@ Beta v1.0.0 Please send feedback to {% endif %} + +
    diff --git a/cara/apps/calculator/templates/report.html.j2 b/cara/apps/calculator/templates/report.html.j2 index 88a91c52..4a4ccfda 100644 --- a/cara/apps/calculator/templates/report.html.j2 +++ b/cara/apps/calculator/templates/report.html.j2 @@ -13,7 +13,7 @@

    Output from CARA - COVID Airborne Risk Assessment tool

    -

    Created {{ creation_date }} using model version {{ model_version }}


    +

    Created {{ creation_date }} using model version {{ form.model_version }}


    Simulation Name: {{ form.simulation_name }}

    Room Number: {{ form.room_number }}

    From ef65039cad26c3c8b9ca94a894f2037f4817f1a5 Mon Sep 17 00:00:00 2001 From: gaazzopa Date: Tue, 10 Nov 2020 17:48:43 +0100 Subject: [PATCH 7/8] Fixed label ID in form --- cara/apps/calculator/templates/calculator.form.html.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cara/apps/calculator/templates/calculator.form.html.j2 b/cara/apps/calculator/templates/calculator.form.html.j2 index d41ae4d6..0e865235 100644 --- a/cara/apps/calculator/templates/calculator.form.html.j2 +++ b/cara/apps/calculator/templates/calculator.form.html.j2 @@ -72,9 +72,9 @@ HEPA filtration: - + - +
    From 211ec92adadcb95f3a443a6627a3dca084ee9d57 Mon Sep 17 00:00:00 2001 From: gaazzopa Date: Tue, 10 Nov 2020 17:55:36 +0100 Subject: [PATCH 8/8] HEPA min value is 0 --- cara/apps/calculator/templates/calculator.form.html.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cara/apps/calculator/templates/calculator.form.html.j2 b/cara/apps/calculator/templates/calculator.form.html.j2 index 0e865235..24fcc42d 100644 --- a/cara/apps/calculator/templates/calculator.form.html.j2 +++ b/cara/apps/calculator/templates/calculator.form.html.j2 @@ -75,7 +75,7 @@ - +
    Face masks: