Skip to content

Retire six PathogenTestTypes per the disease/sample/test matrix workbook: ANTIGEN_DETECTION, RAPID_TEST, RAPID_ANTIGEN_DETECTION and RDT merge into LATERAL_FLOW_ASSAY. DIRECT_MICROSCOPY and RAPID_ANTIBODY_TEST have no successor and become OTHER, with their caption preserved in the free-text companion field. Un-deprecate ANTIBODY_DETECTION and MICROSCOPY, and show Bone, NP swab, Oropharyngeal swab and Tissue for Salmonellosis + Add missing Specie for Malaria#14196

Merged
raulbob merged 3 commits into
developmentfrom
bug-fix-merge-retired-tests-expand-visbility
Jul 10, 2026

Conversation

@roldy

@roldy roldy commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Fixes #

Summary by CodeRabbit

  • New Features
    • Added support for translating retired pathogen test names to current test types during imports, exports, synchronization, and data exchange.
    • Consolidated rapid and antigen-related options under Lateral Flow Assay.
  • Bug Fixes
    • Improved compatibility with older stored and exchanged data, including graceful handling of unknown values.
    • Updated disease classification, malaria result handling, and specimen availability for the revised test types.
    • Preserved existing records through database migration updates.
  • Chores
    • Updated test coverage and validation for legacy-name conversions and data migrations.

roldy added 3 commits July 10, 2026 15:25
…ook:

ANTIGEN_DETECTION, RAPID_TEST, RAPID_ANTIGEN_DETECTION and RDT merge into
LATERAL_FLOW_ASSAY. DIRECT_MICROSCOPY and RAPID_ANTIBODY_TEST have no successor
and become OTHER, with their caption preserved in the free-text companion field.
Un-deprecate ANTIBODY_DETECTION and MICROSCOPY, and show Bone, NP swab,
Oropharyngeal swab and Tissue for Salmonellosis.
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR retires several pathogen test types, consolidates them into LATERAL_FLOW_ASSAY and OTHER, adds legacy-name resolution across serialization and imports, migrates stored values in backend and Android databases, and updates disease applicability, classification, UI behavior, and tests.

Changes

Pathogen test type contract and compatibility

