Skip to content

Commit

Permalink
Merge pull request #13164 from SORMAS-Foundation/change-#13156-hide-c…
Browse files Browse the repository at this point in the history
…ase-classification-for-RSV

#13156 Hide Case Classification for RSV and Automatically Set Default…
  • Loading branch information
leventegal-she authored Oct 25, 2024
2 parents 0221aea + 8d143e1 commit 536f9c8
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,20 @@ public class CaseDataDto extends SormasToSormasShareableDto implements IsCase {
COUNTRY_CODE_SWITZERLAND })
private Date districtLevelDate;
@Outbreaks
@Diseases(value = Disease.RESPIRATORY_SYNCYTIAL_VIRUS, hide = true)
private CaseClassification caseClassification;
@HideForCountriesExcept
private CaseIdentificationSource caseIdentificationSource;
@HideForCountriesExcept
private ScreeningType screeningType;
@Outbreaks
@Diseases(value = Disease.RESPIRATORY_SYNCYTIAL_VIRUS, hide = true)
private UserReferenceDto classificationUser;
@Outbreaks
@Diseases(value = Disease.RESPIRATORY_SYNCYTIAL_VIRUS, hide = true)
private Date classificationDate;
@Outbreaks
@Diseases(value = Disease.RESPIRATORY_SYNCYTIAL_VIRUS, hide = true)
@SensitiveData
@Size(max = FieldConstraints.CHARACTER_LIMIT_DEFAULT, message = Validations.textTooLong)
private String classificationComment;
Expand Down Expand Up @@ -567,21 +571,32 @@ public class CaseDataDto extends SormasToSormasShareableDto implements IsCase {
private YesNoUnknown bloodOrganOrTissueDonated;

@HideForCountriesExcept
@Diseases(value = {
Disease.RESPIRATORY_SYNCYTIAL_VIRUS }, hide = true)
private boolean notACaseReasonNegativeTest;

@HideForCountriesExcept
@Diseases(value = {
Disease.RESPIRATORY_SYNCYTIAL_VIRUS }, hide = true)
private boolean notACaseReasonPhysicianInformation;

@HideForCountriesExcept
@Diseases(value = {
Disease.RESPIRATORY_SYNCYTIAL_VIRUS }, hide = true)
private boolean notACaseReasonDifferentPathogen;

@HideForCountriesExcept
@Diseases(value = {
Disease.RESPIRATORY_SYNCYTIAL_VIRUS }, hide = true)
private boolean notACaseReasonOther;

@HideForCountriesExcept
@SensitiveData
@Diseases(value = {
Disease.RESPIRATORY_SYNCYTIAL_VIRUS }, hide = true)
@Size(max = FieldConstraints.CHARACTER_LIMIT_TEXT, message = Validations.textTooLong)
private String notACaseReasonDetails;

private Date followUpStatusChangeDate;
private UserReferenceDto followUpStatusChangeUser;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2066,7 +2066,8 @@ private void updateTasksOnCaseChanged(Case newCase, CaseDataDto existingCase) {
@PermitAll
public void onCaseSampleChanged(Case associatedCase) {
// Update case classification if the feature is enabled
if (configFacade.getCaseClassificationCalculationMode(associatedCase.getDisease()).isAutomaticEnabled()) {
if (configFacade.getCaseClassificationCalculationMode(associatedCase.getDisease()).isAutomaticEnabled()
& associatedCase.getDisease() != Disease.RESPIRATORY_SYNCYTIAL_VIRUS) {
if (associatedCase.getCaseClassification() != CaseClassification.NO_CASE) {
Long pathogenTestsCount = pathogenTestService.countByCase(associatedCase);
if (pathogenTestsCount == 0) {
Expand Down Expand Up @@ -2200,8 +2201,14 @@ public void onCaseChanged(CaseDataDto existingCase, Case newCase, boolean syncSh
service.updateFollowUpDetails(newCase, existingCase != null && newCase.getFollowUpStatus() != existingCase.getFollowUpStatus());

updateTasksOnCaseChanged(newCase, existingCase);

handleClassificationOnCaseChange(existingCase, newCase);
if ((existingCase == null || existingCase.getDisease() != newCase.getDisease())
&& newCase.getDisease() == Disease.RESPIRATORY_SYNCYTIAL_VIRUS) {
newCase.setCaseClassification(CaseClassification.CONFIRMED);
newCase.setClassificationDate(newCase.getReportDate());
newCase.setClassificationUser(newCase.getReportingUser());
} else {
handleClassificationOnCaseChange(existingCase, newCase);
}

// Set Yes/No/Unknown fields associated with embedded lists to Yes if the lists
// are not empty
Expand Down Expand Up @@ -2263,7 +2270,8 @@ private void handleClassificationOnCaseChange(CaseDataDto existingDto, Case save
// Update case classification if the feature is enabled
CaseClassification classification = null;
boolean setClassificationInfo = true;
if (configFacade.getCaseClassificationCalculationMode(savedCase.getDisease()).isAutomaticEnabled()) {
if (configFacade.getCaseClassificationCalculationMode(savedCase.getDisease()).isAutomaticEnabled()
& savedCase.getDisease() != Disease.RESPIRATORY_SYNCYTIAL_VIRUS) {
if (savedCase.getCaseClassification() != CaseClassification.NO_CASE
|| configFacade.isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG)) {
// calculate classification
Expand Down
29 changes: 16 additions & 13 deletions sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseDataForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -523,19 +523,6 @@ protected void addFields() {
caseClassificationGroup.removeItem(CaseClassification.CONFIRMED_UNKNOWN_SYMPTOMS);
}

if (diseaseClassificationExists() && FacadeProvider.getConfigFacade().getCaseClassificationCalculationMode(disease).isManualEnabled()) {
Button caseClassificationCalculationButton = ButtonHelper.createButton(Captions.caseClassificationCalculationButton, e -> {
CaseClassification classification = FacadeProvider.getCaseClassificationFacade().getClassification(getValue());
((Field<CaseClassification>) getField(CaseDataDto.CASE_CLASSIFICATION)).setValue(classification);
}, ValoTheme.BUTTON_PRIMARY, FORCE_CAPTION);

getContent().addComponent(caseClassificationCalculationButton, CASE_CLASSIFICATION_CALCULATE_BTN_LOC);

if (!UiUtil.permitted(UserRight.CASE_CLASSIFY)) {
caseClassificationCalculationButton.setEnabled(false);
}
}

boolean extendedClassification = FacadeProvider.getDiseaseConfigurationFacade().usesExtendedClassification(disease);

if (extendedClassification) {
Expand Down Expand Up @@ -1033,6 +1020,22 @@ protected void addFields() {
CaseDataDto.OUTCOME,
CaseDataDto.DISEASE);
setSoftRequired(true, CaseDataDto.INVESTIGATED_DATE, CaseDataDto.OUTCOME_DATE, CaseDataDto.PLAGUE_TYPE, CaseDataDto.SURVEILLANCE_OFFICER);

if (diseaseClassificationExists()
&& FacadeProvider.getConfigFacade().getCaseClassificationCalculationMode(disease).isManualEnabled()
&& isVisibleAllowed(CaseDataDto.CASE_CLASSIFICATION)) {
Button caseClassificationCalculationButton = ButtonHelper.createButton(Captions.caseClassificationCalculationButton, e -> {
CaseClassification classification = FacadeProvider.getCaseClassificationFacade().getClassification(getValue());
((Field<CaseClassification>) getField(CaseDataDto.CASE_CLASSIFICATION)).setValue(classification);
}, ValoTheme.BUTTON_PRIMARY, FORCE_CAPTION);

getContent().addComponent(caseClassificationCalculationButton, CASE_CLASSIFICATION_CALCULATE_BTN_LOC);

if (!UiUtil.permitted(UserRight.CASE_CLASSIFY)) {
caseClassificationCalculationButton.setEnabled(false);
}
}

if (isEditableAllowed(CaseDataDto.INVESTIGATED_DATE)) {
FieldHelper.setVisibleWhen(
getFieldGroup(),
Expand Down

0 comments on commit 536f9c8

Please sign in to comment.