Skip to content

Bugfix mala deng issues#13994

Merged
SORMAS-JanBoehme merged 8 commits into
developmentfrom
bugfix-mala-deng-issues
Jun 19, 2026
Merged

Bugfix mala deng issues#13994
SORMAS-JanBoehme merged 8 commits into
developmentfrom
bugfix-mala-deng-issues

Conversation

@KarnaiahPesula

@KarnaiahPesula KarnaiahPesula commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Fixes #

Summary by CodeRabbit

  • New Features
    • Added a “four-fold increase in antibody titer” option to lab test reports and included it in lab message processing.
    • Expanded Dengue applicability across relevant test types and sample materials.
  • Bug Fixes
    • Updated prophylaxis adherence visibility to show only for malaria when “traveled abroad” is selected.
    • Refined exposure form behavior (e.g., conditional field enablement and travel-related visibility) and improved AIRPORT_WORKER field placement.
  • Documentation
    • Updated i18n captions for Shigellosis and revised wording for enum captions (including “Sexual contact” and high-contact environments).
  • Tests
    • Adjusted backend user lookup/filtering test expectations.

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds the fourFoldIncreaseAntibodyTiter boolean field through the full lab-message stack (SQL schema, TestReport entity, TestReportDto, facade EJB, and ExternalMessageMapper). It expands Dengue disease @Diseases annotations on PathogenTestType and SampleMaterial enum constants, applies disease-specific UI fixes to EpiDataForm (Shigellosis country caption) and ExposureForm (Malaria prophylaxis gating, setting field enable/disable), adds supporting i18n/enum captions, and updates user facade test expectations.

Changes

Malaria, Dengue and Lab Message Processing Fixes

Layer / File(s) Summary
fourFoldIncreaseAntibodyTiter: schema, entity, DTO, and facade
sormas-backend/src/main/resources/sql/sormas_schema.sql, sormas-backend/.../labmessage/TestReport.java, sormas-api/.../labmessage/TestReportDto.java, sormas-backend/.../labmessage/TestReportFacadeEjb.java
Adds fourfoldincreaseantibodytiter boolean column (default false) to testreport and testreport_history in schema version 642. Introduces the private field and public accessor/mutator in TestReport and TestReportDto. TestReportFacadeEjb maps the field bidirectionally in toDto and fillOrBuildEntity.
ExternalMessageMapper: fourFoldIncreaseAntibodyTiter propagation
sormas-api/.../processing/ExternalMessageMapper.java
Fixes the Stream.of(...) closure in mapToPathogenTest and adds a Mapping.of(...) entry that propagates fourFoldIncreaseAntibodyTiter from TestReportDto into PathogenTestDto with UI field path FOUR_FOLD_INCREASE_ANTIBODY_TITER.
Dengue @Diseases annotation expansion
sormas-api/.../sample/PathogenTestType.java, sormas-api/.../sample/SampleMaterial.java
Expands hidden @Diseases annotations on multiple PathogenTestType enum constants (molecular assay, serological, antigen-detection, culture, microscopy, susceptibility, immune assay methods) and on SampleMaterial.BONE and LUNG_TISSUE to include Disease.DENGUE alongside Disease.SHIGELLOSIS. Also reformats the cqInputApplies method documentation and return expression without changing logic.
Shigellosis country caption and Malaria prophylaxis UI fixes
sormas-ui/.../epidata/EpiDataForm.java, sormas-ui/.../exposure/ExposureForm.java
EpiDataForm overrides the COUNTRY ComboBox caption for Shigellosis using Captions.EpiData_country_SHIG and relocates AIRPORT_WORKER field registration. ExposureForm gates isProphylaxis on disease == MALARIA in addition to TRAVELED_ABROAD, explicitly disables settingField when a defaultSetting is auto-applied, and uses the same Malaria + TRAVELED_ABROAD gating in setValue.
i18n constants and enum captions
sormas-api/.../i18n/Captions.java, sormas-api/src/main/resources/captions.properties, sormas-api/src/main/resources/enum.properties
Adds the EpiData_country_SHIG constant and corresponding caption text "Place of residence of patient at the time of disease onset". Updates ExposureSubSetting.HIGH_TOUCH_ENVIRONMENTS to "High-contact environments (e.g. childcare centers, healthcare facilities)" and SEXUAL_ACTIVITY to "Sexual contact".
User facade test assertion updates
sormas-backend/src/test/java/.../user/UserFacadeEjbTest.java
Modernizes imports with explicit static and type imports. Updates testGetUsersByRegionAndRights, testGetUserRefsByDistrictsForResponsibleSurveillanceOfficer, and related test methods to expect larger user result sets and non-empty assertions in place of empty expectations, reflecting changes in user filtering or lookup behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • SORMAS-Foundation/SORMAS-Project#13584: Both PRs extend ExternalMessageMapper.mapToPathogenTest field mappings from TestReportDto into PathogenTestDto (this PR adds fourFoldIncreaseAntibodyTiter; that PR adds rsvSubtype).
  • SORMAS-Foundation/SORMAS-Project#13766: Both PRs extend the same lab-message mapping chain (TestReportDto/TestReport/TestReportFacadeEjb and ExternalMessageMapper) by adding and propagating new fields through the same code path.
  • SORMAS-Foundation/SORMAS-Project#13943: The retrieved PR updates FourFoldCtCqComponent visibility/clearing logic for the four-fold increase checkbox, which corresponds directly to the fourFoldIncreaseAntibodyTiter field added in this PR.

