Skip to content

Commit

Permalink
[GITFLOW]merging 'hotfix-1.74.1' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
MateStrysewske committed Aug 2, 2022
2 parents 7ed7604 + 97cdc6a commit 5aa4bb9
Show file tree
Hide file tree
Showing 42 changed files with 444 additions and 147 deletions.
2 changes: 1 addition & 1 deletion sormas-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>de.symeda.sormas</groupId>
<artifactId>sormas-base</artifactId>
<version>1.74.0</version>
<version>1.74.1</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
5 changes: 5 additions & 0 deletions sormas-api/src/main/java/de/symeda/sormas/api/Disease.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ public enum Disease
ENTEROVIRUS(true, false, true, false, 0, true, false, false),
M_PNEUMONIAE(true, false, true, false, 0, true, false, false),
C_PNEUMONIAE(true, false, true, false, 0, true, false, false),
ARI(true, false, false, false, 0, true, false, false),
CHIKUNGUNYA(true, false, false, false, 0, true, false, false),
POST_IMMUNIZATION_ADVERSE_EVENTS_MILD(true, false, false, false, 0, true, false, false),
POST_IMMUNIZATION_ADVERSE_EVENTS_SEVERE(true, false, false, false, 0, true, false, false),
FHA(true, false, false, false, 0, true, false, false),
OTHER(true, true, true, true, 21, false, false, false),
UNDEFINED(true, true, true, true, 0, false, false, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import de.symeda.sormas.api.CaseMeasure;
import de.symeda.sormas.api.CoreFacade;
import de.symeda.sormas.api.Disease;
import de.symeda.sormas.api.EditPermissionType;
import de.symeda.sormas.api.Language;
import de.symeda.sormas.api.common.DeletionDetails;
import de.symeda.sormas.api.common.Page;
Expand Down Expand Up @@ -232,4 +233,5 @@ void saveBulkEditWithFacilities(
void dearchive(List<String> entityUuids, String dearchiveReason, boolean includeContacts);

void setResultingCase(EventParticipantReferenceDto eventParticipantReferenceDto, CaseReferenceDto caseReferenceDto);
EditPermissionType isEditContactAllowed(String uuid);
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public class EventParticipantExportDto implements Serializable {
private long personAddressId;

private String eventUuid;
private Date eventReportDateTime;

private final EventStatus eventStatus;
private final EventInvestigationStatus eventInvestigationStatus;
Expand Down Expand Up @@ -177,7 +178,7 @@ public class EventParticipantExportDto implements Serializable {
private long contactCount;

//@formatter:off
public EventParticipantExportDto(long id, long personId, String personUuid, String eventParticipantUuid, String nationalHealthId, long personAddressId, boolean isInJurisdiction, String eventUuid,
public EventParticipantExportDto(long id, long personId, String personUuid, String eventParticipantUuid, String nationalHealthId, long personAddressId, boolean isInJurisdiction, String eventUuid, Date eventReportDateTime,

EventStatus eventStatus, EventInvestigationStatus eventInvestigationStatus, Disease eventDisease, TypeOfPlace typeOfPlace, Date eventStartDate, Date eventEndDate, String eventTitle, String eventDesc,
String eventRegion, String eventDistrict, String eventCommunity, String eventCity, String eventStreet, String eventHouseNumber,
Expand All @@ -197,6 +198,7 @@ public EventParticipantExportDto(long id, long personId, String personUuid, Stri
this.nationalHealthId = nationalHealthId;
this.personAddressId = personAddressId;
this.eventUuid = eventUuid;
this.eventReportDateTime = eventReportDateTime;

this.eventStatus = eventStatus;
this.eventInvestigationStatus = eventInvestigationStatus;
Expand Down Expand Up @@ -978,4 +980,8 @@ public void setVaccineUniiCode(String vaccineUniiCode) {
public void setVaccineAtcCode(String vaccineAtcCode) {
this.vaccineAtcCode = vaccineAtcCode;
}

public Date getEventReportDateTime() {
return eventReportDateTime;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ public interface Strings {
String errorNoPopulationDataLocations = "errorNoPopulationDataLocations";
String errorNoRightsForChangingField = "errorNoRightsForChangingField";
String errorNoRightsForChangingMultipleFields = "errorNoRightsForChangingMultipleFields";
String errorNotifyingExternalSurveillanceTool = "errorNotifyingExternalSurveillanceTool";
String errorNotRequiredRights = "errorNotRequiredRights";
String errorOccurred = "errorOccurred";
String errorProblemOccurred = "errorProblemOccurred";
Expand Down
4 changes: 2 additions & 2 deletions sormas-api/src/main/resources/captions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ aggregateReportNewCasesShort=C
aggregateReportThisWeek=This Week
AggregateReport.disease=Disease
AggregateReport.grouping=Grouping
AggregateReport.newCases=New cases
AggregateReport.newCases=Suspected cases
AggregateReport.labConfirmations=Lab confirmations
AggregateReport.deaths=Deaths
AggregateReport.healthFacility=Facility
Expand Down Expand Up @@ -2570,7 +2570,7 @@ SormasToSormasOptions.handOverOwnership=Hand over the ownership
SormasToSormasOptions.pseudonymizePersonalData=Exclude personal data
SormasToSormasOptions.pseudonymizeSensitiveData=Exclude sensitive data
SormasToSormasOptions.comment=Comment
sormasToSormasErrorDialogTitle=Error while sharing with another health department
sormasToSormasErrorDialogTitle=Error during share operation
sormasToSormasListTitle=Share
sormasToSormasShare=Share
sormasToSormasReturn=Return
Expand Down
10 changes: 10 additions & 0 deletions sormas-api/src/main/resources/enum.properties
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,11 @@ Disease.RHINOVIRUS = Rhinovirus
Disease.ENTEROVIRUS = Enterovirus
Disease.M_PNEUMONIAE = M.pneumoniae
Disease.C_PNEUMONIAE = C.pneumoniae
Disease.ARI = ARI (Acute Respiratory Infections)
Disease.CHIKUNGUNYA = Chikungunya
Disease.POST_IMMUNIZATION_ADVERSE_EVENTS_MILD = Post-immunization adverse events mild
Disease.POST_IMMUNIZATION_ADVERSE_EVENTS_SEVERE = Post-immunization adverse events severe
Disease.FHA = FHA (Functional Hypothalamic Amenorrhea)
Disease.Short.AFP = AFP
Disease.Short.CHOLERA = Cholera
Disease.Short.CONGENITAL_RUBELLA = CRS
Expand Down Expand Up @@ -548,6 +553,11 @@ Disease.Short.RHINOVIRUS = Rhinovirus
Disease.Short.ENTEROVIRUS = Enterovirus
Disease.Short.M_PNEUMONIAE = M.pneumoniae
Disease.Short.C_PNEUMONIAE = C.pneumoniae
Disease.Short.ARI = ARI
Disease.Short.CHIKUNGUNYA = Chikungunya
Disease.Short.POST_IMMUNIZATION_ADVERSE_EVENTS_MILD = Post-immunization adverse events mild
Disease.Short.POST_IMMUNIZATION_ADVERSE_EVENTS_SEVERE = Post-immunization adverse events severe
Disease.Short.FHA = FHA

DiseaseTransmissionMode.HUMAN_TO_HUMAN = Primarily via human to human
DiseaseTransmissionMode.ANIMAL = Primarily via animal
Expand Down
3 changes: 2 additions & 1 deletion sormas-api/src/main/resources/strings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ errorSormasToSormasResult = Unexpected error occurred while getting share result
errorSormasToSormasCertNotGenerated = Sormas to sormas certificate is not yet generated. Please contact an admin and tell them about this issue.
errorSormasToSormasEncrypt = Could not encrypt the data. Please contact an admin and tell them about this issue.
errorSormasToSormasDecrypt = Could not decrypt the shared data. Please contact an admin and tell them about this issue.
unexpectedErrorSormasToSormasAccept = The share request could not be accepted. Please contact the sender health department and your admin and tell them about this issue.
unexpectedErrorSormasToSormasAccept = The share request could not be marked as accepted on the source system.<br/><br/>The following error occurred: <b>%s</b>.<br/><br/>Please contact your admin and the admin of the source system and tell them about this issue.
errorSormasToSormasAccept = The share request could not be accepted.
errorSormasToSormasDeleteFromExternalSurveillanceTool = Failed to delete entities from external surveillance tool.
errorSormasToSormasInvalidRequestMethod = Invalid HTTP verb used
Expand Down Expand Up @@ -358,6 +358,7 @@ errorCampaignDiagramTotalsCalculationError=At least part of the percentage value
errorNoPopulationDataLocations=No population data was found for the following locations: %s
errorNoPopulationDataFound=There is no population data available. Switching to absolute data view
errorFormIdPopulationAgeGroup=Both "Form Id" and "Population Age Group" options are set
errorNotifyingExternalSurveillanceTool=Error notifying external reporting tool
errorExternalSurveillanceToolNonCoronavirusCase=Could not send the selected cases to the reporting tool because the case %s is not a %s case.
errorExternalSurveillanceToolCasesNotSharable=%d of the selected cases can not be sent to the external reporting tool.</br> Please make sure that all of the cases below are owned and allowed to be shared with the external reporting tool. Then, re-try sending or only send the ones that can be sent.
errorExternalSurveillanceToolNonClusterEvent=Could not send the selected events to the reporting tool because the event %s is not a %s cluster.
Expand Down
2 changes: 1 addition & 1 deletion sormas-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>sormas-base</artifactId>
<groupId>de.symeda.sormas</groupId>
<version>1.74.0</version>
<version>1.74.1</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
14 changes: 13 additions & 1 deletion sormas-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>sormas-base</artifactId>
<groupId>de.symeda.sormas</groupId>
<version>1.74.0</version>
<version>1.74.1</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -125,6 +125,18 @@
<groupId>info.novatec</groupId>
<artifactId>bean-test</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se</artifactId>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.core</groupId>
<artifactId>deltaspike-core-impl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.cdictrl</groupId>
<artifactId>deltaspike-cdictrl-weld</artifactId>
</dependency>

<dependency>
<groupId>org.glassfish.jersey.core</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -886,16 +886,13 @@ public List<CaseExportDto> getExportList(

List<Long> resultCaseIds = resultList.stream().map(CaseExportDto::getId).collect(Collectors.toList());
if (!resultList.isEmpty()) {
Map<Long, Symptoms> symptoms = null;
if (ExportHelper.shouldExportFields(exportConfiguration, CaseDataDto.SYMPTOMS)) {
List<Symptoms> symptomsList = null;
CriteriaQuery<Symptoms> symptomsCq = cb.createQuery(Symptoms.class);
Root<Symptoms> symptomsRoot = symptomsCq.from(Symptoms.class);
Expression<String> symptomsIdsExpr = symptomsRoot.get(Symptoms.ID);
symptomsCq.where(symptomsIdsExpr.in(resultList.stream().map(CaseExportDto::getSymptomsId).collect(Collectors.toList())));
symptomsList = em.createQuery(symptomsCq).setHint(ModelConstants.HINT_HIBERNATE_READ_ONLY, true).getResultList();
symptoms = symptomsList.stream().collect(Collectors.toMap(Symptoms::getId, Function.identity()));
}
List<Symptoms> symptomsList = null;
CriteriaQuery<Symptoms> symptomsCq = cb.createQuery(Symptoms.class);
Root<Symptoms> symptomsRoot = symptomsCq.from(Symptoms.class);
Expression<String> symptomsIdsExpr = symptomsRoot.get(Symptoms.ID);
symptomsCq.where(symptomsIdsExpr.in(resultList.stream().map(CaseExportDto::getSymptomsId).collect(Collectors.toList())));
symptomsList = em.createQuery(symptomsCq).setHint(ModelConstants.HINT_HIBERNATE_READ_ONLY, true).getResultList();
Map<Long, Symptoms> symptoms = symptomsList.stream().collect(Collectors.toMap(Symptoms::getId, Function.identity()));

Map<Long, HealthConditions> healthConditions = null;
if (exportType == null || exportType == CaseExportType.CASE_MANAGEMENT) {
Expand Down Expand Up @@ -1049,7 +1046,7 @@ public List<CaseExportDto> getExportList(
if (exportConfiguration == null || exportConfiguration.getProperties().contains(CaseExportDto.COUNTRY)) {
exportDto.setCountry(configFacade.getEpidPrefix());
}
if (symptoms != null) {
if (ExportHelper.shouldExportFields(exportConfiguration, CaseDataDto.SYMPTOMS)) {
Optional.ofNullable(symptoms.get(exportDto.getSymptomsId()))
.ifPresent(symptom -> exportDto.setSymptoms(SymptomsFacadeEjb.toDto(symptom)));
}
Expand Down Expand Up @@ -1143,10 +1140,12 @@ public List<CaseExportDto> getExportList(
filteredImmunizations.sort(Comparator.comparing(i -> ImmunizationEntityHelper.getDateForComparison(i, false)));
Immunization mostRecentImmunization = filteredImmunizations.get(filteredImmunizations.size() - 1);
Integer numberOfDoses = mostRecentImmunization.getNumberOfDoses();
Date onsetDate = Optional.ofNullable(symptoms.get(exportDto.getSymptomsId())).map(Symptoms::getOnsetDate).orElse(null);

List<Vaccination> relevantSortedVaccinations = getRelevantSortedVaccinations(
exportDto.getUuid(),
filteredImmunizations.stream().flatMap(i -> i.getVaccinations().stream()).collect(Collectors.toList()));
List<Vaccination> relevantSortedVaccinations = vaccinationService.getRelevantSortedVaccinations(
filteredImmunizations.stream().flatMap(i -> i.getVaccinations().stream()).collect(Collectors.toList()),
onsetDate,
exportDto.getReportDate());
Vaccination firstVaccination = null;
Vaccination lastVaccination = null;

Expand Down Expand Up @@ -1289,15 +1288,6 @@ private Map<Long, UserReference> getCaseUsersForExport(List<CaseExportDto> resul
return caseUsers;
}

private List<Vaccination> getRelevantSortedVaccinations(String caseUuid, List<Vaccination> vaccinations) {
Case caze = caseService.getByUuid(caseUuid);

return vaccinations.stream()
.filter(v -> vaccinationService.isVaccinationRelevant(caze, v))
.sorted(Comparator.comparing(ImmunizationEntityHelper::getVaccinationDateForComparison))
.collect(Collectors.toList());
}

private String getNumberOfDosesFromVaccinations(Vaccination vaccination) {
return vaccination != null ? vaccination.getVaccineDose() : "";
}
Expand Down Expand Up @@ -2605,6 +2595,12 @@ public void setResultingCase(EventParticipantReferenceDto eventParticipantRefere
}
}

@Override
public EditPermissionType isEditContactAllowed(String uuid) {
Case ado = service.getByUuid(uuid);
return service.isAddContactAllowed(ado);
}

@Override
public List<String> getArchivedUuidsSince(Date since) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,16 @@ public Date computeFollowUpuntilDate(Case caze, Collection<Sample> samples) {
.getFollowUpEndDate();
}

public EditPermissionType isAddContactAllowed(Case caze) {
// we allow CaseContactViewEdit independently of ownership or similar

if (!inJurisdictionOrOwned(caze)) {
return EditPermissionType.REFUSED;
}

return super.getEditPermissionType(caze);
}

@Override
public EditPermissionType getEditPermissionType(Case caze) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -848,9 +848,10 @@ public List<ContactExportDto> getExportList(
Immunization mostRecentImmunization = filteredImmunizations.get(filteredImmunizations.size() - 1);
Integer numberOfDoses = mostRecentImmunization.getNumberOfDoses();

List<Vaccination> relevantSortedVaccinations = getRelevantSortedVaccinations(
exportContact.getUuid(),
filteredImmunizations.stream().flatMap(i -> i.getVaccinations().stream()).collect(Collectors.toList()));
List<Vaccination> relevantSortedVaccinations = vaccinationService.getRelevantSortedVaccinations(
filteredImmunizations.stream().flatMap(i -> i.getVaccinations().stream()).collect(Collectors.toList()),
exportContact.getLastContactDate(),
exportContact.getReportDate());
Vaccination firstVaccination = null;
Vaccination lastVaccination = null;

Expand Down Expand Up @@ -2260,15 +2261,6 @@ private User getRandomDistrictContactResponsible(District district) {
return userService.getRandomDistrictUser(district, UserRight.CONTACT_RESPONSIBLE);
}

private List<Vaccination> getRelevantSortedVaccinations(String caseUuid, List<Vaccination> vaccinations) {
Contact contact = contactService.getByUuid(caseUuid);

return vaccinations.stream()
.filter(v -> vaccinationService.isVaccinationRelevant(contact, v))
.sorted(Comparator.comparing(ImmunizationEntityHelper::getVaccinationDateForComparison))
.collect(Collectors.toList());
}

private String getNumberOfDosesFromVaccinations(Vaccination vaccination) {
return vaccination != null ? vaccination.getVaccineDose() : "";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,21 +172,40 @@ public Map<CaseClassification, Integer> getCasesCountByClassification(DashboardC
cq.where(filter);
cq.groupBy(caze.get(Case.CASE_CLASSIFICATION));

result = em.createQuery(cq).getResultStream().collect(Collectors.toMap(tuple -> {
if (!configFacade.isConfiguredCountry(CountryHelper.COUNTRY_CODE_GERMANY)
&& CaseClassification.getConfirmedClassifications().contains((CaseClassification) tuple[0])) {
return CaseClassification.CONFIRMED;
} else {
return (CaseClassification) tuple[0];
}
}, tuple -> ((Number) tuple[1]).intValue()));
List<Object[]> resultList = em.createQuery(cq).getResultList();
boolean aggregateConfirmed = !configFacade.isConfiguredCountry(CountryHelper.COUNTRY_CODE_GERMANY);
result = getCasesCountByClassification(resultList, aggregateConfirmed);
} else {
result = Collections.emptyMap();
}

return result;
}

static Map<CaseClassification, Integer> getCasesCountByClassification(List<Object[]> classificationCountList, boolean aggregateConfirmed) {

Map<CaseClassification, Integer> result = classificationCountList.stream()
.collect(Collectors.toMap(tuple -> (CaseClassification) tuple[0], tuple -> ((Number) tuple[1]).intValue()));

if (aggregateConfirmed) {
CaseClassification confirmedKey = CaseClassification.CONFIRMED;
int confirmedSum = result.entrySet()
.stream()
.filter(e -> CaseClassification.getConfirmedClassifications().contains(e.getKey()))
.mapToInt(e -> e.getValue())
.sum();
for (CaseClassification caseClassification : CaseClassification.getConfirmedClassifications()) {
if (caseClassification == confirmedKey && confirmedSum > 0) {
result.put(confirmedKey, confirmedSum);
} else {
result.remove(caseClassification);
}
}
}

return result;
}

public Map<Disease, Long> getCaseCountByDisease(DashboardCriteria dashboardCriteria) {

CriteriaBuilder cb = em.getCriteriaBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import de.symeda.sormas.backend.common.CoreAdo;
import de.symeda.sormas.backend.disease.DiseaseVariantConverter;
import de.symeda.sormas.backend.location.Location;
import de.symeda.sormas.backend.share.ExternalShareInfo;
import de.symeda.sormas.backend.sormastosormas.entities.SormasToSormasShareable;
import de.symeda.sormas.backend.sormastosormas.origin.SormasToSormasOriginInfo;
import de.symeda.sormas.backend.sormastosormas.share.shareinfo.SormasToSormasShareInfo;
Expand Down Expand Up @@ -219,6 +220,8 @@ public class Event extends CoreAdo implements SormasToSormasShareable, HasExtern

private EventIdentificationSource eventIdentificationSource;

private List<ExternalShareInfo> externalShares = new ArrayList<>(0);

@Enumerated(EnumType.STRING)
@Column(nullable = false)
public EventStatus getEventStatus() {
Expand Down Expand Up @@ -809,4 +812,14 @@ public EventIdentificationSource getEventIdentificationSource() {
public void setEventIdentificationSource(EventIdentificationSource eventIdentificationSource) {
this.eventIdentificationSource = eventIdentificationSource;
}

@OneToMany(mappedBy = ExternalShareInfo.EVENT, fetch = FetchType.LAZY)
public List<ExternalShareInfo> getExternalShares() {
return externalShares;
}

public void setExternalShares(List<ExternalShareInfo> externalShares) {
this.externalShares = externalShares;
}

}
Loading

0 comments on commit 5aa4bb9

Please sign in to comment.