renamed new input "short_range_total_people" to "short_range_occupants"
This commit is contained in:
parent
e61700aaad
commit
a0d8f45424
8 changed files with 11 additions and 11 deletions
|
|
@ -73,7 +73,7 @@ DEFAULTS = {
|
|||
'sensor_in_use': '',
|
||||
'short_range_option': 'short_range_no',
|
||||
'short_range_interactions': '[]',
|
||||
'short_range_total_people': 1,
|
||||
'short_range_occupants': 1,
|
||||
}
|
||||
|
||||
# ------------------ Activities ----------------------
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class VirusFormData(FormData):
|
|||
sensor_in_use: str
|
||||
short_range_option: str
|
||||
short_range_interactions: list
|
||||
short_range_total_people: int
|
||||
short_range_occupants: int
|
||||
|
||||
_DEFAULTS: typing.ClassVar[typing.Dict[str, typing.Any]] = DEFAULTS
|
||||
|
||||
|
|
@ -186,9 +186,9 @@ class VirusFormData(FormData):
|
|||
|
||||
# Validate number of people with short-range interactions
|
||||
max_people_for_sr = self.total_people - self.infected_people
|
||||
if self.short_range_total_people > max_people_for_sr:
|
||||
if self.short_range_occupants > max_people_for_sr:
|
||||
raise ValueError(
|
||||
f'The total number of people having short-range interactions ({self.short_range_total_people}) should be lower than the exposed population ({max_people_for_sr}).'
|
||||
f'The total number of people having short-range interactions ({self.short_range_occupants}) should be lower than the exposed population ({max_people_for_sr}).'
|
||||
)
|
||||
|
||||
def initialize_room(self) -> models.Room:
|
||||
|
|
@ -241,7 +241,7 @@ class VirusFormData(FormData):
|
|||
geographic_cases=self.geographic_cases,
|
||||
ascertainment_bias=CONFIDENCE_LEVEL_OPTIONS[self.ascertainment_bias],
|
||||
),
|
||||
exposed_to_short_range=self.short_range_total_people,
|
||||
exposed_to_short_range=self.short_range_occupants,
|
||||
)
|
||||
|
||||
def build_model(self, sample_size=None) -> models.ExposureModel:
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@ def manufacture_alternative_scenarios(form: VirusFormData) -> typing.Dict[str, m
|
|||
scenarios['Neither ventilation nor masks'] = without_mask_or_vent.build_mc_model()
|
||||
|
||||
else:
|
||||
no_short_range_alternative = dataclass_utils.replace(form, short_range_interactions=[], total_people=form.total_people - form.short_range_total_people)
|
||||
no_short_range_alternative = dataclass_utils.replace(form, short_range_interactions=[], total_people=form.total_people - form.short_range_occupants)
|
||||
scenarios['Base scenario without short-range interactions'] = no_short_range_alternative.build_mc_model()
|
||||
|
||||
return scenarios
|
||||
|
|
|
|||
|
|
@ -1268,7 +1268,7 @@ $(document).ready(function () {
|
|||
let activity = validate_sr_parameter('#sr_expiration_no_' + String(index)[0], "Required input.");
|
||||
let start = validate_sr_parameter('#sr_start_no_' + String(index)[0], "Required input.");
|
||||
let duration = validate_sr_parameter('#sr_duration_no_' + String(index)[0], "Required input.");
|
||||
let total_people = validate_sr_people('#short_range_total_people');
|
||||
let total_people = validate_sr_people('#short_range_occupants');
|
||||
if (activity && start && duration && total_people) {
|
||||
if (validate_sr_time('#sr_start_no_' + String(index)) && validate_sr_time('#sr_duration_no_' + String(index))) {
|
||||
document.getElementById('sr_expiration_no_' + String(index)).disabled = true;
|
||||
|
|
|
|||
|
|
@ -590,7 +590,7 @@
|
|||
<label class="col-form-label col-form-label-sm">Total people with short-range interactions:</label>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<input type="number" id="short_range_total_people" name="short_range_total_people" class="form-control form-control-sm" min="0" value="1" tabindex="-1" onchange="validate_sr_people(this)" required>
|
||||
<input type="number" id="short_range_occupants" name="short_range_occupants" class="form-control form-control-sm" min="0" value="1" tabindex="-1" onchange="validate_sr_people(this)" required>
|
||||
</div>
|
||||
<div class="col-sm-6"></div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -614,7 +614,7 @@
|
|||
Short-range interactions: {{ form.short_range_interactions|length }}
|
||||
</p></li>
|
||||
<li><p class="data_text">
|
||||
Total number of people having short-range interactions: {{ form.short_range_total_people }}
|
||||
Total number of people having short-range interactions: {{ form.short_range_occupants }}
|
||||
</p></li>
|
||||
<ul>
|
||||
{% for interaction in form.short_range_interactions %}
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@ def baseline_form_with_sr(baseline_form_data, data_registry):
|
|||
form_data_sr = baseline_form_data
|
||||
form_data_sr['short_range_option'] = 'short_range_yes'
|
||||
form_data_sr['short_range_interactions'] = '[{"expiration": "Shouting", "start_time": "10:30", "duration": "30"}]'
|
||||
form_data_sr['short_range_total_people'] = 5
|
||||
form_data_sr['short_range_occupants'] = 5
|
||||
return model_generator.VirusFormData.from_dict(form_data_sr, data_registry)
|
||||
|
|
@ -114,4 +114,4 @@ def test_expected_new_cases(baseline_form_with_sr: VirusFormData):
|
|||
)
|
||||
|
||||
lr_expected_new_cases = alternative_statistics['stats']['Base scenario without short-range interactions']['expected_new_cases']
|
||||
np.testing.assert_almost_equal(sr_lr_expected_new_cases, lr_expected_new_cases + sr_lr_prob_inf * baseline_form_with_sr.short_range_total_people, 2)
|
||||
np.testing.assert_almost_equal(sr_lr_expected_new_cases, lr_expected_new_cases + sr_lr_prob_inf * baseline_form_with_sr.short_range_occupants, 2)
|
||||
|
|
|
|||
Loading…
Reference in a new issue