Suggested reviewers

  • raulbob

Poem

🐇 A titer that quadruples? Now tracked with great care,
Dengue hides its test types — the annotations are there,
Shigellosis gets captions, Malaria gates prop,
The schema migrates, the mapper won't drop.
From SQL to DTO, every field hops along —
This rabbit is pleased the lab pipeline is strong! 🧪

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete, containing only the template prompt with no issue number, no explanation of changes, and no description of what bugs are being fixed. Complete the description by specifying the issue number being fixed (e.g., 'Fixes #123') and briefly explaining the nature of the malaria/dengue-related bugs addressed.
Docstring Coverage ⚠️ Warning Docstring coverage is 5.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Bugfix mala deng issues' is vague and uses abbreviations ('mala deng') that lack clear meaning without additional context. Expand the title to use full terminology and clearly describe the specific issues being addressed (e.g., 'Fix malaria and dengue lab message processing' or similar).
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix-mala-deng-issues

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@sormas-ui/src/main/java/de/symeda/sormas/ui/exposure/ExposureForm.java`:
- Around line 425-428: The prophylaxis visibility logic in the new listener gate
(lines 425-428) correctly restricts prophylaxis fields to malaria-only travelers
by checking both disease == Disease.MALARIA and TRAVELED_ABROAD, but the load
path in the setValue method (around line 707 onward) only checks TRAVELED_ABROAD
without the disease restriction. Apply the same disease == Disease.MALARIA check
in the load path where it currently controls the visibility of
PROPHYLAXIS_ADHERENCE and TRAVEL_PURPOSE fields to ensure non-malaria disease
records cannot display prophylaxis fields through the load path, maintaining
consistency with the new malaria-only rule.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5680faab-1fcf-406a-a947-83a465dd2fa0

📥 Commits

Reviewing files that changed from the base of the PR and between be5a6cd and c5106fc.

📒 Files selected for processing (12)
  • sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/labmessage/TestReportDto.java
  • sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/ExternalMessageMapper.java
  • sormas-api/src/main/java/de/symeda/sormas/api/i18n/Captions.java
  • sormas-api/src/main/java/de/symeda/sormas/api/sample/PathogenTestType.java
  • sormas-api/src/main/java/de/symeda/sormas/api/sample/SampleMaterial.java
  • sormas-api/src/main/resources/captions.properties
  • sormas-api/src/main/resources/enum.properties
  • sormas-backend/src/main/java/de/symeda/sormas/backend/externalmessage/labmessage/TestReport.java
  • sormas-backend/src/main/java/de/symeda/sormas/backend/externalmessage/labmessage/TestReportFacadeEjb.java
  • sormas-backend/src/main/resources/sql/sormas_schema.sql
  • sormas-ui/src/main/java/de/symeda/sormas/ui/epidata/EpiDataForm.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/exposure/ExposureForm.java

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{}

1 similar comment
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{}

# Conflicts:
#	sormas-api/src/main/java/de/symeda/sormas/api/sample/PathogenTestType.java
#	sormas-api/src/main/java/de/symeda/sormas/api/sample/SampleMaterial.java
#	sormas-backend/src/main/resources/sql/sormas_schema.sql

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@sormas-backend/src/main/resources/sql/sormas_schema.sql`:
- Around line 16412-16413: The ALTER TABLE statements for testreport and
testreport_history are adding fourfoldincreaseantibodytiter as nullable boolean
columns with DEFAULT false, but the Java entity uses a primitive boolean type
which cannot be null, creating a schema-Java mismatch. To fix this, follow the
established pattern in the schema: first add an UPDATE statement to set any
existing NULL values to false in both the testreport and testreport_history
tables, then modify both ALTER TABLE statements to include the NOT NULL
constraint on the fourfoldincreaseantibodytiter columns to enforce the
non-nullable contract expected by the Java primitive boolean field.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ac11a9ad-39ae-4ef9-8c2b-895df47e5914

