diff --git a/README.md b/README.md index ce8821cd..886a5cf1 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ python -m cara.apps.calculator To run with the CERN theme: ``` -python -m cara.apps.calculator --theme=cara/apps/calculator/themes/cern +python -m cara.apps.calculator --theme=cara/apps/templates/cern ``` To run the calculator on a different URL path: diff --git a/app-config/openshift/deploymentconfig.yaml b/app-config/openshift/deploymentconfig.yaml index af085e6f..e4260f94 100644 --- a/app-config/openshift/deploymentconfig.yaml +++ b/app-config/openshift/deploymentconfig.yaml @@ -208,7 +208,7 @@ - name: CARA_CALCULATOR_PREFIX value: /calculator-cern - name: CARA_THEME - value: cara/apps/calculator/themes/cern + value: cara/apps/templates/cern image: '${PROJECT_NAME}/cara-webservice' ports: - containerPort: 8080 diff --git a/cara/apps/calculator/__init__.py b/cara/apps/calculator/__init__.py index 407382e3..c5b50385 100644 --- a/cara/apps/calculator/__init__.py +++ b/cara/apps/calculator/__init__.py @@ -229,7 +229,7 @@ def make_app( calculator_templates = Path(__file__).parent / "templates" templates_directories = [cara_templates, calculator_templates] if theme_dir: - templates_directories.insert(0, theme_dir / 'templates') + templates_directories.insert(0, theme_dir) loader = jinja2.FileSystemLoader([str(path) for path in templates_directories]) template_environment = jinja2.Environment( loader=loader, diff --git a/cara/apps/calculator/__main__.py b/cara/apps/calculator/__main__.py index 7ec61206..7ec8b69a 100644 --- a/cara/apps/calculator/__main__.py +++ b/cara/apps/calculator/__main__.py @@ -36,7 +36,6 @@ def main(): if theme_dir is not None: theme_dir = Path(theme_dir).absolute() assert theme_dir.exists() - assert (theme_dir / 'templates').exists() app = make_app(debug=args.no_debug, calculator_prefix=args.prefix, theme_dir=theme_dir) app.listen(args.port) IOLoop.instance().start() diff --git a/cara/apps/calculator/templates/calculator.form.html.j2 b/cara/apps/templates/base/calculator.form.html.j2 similarity index 99% rename from cara/apps/calculator/templates/calculator.form.html.j2 rename to cara/apps/templates/base/calculator.form.html.j2 index de724ccd..e9b6cb18 100644 --- a/cara/apps/calculator/templates/calculator.form.html.j2 +++ b/cara/apps/templates/base/calculator.form.html.j2 @@ -77,9 +77,11 @@
Room data: -
+ {% block room_data %} +
?
+ {% endblock room_data %}
diff --git a/cara/apps/calculator/templates/base/calculator.report.html.j2 b/cara/apps/templates/base/calculator.report.html.j2 similarity index 100% rename from cara/apps/calculator/templates/base/calculator.report.html.j2 rename to cara/apps/templates/base/calculator.report.html.j2 diff --git a/cara/apps/templates/base/index.html.j2 b/cara/apps/templates/base/index.html.j2 new file mode 100644 index 00000000..4e1ba69a --- /dev/null +++ b/cara/apps/templates/base/index.html.j2 @@ -0,0 +1,64 @@ +{% extends "layout.html.j2" %} +{% set active_page="home/" %} + +{% block main %} + {#
#} +
+
+ + +
+
+ +
+ +
+
+

Introduction


+
+

+ CARA is a risk assessment tool developed to model the concentration of viruses in enclosed spaces, in order to inform space-management decisions. + It does this by simulating the long-range airborne spread SARS-CoV-2 virus in a finite volume, assuming homogenous mixing, and it estimates the risk of COVID-19 airborne transmission therein. + Please see the About page for more details on the methodology, assumptions and limitations of CARA. +

+

+ The full CARA source code can be accessed freely under an Apache 2.0 open source license from our code repository. + It includes detailed instructions on how to run your own version of this tool. +

+
+
+
+
+ +
+
+
+ +
+
+

Apps:

+
+ +
+ +
+
+
+ + {% block cara_at_cern %} + {% endblock cara_at_cern %} + +
+

Acknowledgements


+

+ We wish to thank CERN’s HSE Unit, Beams Department, Experimental Physics Department, Information Technology Department, Industry, Procurement and Knowledge Transfer Department and International Relations Sector for their support to the study. + Thanks to Doris Forkel-Wirth, Benoit Delille, Walid Fadel, Olga Beltramello, Letizia Di Giulio, Evelyne Dho, Wayne Salter, Benoit Salvant and colleagues from the COVID working group for providing expert advice and extensively testing the model. + Finally, we wish to thank Fabienne Landua and the design service for preparing the illustrations and Alessandro Raimondo, Ana Padua and Manuela Cirilli from the Knowledge Transfer Group for their continuous support. + Our compliments towards the work and research performed by world leading scientists in this domain: Dr. Julian Tang, Prof. Manuel Gameiro, Dr. Linsey Marr, Prof. Jose Jimenez, Prof. Lidia Morawska, Prof. Yuguo Li et al. - their scientific contribution was indispensable for this project. + +

+
+
+{% endblock main %} diff --git a/cara/apps/templates/base/layout.html.j2 b/cara/apps/templates/base/layout.html.j2 new file mode 100644 index 00000000..cfa9bb09 --- /dev/null +++ b/cara/apps/templates/base/layout.html.j2 @@ -0,0 +1,120 @@ + + + + + + + + + + {% block title %} + CARA | COVID Airborne Risk Assessment + {% endblock title %} + + + + + + + + {% block extra_headers %} + {% endblock extra_headers %} + + + + + + +
+ {% block main %} + {% endblock main %} +
+ + + + + + + + + + + + + + + + {% block body_scripts %} + {% endblock body_scripts %} + + + diff --git a/cara/apps/calculator/templates/userguide.html.j2 b/cara/apps/templates/base/userguide.html.j2 similarity index 99% rename from cara/apps/calculator/templates/userguide.html.j2 rename to cara/apps/templates/base/userguide.html.j2 index 5a4cb102..74e6452d 100644 --- a/cara/apps/calculator/templates/userguide.html.j2 +++ b/cara/apps/templates/base/userguide.html.j2 @@ -86,7 +86,9 @@ However, this value may be revised in the future as more studies of the Gamma VO

Room Data


Please enter either the room volume (in m³) or both the floor area (m²) and the room height (m). -This information is available via GIS Portal (https://gis.cern.ch/gisportal/).

+{% block room_volume_guide %} +

+{% endblock room_volume_guide %}

Room heating system


diff --git a/cara/apps/templates/calculator.form.html.j2 b/cara/apps/templates/calculator.form.html.j2 new file mode 100644 index 00000000..368da022 --- /dev/null +++ b/cara/apps/templates/calculator.form.html.j2 @@ -0,0 +1,2 @@ +{# The main calculator form, this template is intended to be implemented by themes #} +{% extends "base/calculator.form.html.j2" %} diff --git a/cara/apps/calculator/templates/calculator.report.html.j2 b/cara/apps/templates/calculator.report.html.j2 similarity index 100% rename from cara/apps/calculator/templates/calculator.report.html.j2 rename to cara/apps/templates/calculator.report.html.j2 diff --git a/cara/apps/templates/cern/calculator.form.html.j2 b/cara/apps/templates/cern/calculator.form.html.j2 new file mode 100644 index 00000000..79a879d9 --- /dev/null +++ b/cara/apps/templates/cern/calculator.form.html.j2 @@ -0,0 +1,7 @@ +{% extends "base/calculator.form.html.j2" %} + +{% block room_data %} +
+ ? +
+{% endblock room_data %} \ No newline at end of file diff --git a/cara/apps/calculator/themes/cern/templates/calculator.report.html.j2 b/cara/apps/templates/cern/calculator.report.html.j2 similarity index 100% rename from cara/apps/calculator/themes/cern/templates/calculator.report.html.j2 rename to cara/apps/templates/cern/calculator.report.html.j2 diff --git a/cara/apps/templates/cern/index.html.j2 b/cara/apps/templates/cern/index.html.j2 new file mode 100644 index 00000000..4ad3ef16 --- /dev/null +++ b/cara/apps/templates/cern/index.html.j2 @@ -0,0 +1,11 @@ +{% extends "base/index.html.j2" %} + +{% block cara_at_cern %} +

CARA @ CERN


+
+

+ CARA has been developed by CERN with the intention of allowing members of personnel with roles related to supervision, health & safety or space management to simulate the concerned workplaces on CERN sites. + A hosted CERN version of the CARA Covid Calculator is available on this site to members of the CERN personnel. +

+
+{% endblock cara_at_cern %} \ No newline at end of file diff --git a/cara/apps/templates/cern/layout.html.j2 b/cara/apps/templates/cern/layout.html.j2 new file mode 100644 index 00000000..3959e097 --- /dev/null +++ b/cara/apps/templates/cern/layout.html.j2 @@ -0,0 +1,5 @@ +{% extends "base/layout.html.j2" %} + +{% block covid_information %} + +{% endblock covid_information %} \ No newline at end of file diff --git a/cara/apps/templates/cern/userguide.html.j2 b/cara/apps/templates/cern/userguide.html.j2 new file mode 100644 index 00000000..28ab09db --- /dev/null +++ b/cara/apps/templates/cern/userguide.html.j2 @@ -0,0 +1,5 @@ +{% extends "base/userguide.html.j2" %} + +{% block room_volume_guide %} +This information is available via GIS Portal (https://gis.cern.ch/gisportal/).

+{% endblock room_volume_guide %} \ No newline at end of file diff --git a/cara/apps/templates/index.html.j2 b/cara/apps/templates/index.html.j2 index f589e476..87cbd196 100644 --- a/cara/apps/templates/index.html.j2 +++ b/cara/apps/templates/index.html.j2 @@ -1,68 +1,2 @@ -{% extends "layout.html.j2" %} -{% set active_page="home/" %} - -{% block main %} - {#
#} -
-
- - -
-
- -
-
-
Calculator
-
-
-
-

Introduction


-
-

- CARA is a risk assessment tool developed to model the concentration of viruses in enclosed spaces, in order to inform space-management decisions. - It does this by simulating the long-range airborne spread SARS-CoV-2 virus in a finite volume, assuming homogenous mixing, and it estimates the risk of COVID-19 airborne transmission therein. - Please see the About page for more details on the methodology, assumptions and limitations of CARA. -

-

- The full CARA source code can be accessed freely under an Apache 2.0 open source license from our code repository. - It includes detailed instructions on how to run your own version of this tool. -

-
-
-
-
- -
-
-
- -
-
-

Apps:

-
- -
- -
-
-
- -

CARA @ CERN


-
-

- CARA has been developed by CERN with the intention of allowing members of personnel with roles related to supervision, health & safety or space management to simulate the concerned workplaces on CERN sites. - A hosted CERN version of the CARA Covid Calculator is available on this site to members of the CERN personnel. -

-
-
-

Acknowledgements


-

- We wish to thank CERN’s HSE Unit, Beams Department, Experimental Physics Department, Information Technology Department, Industry, Procurement and Knowledge Transfer Department and International Relations Sector for their support to the study. - Thanks to Doris Forkel-Wirth, Benoit Delille, Walid Fadel, Olga Beltramello, Letizia Di Giulio, Evelyne Dho, Wayne Salter, Benoit Salvant and colleagues from the COVID working group for providing expert advice and extensively testing the model. - Finally, we wish to thank Fabienne Landua and the design service for preparing the illustrations and Alessandro Raimondo, Ana Padua and Manuela Cirilli from the Knowledge Transfer Group for their continuous support. - Our compliments towards the work and research performed by world leading scientists in this domain: Dr. Julian Tang, Prof. Manuel Gameiro, Dr. Linsey Marr, Prof. Jose Jimenez, Prof. Lidia Morawska, Prof. Yuguo Li et al. - their scientific contribution was indispensable for this project. - -

-
- -{% endblock main %} +{# The main index, this template is intended to be implemented by themes #} +{% extends "base/index.html.j2" %} \ No newline at end of file diff --git a/cara/apps/templates/layout.html.j2 b/cara/apps/templates/layout.html.j2 index d9559be3..1298f8eb 100644 --- a/cara/apps/templates/layout.html.j2 +++ b/cara/apps/templates/layout.html.j2 @@ -1,119 +1,2 @@ - - - - - - - - - - {% block title %} - CARA | COVID Airborne Risk Assessment - {% endblock title %} - - - - - - - - {% block extra_headers %} - {% endblock extra_headers %} - - - - - - -
- {% block main %} - {% endblock main %} -
- - - - - - - - - - - - - - - - {% block body_scripts %} - {% endblock body_scripts %} - - - +{# The main layout, this template is intended to be implemented by themes #} +{% extends "base/layout.html.j2" %} diff --git a/cara/apps/templates/userguide.html.j2 b/cara/apps/templates/userguide.html.j2 new file mode 100644 index 00000000..6b34bc4d --- /dev/null +++ b/cara/apps/templates/userguide.html.j2 @@ -0,0 +1,2 @@ +{# The main calculator report, this template is intended to be implemented by themes #} +{% extends "base/userguide.html.j2" %} \ No newline at end of file diff --git a/cara/tests/apps/calculator/test_webapp.py b/cara/tests/apps/calculator/test_webapp.py index 09bc104c..65f3b216 100644 --- a/cara/tests/apps/calculator/test_webapp.py +++ b/cara/tests/apps/calculator/test_webapp.py @@ -72,14 +72,13 @@ class TestBasicApp(tornado.testing.AsyncHTTPTestCase): class TestCernApp(tornado.testing.AsyncHTTPTestCase): def get_app(self): - cern_theme = Path(cara.apps.calculator.__file__).parent / 'themes' / 'cern' + cern_theme = Path(cara.apps.calculator.__file__).parent.parent / 'themes' / 'cern' return cara.apps.calculator.make_app(theme_dir=cern_theme) @tornado.testing.gen_test(timeout=_TIMEOUT) def test_report(self): response = yield self.http_client.fetch(self.get_url('/calculator/baseline-model/result')) self.assertEqual(response.code, 200) - assert 'CERN HSE' in response.body.decode() assert 'expected number of new cases is' in response.body.decode()