Layer / File(s) Summary
Enum contract and legacy resolution
sormas-api/src/main/java/de/symeda/sormas/api/sample/PathogenTestType.java, sormas-api/src/main/java/de/symeda/sormas/api/utils/*, sormas-api/src/test/java/de/symeda/sormas/api/...
Retired test types map to successor constants through @LegacyEnumNames; LegacyEnumHelper provides strict and lenient resolution with collision validation, and Jackson deserialization uses the new resolver.
Stored data and schema migration
sormas-backend/src/main/resources/sql/sormas_schema.sql, sormas-app/app/src/main/java/de/symeda/sormas/app/backend/..., sormas-backend/src/main/java/de/symeda/sormas/backend/sample/Sample.java
Postgres and Android migrations rewrite retired values, preserve successorless captions as OTHER, expand requested-test columns, and update upgrade handling.
Serialization and import/export compatibility
sormas-app/app/src/main/java/de/symeda/sormas/app/rest/*, sormas-backend/src/main/java/de/symeda/sormas/backend/importexport/*, sormas-ui/src/main/java/de/symeda/sormas/ui/importer/*, sormas-api/src/main/java/de/symeda/sormas/api/epipulse/*
Gson, CSV, sample, EpiPulse, and MENI mapping paths resolve legacy names and emit current test types.
Disease applicability and UI behavior
sormas-api/src/main/java/de/symeda/sormas/api/sample/PathogenSpecie.java, sormas-api/src/main/java/de/symeda/sormas/api/sample/SampleMaterial.java, sormas-ui/src/main/java/de/symeda/sormas/ui/samples/*, sormas-ui/src/main/java/de/symeda/sormas/ui/utils/components/sidecomponent/*
Malaria species applicability, Salmonellosis specimen visibility, malaria automatic-positive behavior, and side-component mappings use the revised test types.
Classification and dependent test fixtures
sormas-backend/src/main/java/de/symeda/sormas/backend/caze/classification/*, sormas-backend/src/test/java/de/symeda/sormas/backend/*, sormas-ui/src/test/java/*, sormas-app/src/androidTest/*
Classification criteria and affected test data replace retired antigen and rapid test constants with LATERAL_FLOW_ASSAY; related assertions are updated.
Estimated code review effort: 4 (Complex) ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant StoredData
  participant LegacyEnumHelper
  participant PathogenTestType
  participant ImportOrSync
  StoredData->>ImportOrSync: provide retired test type name
  ImportOrSync->>LegacyEnumHelper: resolve legacy name
  LegacyEnumHelper->>PathogenTestType: return successor constant
  PathogenTestType-->>ImportOrSync: use current enum value
Loading

Possibly related PRs

Suggested reviewers: raulbob, obinna-h-n, KarnaiahPesula

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only contains the template text and an empty 'Fixes #' placeholder, so the required issue reference is missing. Add the related issue number after 'Fixes #' and include a brief PR summary instead of leaving the template placeholder blank.
Docstring Coverage ⚠️ Warning Docstring coverage is 12.73% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is specific and accurately summarizes the main enum retirement and visibility changes.
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.
✨ 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 bug-fix-merge-retired-tests-expand-visbility

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.44.1)
sormas-app/app/src/main/java/de/symeda/sormas/app/backend/common/DatabaseHelper.java

ast-grep timed out on this file

sormas-backend/src/test/java/de/symeda/sormas/backend/caze/CaseFacadeEjbTest.java

ast-grep timed out on this file

sormas-backend/src/test/java/de/symeda/sormas/backend/externalmessage/labmessage/AutomaticLabMessageProcessorTest.java

ast-grep retry budget exhausted before isolating this batch

  • 14 others

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.

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
sormas-api/src/main/java/de/symeda/sormas/api/epipulse/EpipulseLaboratoryMapper.java (1)

776-805: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Normalize legacy names before MENI mapping.

This method receives a raw string, so retired aliases bypass the new LATERAL_FLOW_ASSAY case: RAPID_TEST and RDT map to OTH, while DIRECT_MICROSCOPY matches MICRO. Resolve the name through LegacyEnumHelper.resolveOrNull before the switch, while retaining the existing fallback for unknown values.

Suggested fix
 String normalized = testType.trim().toUpperCase();
+PathogenTestType resolved = LegacyEnumHelper.resolveOrNull(PathogenTestType.class, normalized);
+if (resolved != null) {
+    normalized = resolved.name();
+}

 switch (normalized) {
🤖 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-api/src/main/java/de/symeda/sormas/api/epipulse/EpipulseLaboratoryMapper.java`
around lines 776 - 805, Update mapToMeniDetectionMethod to normalize legacy
pathogen test type aliases through LegacyEnumHelper.resolveOrNull before the
switch, so RAPID_TEST and RDT resolve to LATERAL_FLOW_ASSAY and
DIRECT_MICROSCOPY resolves to MICROSCOPY. Preserve the existing
normalized-string fallback behavior for unknown or unresolved values, and keep
null/blank handling intact.
🧹 Nitpick comments (2)
sormas-api/src/test/java/de/symeda/sormas/api/sample/PathogenTestTypeTest.java (1)

316-408: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Test companion-field preservation, not only enum translation.

These tests prove that retired names become OTHER, but do not verify that DIRECT_MICROSCOPY and RAPID_ANTIBODY_TEST retain their captions in testTypeText or the requested-other field. Add assertions through SampleExportDto and the Android adapter paths so the stated compatibility requirement cannot regress.

🤖 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-api/src/test/java/de/symeda/sormas/api/sample/PathogenTestTypeTest.java`
around lines 316 - 408, The tests cover enum translation but not preservation of
retired method captions in companion fields. Extend the relevant compatibility
tests around PathogenTestType.fromLegacyName and Jackson handling to exercise
SampleExportDto and Android adapter deserialization paths, asserting
DIRECT_MICROSCOPY and RAPID_ANTIBODY_TEST map to OTHER while retaining their
original captions in testTypeText and the requested-other field.
sormas-api/src/test/java/de/symeda/sormas/api/epipulse/EpipulseLaboratoryMapperTest.java (1)

108-128: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider adding the remaining switch-case enum values to the expected map.

The test verifies that specific PathogenTestType values don't degrade to "OTH", but SEQUENCING, GENOTYPING (→GENOSEQ), DNA_MICROARRAY, and TMA (→NUCLACID) are missing. If someone removes one of those case labels from mapToMeniDetectionMethod, this test would still pass.

♻️ Optional: add missing cases for full switch coverage
 		expected.put(PathogenTestType.WHOLE_GENOME_SEQUENCING, "GENOSEQ");
 		expected.put(PathogenTestType.MULTILOCUS_SEQUENCE_TYPING, "GENOSEQ");
+		expected.put(PathogenTestType.SEQUENCING, "GENOSEQ");
+		expected.put(PathogenTestType.GENOTYPING, "GENOSEQ");
+		expected.put(PathogenTestType.DNA_MICROARRAY, "NUCLACID");
+		expected.put(PathogenTestType.TMA, "NUCLACID");
🤖 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-api/src/test/java/de/symeda/sormas/api/epipulse/EpipulseLaboratoryMapperTest.java`
around lines 108 - 128, Expand the expected map in
testMapToMeniDetectionMethod_MethodsMustNotDegradeToOther to cover the remaining
mapped PathogenTestType values: SEQUENCING → GENOSEQ, GENOTYPING → GENOSEQ,
DNA_MICROARRAY → NUCLACID, and TMA → NUCLACID. Keep the existing iteration-based
assertions so removal of any corresponding case in mapToMeniDetectionMethod
causes the test to fail.
🤖 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-api/src/main/java/de/symeda/sormas/api/sample/PathogenTestType.java`:
- Around line 683-698: Preserve legacy enum tokens before deserialization
resolves them to OTHER. Update the DTO/import boundary handling for
PathogenTestType so DIRECT_MICROSCOPY and RAPID_ANTIBODY_TEST are captured in
testTypeText before fromLegacyName or LegacyEnumHelper.resolve runs, and ensure
normal values remain unchanged. Add regression coverage verifying both legacy
names resolve to OTHER while retaining their original captions.

In `@sormas-api/src/main/java/de/symeda/sormas/api/sample/SampleExportDto.java`:
- Around line 219-226: Update the requestedPathogenTests parsing in
SampleExportDto so successorless aliases DIRECT_MICROSCOPY and
RAPID_ANTIBODY_TEST retain their original legacy captions: when either value is
encountered, append the raw s value to the requestedOtherPathogenTests
collection before the final requestedOtherPathogenTests assignment, while
preserving existing PathogenTestType conversion behavior.

---

Outside diff comments:
In
`@sormas-api/src/main/java/de/symeda/sormas/api/epipulse/EpipulseLaboratoryMapper.java`:
- Around line 776-805: Update mapToMeniDetectionMethod to normalize legacy
pathogen test type aliases through LegacyEnumHelper.resolveOrNull before the
switch, so RAPID_TEST and RDT resolve to LATERAL_FLOW_ASSAY and
DIRECT_MICROSCOPY resolves to MICROSCOPY. Preserve the existing
normalized-string fallback behavior for unknown or unresolved values, and keep
null/blank handling intact.

---

Nitpick comments:
In
`@sormas-api/src/test/java/de/symeda/sormas/api/epipulse/EpipulseLaboratoryMapperTest.java`:
- Around line 108-128: Expand the expected map in
testMapToMeniDetectionMethod_MethodsMustNotDegradeToOther to cover the remaining
mapped PathogenTestType values: SEQUENCING → GENOSEQ, GENOTYPING → GENOSEQ,
DNA_MICROARRAY → NUCLACID, and TMA → NUCLACID. Keep the existing iteration-based
assertions so removal of any corresponding case in mapToMeniDetectionMethod
causes the test to fail.

In
`@sormas-api/src/test/java/de/symeda/sormas/api/sample/PathogenTestTypeTest.java`:
- Around line 316-408: The tests cover enum translation but not preservation of
retired method captions in companion fields. Extend the relevant compatibility
tests around PathogenTestType.fromLegacyName and Jackson handling to exercise
SampleExportDto and Android adapter deserialization paths, asserting
DIRECT_MICROSCOPY and RAPID_ANTIBODY_TEST map to OTHER while retaining their
original captions in testTypeText and the requested-other 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: 5cf4f37a-a571-4c24-bf23-b2efa197d884

📥 Commits

Reviewing files that changed from the base of the PR and between ebe9ffe and fc51ca5.

⛔ Files ignored due to path filters (1)
  • sormas-ui/src/test/resources/sormas_case_import_test_pathogen_tests.csv is excluded by !**/*.csv