📥 Commits

Reviewing files that changed from the base of the PR and between c5106fc and 2cd9182.

📒 Files selected for processing (8)
  • sormas-api/src/main/java/de/symeda/sormas/api/i18n/Captions.java
  • sormas-api/src/main/java/de/symeda/sormas/api/sample/PathogenTestType.java
  • sormas-api/src/main/java/de/symeda/sormas/api/sample/SampleMaterial.java
  • sormas-api/src/main/resources/captions.properties
  • sormas-api/src/main/resources/enum.properties
  • sormas-backend/src/main/resources/sql/sormas_schema.sql
  • sormas-ui/src/main/java/de/symeda/sormas/ui/epidata/EpiDataForm.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/exposure/ExposureForm.java
✅ Files skipped from review due to trivial changes (1)
  • sormas-api/src/main/resources/enum.properties
🚧 Files skipped from review as they are similar to previous changes (5)
  • sormas-api/src/main/resources/captions.properties
  • sormas-api/src/main/java/de/symeda/sormas/api/i18n/Captions.java
  • sormas-api/src/main/java/de/symeda/sormas/api/sample/SampleMaterial.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/epidata/EpiDataForm.java
  • sormas-api/src/main/java/de/symeda/sormas/api/sample/PathogenTestType.java

Comment on lines +16412 to +16413
ALTER TABLE testreport ADD COLUMN IF NOT EXISTS fourfoldincreaseantibodytiter boolean DEFAULT false;
ALTER TABLE testreport_history ADD COLUMN IF NOT EXISTS fourfoldincreaseantibodytiter boolean DEFAULT false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify current nullability/defaults for the added columns in schema SQL
rg -n -C2 'fourfoldincreaseantibodytiter|ALTER COLUMN .* SET NOT NULL' sormas-backend/src/main/resources/sql/sormas_schema.sql

Repository: SORMAS-Foundation/SORMAS-Project

Length of output: 16223


🏁 Script executed:

fd -i testReport.java -type f

Repository: SORMAS-Foundation/SORMAS-Project

Length of output: 247


🏁 Script executed:

find . -type f -name "*.java" | xargs grep -l "class TestReport" | head -5

Repository: SORMAS-Foundation/SORMAS-Project

Length of output: 602


🏁 Script executed:

rg -l "class TestReport\b" --type java

Repository: SORMAS-Foundation/SORMAS-Project

Length of output: 173


🏁 Script executed:

cat -n sormas-backend/src/main/java/de/symeda/sormas/backend/externalmessage/labmessage/TestReport.java | grep -A5 -B5 "fourFoldIncreaseAntibodyTiter"

Repository: SORMAS-Foundation/SORMAS-Project

Length of output: 988


Enforce NOT NULL on the new boolean columns to match the Java primitive contract.

TestReport uses primitive boolean for fourFoldIncreaseAntibodyTiter (line 186), but the new DB columns allow NULL. This creates a schema-Java mismatch at the persistence boundary.

The established pattern in the schema file (see epidata.clusterrelated at lines 14651-14656) is to UPDATE existing NULLs before adding the NOT NULL constraint:

