Implementation of the probability of one individual is infected in a given population (@mandrein) - Probability_to_be_infected.pptx.

On the **Event data** there is a new section for `Deterministic exposure`

or `Probabilistic exposure`

(radio buttons). If the later is checked, three new UI input fields are displayed - `Population`

, `New confirmed cases (weekly)`

and `Confidence level`

needed for the calculation of the new probability. If the

`Confidence level`

(in the infected population monitoring, or "Ascertainment Bias"):

- High (mandatory population-wide surveillance) -
`AB=2`

- Medium (recommended population-wide surveillance) -
`AB=5`

- Low (surveillance only for symptomatic patients) -
`AB=10`

This probability uses the previous CARA probability multiplied by a Binomial distribution that follows the probability of having `x`

infected persons in an event with `n`

people. `n`

is the `Total number of occupants`

, while `x`

is a value that goes from `1`

until the number of infected people, if lower than `10`

:

- Calculate the P(I) when the number of infection persons is
`1`

and multiply by the distribution output when`x`

is`1`

. - Calculate the P(I) when the number of infection persons is
`2`

and multiply by the distribution output when`x`

is`2`

. - ...

The final probability is a sum of all these calculations.

Performance tests:

```
Before:
[I 220602 09:24:52 web:2239] 200 POST /calculator/report (::1) 6511.08ms
[I 220602 09:24:59 web:2239] 200 POST /calculator/report (::1) 4665.08ms
```

```
After:
[I 220602 09:21:35 web:2239] 200 POST /calculator/report (::1) 10708.70ms
[I 220602 09:21:45 web:2239] 200 POST /calculator/report (::1) 9095.44ms
```

Assuming this scenario, with a total population of `270000`

inhabitants, `100`

cumulative cases in the past 7 days, and **medium** confidence level, the probability of on-site transmission, having at least 1 new infection in an event with `5`

occupants, is `0.04%`

.

If there is any short-range interaction, the card displays (in an unordered list) two P(I), one that considers the short-range interactions P(I), and other that doesn't:

@mandrein In this implementation we ask for the 7-day average of new reported cases instead of the 10-days.

New section in calculator:

**Note:** New activity type was added to this MR through this (merged) MR.

The tests that were added are based on calculations performed with an excel file : test_pi_one_infected.xlsx

- The P(I) values were extracted from CAiMIRA from three different scenarios -
`lambda t: 36.`

;`lambda t: 72.`

;`lambda t: 1.2`

. - For each of the previous scenarios, we calculated the respective results for a population of
`11`

,`21`

and`31`

people, where initially there was only`1`

infected person.