Skip to content

Commit 3d90d96

Browse files
Merge pull request #13985 from SORMAS-Foundation/bugfix-negative-test-results-updates-caseclassification
Fixed the case classification when a negative test result is detected.
2 parents 0a39398 + 46ea358 commit 3d90d96

7 files changed

Lines changed: 49 additions & 5 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,7 @@ public interface Captions {
921921
String caseLinkToSamples = "caseLinkToSamples";
922922
String caseMergeDuplicates = "caseMergeDuplicates";
923923
String caseMinusDays = "caseMinusDays";
924+
String caseNegativeCase = "caseNegativeCase";
924925
String caseNewCase = "caseNewCase";
925926
String caseNewCaseDate = "caseNewCaseDate";
926927
String caseNoDiseaseVariant = "caseNoDiseaseVariant";

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
@@ -1554,6 +1554,7 @@ public interface Strings {
15541554
String messageMissingDateFilter = "messageMissingDateFilter";
15551555
String messageMissingEpiWeekFilter = "messageMissingEpiWeekFilter";
15561556
String messageMultipleSampleReports = "messageMultipleSampleReports";
1557+
String messageNegativeCaseAfterPathogenTest = "messageNegativeCaseAfterPathogenTest";
15571558
String messageNoCaseFound = "messageNoCaseFound";
15581559
String messageNoCaseFoundToLinkImmunization = "messageNoCaseFoundToLinkImmunization";
15591560
String messageNoCasesSelected = "messageNoCasesSelected";

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ caseCalculateCompleteness=Calculate completeness
409409
caseClassificationCalculationButton=Calculate case classification
410410
caseNumberOfDuplicatesDetected=%d potential duplicates detected
411411
caseConfirmCase=Confirm case
412+
caseNegativeCase=Negative case
412413
convertEventParticipantToCase=Create case from event participant with positive test result?
413414
convertContactToCase=Create case from contact with positive test result?
414415
caseSearchSpecificCase=Search specific case

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,7 @@ messageCloneCaseWithNewDisease = You have just created a positive pathogen test
12431243
messageUpdateCaseWithNewDiseaseVariant = You have saved a positive pathogen test of a different disease variant than the variant specified in the case. Do you want to update the disease variant of the case? The case's current disease variant is %s, the pathogen test's disease variant is %s.
12441244
messageCompletenessValuesUpdated = Completeness values have been updated.
12451245
messageConfirmCaseAfterPathogenTest=The final laboratory result of the sample the saved pathogen test belongs to is positive. However, the case cannot be automatically classified as a confirmed case because it is missing some information. Do you want to set the case classification to confirmed anyway?
1246+
messageNegativeCaseAfterPathogenTest=The final laboratory result of the sample the saved pathogen test belongs to is negative. However, the case cannot be automatically classified as not a case because it is missing some information. Do you want to set the case classification to not a case anyway?
12461247
messageConvertContactToCase=You have just saved a positive laboratory result for the contact disease. Do you want to create a case for the contact person? The case will be set as the resulting case of this contact, and the final laboratory result of the sample will automatically be set to positive.
12471248
messageConvertContactToCaseDifferentDiseases=You have just saved a positive laboratory result for a different disease than the contact disease. Do you want to create a case with this disease for the contact person? The case will not be set as the resulting case of this contact.
12481249
messageConvertEventParticipantToCase=You have just saved a positive laboratory result for the event disease. Do you want to create a case for the event participant person? The case will automatically be linked to the event participant, and the final laboratory result of the sample will be set to positive.

sormas-backend/src/main/java/de/symeda/sormas/backend/caze/classification/CaseClassificationFacadeEjb.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ private void buildCriteria() {
554554
symptom(SymptomsDto.ABDOMINAL_PAIN),
555555
symptom(SymptomsDto.WEIGHT_LOSS)),
556556
xOf(1, (positiveTestResult(Disease.GIARDIASIS, PathogenTestType.MICROSCOPY, PathogenTestType.PCR_RT_PCR, PathogenTestType.CULTURE))));
557-
addCriteria(Disease.GIARDIASIS, DateHelper.getDateZero(2020, 11, 6), null, probable, confirmed, null);
557+
addCriteria(Disease.GIARDIASIS, DateHelper.getDateZero(2020, 11, 6), null, probable, confirmed, notACase(Disease.GIARDIASIS));
558558

559559
// Cryptosporidiosis
560560
probable = allOf(
@@ -572,7 +572,7 @@ private void buildCriteria() {
572572
xOf(
573573
1,
574574
(positiveTestResult(Disease.CRYPTOSPORIDIOSIS, PathogenTestType.MICROSCOPY, PathogenTestType.PCR_RT_PCR, PathogenTestType.CULTURE))));
575-
addCriteria(Disease.CRYPTOSPORIDIOSIS, DateHelper.getDateZero(2020, 11, 6), null, probable, confirmed, null);
575+
addCriteria(Disease.CRYPTOSPORIDIOSIS, DateHelper.getDateZero(2020, 11, 6), null, probable, confirmed, notACase(Disease.CRYPTOSPORIDIOSIS));
576576

577577
// CORONAVIRUS
578578
suspect = xOf(

sormas-ui/src/main/java/de/symeda/sormas/ui/contact/ContactDataView.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,9 @@ protected void initView(String params) {
228228
taskList.addStyleName(CssStyles.SIDE_COMPONENT);
229229
layout.addSidePanelComponent(taskList, TASKS_LOC);
230230
}
231-
231+
// Allowing the samples component for LUX Measles.
232232
if (!(FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG)
233-
&& List.of(Disease.INVASIVE_MENINGOCOCCAL_INFECTION, Disease.MEASLES).contains(contactDto.getDisease()))) {
233+
&& List.of(Disease.INVASIVE_MENINGOCOCCAL_INFECTION).contains(contactDto.getDisease()))) {
234234
if (UiUtil.permitted(UserRight.SAMPLE_VIEW)) {
235235
SampleListComponent sampleList = new SampleListComponent(
236236
new SampleCriteria().contact(getContactRef())
@@ -257,7 +257,8 @@ protected void initView(String params) {
257257
}
258258

259259
// Immunizations are not shown for Salmonellosis contacts
260-
if (UiUtil.permitted(FeatureType.IMMUNIZATION_MANAGEMENT, UserRight.IMMUNIZATION_VIEW) && !IMMUNIZATION_EXCLUDED_DISEASES.contains(resolvedDisease)) {
260+
if (UiUtil.permitted(FeatureType.IMMUNIZATION_MANAGEMENT, UserRight.IMMUNIZATION_VIEW)
261+
&& !IMMUNIZATION_EXCLUDED_DISEASES.contains(resolvedDisease)) {
261262
final VaccinationStatusPanel vaccinationStatusPanel = VaccinationStatusPanel.forContact(contactDto);
262263
if (contactDto.getVaccinationStatusLastUpdated() == null && UiUtil.permitted(UserRight.IMMUNIZATION_EDIT)) {
263264
showVaccinationStatusUpdateDialog(contactDto);

sormas-ui/src/main/java/de/symeda/sormas/ui/samples/PathogenTestController.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,14 @@ private void handleAssociatedCase(List<PathogenTestDto> pathogenTests, CaseRefer
458458
// However, the case cannot be automatically classified as a confirmed case because it is missing some information.
459459
// Do you want to set the case classification to confirmed anyway?
460460
this.showConfirmCaseDialog(c); // Case classification
461+
} else if (hasVerifiedNegativeTest) {
462+
// Show the confirmation dialog if there are verified negative tests.
463+
// The final laboratory result of the sample the saved pathogen test belongs to is negative. <-- sample overall result
464+
// However, the case cannot be automatically classified as not a case because it is missing some information.
465+
// Do you want to set the case classification to not a case anyway?
466+
this.showNegativeCaseDialog(caze);
467+
} else {
468+
// for other cases, no information is required.
461469
}
462470
});
463471
}
@@ -780,4 +788,35 @@ public void showConfirmCaseDialog(CaseDataDto caze) {
780788
}
781789
});
782790
}
791+
792+
/**
793+
* When the test result is negative, the case is not "confirmed" anymore, but the user might want to update the case classification to
794+
* confirmed or not a case for the negative test result. This dialog offers this option to the user.
795+
* If the user accepts the case classification change, then it'll be updated with not a case, otherwise
796+
* no change to the existing classification.
797+
*
798+
* @param caze
799+
*/
800+
public void showNegativeCaseDialog(CaseDataDto caze) {
801+
// This is applicable for all countries.
802+
// if the case is already not a case, then no need to show the dialog
803+
if (caze.getCaseClassification() == CaseClassification.NO_CASE) {
804+
return;
805+
}
806+
807+
VaadinUiUtil.showConfirmationPopup(
808+
I18nProperties.getCaption(Captions.caseNegativeCase),
809+
new Label(I18nProperties.getString(Strings.messageNegativeCaseAfterPathogenTest)),
810+
I18nProperties.getString(Strings.yes),
811+
I18nProperties.getString(Strings.no),
812+
800,
813+
confirmed -> {
814+
if (Boolean.TRUE.equals(confirmed)) {
815+
CaseDataDto caseDataByUuid = FacadeProvider.getCaseFacade().getCaseDataByUuid(caze.getUuid());
816+
caseDataByUuid.setCaseClassification(CaseClassification.NO_CASE);
817+
FacadeProvider.getCaseFacade().save(caseDataByUuid);
818+
ControllerProvider.getCaseController().navigateToCase(caseDataByUuid.getUuid());
819+
}
820+
});
821+
}
783822
}

0 commit comments

Comments
 (0)