Suggested migration adjustment
ALTER TABLE testreport ADD COLUMN IF NOT EXISTS fourfoldincreaseantibodytiter boolean DEFAULT false;
ALTER TABLE testreport_history ADD COLUMN IF NOT EXISTS fourfoldincreaseantibodytiter boolean DEFAULT false;
+UPDATE testreport SET fourfoldincreaseantibodytiter = false WHERE fourfoldincreaseantibodytiter IS NULL;
+UPDATE testreport_history SET fourfoldincreaseantibodytiter = false WHERE fourfoldincreaseantibodytiter IS NULL;
+ALTER TABLE testreport ALTER COLUMN fourfoldincreaseantibodytiter SET NOT NULL;
+ALTER TABLE testreport_history ALTER COLUMN fourfoldincreaseantibodytiter SET NOT NULL;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ALTER TABLE testreport ADD COLUMN IF NOT EXISTS fourfoldincreaseantibodytiter boolean DEFAULT false;
ALTER TABLE testreport_history ADD COLUMN IF NOT EXISTS fourfoldincreaseantibodytiter boolean DEFAULT false;
ALTER TABLE testreport ADD COLUMN IF NOT EXISTS fourfoldincreaseantibodytiter boolean DEFAULT false;
ALTER TABLE testreport_history ADD COLUMN IF NOT EXISTS fourfoldincreaseantibodytiter boolean DEFAULT false;
UPDATE testreport SET fourfoldincreaseantibodytiter = false WHERE fourfoldincreaseantibodytiter IS NULL;
UPDATE testreport_history SET fourfoldincreaseantibodytiter = false WHERE fourfoldincreaseantibodytiter IS NULL;
ALTER TABLE testreport ALTER COLUMN fourfoldincreaseantibodytiter SET NOT NULL;
ALTER TABLE testreport_history ALTER COLUMN fourfoldincreaseantibodytiter SET NOT NULL;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@sormas-backend/src/main/resources/sql/sormas_schema.sql` around lines 16412 -
16413, The ALTER TABLE statements for testreport and testreport_history are
adding fourfoldincreaseantibodytiter as nullable boolean columns with DEFAULT
false, but the Java entity uses a primitive boolean type which cannot be null,
creating a schema-Java mismatch. To fix this, follow the established pattern in
the schema: first add an UPDATE statement to set any existing NULL values to
false in both the testreport and testreport_history tables, then modify both
ALTER TABLE statements to include the NOT NULL constraint on the
fourfoldincreaseantibodytiter columns to enforce the non-nullable contract
expected by the Java primitive boolean field.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@sormas-backend/src/test/java/de/symeda/sormas/backend/user/UserFacadeEjbTest.java`:
- Around line 83-84: Replace the weak assertions using
assertFalse(result.isEmpty()) at lines 83, 103, 124, and 425 with stronger
assertions that verify specific user inclusion and exclusion behavior. Instead
of only checking that the result is not empty, add assertions that verify the
expected users are present in the results and unwanted users are absent.
Additionally, assert the result size where the expected outcome is deterministic
to prevent false positives when incorrect users are returned by the filter.
- Around line 91-92: The assertion in the test method that checks result.get(1)
is order-dependent and will fail if the query results return in a different
order. Replace the index-based assertion that uses get(1) to check
natUser.toReference() with a containment assertion that verifies the
natUser.toReference() is a member of the result collection, regardless of its
position. Use an appropriate matcher like hasItem or contains to check for
membership rather than specific index positions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 12527b86-2914-487b-b7f5-b0b63a6ea6db

📥 Commits

Reviewing files that changed from the base of the PR and between 2cd9182 and c839632.

📒 Files selected for processing (1)
  • sormas-backend/src/test/java/de/symeda/sormas/backend/user/UserFacadeEjbTest.java

Comment on lines +83 to 84
assertFalse(result.isEmpty());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

These assertions are too weak for filter-behavior tests

Using only assertFalse(result.isEmpty()) (Lines 83, 103, 124, 425) can pass even when wrong users are returned. Since these tests validate filtering contracts, assert specific inclusion/exclusion (and size where deterministic) to prevent false positives.

Also applies to: 103-104, 124-125, 425-426

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@sormas-backend/src/test/java/de/symeda/sormas/backend/user/UserFacadeEjbTest.java`
around lines 83 - 84, Replace the weak assertions using
assertFalse(result.isEmpty()) at lines 83, 103, 124, and 425 with stronger
assertions that verify specific user inclusion and exclusion behavior. Instead
of only checking that the result is not empty, add assertions that verify the
expected users are present in the results and unwanted users are absent.
Additionally, assert the result size where the expected outcome is deterministic
to prevent false positives when incorrect users are returned by the filter.

Comment on lines +91 to 92
assertThat(result.get(1), equalTo(natUser.toReference()));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Avoid index-based assertion on unordered results

Line 91 asserts result.get(1) equals natUser, which makes this test order-sensitive and flaky if query ordering changes. Assert membership instead of position.

Suggested fix
-		assertThat(result.get(1), equalTo(natUser.toReference()));
+		assertThat(result, hasItem(equalTo(natUser.toReference())));
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
assertThat(result.get(1), equalTo(natUser.toReference()));
assertThat(result, hasItem(equalTo(natUser.toReference())));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@sormas-backend/src/test/java/de/symeda/sormas/backend/user/UserFacadeEjbTest.java`
around lines 91 - 92, The assertion in the test method that checks result.get(1)
is order-dependent and will fail if the query results return in a different
order. Replace the index-based assertion that uses get(1) to check
natUser.toReference() with a containment assertion that verifies the
natUser.toReference() is a member of the result collection, regardless of its
position. Use an appropriate matcher like hasItem or contains to check for
membership rather than specific index positions.

@SORMAS-JanBoehme SORMAS-JanBoehme merged commit 7eb48ed into development Jun 19, 2026
7 checks passed
@SORMAS-JanBoehme SORMAS-JanBoehme deleted the bugfix-mala-deng-issues branch June 19, 2026 14:52
@coderabbitai coderabbitai Bot mentioned this pull request Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants