Skip to content

Commit

Permalink
caimira: inject package version
Browse files Browse the repository at this point in the history
  • Loading branch information
ntarocco committed Sep 13, 2024
1 parent 73bed86 commit c7a5948
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion caimira/src/caimira/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self):
settings = dict(
debug=True,
)
super(Application, self).__init__(handlers, **settings)
super().__init__(handlers, **settings)


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import numpy as np

from caimira import __version__ as calculator_version
from ..form_validator import FormData, cast_class_fields, time_string_to_minutes
from ..defaults import (DEFAULTS, CONFIDENCE_LEVEL_OPTIONS,
MECHANICAL_VENTILATION_TYPES, MASK_WEARING_OPTIONS, MONTH_NAMES, VACCINE_BOOSTER_TYPE, VACCINE_TYPE,
Expand Down Expand Up @@ -199,7 +200,7 @@ def validate(self):
if total_percentage != 100:
raise ValueError(
f'The sum of all respiratory activities should be 100. Got {total_percentage}.')

# Validate number of people with short-range interactions
max_occupants_for_sr = self.total_people - self.infected_people
if self.short_range_occupants > max_occupants_for_sr:
Expand Down Expand Up @@ -559,7 +560,7 @@ def baseline_raw_form_data() -> typing.Dict[str, typing.Union[str, float]]:
'mask_type': 'Type I',
'mask_wearing_option': 'mask_off',
'mechanical_ventilation_type': '',
'calculator_version': '4.17.0', #TODO different version for API and calculator form?
'calculator_version': calculator_version,
'opening_distance': '0.2',
'event_month': 'January',
'room_heating_option': '0',
Expand Down
8 changes: 4 additions & 4 deletions cern_caimira/src/cern_caimira/apps/calculator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ async def post(self) -> None:
self.set_status(400)
self.finish(json.dumps(response_json))
return

base_url = self.request.protocol + "://" + self.request.host
report_generator: VirusReportGenerator = self.settings['report_generator']
executor = loky.get_reusable_executor(
Expand Down Expand Up @@ -265,7 +265,7 @@ async def get(self) -> None:
data_service.update_registry(data_registry)

form = virus_report_controller.generate_form_obj(virus_validator.baseline_raw_form_data(), data_registry)

base_url = self.request.protocol + "://" + self.request.host
report_generator: VirusReportGenerator = self.settings['report_generator']
executor = loky.get_reusable_executor(max_workers=self.settings['handler_worker_pool_size'])
Expand Down Expand Up @@ -429,7 +429,7 @@ async def post(self, endpoint: str) -> None:
report_task = executor.submit(
CO2_report_generator.build_fitting_results, form,
)

report = await asyncio.wrap_future(report_task)
self.finish(report)

Expand Down Expand Up @@ -529,7 +529,7 @@ def make_app(
data_service_enabled = int(os.environ.get('DATA_SERVICE_ENABLED', 0))
except ValueError:
data_service_enabled = None

if data_service_enabled: data_service = DataService.create()

return Application(
Expand Down

0 comments on commit c7a5948

Please sign in to comment.