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
Conversation
…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.
📝 WalkthroughWalkthroughThe PR retires several pathogen test types, consolidates them into ChangesPathogen test type contract and compatibility
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
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.javaast-grep timed out on this file sormas-backend/src/test/java/de/symeda/sormas/backend/caze/CaseFacadeEjbTest.javaast-grep timed out on this file sormas-backend/src/test/java/de/symeda/sormas/backend/externalmessage/labmessage/AutomaticLabMessageProcessorTest.javaast-grep retry budget exhausted before isolating this batch
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. Comment |
There was a problem hiding this comment.
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 winNormalize legacy names before MENI mapping.
This method receives a raw string, so retired aliases bypass the new
LATERAL_FLOW_ASSAYcase:RAPID_TESTandRDTmap toOTH, whileDIRECT_MICROSCOPYmatchesMICRO. Resolve the name throughLegacyEnumHelper.resolveOrNullbefore 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 winTest companion-field preservation, not only enum translation.
These tests prove that retired names become
OTHER, but do not verify thatDIRECT_MICROSCOPYandRAPID_ANTIBODY_TESTretain their captions intestTypeTextor the requested-other field. Add assertions throughSampleExportDtoand 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 winConsider adding the remaining switch-case enum values to the expected map.
The test verifies that specific
PathogenTestTypevalues don't degrade to "OTH", butSEQUENCING,GENOTYPING(→GENOSEQ),DNA_MICROARRAY, andTMA(→NUCLACID) are missing. If someone removes one of those case labels frommapToMeniDetectionMethod, 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
⛔ Files ignored due to path filters (1)
sormas-ui/src/test/resources/sormas_case_import_test_pathogen_tests.csvis excluded by!**/*.csv
📒 Files selected for processing (46)
sormas-api/src/main/java/de/symeda/sormas/api/epipulse/EpipulseDiseaseExportEntryDto.javasormas-api/src/main/java/de/symeda/sormas/api/epipulse/EpipulseLaboratoryMapper.javasormas-api/src/main/java/de/symeda/sormas/api/sample/PathogenSpecie.javasormas-api/src/main/java/de/symeda/sormas/api/sample/PathogenTestType.javasormas-api/src/main/java/de/symeda/sormas/api/sample/SampleExportDto.javasormas-api/src/main/java/de/symeda/sormas/api/sample/SampleMaterial.javasormas-api/src/main/java/de/symeda/sormas/api/utils/LegacyEnumHelper.javasormas-api/src/main/java/de/symeda/sormas/api/utils/LegacyEnumNames.javasormas-api/src/main/resources/enum.propertiessormas-api/src/test/java/de/symeda/sormas/api/epipulse/EpipulseLaboratoryMapperTest.javasormas-api/src/test/java/de/symeda/sormas/api/sample/PathogenTestTypeTest.javasormas-api/src/test/java/de/symeda/sormas/api/sample/SampleMaterialTest.javasormas-api/src/test/java/de/symeda/sormas/api/utils/LegacyEnumHelperTest.javasormas-app/app/src/androidTest/java/de/symeda/sormas/app/TestEntityCreator.javasormas-app/app/src/main/java/de/symeda/sormas/app/backend/common/DatabaseHelper.javasormas-app/app/src/main/java/de/symeda/sormas/app/backend/sample/Sample.javasormas-app/app/src/main/java/de/symeda/sormas/app/rest/LegacyEnumTypeAdapterFactory.javasormas-app/app/src/main/java/de/symeda/sormas/app/rest/RetroProvider.javasormas-app/app/src/test/java/de/symeda/sormas/app/rest/LegacyEnumTypeAdapterFactoryTest.javasormas-backend/src/main/java/de/symeda/sormas/backend/caze/classification/CaseClassificationFacadeEjb.javasormas-backend/src/main/java/de/symeda/sormas/backend/importexport/parser/ImportParserService.javasormas-backend/src/main/java/de/symeda/sormas/backend/sample/Sample.javasormas-backend/src/main/resources/sql/sormas_schema.sqlsormas-backend/src/test/java/de/symeda/sormas/backend/TestDataCreator.javasormas-backend/src/test/java/de/symeda/sormas/backend/bagexport/BAGExportFacadeEjbTest.javasormas-backend/src/test/java/de/symeda/sormas/backend/caze/CaseClassificationLogicTest.javasormas-backend/src/test/java/de/symeda/sormas/backend/caze/CaseFacadeEjbTest.javasormas-backend/src/test/java/de/symeda/sormas/backend/dashboard/sample/SampleDashboardFacadeEjbTest.javasormas-backend/src/test/java/de/symeda/sormas/backend/externalmessage/labmessage/AutomaticLabMessageProcessorTest.javasormas-backend/src/test/java/de/symeda/sormas/backend/externalmessage/processing/labmessage/AbstractLabMessageProcessingFlowTest.javasormas-backend/src/test/java/de/symeda/sormas/backend/importexport/ImportParserServiceTest.javasormas-backend/src/test/java/de/symeda/sormas/backend/sample/DeleteOldPathogenTestsAndSamplesTest.javasormas-backend/src/test/java/de/symeda/sormas/backend/sample/PathogenTestTypeRetirementTest.javasormas-backend/src/test/java/de/symeda/sormas/backend/sample/SampleFacadeEjbTest.javasormas-backend/src/test/java/de/symeda/sormas/backend/sormastosormas/SormasToSormasTest.javasormas-backend/src/test/java/de/symeda/sormas/backend/sormastosormas/entities/SormasToSormasContactFacadeEjbTest.javasormas-backend/src/test/java/de/symeda/sormas/backend/sormastosormas/entities/SormasToSormasEventFacadeEjbTest.javasormas-backend/src/test/java/de/symeda/sormas/backend/util/DtoHelperTest.javasormas-e2e-tests/src/main/resources/enum.propertiessormas-ui/src/main/java/de/symeda/sormas/ui/importer/DataImporter.javasormas-ui/src/main/java/de/symeda/sormas/ui/samples/diseasesection/MalariaSectionComponent.javasormas-ui/src/main/java/de/symeda/sormas/ui/utils/components/sidecomponent/SideComponentField.javasormas-ui/src/test/java/de/symeda/sormas/backend/TestDataCreator.javasormas-ui/src/test/java/de/symeda/sormas/ui/caze/importer/CaseImporterTest.javasormas-ui/src/test/java/de/symeda/sormas/ui/dashboard/sample/SampleDashboardDataProviderTest.javasormas-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
Fixes #
Summary by CodeRabbit