Skip to content

#13156 Hide Case Classification for RSV and Automatically Set Default… #13164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the above condition will be hard to follow if the number of diseases with this attributes start to grow. Shouldn't we have a single place where we test the disease?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be changed when it gets hard to follow, at the moment we don't know how it will be

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
Loading