From ef6357ab6d58b61ed42ea7668d093fc70f556af7 Mon Sep 17 00:00:00 2001 From: Andre Henriques Date: Mon, 14 Jun 2021 12:44:21 +0000 Subject: [PATCH] add frequency parameter --- cara/apps/calculator/report_generator.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/cara/apps/calculator/report_generator.py b/cara/apps/calculator/report_generator.py index 4029e54f..e46c59cf 100644 --- a/cara/apps/calculator/report_generator.py +++ b/cara/apps/calculator/report_generator.py @@ -276,6 +276,25 @@ def comparison_report(scenarios: typing.Dict[str, models.ExposureModel]): 'plot': img2base64(_figure2bytes(comparison_plot(scenarios))), 'stats': statistics, } + +def frequency(rate: int) -> str: + #The frequency at which one person can get infected which is based on the incidence rate. + #Incidence rate is number of positive cases per 100 000 population + inc_rate = rate/100000 + freq = exposed_occupants * inc_rate + + if freq >= 1 + return 1 + else + return "frequency": freq + +def transmission_probabiltiy(self) -> str: + #The probability that transmission takes place which includes the prob of occurance that someone gets + #infected out of the total amount of occupants. + + #Probability of transmission (in %) + Prob_transmission = (self.frequency * (prob_inf/100)) * 100 + return "prob_trans": Prob_transmission @dataclasses.dataclass