Skip to content

Commit 2100265

Browse files
authored
Merge pull request #13888 from SORMAS-Foundation/13887-exposure-form-redesign
add enums, modify entities, dtos for exposure form redesign
2 parents a3b69fb + ccdf73c commit 2100265

14 files changed

Lines changed: 1132 additions & 0 deletions

File tree

sormas-api/src/main/java/de/symeda/sormas/api/epidata/EpiDataDto.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public class EpiDataDto extends PseudonymizableDto {
6868
public static final String INFECTION_SOURCE_TEXT = "infectionSourceText";
6969
public static final String IMPORTED_CASE = "importedCase";
7070
public static final String COUNTRY = "country";
71+
public static final String OTHER_DETAILS = "otherDetails";
7172

7273
private YesNoUnknown exposureDetailsKnown;
7374
private YesNoUnknown activityAsCaseDetailsKnown;
@@ -140,6 +141,8 @@ public class EpiDataDto extends PseudonymizableDto {
140141
@Valid
141142
private List<ActivityAsCaseDto> activitiesAsCase = new ArrayList<>();
142143

144+
private String otherDetails;
145+
143146
public YesNoUnknown getExposureDetailsKnown() {
144147
return exposureDetailsKnown;
145148
}
@@ -293,6 +296,14 @@ public void setCountry(CountryReferenceDto country) {
293296
this.country = country;
294297
}
295298

299+
public String getOtherDetails() {
300+
return otherDetails;
301+
}
302+
303+
public void setOtherDetails(String otherDetails) {
304+
this.otherDetails = otherDetails;
305+
}
306+
296307
@Override
297308
public EpiDataDto clone() throws CloneNotSupportedException {
298309
EpiDataDto clone = (EpiDataDto) super.clone();
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
3+
* Copyright © 2016-2024 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
* You should have received a copy of the GNU General Public License
13+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
14+
*/
15+
16+
package de.symeda.sormas.api.exposure;
17+
18+
import de.symeda.sormas.api.i18n.I18nProperties;
19+
20+
public enum AnimalCategory {
21+
22+
DOMESTIC,
23+
WILD;
24+
25+
@Override
26+
public String toString() {
27+
return I18nProperties.getEnumCaption(this);
28+
}
29+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
3+
* Copyright © 2016-2024 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
* You should have received a copy of the GNU General Public License
13+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
14+
*/
15+
16+
package de.symeda.sormas.api.exposure;
17+
18+
import de.symeda.sormas.api.i18n.I18nProperties;
19+
20+
public enum ExposureCategory {
21+
22+
AIR_BORNE,
23+
ANIMAL_CONTACT,
24+
DIRECT_CONTACT,
25+
FOMITE_TRANSMISSION,
26+
FOOD_BORNE,
27+
VECTOR_BORNE,
28+
VERTICAL_TRANSMISSION,
29+
WATER_BORNE;
30+
31+
@Override
32+
public String toString() {
33+
return I18nProperties.getEnumCaption(this);
34+
}
35+
}
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
/*
2+
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
3+
* Copyright © 2016-2024 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
* You should have received a copy of the GNU General Public License
13+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
14+
*/
15+
16+
package de.symeda.sormas.api.exposure;
17+
18+
import java.util.Arrays;
19+
import java.util.Collections;
20+
import java.util.List;
21+
import java.util.stream.Collectors;
22+
23+
import de.symeda.sormas.api.i18n.I18nProperties;
24+
25+
public enum ExposureContactFactor {
26+
27+
DURATION_OF_EXPOSURE(ExposureCategory.AIR_BORNE, ExposureSetting.INDOOR),
28+
PROXIMITY_TO_SOURCE(ExposureCategory.AIR_BORNE, ExposureSetting.INDOOR),
29+
TYPE_OF_ACTIVITY(ExposureCategory.AIR_BORNE, ExposureSetting.INDOOR),
30+
POOR_VENTILATION(ExposureCategory.AIR_BORNE, ExposureSetting.INDOOR),
31+
32+
PROXIMITY_AND_DURATION(ExposureCategory.AIR_BORNE, ExposureSetting.OUTDOOR),
33+
WIND_AND_AIRFLOW(ExposureCategory.AIR_BORNE, ExposureSetting.OUTDOOR),
34+
DENSITY_OF_PEOPLE(ExposureCategory.AIR_BORNE, ExposureSetting.OUTDOOR),
35+
36+
SKIN_CONTACT(ExposureCategory.DIRECT_CONTACT, ExposureSetting.PERSON_TO_PERSON),
37+
BODY_FLUIDS(ExposureCategory.DIRECT_CONTACT, ExposureSetting.PERSON_TO_PERSON),
38+
39+
BUTCHERING(ExposureCategory.ANIMAL_CONTACT, null),
40+
COOKING(ExposureCategory.ANIMAL_CONTACT, null),
41+
TOUCHING_CONTACT_WITH_FLUIDS(ExposureCategory.ANIMAL_CONTACT, null),
42+
SCRATCHES_BITES_LICKING(ExposureCategory.ANIMAL_CONTACT, null),
43+
44+
SHARED_SURFACES(ExposureCategory.FOMITE_TRANSMISSION, null),
45+
46+
OUTDOOR_ACTIVITIES(ExposureCategory.VECTOR_BORNE, ExposureSetting.OUTDOOR),
47+
STANDING_WATER_PROXIMITY(ExposureCategory.VECTOR_BORNE, ExposureSetting.OUTDOOR),
48+
HIGH_MOSQUITO_ACTIVITY_REGIONS(ExposureCategory.VECTOR_BORNE, ExposureSetting.OUTDOOR),
49+
50+
UNPROTECTED_HOUSEHOLD(ExposureCategory.VECTOR_BORNE, ExposureSetting.INDOOR),
51+
52+
MOSQUITO_ACTIVITY_TIME_OF_DAY(ExposureCategory.VECTOR_BORNE, ExposureSetting.MOSQUITO_BORNE),
53+
CLOTHING_COVERAGE(ExposureCategory.VECTOR_BORNE, ExposureSetting.MOSQUITO_BORNE),
54+
55+
DURATION_OUTDOORS(ExposureCategory.VECTOR_BORNE, ExposureSetting.TICK_BORNE),
56+
EXPOSED_SKIN(ExposureCategory.VECTOR_BORNE, ExposureSetting.TICK_BORNE),
57+
58+
DRINKING_CONTAMINATED_WATER(ExposureCategory.WATER_BORNE, ExposureSetting.DRINKING_WATER),
59+
ICE_AND_FOOD_PREPARATION(ExposureCategory.WATER_BORNE, ExposureSetting.DRINKING_WATER),
60+
61+
SWALLOWING_WATER(ExposureCategory.WATER_BORNE, ExposureSetting.RECREATIONAL_WATER),
62+
CONTACT_WITH_OPEN_WOUNDS(ExposureCategory.WATER_BORNE, ExposureSetting.RECREATIONAL_WATER),
63+
64+
EGG(ExposureCategory.FOOD_BORNE, null),
65+
MEAT(ExposureCategory.FOOD_BORNE, null),
66+
FISH_SEAFOOD(ExposureCategory.FOOD_BORNE, null),
67+
DAIRY(ExposureCategory.FOOD_BORNE, null),
68+
FRUIT(ExposureCategory.FOOD_BORNE, null),
69+
RAW_VEGETABLES(ExposureCategory.FOOD_BORNE, null),
70+
71+
UNKNOWN(null, null),
72+
OTHER(null, null);
73+
74+
private final ExposureCategory category;
75+
private final ExposureSetting setting;
76+
77+
ExposureContactFactor(ExposureCategory category, ExposureSetting setting) {
78+
this.category = category;
79+
this.setting = setting;
80+
}
81+
82+
public ExposureCategory getCategory() {
83+
return category;
84+
}
85+
86+
public ExposureSetting getSetting() {
87+
return setting;
88+
}
89+
90+
/**
91+
* Returns contact factors for a given category and setting combination.
92+
* <ul>
93+
* <li>Factors with matching category AND setting are included.</li>
94+
* <li>Factors with matching category and null setting (category-wide) are included.</li>
95+
* <li>UNKNOWN and OTHER (null category) are always included.</li>
96+
* </ul>
97+
*
98+
* Because INDOOR/OUTDOOR are shared settings, the category parameter
99+
* ensures (AIR_BORNE, INDOOR) and (VECTOR_BORNE, INDOOR) return different factors.
100+
*/
101+
public static List<ExposureContactFactor> getValues(ExposureCategory category, ExposureSetting setting) {
102+
if (category == null) {
103+
return Collections.emptyList();
104+
}
105+
return Arrays.stream(values()).filter(cf -> {
106+
if (cf.category == null) {
107+
return true; // UNKNOWN, OTHER
108+
}
109+
if (cf.category != category) {
110+
return false;
111+
}
112+
return cf.setting == null || cf.setting == setting;
113+
}).collect(Collectors.toList());
114+
}
115+
116+
@Override
117+
public String toString() {
118+
return I18nProperties.getEnumCaption(this);
119+
}
120+
}

0 commit comments

Comments
 (0)