Skip to content

Commit ac0e072

Browse files
authored
Merge pull request #13905 from SORMAS-Foundation/13887-exposure-form-redesign
13887-exposure-form-redesign
2 parents 20092e7 + d87ec8c commit ac0e072

File tree

22 files changed

+831
-238
lines changed

22 files changed

+831
-238
lines changed

sormas-api/src/main/java/de/symeda/sormas/api/disease/DiseaseConfigurationDto.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package de.symeda.sormas.api.disease;
22

33
import java.util.List;
4+
import java.util.Set;
45

56
import de.symeda.sormas.api.Disease;
67
import de.symeda.sormas.api.EntityDto;
8+
import de.symeda.sormas.api.exposure.ExposureCategory;
79

810
public class DiseaseConfigurationDto extends EntityDto {
911

@@ -28,6 +30,7 @@ public class DiseaseConfigurationDto extends EntityDto {
2830
public static final String EXTENDED_CLASSIFICATION_MULTI = "extendedClassificationMulti";
2931
public static final String AGE_GROUPS = "ageGroups";
3032
public static final String AUTOMATIC_SAMPLE_ASSIGNMENT_THRESHOLD = "automaticSampleAssignmentThreshold";
33+
public static final String EXPOSURE_CATEGORIES = "exposureCategories";
3134

3235
private Disease disease;
3336
private Boolean active;
@@ -47,6 +50,8 @@ public class DiseaseConfigurationDto extends EntityDto {
4750
private List<String> ageGroups;
4851
private Integer automaticSampleAssignmentThreshold;
4952

53+
private Set<ExposureCategory> exposureCategories;
54+
5055
public Disease getDisease() {
5156
return disease;
5257
}
@@ -182,4 +187,12 @@ public Integer getAutomaticSampleAssignmentThreshold() {
182187
public void setAutomaticSampleAssignmentThreshold(Integer automaticSampleAssignmentThreshold) {
183188
this.automaticSampleAssignmentThreshold = automaticSampleAssignmentThreshold;
184189
}
190+
191+
public Set<ExposureCategory> getExposureCategories() {
192+
return exposureCategories;
193+
}
194+
195+
public void setExposureCategories(Set<ExposureCategory> exposureCategories) {
196+
this.exposureCategories = exposureCategories;
197+
}
185198
}

sormas-api/src/main/java/de/symeda/sormas/api/disease/DiseaseConfigurationIndexDto.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public class DiseaseConfigurationIndexDto extends EntityDto {
4343
public static final String EXTENDED_CLASSIFICATION_MULTI = "extendedClassificationMulti";
4444
public static final String AGE_GROUPS = "ageGroups";
4545
public static final String AUTOMATIC_SAMPLE_ASSIGNMENT_THRESHOLD = "automaticSampleAssignmentThreshold";
46+
public static final String EXPOSURE_CATEGORY_NAMES = "exposureCategoryNames";
4647

4748
private Disease disease;
4849
private Boolean active;
@@ -61,6 +62,7 @@ public class DiseaseConfigurationIndexDto extends EntityDto {
6162
private Boolean extendedClassificationMulti;
6263
private List<String> ageGroups;
6364
private Integer automaticSampleAssignmentThreshold;
65+
private String exposureCategoryNames;
6466

6567
public Disease getDisease() {
6668
return disease;
@@ -197,4 +199,12 @@ public Integer getAutomaticSampleAssignmentThreshold() {
197199
public void setAutomaticSampleAssignmentThreshold(Integer automaticSampleAssignmentThreshold) {
198200
this.automaticSampleAssignmentThreshold = automaticSampleAssignmentThreshold;
199201
}
202+
203+
public String getExposureCategoryNames() {
204+
return exposureCategoryNames;
205+
}
206+
207+
public void setExposureCategoryNames(String exposureCategoryNames) {
208+
this.exposureCategoryNames = exposureCategoryNames;
209+
}
200210
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
package de.symeda.sormas.api.exposure;
1717

18+
import java.util.EnumSet;
19+
1820
import de.symeda.sormas.api.i18n.I18nProperties;
1921

2022
public enum ExposureCategory {
@@ -28,6 +30,14 @@ public enum ExposureCategory {
2830
VERTICAL_TRANSMISSION,
2931
WATER_BORNE;
3032

33+
public boolean hasNoSetting() {
34+
return EnumSet.of(ANIMAL_CONTACT, FOMITE_TRANSMISSION, FOOD_BORNE).contains(this);
35+
}
36+
37+
public boolean hasNoSubSetting() {
38+
return EnumSet.of(ANIMAL_CONTACT, FOMITE_TRANSMISSION).contains(this);
39+
}
40+
3141
@Override
3242
public String toString() {
3343
return I18nProperties.getEnumCaption(this);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public class ExposureDto extends PseudonymizableDto {
129129
public static final String CONTACT_FACTOR_DETAILS = "contactFactorDetails";
130130
public static final String PROTECTIVE_MEASURE_DETAILS = "protectiveMeasureDetails";
131131
public static final String EXPOSURE_COMMENT = "exposureComment";
132+
public static final String CONDITION_OF_ANIMAL = "conditionOfAnimal";
132133
public static final String ANIMAL_CATEGORY = "animalCategory";
133134
public static final String ANIMAL_CATEGORY_DETAILS = "animalCategoryDetails";
134135
public static final String FOMITE_TRANSMISSION_LOCATION = "fomiteTransmissionLocation";

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

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@ public ExposureSetting getSetting() {
6565
return setting;
6666
}
6767

68-
/**
69-
* Returns sub-settings for a given category and setting combination.
70-
* UNKNOWN and OTHER are included when the combination has specific sub-settings.
71-
* Returns empty list if no specific sub-settings exist for the combination.
72-
*/
7368
public static List<ExposureSubSetting> getValues(ExposureCategory category, ExposureSetting setting) {
74-
if (category == null || setting == null) {
69+
if (category == null) {
70+
return Collections.emptyList();
71+
}
72+
73+
if (category.hasNoSubSetting()) {
74+
return Collections.emptyList();
75+
}
76+
if (setting == null) {
7577
return Collections.emptyList();
7678
}
7779
boolean hasSpecific = Arrays.stream(values()).anyMatch(s -> s.category == category && s.setting == setting);
@@ -83,6 +85,25 @@ public static List<ExposureSubSetting> getValues(ExposureCategory category, Expo
8385
.collect(Collectors.toList());
8486
}
8587

88+
public static List<ExposureSubSetting> getValuesForCategoryOnly(ExposureCategory category) {
89+
if (category == null) {
90+
return Collections.emptyList();
91+
}
92+
93+
if (category.hasNoSubSetting()) {
94+
return Collections.emptyList();
95+
}
96+
97+
// Check if this category has subsettings with null setting
98+
boolean hasCategoryOnlySubSettings = Arrays.stream(values()).anyMatch(s -> s.category == category && s.setting == null);
99+
100+
if (!hasCategoryOnlySubSettings) {
101+
return Collections.emptyList();
102+
}
103+
104+
return Arrays.stream(values()).filter(s -> (s.category == category && s.setting == null) || s.category == null).collect(Collectors.toList());
105+
}
106+
86107
@Override
87108
public String toString() {
88109
return I18nProperties.getEnumCaption(this);

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,8 @@ public interface Captions {
14271427
String DiseaseConfiguration_caseSurveillanceEnabled = "DiseaseConfiguration.caseSurveillanceEnabled";
14281428
String DiseaseConfiguration_disease = "DiseaseConfiguration.disease";
14291429
String DiseaseConfiguration_eventParticipantFollowUpDuration = "DiseaseConfiguration.eventParticipantFollowUpDuration";
1430+
String DiseaseConfiguration_exposureCategories = "DiseaseConfiguration.exposureCategories";
1431+
String DiseaseConfiguration_exposureCategoryNames = "DiseaseConfiguration.exposureCategoryNames";
14301432
String DiseaseConfiguration_extendedClassification = "DiseaseConfiguration.extendedClassification";
14311433
String DiseaseConfiguration_extendedClassificationMulti = "DiseaseConfiguration.extendedClassificationMulti";
14321434
String DiseaseConfiguration_followUpDuration = "DiseaseConfiguration.followUpDuration";
@@ -1584,6 +1586,7 @@ public interface Captions {
15841586
String EpiData_largeOutbreaksArea = "EpiData.largeOutbreaksArea";
15851587
String EpiData_modeOfTransmission = "EpiData.modeOfTransmission";
15861588
String EpiData_modeOfTransmissionType = "EpiData.modeOfTransmissionType";
1589+
String EpiData_otherDetails = "EpiData.otherDetails";
15871590
String epiDataNoSourceContacts = "epiDataNoSourceContacts";
15881591
String epipulseActiveExports = "epipulseActiveExports";
15891592
String epipulseAllExports = "epipulseAllExports";
@@ -1827,6 +1830,8 @@ public interface Captions {
18271830
String exportSormasData = "exportSormasData";
18281831
String exportUserRoles = "exportUserRoles";
18291832
String Exposure = "Exposure";
1833+
String Exposure_animalCategory = "Exposure.animalCategory";
1834+
String Exposure_animalCategoryDetails = "Exposure.animalCategoryDetails";
18301835
String Exposure_animalCondition = "Exposure.animalCondition";
18311836
String Exposure_animalContactType = "Exposure.animalContactType";
18321837
String Exposure_animalContactTypeDetails = "Exposure.animalContactTypeDetails";
@@ -1837,6 +1842,8 @@ public interface Captions {
18371842
String Exposure_bodyOfWater = "Exposure.bodyOfWater";
18381843
String Exposure_childcareFacilityDetails = "Exposure.childcareFacilityDetails";
18391844
String Exposure_connectionNumber = "Exposure.connectionNumber";
1845+
String Exposure_contactFactorDetails = "Exposure.contactFactorDetails";
1846+
String Exposure_contactFactors = "Exposure.contactFactors";
18401847
String Exposure_contactToBodyFluids = "Exposure.contactToBodyFluids";
18411848
String Exposure_contactToCase = "Exposure.contactToCase";
18421849
String Exposure_deceasedPersonIll = "Exposure.deceasedPersonIll";
@@ -1845,10 +1852,16 @@ public interface Captions {
18451852
String Exposure_domesticSwimming = "Exposure.domesticSwimming";
18461853
String Exposure_eatingRawAnimalProducts = "Exposure.eatingRawAnimalProducts";
18471854
String Exposure_endDate = "Exposure.endDate";
1855+
String Exposure_exposureCategory = "Exposure.exposureCategory";
1856+
String Exposure_exposureComment = "Exposure.exposureComment";
18481857
String Exposure_exposureDate = "Exposure.exposureDate";
18491858
String Exposure_exposureRole = "Exposure.exposureRole";
1859+
String Exposure_exposureSetting = "Exposure.exposureSetting";
1860+
String Exposure_exposureSettingDetails = "Exposure.exposureSettingDetails";
1861+
String Exposure_exposureSubSettingDetails = "Exposure.exposureSubSettingDetails";
18501862
String Exposure_exposureType = "Exposure.exposureType";
18511863
String Exposure_exposureTypeDetails = "Exposure.exposureTypeDetails";
1864+
String Exposure_fomiteTransmissionLocation = "Exposure.fomiteTransmissionLocation";
18521865
String Exposure_gatheringDetails = "Exposure.gatheringDetails";
18531866
String Exposure_gatheringType = "Exposure.gatheringType";
18541867
String Exposure_habitationDetails = "Exposure.habitationDetails";
@@ -1872,6 +1885,8 @@ public interface Captions {
18721885
String Exposure_probableInfectionEnvironment = "Exposure.probableInfectionEnvironment";
18731886
String Exposure_prophylaxis = "Exposure.prophylaxis";
18741887
String Exposure_prophylaxisDate = "Exposure.prophylaxisDate";
1888+
String Exposure_protectiveMeasureDetails = "Exposure.protectiveMeasureDetails";
1889+
String Exposure_protectiveMeasures = "Exposure.protectiveMeasures";
18751890
String Exposure_protectiveMeasuresDetails = "Exposure.protectiveMeasuresDetails";
18761891
String Exposure_rawFoodContact = "Exposure.rawFoodContact";
18771892
String Exposure_rawFoodContactText = "Exposure.rawFoodContactText";
@@ -1880,6 +1895,7 @@ public interface Captions {
18801895
String Exposure_sexualExposureText = "Exposure.sexualExposureText";
18811896
String Exposure_shortDistance = "Exposure.shortDistance";
18821897
String Exposure_startDate = "Exposure.startDate";
1898+
String Exposure_subSettings = "Exposure.subSettings";
18831899
String Exposure_swimmingLocation = "Exposure.swimmingLocation";
18841900
String Exposure_swimmingLocationType = "Exposure.swimmingLocationType";
18851901
String Exposure_symptomaticIndividualText = "Exposure.symptomaticIndividualText";
@@ -3273,6 +3289,9 @@ public interface Captions {
32733289
String titleDiseaseConfigurationAgeGroup = "titleDiseaseConfigurationAgeGroup";
32743290
String titleDiseaseConfigurationCaseDefinition = "titleDiseaseConfigurationCaseDefinition";
32753291
String titleDiseaseConfigurationGeneral = "titleDiseaseConfigurationGeneral";
3292+
String titleExposureActivitySection = "titleExposureActivitySection";
3293+
String titleExposureLocationSection = "titleExposureLocationSection";
3294+
String titleExposuresSection = "titleExposuresSection";
32763295
String titleNoComplications = "titleNoComplications";
32773296
String to = "to";
32783297
String total = "total";

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,7 @@ public interface Strings {
650650
String headingEnvironmentSamplesRestored = "headingEnvironmentSamplesRestored";
651651
String headingEpiConclusion = "headingEpiConclusion";
652652
String headingEpiCurve = "headingEpiCurve";
653+
String headingEpiDataOtherInformation = "headingEpiDataOtherInformation";
653654
String headingEpiDataSourceCaseContacts = "headingEpiDataSourceCaseContacts";
654655
String headingEpipulseExportCreated = "headingEpipulseExportCreated";
655656
String headingErrorReportNotAvailable = "headingErrorReportNotAvailable";
@@ -675,6 +676,7 @@ public interface Strings {
675676
String headingExportUserRightsFailed = "headingExportUserRightsFailed";
676677
String headingExposureDetails = "headingExposureDetails";
677678
String headingExposureInvestigation = "headingExposureInvestigation";
679+
String headingExposures = "headingExposures";
678680
String headingExtendFollowUp = "headingExtendFollowUp";
679681
String headingExtendQuarantine = "headingExtendQuarantine";
680682
String headingExternalEmailDetails = "headingExternalEmailDetails";

sormas-api/src/main/resources/captions.properties

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,7 @@ EpiData.infectionSource= Suspected vehicle or source of infection
11591159
EpiData.infectionSourceText= Specify source of infection
11601160
EpiData.importedCase= Imported Case
11611161
EpiData.country= Country of contamination
1162+
EpiData.otherDetails= General comment
11621163
#Therapy
11631164
Therapy.directlyObservedTreatment = Directly observed treatment
11641165
Therapy.mdrXdrTuberculosis = MDR/XDR tuberculosis
@@ -1588,6 +1589,25 @@ Exposure.sexualExposureText= Specify sexual exposure
15881589
Exposure.rawFoodContact= Contact with raw pet food
15891590
Exposure.rawFoodContactText= Specify contact with raw pet food
15901591
Exposure.symptomaticIndividualText= Specify contact with symptomatic individual
1592+
1593+
Exposure.exposureCategory=Exposure category
1594+
Exposure.exposureSetting=Exposure setting
1595+
Exposure.exposureSettingDetails=Other setting details
1596+
Exposure.subSettings=Sub-settings
1597+
Exposure.exposureSubSettingDetails=Other sub-settings details
1598+
Exposure.conditionOfAnimal=Condition of animal
1599+
Exposure.animalCategory=Animal category
1600+
Exposure.animalCategoryDetails=Details of the animal
1601+
Exposure.fomiteTransmissionLocation=Fomite transmission location
1602+
Exposure.contactFactors=Contact factors
1603+
Exposure.contactFactorDetails=Other contact factors details
1604+
Exposure.protectiveMeasures=Protective measures
1605+
Exposure.protectiveMeasureDetails=Other protective measures details
1606+
Exposure.exposureComment=Comment
1607+
titleExposuresSection=Exposure details
1608+
titleExposureActivitySection=Activity details
1609+
titleExposureLocationSection=Location of exposure
1610+
15911611
# Facility
15921612
facilityActiveFacilities=Active facilities
15931613
facilityArchivedFacilities=Archived facilities
@@ -3674,6 +3694,8 @@ DiseaseConfiguration.automaticSampleAssignmentThreshold=Automatic sample assignm
36743694
DiseaseConfiguration.incubationPeriodEnabled=Incubation period enabled
36753695
DiseaseConfiguration.minIncubationPeriod=Minimum incubation period
36763696
DiseaseConfiguration.maxIncubationPeriod=Maximum incubation period
3697+
DiseaseConfiguration.exposureCategories=Exposure categories
3698+
DiseaseConfiguration.exposureCategoryNames=Exposure categories
36773699
titleDiseaseConfigurationGeneral=General
36783700
titleDiseaseConfigurationCaseDefinition=Case definition
36793701
titleDiseaseConfigurationAgeGroup=Age groups

sormas-api/src/main/resources/enum.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3052,3 +3052,11 @@ ExposureProtectiveMeasure.WASHED=Washed
30523052
ExposureProtectiveMeasure.MEDICATION=Medication
30533053
ExposureProtectiveMeasure.C_SECTION=C-Section
30543054
ExposureProtectiveMeasure.OTHER=Other
3055+
3056+
# AnimalCategory
3057+
AnimalCategory.DOMESTIC=Domestic
3058+
AnimalCategory.WILD=Wild
3059+
3060+
# FomiteTransmissionLocation
3061+
FomiteTransmissionLocation.INSIDE_HOME=Inside home
3062+
FomiteTransmissionLocation.OUTSIDE=Outside

sormas-api/src/main/resources/strings.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,9 @@ headingAdjustQuarantine = Adjust quarantine
832832
headingExtendFollowUp = Extend follow-up period
833833
headingExposureInvestigation = Exposure Investigation
834834
headingEpiDataSourceCaseContacts = Contacts with Source Case
835+
headingExposures = Exposures
835836
headingExposureDetails = Exposure Details
837+
headingEpiDataOtherInformation = Other information
836838
headingEpiConclusion = Conclusion
837839
headingClusterType = Cluster Type
838840
headingAnimalContactDetails = Animal Contact Details

0 commit comments

Comments
 (0)