Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit 31bb6e7

Browse files
author
barnabartha
committed
Merge branch 'development' into feature-3253-SendSMSToCases
# Conflicts: # sormas-backend/src/main/resources/META-INF/persistence.xml # sormas-backend/src/main/resources/sql/sormas_schema.sql # sormas-backend/src/test/resources/META-INF/persistence.xml # sormas-ui/src/test/resources/META-INF/persistence.xml
2 parents 0d1da72 + 2b1d054 commit 31bb6e7

258 files changed

Lines changed: 8133 additions & 13281 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,23 @@ public enum CaseClassification
2424
implements
2525
StatisticsGroupingKey {
2626

27-
NOT_CLASSIFIED,
28-
SUSPECT,
29-
PROBABLE,
30-
CONFIRMED,
31-
CONFIRMED_NO_SYMPTOMS,
32-
CONFIRMED_UNKNOWN_SYMPTOMS,
33-
NO_CASE;
27+
NOT_CLASSIFIED(1),
28+
SUSPECT(2),
29+
PROBABLE(3),
30+
CONFIRMED(6),
31+
CONFIRMED_NO_SYMPTOMS(4),
32+
CONFIRMED_UNKNOWN_SYMPTOMS(5),
33+
NO_CASE(0);
34+
35+
/**
36+
* Severity of the case classification; confirmed has the highest severity in terms of the classification process
37+
* while no_case has the lowest.
38+
*/
39+
private final int severity;
40+
41+
CaseClassification(int severity) {
42+
this.severity = severity;
43+
}
3444

3545
public String getName() {
3646
return this.name();
@@ -57,4 +67,8 @@ public int keyCompareTo(StatisticsGroupingKey o) {
5767

5868
return this.toString().compareTo(o.toString());
5969
}
70+
71+
public int getSeverity() {
72+
return severity;
73+
}
6074
}

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

Lines changed: 16 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public class CaseExportDto implements Serializable {
8585
public static final String ADDRESS_REGION = "addressRegion";
8686
public static final String ADDRESS_COMMUNITY = "addressCommunity";
8787
public static final String ADDRESS_GPS_COORDINATES = "addressGpsCoordinates";
88+
public static final String BURIAL_ATTENDED = "burialAttended";
8889
public static final String TRAVELED = "traveled";
8990
public static final String TRAVEL_HISTORY = "travelHistory";
9091
public static final String NUMBER_OF_PRESCRIPTIONS = "numberOfPrescriptions";
@@ -186,11 +187,9 @@ public class CaseExportDto implements Serializable {
186187
private String occupationType;
187188
private String educationType;
188189
private String travelHistory;
189-
private YesNoUnknown traveled;
190-
private YesNoUnknown burialAttended;
191-
private YesNoUnknown directContactConfirmedCase;
192-
private YesNoUnknown directContactProbableCase;
193-
private YesNoUnknown contactWithRodent;
190+
private boolean traveled;
191+
private boolean burialAttended;
192+
private YesNoUnknown contactWithSourceCaseKnown;
194193
private SymptomsDto symptoms;
195194
// private Date onsetDate;
196195
// private String symptoms;
@@ -261,8 +260,7 @@ public CaseExportDto(long id, long personId, long personAddressId, long epiDataI
261260
String addressRegion, String addressDistrict, String addressCommunity, String city, String street, String houseNumber, String additionalInformation, String postalCode,
262261
String facility, String facilityUuid, String facilityDetails,
263262
String phone, String phoneOwner, String emailAddress, EducationType educationType, String educationDetails,
264-
OccupationType occupationType, String occupationDetails, YesNoUnknown traveled,
265-
YesNoUnknown burialAttended, YesNoUnknown directContactConfirmedCase, YesNoUnknown directContactProbableCase, YesNoUnknown contactWithRodent,
263+
OccupationType occupationType, String occupationDetails, YesNoUnknown contactWithSourceCaseKnown,
266264
//Date onsetDate,
267265
Vaccination vaccination, String vaccinationDoses, Date vaccinationDate,
268266
VaccinationInfoSource vaccinationInfoSource, YesNoUnknown postpartum, Trimester trimester,
@@ -329,11 +327,7 @@ public CaseExportDto(long id, long personId, long personAddressId, long epiDataI
329327
this.emailAddress = emailAddress;
330328
this.educationType = PersonHelper.buildEducationString(educationType, educationDetails);
331329
this.occupationType = PersonHelper.buildOccupationString(occupationType, occupationDetails);
332-
this.traveled = traveled;
333-
this.burialAttended = burialAttended;
334-
this.directContactConfirmedCase = directContactConfirmedCase;
335-
this.directContactProbableCase = directContactProbableCase;
336-
this.contactWithRodent = contactWithRodent;
330+
this.contactWithSourceCaseKnown = contactWithSourceCaseKnown;
337331
// this.onsetDate = onsetDate;
338332
this.vaccination = vaccination;
339333
this.vaccinationDoses = vaccinationDoses;
@@ -1014,11 +1008,11 @@ public String getOccupationType() {
10141008
CaseExportType.CASE_SURVEILLANCE })
10151009
@ExportProperty(TRAVELED)
10161010
@ExportGroup(ExportGroupType.EPIDEMIOLOGICAL)
1017-
public YesNoUnknown getTraveled() {
1011+
public boolean isTraveled() {
10181012
return traveled;
10191013
}
10201014

1021-
public void setTraveled(YesNoUnknown traveled) {
1015+
public void setTraveled(boolean traveled) {
10221016
this.traveled = traveled;
10231017
}
10241018

@@ -1034,49 +1028,27 @@ public String getTravelHistory() {
10341028
@Order(80)
10351029
@ExportTarget(caseExportTypes = {
10361030
CaseExportType.CASE_SURVEILLANCE })
1037-
@ExportProperty(EpiDataDto.BURIAL_ATTENDED)
1031+
@ExportProperty(BURIAL_ATTENDED)
10381032
@ExportGroup(ExportGroupType.EPIDEMIOLOGICAL)
1039-
public YesNoUnknown getBurialAttended() {
1033+
public boolean isBurialAttended() {
10401034
return burialAttended;
10411035
}
10421036

1043-
public void setBurialAttended(YesNoUnknown burialAttended) {
1037+
public void setBurialAttended(boolean burialAttended) {
10441038
this.burialAttended = burialAttended;
10451039
}
10461040

10471041
@Order(81)
10481042
@ExportTarget(caseExportTypes = {
10491043
CaseExportType.CASE_SURVEILLANCE })
1050-
@ExportProperty(EpiDataDto.DIRECT_CONTACT_CONFIRMED_CASE)
1051-
@ExportGroup(ExportGroupType.EPIDEMIOLOGICAL)
1052-
public YesNoUnknown getDirectContactConfirmedCase() {
1053-
return directContactConfirmedCase;
1054-
}
1055-
1056-
public void setDirectContactConfirmedCase(YesNoUnknown directContactConfirmedCase) {
1057-
this.directContactConfirmedCase = directContactConfirmedCase;
1058-
}
1059-
1060-
@Order(90)
1061-
@ExportTarget(caseExportTypes = {
1062-
CaseExportType.CASE_SURVEILLANCE })
1063-
@ExportProperty(EpiDataDto.DIRECT_CONTACT_PROBABLE_CASE)
1044+
@ExportProperty(EpiDataDto.CONTACT_WITH_SOURCE_CASE_KNOWN)
10641045
@ExportGroup(ExportGroupType.EPIDEMIOLOGICAL)
1065-
public YesNoUnknown getDirectContactProbableCase() {
1066-
return directContactProbableCase;
1046+
public YesNoUnknown getContactWithSourceCaseKnown() {
1047+
return contactWithSourceCaseKnown;
10671048
}
10681049

1069-
public void setDirectContactProbableCase(YesNoUnknown directContactProbableCase) {
1070-
this.directContactProbableCase = directContactProbableCase;
1071-
}
1072-
1073-
@Order(91)
1074-
@ExportTarget(caseExportTypes = {
1075-
CaseExportType.CASE_SURVEILLANCE })
1076-
@ExportProperty(EpiDataDto.RODENTS)
1077-
@ExportGroup(ExportGroupType.EPIDEMIOLOGICAL)
1078-
public YesNoUnknown getContactWithRodent() {
1079-
return contactWithRodent;
1050+
public void setContactWithSourceCaseKnown(YesNoUnknown contactWithSourceCaseKnown) {
1051+
this.contactWithSourceCaseKnown = contactWithSourceCaseKnown;
10801052
}
10811053

10821054
@Order(92)
@@ -1522,10 +1494,6 @@ public void setTravelHistory(String travelHistory) {
15221494
this.travelHistory = travelHistory;
15231495
}
15241496

1525-
public void setContactWithRodent(YesNoUnknown contactWithRodent) {
1526-
this.contactWithRodent = contactWithRodent;
1527-
}
1528-
15291497
public void setInitialDetectionPlace(String initialDetectionPlace) {
15301498
this.initialDetectionPlace = initialDetectionPlace;
15311499
}
@@ -1546,10 +1514,6 @@ public void setVaccinationInfoSource(VaccinationInfoSource vaccinationInfoSource
15461514
this.vaccinationInfoSource = vaccinationInfoSource;
15471515
}
15481516

1549-
// public void setOnsetDate(Date onsetDate) {
1550-
// this.onsetDate = onsetDate;
1551-
// }
1552-
15531517
public void setSymptoms(SymptomsDto symptoms) {
15541518
this.symptoms = symptoms;
15551519
}

sormas-api/src/main/java/de/symeda/sormas/api/caze/classification/CaseClassificationFacade.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
@Remote
3131
public interface CaseClassificationFacade {
3232

33-
CaseClassification getClassification(CaseDataDto caze, List<PathogenTestDto> sampleTests);
33+
CaseClassification getClassification(CaseDataDto caze, List<PathogenTestDto> pathogenTests);
3434

3535
DiseaseClassificationCriteriaDto getByDisease(Disease disease);
3636

sormas-api/src/main/java/de/symeda/sormas/api/caze/classification/ClassificationCaseCriteriaDto.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
@JsonSubTypes.Type(value = ClassificationEpiDataCriteriaDto.class, name = "ClassificationEpiDataCriteriaDto"),
3636
@JsonSubTypes.Type(value = ClassificationNotInStartDateRangeCriteriaDto.class, name = "ClassificationNotInStartDateRangeCriteriaDto"),
3737
@JsonSubTypes.Type(value = ClassificationPathogenTestCriteriaDto.class, name = "ClassificationPathogenTestCriteriaDto"),
38+
@JsonSubTypes.Type(value = ClassificationExposureCriteriaDto.class, name = "ClassificationExposureCriteriaDto"),
3839
@JsonSubTypes.Type(value = ClassificationSymptomsCriteriaDto.class, name = "ClassificationSymptomsCriteriaDto"), })
3940
public class ClassificationCaseCriteriaDto extends ClassificationCriteriaDto {
4041

@@ -61,7 +62,7 @@ protected Object getInvokeObject(CaseDataDto caze) {
6162
}
6263

6364
@Override
64-
public boolean eval(CaseDataDto caze, PersonDto person, List<PathogenTestDto> sampleTests) {
65+
public boolean eval(CaseDataDto caze, PersonDto person, List<PathogenTestDto> pathogenTests) {
6566

6667
try {
6768
Method method = getInvokeClass().getMethod("get" + propertyId.substring(0, 1).toUpperCase() + propertyId.substring(1));

sormas-api/src/main/java/de/symeda/sormas/api/caze/classification/ClassificationCriteriaDto.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public abstract class ClassificationCriteriaDto implements Serializable {
5555

5656
private static final long serialVersionUID = -3686569295881034008L;
5757

58-
public abstract boolean eval(CaseDataDto caze, PersonDto person, List<PathogenTestDto> sampleTests);
58+
public abstract boolean eval(CaseDataDto caze, PersonDto person, List<PathogenTestDto> pathogenTests);
5959

6060
public abstract String buildDescription();
6161

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
/*
2+
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
3+
* Copyright © 2016-2020 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.caze.classification;
17+
18+
import java.lang.reflect.InvocationTargetException;
19+
import java.lang.reflect.Method;
20+
import java.util.List;
21+
22+
import org.apache.commons.collections.CollectionUtils;
23+
24+
import de.symeda.sormas.api.EntityDto;
25+
import de.symeda.sormas.api.caze.CaseDataDto;
26+
import de.symeda.sormas.api.exposure.ExposureDto;
27+
import de.symeda.sormas.api.exposure.ExposureType;
28+
import de.symeda.sormas.api.i18n.I18nProperties;
29+
import de.symeda.sormas.api.i18n.Strings;
30+
import de.symeda.sormas.api.person.PersonDto;
31+
import de.symeda.sormas.api.sample.PathogenTestDto;
32+
import de.symeda.sormas.api.utils.YesNoUnknown;
33+
34+
public class ClassificationExposureCriteriaDto extends ClassificationCaseCriteriaDto {
35+
36+
private ExposureType exposureType;
37+
38+
public ClassificationExposureCriteriaDto() {
39+
super();
40+
}
41+
42+
public ClassificationExposureCriteriaDto(String propertyId, ExposureType exposureType, Object... propertyValues) {
43+
44+
super(propertyId, propertyValues);
45+
this.exposureType = exposureType;
46+
}
47+
48+
@Override
49+
protected Class<? extends EntityDto> getInvokeClass() {
50+
return ExposureDto.class;
51+
}
52+
53+
@Override
54+
public boolean eval(CaseDataDto caze, PersonDto person, List<PathogenTestDto> pathogenTests) {
55+
56+
for (ExposureDto exposure : caze.getEpiData().getExposures()) {
57+
if (exposureType != null && exposure.getExposureType() != exposureType) {
58+
continue;
59+
}
60+
61+
Method method;
62+
try {
63+
method = getInvokeClass().getMethod("get" + propertyId.substring(0, 1).toUpperCase() + propertyId.substring(1));
64+
} catch (NoSuchMethodException e) {
65+
try {
66+
method = getInvokeClass().getMethod("is" + propertyId.substring(0, 1).toUpperCase() + propertyId.substring(1));
67+
} catch (NoSuchMethodException newE) {
68+
throw new RuntimeException(newE);
69+
}
70+
} catch (SecurityException e) {
71+
throw new RuntimeException(e);
72+
}
73+
74+
try {
75+
Object value = method.invoke(exposure);
76+
if (propertyValues.contains(value) || CollectionUtils.isEmpty(propertyValues) && YesNoUnknown.YES.equals(value)) {
77+
return true;
78+
}
79+
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | SecurityException e) {
80+
throw new RuntimeException(e);
81+
}
82+
}
83+
84+
return false;
85+
}
86+
87+
@Override
88+
public String buildDescription() {
89+
90+
StringBuilder sb = new StringBuilder();
91+
sb.append(I18nProperties.getPrefixCaption(ExposureDto.I18N_PREFIX, propertyId));
92+
if (exposureType != null) {
93+
sb.append(" ").append(I18nProperties.getString(Strings.classificationCriteriaForExposureType)).append(exposureType.toString());
94+
}
95+
96+
return sb.toString();
97+
}
98+
99+
}

sormas-api/src/main/java/de/symeda/sormas/api/contact/ContactCriteria.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public class ContactCriteria extends BaseCriteria implements Serializable {
6969
private UserRole reportingUserRole;
7070
private Disease disease;
7171
private CaseReferenceDto caze;
72+
private CaseReferenceDto resultingCase;
7273
private RegionReferenceDto region;
7374
private DistrictReferenceDto district;
7475
private CommunityReferenceDto community;
@@ -148,6 +149,15 @@ public ContactCriteria caze(CaseReferenceDto caze) {
148149
return this;
149150
}
150151

152+
public CaseReferenceDto getResultingCase() {
153+
return resultingCase;
154+
}
155+
156+
public ContactCriteria resultingCase(CaseReferenceDto resultingCase) {
157+
this.resultingCase = resultingCase;
158+
return this;
159+
}
160+
151161
public RegionReferenceDto getRegion() {
152162
return region;
153163
}

0 commit comments

Comments
 (0)