Skip to content

Commit 879b096

Browse files
authored
Merge pull request #13391 from SORMAS-Foundation/feature-13317-integration-of-tuberculosis-disease
tuberculosis specific symptoms changes
2 parents fd969ef + 112f651 commit 879b096

File tree

14 files changed

+484
-170
lines changed

14 files changed

+484
-170
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2812,6 +2812,7 @@ public interface Captions {
28122812
String Symptoms_chestPain = "Symptoms.chestPain";
28132813
String Symptoms_chestPressure = "Symptoms.chestPressure";
28142814
String Symptoms_chillsSweats = "Symptoms.chillsSweats";
2815+
String Symptoms_clinicalPresentationStatus = "Symptoms.clinicalPresentationStatus";
28152816
String Symptoms_coma = "Symptoms.coma";
28162817
String Symptoms_confusedDisoriented = "Symptoms.confusedDisoriented";
28172818
String Symptoms_congenitalGlaucoma = "Symptoms.congenitalGlaucoma";
@@ -2833,6 +2834,7 @@ public interface Captions {
28332834
String Symptoms_dehydration = "Symptoms.dehydration";
28342835
String Symptoms_delirium = "Symptoms.delirium";
28352836
String Symptoms_developmentalDelay = "Symptoms.developmentalDelay";
2837+
String Symptoms_diagnosis = "Symptoms.diagnosis";
28362838
String Symptoms_diarrhea = "Symptoms.diarrhea";
28372839
String Symptoms_difficultyBreathing = "Symptoms.difficultyBreathing";
28382840
String Symptoms_digestedBloodVomit = "Symptoms.digestedBloodVomit";
@@ -2904,12 +2906,14 @@ public interface Captions {
29042906
String Symptoms_lymphadenopathyAxillary = "Symptoms.lymphadenopathyAxillary";
29052907
String Symptoms_lymphadenopathyCervical = "Symptoms.lymphadenopathyCervical";
29062908
String Symptoms_lymphadenopathyInguinal = "Symptoms.lymphadenopathyInguinal";
2909+
String Symptoms_majorSite = "Symptoms.majorSite";
29072910
String Symptoms_malaise = "Symptoms.malaise";
29082911
String Symptoms_meningealSigns = "Symptoms.meningealSigns";
29092912
String Symptoms_meningitis = "Symptoms.meningitis";
29102913
String Symptoms_meningoencephalitis = "Symptoms.meningoencephalitis";
29112914
String Symptoms_microcephaly = "Symptoms.microcephaly";
29122915
String Symptoms_midUpperArmCircumference = "Symptoms.midUpperArmCircumference";
2916+
String Symptoms_minorSite = "Symptoms.minorSite";
29132917
String Symptoms_musclePain = "Symptoms.musclePain";
29142918
String Symptoms_nausea = "Symptoms.nausea";
29152919
String Symptoms_neckStiffness = "Symptoms.neckStiffness";
@@ -2927,6 +2931,8 @@ public interface Captions {
29272931
String Symptoms_otherComplicationsText = "Symptoms.otherComplicationsText";
29282932
String Symptoms_otherHemorrhagicSymptoms = "Symptoms.otherHemorrhagicSymptoms";
29292933
String Symptoms_otherHemorrhagicSymptomsText = "Symptoms.otherHemorrhagicSymptomsText";
2934+
String Symptoms_otherMajorSiteDetails = "Symptoms.otherMajorSiteDetails";
2935+
String Symptoms_otherMinorSiteDetails = "Symptoms.otherMinorSiteDetails";
29302936
String Symptoms_otherNonHemorrhagicSymptoms = "Symptoms.otherNonHemorrhagicSymptoms";
29312937
String Symptoms_otherNonHemorrhagicSymptomsText = "Symptoms.otherNonHemorrhagicSymptomsText";
29322938
String Symptoms_otitisMedia = "Symptoms.otitisMedia";

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
@@ -732,6 +732,7 @@ public interface Strings {
732732
String headingLimitedDiseases = "headingLimitedDiseases";
733733
String headingLineListing = "headingLineListing";
734734
String headingLineListingImport = "headingLineListingImport";
735+
String headingLocalisation = "headingLocalisation";
735736
String headingLocation = "headingLocation";
736737
String headingLoginFailed = "headingLoginFailed";
737738
String headingMaternalHistory = "headingMaternalHistory";

sormas-api/src/main/java/de/symeda/sormas/api/symptoms/ClinicalPresentation.java renamed to sormas-api/src/main/java/de/symeda/sormas/api/symptoms/ClinicalPresentationStatus.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import de.symeda.sormas.api.i18n.I18nProperties;
1919

20-
public enum ClinicalPresentation {
20+
public enum ClinicalPresentationStatus {
2121

2222
ASYMPTOMATIC,
2323
COMPATIBLE,
@@ -27,4 +27,14 @@ public enum ClinicalPresentation {
2727
public String toString() {
2828
return I18nProperties.getEnumCaption(this);
2929
}
30+
31+
public String buildCaption(String diseaseShort) {
32+
String caption = null;
33+
if (this == ClinicalPresentationStatus.COMPATIBLE) {
34+
caption = String.format(this.toString(), diseaseShort);
35+
} else {
36+
caption = I18nProperties.getEnumCaption(this);
37+
}
38+
return caption;
39+
}
3040
}
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
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.symptoms;
17+
18+
import java.util.Arrays;
19+
import java.util.LinkedHashSet;
20+
import java.util.Set;
21+
import java.util.stream.Collectors;
22+
23+
import de.symeda.sormas.api.Disease;
24+
import de.symeda.sormas.api.i18n.I18nProperties;
25+
import de.symeda.sormas.api.utils.Diseases;
26+
27+
public enum InfectionSite {
28+
29+
NOT_APPLICABLE(false, true),
30+
@Diseases(value = {
31+
Disease.TUBERCULOSIS })
32+
BONES_JOINTS_OTHER_THAN_VERTEBRAE(true, true),
33+
@Diseases(value = {
34+
Disease.TUBERCULOSIS })
35+
CNS_EXCEPT_MENINGES(true, true),
36+
@Diseases(value = {
37+
Disease.TUBERCULOSIS })
38+
DISSEMINATED_FORM(true, true),
39+
@Diseases(value = {
40+
Disease.TUBERCULOSIS })
41+
EXTRAPULMONARY_UNKNOWN_SITE(true, true),
42+
@Diseases(value = {
43+
Disease.TUBERCULOSIS })
44+
EXTRA_THORACIC_LYMPH_NODES(true, true),
45+
@Diseases(value = {
46+
Disease.TUBERCULOSIS })
47+
GENITO_URINARY(true, true),
48+
@Diseases(value = {
49+
Disease.TUBERCULOSIS })
50+
INTRATHORACIC_LYMPH_NODES(true, true),
51+
@Diseases(value = {
52+
Disease.TUBERCULOSIS })
53+
LUNG(true, true),
54+
@Diseases(value = {
55+
Disease.TUBERCULOSIS })
56+
MENINGES(true, true),
57+
@Diseases(value = {
58+
Disease.TUBERCULOSIS })
59+
PERITONEUM_DIGESTIVE_TRACT(true, true),
60+
@Diseases(value = {
61+
Disease.TUBERCULOSIS })
62+
PLEURA(true, true),
63+
@Diseases(value = {
64+
Disease.TUBERCULOSIS })
65+
UROGENITAL_SYSTEM(true, true),
66+
@Diseases(value = {
67+
Disease.TUBERCULOSIS })
68+
VERTEBRAE(true, true),
69+
UNKNOWN(true, true),
70+
OTHER(true, true);
71+
72+
private final boolean major;
73+
private final boolean minor;
74+
75+
InfectionSite(boolean major, boolean minor) {
76+
this.major = major;
77+
this.minor = minor;
78+
}
79+
80+
public boolean isMajor() {
81+
return major;
82+
}
83+
84+
public boolean isMinor() {
85+
return minor;
86+
}
87+
88+
@Override
89+
public String toString() {
90+
return I18nProperties.getEnumCaption(this);
91+
}
92+
93+
public static Set<InfectionSite> filter(Disease disease, boolean includeMajor, boolean includeMinor) {
94+
return Arrays.stream(values()).filter(site -> {
95+
// Check if the site is applicable for the disease
96+
boolean diseaseMatches = isDiseaseApplicable(site, disease);
97+
98+
// Check if the site matches the major/minor criteria
99+
boolean criteriaMatches = (includeMajor && site.isMajor()) || (includeMinor && site.isMinor());
100+
101+
return diseaseMatches && criteriaMatches;
102+
}).collect(Collectors.toCollection(LinkedHashSet::new));
103+
}
104+
105+
private static boolean matchesCriteria(InfectionSite site, boolean includeMajor, boolean includeMinor) {
106+
if (includeMajor && includeMinor) {
107+
return site.isMajor() || site.isMinor(); // Include if it's either major or minor
108+
} else if (includeMajor) {
109+
return site.isMajor(); // Include only if it's major
110+
} else if (includeMinor) {
111+
return site.isMinor(); // Include only if it's minor
112+
} else {
113+
return false; // Include nothing if both are false
114+
}
115+
}
116+
117+
private static boolean isDiseaseApplicable(InfectionSite site, Disease disease) {
118+
try {
119+
// Get the @Diseases annotation from the enum value
120+
Diseases diseasesAnnotation = site.getClass().getField(site.name()).getAnnotation(Diseases.class);
121+
122+
if (diseasesAnnotation == null) {
123+
// If no annotation, it's applicable to all diseases
124+
return true;
125+
}
126+
127+
// Check if the disease is in the annotation's disease list
128+
return Arrays.asList(diseasesAnnotation.value()).contains(disease);
129+
} catch (NoSuchFieldException e) {
130+
// If we can't access the field, assume it's applicable
131+
return true;
132+
}
133+
}
134+
}

sormas-api/src/main/java/de/symeda/sormas/api/symptoms/MajorInfectionSite.java

Lines changed: 0 additions & 67 deletions
This file was deleted.

sormas-api/src/main/java/de/symeda/sormas/api/symptoms/MinorInfectionSite.java

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)