Skip to content

Commit e50dad3

Browse files
committed
Adds SAL diesease related checks to the various forms Contact, Epi, Exposure, PathogenTest & Case
1 parent eae51b7 commit e50dad3

34 files changed

Lines changed: 957 additions & 78 deletions

File tree

sormas-api/src/main/java/de/symeda/sormas/api/caze/CaseDataDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ public class CaseDataDto extends SormasToSormasShareableDto implements IsCase {
389389
Disease.OTHER })
390390
@Outbreaks
391391
private VaccinationStatus vaccinationStatus;
392+
@Diseases(value = Disease.SALMONELLOSIS, hide = true)
392393
@Outbreaks
393394
@Size(max = FieldConstraints.CHARACTER_LIMIT_DEFAULT, message = Validations.textTooLong)
394395
private String vaccinationStatusDetails;

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public class EpiDataDto extends PseudonymizableDto {
7878
public static final String EXPOSURE_INVESTIGATION_TO_DATE = "exposureInvestigationToDate";
7979
public static final String ACTIVITY_AS_CASE_FROM_DATE = "activityAsCaseFromDate";
8080
public static final String ACTIVITY_AS_CASE_TO_DATE = "activityAsCaseToDate";
81+
public static final String FOOD_HISTORY = "foodHistory";
8182

8283
private YesNoUnknown exposureDetailsKnown;
8384
private YesNoUnknown activityAsCaseDetailsKnown;
@@ -200,6 +201,13 @@ public class EpiDataDto extends PseudonymizableDto {
200201
CountryHelper.COUNTRY_CODE_LUXEMBOURG })
201202
private Date activityAsCaseToDate;
202203

204+
@Valid
205+
@Diseases({
206+
Disease.SALMONELLOSIS })
207+
@HideForCountriesExcept(countries = {
208+
CountryHelper.COUNTRY_CODE_LUXEMBOURG })
209+
private FoodHistoryDto foodHistory;
210+
203211
public YesNoUnknown getExposureDetailsKnown() {
204212
return exposureDetailsKnown;
205213
}
@@ -437,6 +445,14 @@ public void setActivityAsCaseToDate(Date activityAsCaseToDate) {
437445
this.activityAsCaseToDate = activityAsCaseToDate;
438446
}
439447