📒 Files selected for processing (46)
  • sormas-api/src/main/java/de/symeda/sormas/api/epipulse/EpipulseDiseaseExportEntryDto.java
  • sormas-api/src/main/java/de/symeda/sormas/api/epipulse/EpipulseLaboratoryMapper.java
  • sormas-api/src/main/java/de/symeda/sormas/api/sample/PathogenSpecie.java
  • sormas-api/src/main/java/de/symeda/sormas/api/sample/PathogenTestType.java
  • sormas-api/src/main/java/de/symeda/sormas/api/sample/SampleExportDto.java
  • sormas-api/src/main/java/de/symeda/sormas/api/sample/SampleMaterial.java
  • sormas-api/src/main/java/de/symeda/sormas/api/utils/LegacyEnumHelper.java
  • sormas-api/src/main/java/de/symeda/sormas/api/utils/LegacyEnumNames.java
  • sormas-api/src/main/resources/enum.properties
  • sormas-api/src/test/java/de/symeda/sormas/api/epipulse/EpipulseLaboratoryMapperTest.java
  • sormas-api/src/test/java/de/symeda/sormas/api/sample/PathogenTestTypeTest.java
  • sormas-api/src/test/java/de/symeda/sormas/api/sample/SampleMaterialTest.java
  • sormas-api/src/test/java/de/symeda/sormas/api/utils/LegacyEnumHelperTest.java
  • sormas-app/app/src/androidTest/java/de/symeda/sormas/app/TestEntityCreator.java
  • sormas-app/app/src/main/java/de/symeda/sormas/app/backend/common/DatabaseHelper.java
  • sormas-app/app/src/main/java/de/symeda/sormas/app/backend/sample/Sample.java
  • sormas-app/app/src/main/java/de/symeda/sormas/app/rest/LegacyEnumTypeAdapterFactory.java
  • sormas-app/app/src/main/java/de/symeda/sormas/app/rest/RetroProvider.java
  • sormas-app/app/src/test/java/de/symeda/sormas/app/rest/LegacyEnumTypeAdapterFactoryTest.java
  • sormas-backend/src/main/java/de/symeda/sormas/backend/caze/classification/CaseClassificationFacadeEjb.java
  • sormas-backend/src/main/java/de/symeda/sormas/backend/importexport/parser/ImportParserService.java
  • sormas-backend/src/main/java/de/symeda/sormas/backend/sample/Sample.java
  • sormas-backend/src/main/resources/sql/sormas_schema.sql
  • sormas-backend/src/test/java/de/symeda/sormas/backend/TestDataCreator.java
  • sormas-backend/src/test/java/de/symeda/sormas/backend/bagexport/BAGExportFacadeEjbTest.java
  • sormas-backend/src/test/java/de/symeda/sormas/backend/caze/CaseClassificationLogicTest.java
  • sormas-backend/src/test/java/de/symeda/sormas/backend/caze/CaseFacadeEjbTest.java
  • sormas-backend/src/test/java/de/symeda/sormas/backend/dashboard/sample/SampleDashboardFacadeEjbTest.java
  • sormas-backend/src/test/java/de/symeda/sormas/backend/externalmessage/labmessage/AutomaticLabMessageProcessorTest.java
  • sormas-backend/src/test/java/de/symeda/sormas/backend/externalmessage/processing/labmessage/AbstractLabMessageProcessingFlowTest.java
  • sormas-backend/src/test/java/de/symeda/sormas/backend/importexport/ImportParserServiceTest.java
  • sormas-backend/src/test/java/de/symeda/sormas/backend/sample/DeleteOldPathogenTestsAndSamplesTest.java
  • sormas-backend/src/test/java/de/symeda/sormas/backend/sample/PathogenTestTypeRetirementTest.java
  • sormas-backend/src/test/java/de/symeda/sormas/backend/sample/SampleFacadeEjbTest.java
  • sormas-backend/src/test/java/de/symeda/sormas/backend/sormastosormas/SormasToSormasTest.java
  • sormas-backend/src/test/java/de/symeda/sormas/backend/sormastosormas/entities/SormasToSormasContactFacadeEjbTest.java
  • sormas-backend/src/test/java/de/symeda/sormas/backend/sormastosormas/entities/SormasToSormasEventFacadeEjbTest.java
  • sormas-backend/src/test/java/de/symeda/sormas/backend/util/DtoHelperTest.java
  • sormas-e2e-tests/src/main/resources/enum.properties
  • sormas-ui/src/main/java/de/symeda/sormas/ui/importer/DataImporter.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/samples/diseasesection/MalariaSectionComponent.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/utils/components/sidecomponent/SideComponentField.java
  • sormas-ui/src/test/java/de/symeda/sormas/backend/TestDataCreator.java
  • sormas-ui/src/test/java/de/symeda/sormas/ui/caze/importer/CaseImporterTest.java
  • sormas-ui/src/test/java/de/symeda/sormas/ui/dashboard/sample/SampleDashboardDataProviderTest.java
  • sormas-ui/src/test/java/de/symeda/sormas/ui/externalmessage/labmessage/RelatedLabMessageHandlerTest.java
💤 Files with no reviewable changes (3)
  • sormas-e2e-tests/src/main/resources/enum.properties
  • sormas-api/src/main/resources/enum.properties
  • sormas-api/src/main/java/de/symeda/sormas/api/sample/SampleMaterial.java

@roldy roldy requested review from KarnaiahPesula and raulbob July 10, 2026 13:37
@raulbob raulbob merged commit ee350e8 into development Jul 10, 2026
7 checks passed
@raulbob raulbob deleted the bug-fix-merge-retired-tests-expand-visbility branch July 10, 2026 15:02
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