From 56128922ad6852f24fd0b1f513ca2f59ab2828b2 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Thu, 2 Dec 2021 14:33:09 +0100 Subject: [PATCH 1/9] Edited training option to accomplish trainings fixes #224 --- .../calculator/templates/base/calculator.report.html.j2 | 2 +- cara/apps/calculator/templates/calculator.form.html.j2 | 8 ++++---- cara/apps/calculator/templates/userguide.html.j2 | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cara/apps/calculator/templates/base/calculator.report.html.j2 b/cara/apps/calculator/templates/base/calculator.report.html.j2 index fdccca1f..84fac045 100644 --- a/cara/apps/calculator/templates/base/calculator.report.html.j2 +++ b/cara/apps/calculator/templates/base/calculator.report.html.j2 @@ -298,7 +298,7 @@ {% elif form.activity_type == "workshop" %} Workshop = assembly workshop environment, all persons doing moderate physical activity, talking 50% of the time. {% elif form.activity_type == "training" %} - Training – one person (the trainer) standing, talking, all others seated, talking quietly (whispering). It is assumed the trainer is the infected person, for the worst case scenario. + Conference/Training – one person (the speaker/trainer) standing, talking, all others seated, talking quietly (whispering). It is assumed the speaker/trainer is the infected person, for the worst case scenario. {% elif form.activity_type == "lab" %} Laboratory = Lab or technical environment, all persons doing light physical activity, talking 50% of the time. {% elif form.activity_type == "gym" %} diff --git a/cara/apps/calculator/templates/calculator.form.html.j2 b/cara/apps/calculator/templates/calculator.form.html.j2 index 57adeeff..e18114f8 100644 --- a/cara/apps/calculator/templates/calculator.form.html.j2 +++ b/cara/apps/calculator/templates/calculator.form.html.j2 @@ -293,7 +293,7 @@
- +
@@ -308,7 +308,7 @@ - +
@@ -531,8 +531,8 @@
  • Library = all seated, no talking, just breathing,
  • Laboratory = light physical activity, talking 50% of the time,
  • Workshop = moderate physical activity, talking 50% of the time,
  • -
  • Training = trainer standing and talking, rest seated and talking quietly. - Trainer assumed infected (worst case scenario),
  • +
  • Conference/Training = speaker/trainer standing and talking, rest seated and talking quietly. + Speaker/Trainer assumed infected (worst case scenario),
  • Gym = heavy exercise, no talking, just breathing.
  • Activity breaks:
    diff --git a/cara/apps/calculator/templates/userguide.html.j2 b/cara/apps/calculator/templates/userguide.html.j2 index a7f99c9e..5a4cb102 100644 --- a/cara/apps/calculator/templates/userguide.html.j2 +++ b/cara/apps/calculator/templates/userguide.html.j2 @@ -157,9 +157,9 @@ Within the number of people occupying the space, you should specify how many are
  • Control Room (night shift) = All persons seated, all talking 10% of the time. Everyone (exposed and infected occupants) is treated the same in this model.
  • Lab = Based on a typical lab or technical working area, all persons are doing light activity and talking 50% of the time. Everyone (exposed and infected occupants) is treated the same in this model.
  • Workshop = Based on a mechanical assembly workshop or equipment installation scenario, all persons are doing moderate activity and talking 50% of the time. This activity is equally applicable to bicycling, or walking on a gradient, in the LHC tunnels. Everyone (exposed and infected occupants) is treated the same in this model.
  • -
  • Training = Based on a typical training course scenario. -One individual (the trainer) is standing and talking, with all other individuals seated and talking quietly (whispering). -In this case it is assumed that the infected person is the trainer, because this is the worst case in terms of viral shedding.
  • +
  • Conference/Training = Based on a typical conference/training course scenario. +One individual (the speaker/trainer) is standing and talking, with all other individuals seated and talking quietly (whispering). +In this case it is assumed that the infected person is the speaker/trainer, because this is the worst case in terms of viral shedding.
  • Gym = All persons are doing heavy exercise and breathing (not talking). Everyone (exposed and infected occupants) is treated the same in this model.

  • Timings

    @@ -210,7 +210,7 @@ If not, then you can input separate breaks. This is particularly different when

    The model allows for a simulation with either a continuous wearing of face masks throughout the duration of the event, or have the removed at all times - i.e. all occupants (infected and exposed alike) wear or not masks for the duration of the simulation. Please bear in mind the user inputs shall be aligned with the current applicable public health & safety instructions. Please check what are the applicable rules, before deciding which assumptions are used for the simulation.

    -

    If you have selected the Training activity type, this equates to the trainer and all participants either wearing masks throughout the training (Yes), or removing them when seated/standing at their socially distanced positions within the training room (No). +

    If you have selected the Conference/Training activity type, this equates to the speakr/trainer and all participants either wearing masks throughout the conference/training (Yes), or removing them when seated/standing at their socially distanced positions within the conference/training room (No). Please confirm what are the applicable rules, before deciding which assumptions are used for the simulation

    For the time being only the Type 1 surgical and FFP2 masks can be selected.


    From a5b28998ec4d78661b1f5e3df832f4fc7512d80d Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Fri, 3 Dec 2021 11:30:46 +0100 Subject: [PATCH 2/9] Added mask icons fixes #223 --- .../calculator/templates/calculator.form.html.j2 | 6 ++++-- cara/apps/static/css/style.css | 4 ++++ cara/apps/static/images/masks/ffp2.png | Bin 0 -> 3714 bytes cara/apps/static/images/masks/t1.png | Bin 0 -> 3395 bytes 4 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 cara/apps/static/images/masks/ffp2.png create mode 100644 cara/apps/static/images/masks/t1.png diff --git a/cara/apps/calculator/templates/calculator.form.html.j2 b/cara/apps/calculator/templates/calculator.form.html.j2 index 57adeeff..d6d7fbd9 100644 --- a/cara/apps/calculator/templates/calculator.form.html.j2 +++ b/cara/apps/calculator/templates/calculator.form.html.j2 @@ -266,11 +266,13 @@

    diff --git a/cara/apps/static/css/style.css b/cara/apps/static/css/style.css index 008f833a..7e701ebc 100644 --- a/cara/apps/static/css/style.css +++ b/cara/apps/static/css/style.css @@ -170,6 +170,10 @@ body { display: block; } +.mask_icons { + height: 4em; +} + /*===== FIXED BACKGROUND IMG =====*/ .fixed-background { diff --git a/cara/apps/static/images/masks/ffp2.png b/cara/apps/static/images/masks/ffp2.png new file mode 100644 index 0000000000000000000000000000000000000000..57de5fc1422dc87f5e23cdc1bca74310525d8573 GIT binary patch literal 3714 zcmZ`+owUqiYD_Xht_8jY>#6X(R^H-CY8Lz~~YL zQD1(4zgtB)#2& zY`Vlrf_OOoKMX^#o?BADExP?c^Z?8`IT5S69>EM3D0vC*-#tT2bS5YHKks3WE2lM0# z%BjViwlh%emEFD>PHb`Ow)1WjzS&!SreJ&z)-i@hFOJR`FGEFEGMh<=d#%)r-cc|Y zzNaZkVbrM;h=+E-je>^ZgRXi;2|;&H#7h&rPc{q`JN5YMSlz~wlrWzKO2*K#Ix&T^ zcp?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>2v2C!NKnRF?3)uz+``Fp732tKentmy-pSPf^>*{+{)`ZYerrt3R&qqW>RuZX9Qe|Bzmd Xe;aXW46?p^e28>44K-@j9HRaQ6eW4< literal 0 HcmV?d00001 From b7575d0f9f8c3f5d728cb0b0890e43f0967d14e5 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Fri, 3 Dec 2021 12:00:25 +0100 Subject: [PATCH 3/9] Changed 1 to I and turned mask icon clickable --- .../calculator/templates/calculator.form.html.j2 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cara/apps/calculator/templates/calculator.form.html.j2 b/cara/apps/calculator/templates/calculator.form.html.j2 index d6d7fbd9..ab163e1c 100644 --- a/cara/apps/calculator/templates/calculator.form.html.j2 +++ b/cara/apps/calculator/templates/calculator.form.html.j2 @@ -268,11 +268,15 @@
    From 8e9123462874af93b558f07fbdf5a46f690d5db1 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Mon, 6 Dec 2021 14:23:35 +0100 Subject: [PATCH 4/9] COVID level scale update #225 --- cara/apps/calculator/report_generator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cara/apps/calculator/report_generator.py b/cara/apps/calculator/report_generator.py index a4d88bd9..59ab1302 100644 --- a/cara/apps/calculator/report_generator.py +++ b/cara/apps/calculator/report_generator.py @@ -308,9 +308,9 @@ class ReportGenerator: context['permalink'] = generate_permalink(base_url, self.calculator_prefix, form) context['calculator_prefix'] = self.calculator_prefix context['scale_warning'] = { - 'level': 'yellow-2', - 'incidence_rate': 'lower than 25 new cases per 100 000 inhabitants', - 'onsite_access': 'of about 8000', + 'level': 'orange-3', + 'incidence_rate': 'somewhere in between 25 and 100 new cases per 100 000 inhabitants', + 'onsite_access': 'of about 5000', 'threshold': '' } return context From 08432e2a0ea0bb4c0d5b68529faf5a9eaeb9383d Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Tue, 7 Dec 2021 17:08:58 +0100 Subject: [PATCH 5/9] Changed FFP2 label --- .../templates/calculator.form.html.j2 | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/cara/apps/calculator/templates/calculator.form.html.j2 b/cara/apps/calculator/templates/calculator.form.html.j2 index ab163e1c..bf936c63 100644 --- a/cara/apps/calculator/templates/calculator.form.html.j2 +++ b/cara/apps/calculator/templates/calculator.form.html.j2 @@ -267,16 +267,22 @@
    From 79f51c641160c43c34d2b75b7f5f97a1790833ae Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Thu, 9 Dec 2021 14:26:29 +0100 Subject: [PATCH 6/9] Consideration on the time the first person (either infected or exposed) arrives at the enclosed space --- cara/apps/calculator/model_generator.py | 2 +- cara/models.py | 5 ++++- cara/tests/apps/calculator/test_model_generator.py | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cara/apps/calculator/model_generator.py b/cara/apps/calculator/model_generator.py index 06c29229..aa161dbc 100644 --- a/cara/apps/calculator/model_generator.py +++ b/cara/apps/calculator/model_generator.py @@ -303,7 +303,7 @@ class FormData: # Initializes a ventilation instance as a window if 'natural_ventilation' is selected, or as a HEPA-filter otherwise if self.ventilation_type == 'natural_ventilation': if self.window_opening_regime == 'windows_open_periodically': - window_interval = models.PeriodicInterval(self.windows_frequency, self.windows_duration) + window_interval = models.PeriodicInterval(self.windows_frequency, self.windows_duration, min(self.infected_start, self.exposed_start)) else: window_interval = always_on diff --git a/cara/models.py b/cara/models.py index 272b6b47..012e453e 100644 --- a/cara/models.py +++ b/cara/models.py @@ -123,11 +123,14 @@ class PeriodicInterval(Interval): #: occurring, a value of 0 signifies that the event never happens. duration: float + #: Time at which the first person (infected or exposed) arrives at the enclosed space. + start: float = 0.0 + def boundaries(self) -> BoundarySequence_t: if self.period == 0 or self.duration == 0: return tuple() result = [] - for i in np.arange(0, 24, self.period / 60): + for i in np.arange(self.start, 24, self.period / 60): # NOTE: It is important that the time type is float, not np.float, in # order to allow hashability (for caching). result.append((float(i), float(i+self.duration/60))) diff --git a/cara/tests/apps/calculator/test_model_generator.py b/cara/tests/apps/calculator/test_model_generator.py index 6ee821c0..dd635946 100644 --- a/cara/tests/apps/calculator/test_model_generator.py +++ b/cara/tests/apps/calculator/test_model_generator.py @@ -48,7 +48,7 @@ def test_ventilation_slidingwindow(baseline_form: model_generator.FormData): assert isinstance(baseline_window, models.SlidingWindow) window = models.SlidingWindow( - active=models.PeriodicInterval(period=120, duration=10), + active=models.PeriodicInterval(period=120, duration=10, start=minutes_since_midnight(9 * 60)), inside_temp=models.PiecewiseConstant((0, 24), (293,)), outside_temp=baseline_window.outside_temp, window_height=1.6, opening_length=0.6, @@ -80,7 +80,7 @@ def test_ventilation_hingedwindow(baseline_form: model_generator.FormData): assert isinstance(baseline_window, models.HingedWindow) window = models.HingedWindow( - active=models.PeriodicInterval(period=120, duration=10), + active=models.PeriodicInterval(period=120, duration=10, start=minutes_since_midnight(9 * 60)), inside_temp=models.PiecewiseConstant((0, 24), (293,)), outside_temp=baseline_window.outside_temp, window_height=1.6, window_width=1., opening_length=0.6, @@ -141,7 +141,7 @@ def test_ventilation_window_hepa(baseline_form: model_generator.FormData): # Now build the equivalent ventilation instance directly, and compare. window = models.SlidingWindow( - active=models.PeriodicInterval(period=120, duration=10), + active=models.PeriodicInterval(period=120, duration=10, start=minutes_since_midnight(9 * 60)), inside_temp=models.PiecewiseConstant((0, 24), (293,)), outside_temp=baseline_window.outside_temp, window_height=1.6, opening_length=0.6, From f44817307867b282ec9e95ed90081de006fe565e Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Mon, 6 Dec 2021 11:55:58 +0100 Subject: [PATCH 7/9] Added locust test file and README --- simulation-tests/README.md | 18 ++++++++++++++++++ simulation-tests/locust.py | 10 ++++++++++ 2 files changed, 28 insertions(+) create mode 100644 simulation-tests/README.md create mode 100644 simulation-tests/locust.py diff --git a/simulation-tests/README.md b/simulation-tests/README.md new file mode 100644 index 00000000..59052dd2 --- /dev/null +++ b/simulation-tests/README.md @@ -0,0 +1,18 @@ +# locust + +A simple open source load testing tool that allows to define user behavior. + +In order to set it up for the first time, we followed the documentation at https://locust.io/. In particular, we: + +* Defined a class for the users that will be simulating. +* Defined a ``wait_time`` variable that will make the simulated users wait between the specified seconds after each task executed. +* Decorated our method with ``@Task`` that creates a micro-thread that calls this method. +* Defined the ``self.client`` attribute that makes it possible to make HTTP calls that will be logged by Locust. + +To use, open the terminal on this folder and run the following command: + +``locust -f locust.py --host https://cara.web.cern.ch`` + +Then, open up a browser and point it to http://localhost:8089. +By default we pointed out the test to our own web server. +``Start swarming`` will trigger the simulation. \ No newline at end of file diff --git a/simulation-tests/locust.py b/simulation-tests/locust.py new file mode 100644 index 00000000..c697a39b --- /dev/null +++ b/simulation-tests/locust.py @@ -0,0 +1,10 @@ +import time +from locust import HttpUser, task, between + +class WebsiteUser(HttpUser): + '''Time (in seconds) between the execution of each task.''' + wait_time = between(10, 20) + + @task + def baseline_model(self): + self.client.get(url="/calculator-open/baseline-model/result") \ No newline at end of file From 4a45e9c2631dfa3fe6fa4063ffe970d26b814f7e Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Mon, 13 Dec 2021 10:39:27 +0000 Subject: [PATCH 8/9] Renamed files and added docstrings on each method. --- .../README.md | 2 +- server-performance-tests/locust.py | 42 +++++++++++++++++++ simulation-tests/locust.py | 10 ----- 3 files changed, 43 insertions(+), 11 deletions(-) rename {simulation-tests => server-performance-tests}/README.md (86%) create mode 100644 server-performance-tests/locust.py delete mode 100644 simulation-tests/locust.py diff --git a/simulation-tests/README.md b/server-performance-tests/README.md similarity index 86% rename from simulation-tests/README.md rename to server-performance-tests/README.md index 59052dd2..7bf5e43b 100644 --- a/simulation-tests/README.md +++ b/server-performance-tests/README.md @@ -9,7 +9,7 @@ In order to set it up for the first time, we followed the documentation at https * Decorated our method with ``@Task`` that creates a micro-thread that calls this method. * Defined the ``self.client`` attribute that makes it possible to make HTTP calls that will be logged by Locust. -To use, open the terminal on this folder and run the following command: +To use, uncomment the desired method on ``lucust.py``` file, open the terminal on this folder and run the following command: ``locust -f locust.py --host https://cara.web.cern.ch`` diff --git a/server-performance-tests/locust.py b/server-performance-tests/locust.py new file mode 100644 index 00000000..1cee4ae0 --- /dev/null +++ b/server-performance-tests/locust.py @@ -0,0 +1,42 @@ +from locust import HttpUser, task, between +from gevent.pool import Group +import time + +''' +Method no. 1 - Simulation with each single user +running x requests in parallel. +Specify the desired number of parallel requests in +"num_of_parallel_requests" variable (35 by default). + +This method was used in simulations with one single +user perfoming 35 requests in parallel. +''' +# num_of_parallel_requests = 35 +# class User(HttpUser): +# wait_time = between(0.05, 0.1) + +# @task(1) +# def test_api(self): +# group = Group() +# for i in range(0, num_of_parallel_requests): +# group.spawn(lambda:self.client.get("/calculator-open/baseline-model/result")) +# group.join() +# while(1): +# time.sleep(1) + +''' +Method no. 2 - Simulation with different users +running x requests concurrently. +With this method, each user is intended to +perform one single request. + +This method was used in simulations with different +number of users requesting once at the same time. +''' +# class User(HttpUser): + +# @task(1) +# def test_api(self): +# self.client.get("/calculator-open/baseline-model/result") +# while(1): +# time.sleep(1) \ No newline at end of file diff --git a/simulation-tests/locust.py b/simulation-tests/locust.py deleted file mode 100644 index c697a39b..00000000 --- a/simulation-tests/locust.py +++ /dev/null @@ -1,10 +0,0 @@ -import time -from locust import HttpUser, task, between - -class WebsiteUser(HttpUser): - '''Time (in seconds) between the execution of each task.''' - wait_time = between(10, 20) - - @task - def baseline_model(self): - self.client.get(url="/calculator-open/baseline-model/result") \ No newline at end of file From 091bd1bdc224f5bf12f2592237f817905e0e58d0 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Thu, 16 Dec 2021 11:37:11 +0100 Subject: [PATCH 9/9] Remove ExpertApp from mobile and tablet screen sizes --- cara/apps/static/css/style.css | 30 +++++++++++++++--------------- cara/apps/templates/index.html.j2 | 7 +++---- cara/apps/templates/layout.html.j2 | 26 ++++++++++++++++---------- 3 files changed, 34 insertions(+), 29 deletions(-) diff --git a/cara/apps/static/css/style.css b/cara/apps/static/css/style.css index 7e701ebc..022b4ca6 100644 --- a/cara/apps/static/css/style.css +++ b/cara/apps/static/css/style.css @@ -234,6 +234,10 @@ footer img { width: 25%; } + #mobile_calculator_option { + display: none; + } + #nat_vent_image { height: 15em; } @@ -246,7 +250,7 @@ footer img { height: 6em; margin: 1%; } - #mobile-app-buttons { + #calculator_app_button { display: none!important; } .feedback { @@ -286,6 +290,9 @@ footer img { .nav-link { padding: .5rem .5rem!important; } + #apps_dropdown { + display: none; + } #report_version { font-size: .5rem; } @@ -302,13 +309,6 @@ footer img { #mobile_link { display: inline!important; } - #desktop_logo { - display: none!important; - } - - #mobile_logo { - display: block!important; - } .feedback { float:right; font-size:.75rem; @@ -328,16 +328,16 @@ footer img { } */ -/* Large (lg) devices (desktops, 992px and up) */ -@media (max-width: 992px) { - #download-pdf { +/* Large (lg) devices (tablets) */ +@media (max-width: 64em) { + .expert_app_button { display: none; } - #link_reproduce_results { - display: none; + #desktop_logo { + display: none!important; } - #mobile_link { - display: inline!important; + #mobile_logo { + display: block!important; } } diff --git a/cara/apps/templates/index.html.j2 b/cara/apps/templates/index.html.j2 index 30ed7f07..f589e476 100644 --- a/cara/apps/templates/index.html.j2 +++ b/cara/apps/templates/index.html.j2 @@ -11,12 +11,11 @@
    -
    +
    -
    +

    Introduction


    @@ -43,7 +42,7 @@


    - +

    diff --git a/cara/apps/templates/layout.html.j2 b/cara/apps/templates/layout.html.j2 index 15020daa..d9559be3 100644 --- a/cara/apps/templates/layout.html.j2 +++ b/cara/apps/templates/layout.html.j2 @@ -35,16 +35,22 @@