448+
public FoodHistoryDto getFoodHistory() {
449+
return foodHistory;
450+
}
451+
452+
public void setFoodHistory(FoodHistoryDto foodHistory) {
453+
this.foodHistory = foodHistory;
454+
}
455+
440456
private static void validateDateRange(Date from, Date to, String fromName, String toName) {
441457
if (from != null && to != null && from.after(to)) {
442458
throw new IllegalArgumentException(fromName + " must be before or equal to " + toName);
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
3+
* Copyright © 2016-2026 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+
*/
9+
10+
package de.symeda.sormas.api.epidata;
11+
12+
import de.symeda.sormas.api.i18n.I18nProperties;
13+
14+
/**
15+
* Food consumption items captured by the Salmonellosis (Luxembourg) survey, 5-day window before symptom onset.
16+
* Source: SALM_enquête_publipostage.docx, Alimentation / Ernährung / Food section.
17+
*/
18+
public enum FoodConsumptionItem {
19+
20+
TAP_WATER,
21+
ICE_CUBES,
22+
BOTTLED_WATER,
23+
OTHER_DRINKS,
24+
POULTRY,
25+
BEEF,
26+
PORK,
27+
OTHER_MEAT,
28+
FISH,
29+
SEAFOOD,
30+
EGGS,
31+
CHEESE,
32+
DAIRY,
33+
DESSERTS,
34+
VEGETABLES,
35+
FRUITS,
36+
DRIED_FRUITS,
37+
SPICES,
38+
PREPARED_MEALS,
39+
SNACKS;
40+
41+
@Override
42+
public String toString() {
43+
return I18nProperties.getEnumCaption(this);
44+
}
45+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
3+
* Copyright © 2016-2026 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+
*/
9+
10+
package de.symeda.sormas.api.epidata;
11+
12+
import java.util.EnumMap;
13+
import java.util.Map;
14+
15+
import javax.validation.constraints.Size;
16+
17+
import de.symeda.sormas.api.feature.FeatureType;
18+
import de.symeda.sormas.api.i18n.Validations;
19+
import de.symeda.sormas.api.utils.DataHelper;
20+
import de.symeda.sormas.api.utils.DependingOnFeatureType;
21+
import de.symeda.sormas.api.utils.FieldConstraints;
22+
import de.symeda.sormas.api.utils.pseudonymization.PseudonymizableDto;
23+
24+
/**
25+
* Salmonellosis (Luxembourg) food consumption history captured during the 5-day window before symptom onset.
26+
* Source: SALM_enquête_publipostage.docx, Alimentation / Ernährung / Food section.
27+
* Presence of a key in {@link #consumedItemsDetails} means the item was consumed; the value (possibly empty)
28+
* carries any free-text details.
29+
*/
30+
@DependingOnFeatureType(featureType = {
31+
FeatureType.CASE_SURVEILANCE,
32+
FeatureType.CONTACT_TRACING })
33+
public class FoodHistoryDto extends PseudonymizableDto {
34+
35+
private static final long serialVersionUID = -2148717635193517125L;
36+
37+
public static final String I18N_PREFIX = "FoodHistory";
38+
39+
public static final String CONSUMED_ITEMS_DETAILS = "consumedItemsDetails";
40+
public static final String OTHER_FOOD_DETAILS = "otherFoodDetails";
41+
42+
private Map<FoodConsumptionItem, String> consumedItemsDetails = new EnumMap<>(FoodConsumptionItem.class);
43+
44+
@Size(max = FieldConstraints.CHARACTER_LIMIT_DEFAULT, message = Validations.textTooLong)
45+
private String otherFoodDetails;
46+
47+
public static FoodHistoryDto build() {
48+
FoodHistoryDto dto = new FoodHistoryDto();
49+
dto.setUuid(DataHelper.createUuid());
50+
return dto;
51+
}
52+
53+
public Map<FoodConsumptionItem, String> getConsumedItemsDetails() {
54+
return consumedItemsDetails;
55+
}
56+
57+
public void setConsumedItemsDetails(Map<FoodConsumptionItem, String> consumedItemsDetails) {
58+
this.consumedItemsDetails = consumedItemsDetails;
59+
}
60+
61+
public String getOtherFoodDetails() {
62+
return otherFoodDetails;
63+
}
64+
65+
public void setOtherFoodDetails(String otherFoodDetails) {
66+
this.otherFoodDetails = otherFoodDetails;
67+
}
68+
}

sormas-api/src/main/java/de/symeda/sormas/api/exposure/ExposureSubSetting.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
import java.util.List;
2121
import java.util.stream.Collectors;
2222

23+
import de.symeda.sormas.api.Disease;
2324
import de.symeda.sormas.api.i18n.I18nProperties;
25+
import de.symeda.sormas.api.utils.Diseases;
2426

2527
public enum ExposureSubSetting {
2628

@@ -49,6 +51,8 @@ public enum ExposureSubSetting {
4951

5052
EATING_AT_HOME(ExposureCategory.FOOD_BORNE, null),
5153
EATING_OUTSIDE(ExposureCategory.FOOD_BORNE, null),
54+
@Diseases({
55+
Disease.SALMONELLOSIS })
5256
SHOPPING_FOR_FOOD(ExposureCategory.FOOD_BORNE, null),
5357

5458
UNKNOWN(null, null),
@@ -90,6 +94,15 @@ public static List<ExposureSubSetting> getValues(ExposureCategory category, Expo
9094
.collect(Collectors.toList());
9195
}
9296

97+
/**
98+
* Disease-aware overload: filters the values returned by {@link #getValues(ExposureCategory, ExposureSetting)}
99+
* to those whose {@code @Diseases} annotation matches the given disease (or values with no annotation,
100+
* which apply to every disease).
101+
*/
102+
public static List<ExposureSubSetting> getValues(ExposureCategory category, ExposureSetting setting, Disease disease) {
103+
return getValues(category, setting).stream().filter(s -> isVisibleForDisease(s, disease)).collect(Collectors.toList());
104+
}
105+
93106
public static List<ExposureSubSetting> getValuesForCategoryOnly(ExposureCategory category) {
94107
if (category == null) {
95108
return Collections.emptyList();
@@ -109,6 +122,19 @@ public static List<ExposureSubSetting> getValuesForCategoryOnly(ExposureCategory
109122
return Arrays.stream(values()).filter(s -> (s.category == category && s.setting == null) || s.category == null).collect(Collectors.toList());
110123
}
111124

125+
/**
126+
* Disease-aware overload: filters the values returned by {@link #getValuesForCategoryOnly(ExposureCategory)}
127+
* to those whose {@code @Diseases} annotation matches the given disease (or values with no annotation).
128+
*/
129+
public static List<ExposureSubSetting> getValuesForCategoryOnly(ExposureCategory category, Disease disease) {
130+
return getValuesForCategoryOnly(category).stream().filter(s -> isVisibleForDisease(s, disease)).collect(Collectors.toList());
131+
}
132+
133+
private static boolean isVisibleForDisease(ExposureSubSetting subSetting, Disease disease) {
134+
return Diseases.DiseasesConfiguration.isMissing(ExposureSubSetting.class, subSetting.name())
135+
|| Diseases.DiseasesConfiguration.isDefined(ExposureSubSetting.class, subSetting.name(), disease);
136+
}
137+
112138
@Override
113139
public String toString() {
114140
return I18nProperties.getEnumCaption(this);

sormas-api/src/main/java/de/symeda/sormas/api/i18n/Captions.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,7 @@ public interface Captions {
16251625
String EpiData_exposureInvestigationFromDate = "EpiData.exposureInvestigationFromDate";
16261626
String EpiData_exposureInvestigationToDate = "EpiData.exposureInvestigationToDate";
16271627
String EpiData_exposures = "EpiData.exposures";
1628+
String EpiData_foodHistory = "EpiData.foodHistory";
16281629
String EpiData_healthcareProfessional = "EpiData.healthcareProfessional";
16291630
String EpiData_highTransmissionRiskArea = "EpiData.highTransmissionRiskArea";
16301631
String EpiData_importedCase = "EpiData.importedCase";
@@ -2080,6 +2081,8 @@ public interface Captions {
20802081
String FollowUp_followUpUntil = "FollowUp.followUpUntil";
20812082
String FollowUp_person = "FollowUp.person";
20822083
String FollowUp_reportDate = "FollowUp.reportDate";
2084+
String FoodHistory_consumedItemsDetails = "FoodHistory.consumedItemsDetails";
2085+
String FoodHistory_otherFoodDetails = "FoodHistory.otherFoodDetails";
20832086
String formatNumberOfVisitsFormat = "formatNumberOfVisitsFormat";
20842087
String formatNumberOfVisitsLongFormat = "formatNumberOfVisitsLongFormat";
20852088
String formatSimpleNumberFormat = "formatSimpleNumberFormat";

sormas-api/src/main/java/de/symeda/sormas/api/i18n/Strings.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,6 +1887,7 @@ public interface Strings {
18871887
String promptExternalMessagesPersonBirthDateTo = "promptExternalMessagesPersonBirthDateTo";
18881888
String promptExternalMessagesSearchField = "promptExternalMessagesSearchField";
18891889
String promptFilterByPeriod = "promptFilterByPeriod";
1890+
String promptFoodHistoryItemDetails = "promptFoodHistoryItemDetails";
18901891
String promptImmunizationDateFrom = "promptImmunizationDateFrom";
18911892
String promptImmunizationDateTo = "promptImmunizationDateTo";
18921893
String promptImmunizationDateType = "promptImmunizationDateType";

0 commit comments

Comments
 (0)