Skip to content

Fix/13938 pathogen test form issues#13943

Merged
roldy merged 3 commits into
developmentfrom
fix/13938-pathogen-test-form-issues
May 26, 2026
Merged

Fix/13938 pathogen test form issues#13943
roldy merged 3 commits into
developmentfrom
fix/13938-pathogen-test-form-issues

Conversation

@roldy
Copy link
Copy Markdown
Contributor

@roldy roldy commented May 25, 2026

Fixes #13938

Summary by CodeRabbit

  • New Features

    • Pathogen tests now display sorted by date (most recent first).
    • Enhanced disease-specific handling for pathogen test fields.
  • Bug Fixes

    • Test date validation ensures dates are after sample collection dates.
    • Duplicate enum values removed from test type lists.
    • Field visibility improved based on test results and disease type.
  • Tests

    • Added test coverage for enum value deduplication.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7d6a5412-e1ae-4fac-9b56-545099d25f15

📥 Commits

Reviewing files that changed from the base of the PR and between 7ffc9c3 and 9bb1d49.

📒 Files selected for processing (19)
  • 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/resources/captions.properties
  • sormas-api/src/main/resources/enum.properties
  • sormas-backend/src/main/java/de/symeda/sormas/backend/customizableenum/CustomizableEnumFacadeEjb.java
  • sormas-backend/src/test/java/de/symeda/sormas/backend/customizableenum/CustomizableEnumFacadeEjbTest.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/samples/PathogenTestController.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/samples/PathogenTestForm.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/samples/components/CtCqValueComponent.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/samples/components/DiseaseVariantComponent.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/samples/components/FourFoldCtCqComponent.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/samples/components/TestMethodComponent.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/samples/diseasesection/DefaultSectionComponent.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/samples/diseasesection/DengueSectionComponent.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/samples/diseasesection/IpiSectionComponent.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/samples/diseasesection/MalariaSectionComponent.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/samples/diseasesection/TuberculosisSectionComponent.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/samples/pathogentestlink/PathogenTestList.java
  • sormas-ui/src/main/java/de/symeda/sormas/ui/samples/pathogentestlink/PathogenTestListEntry.java

📝 Walkthrough

Walkthrough

This PR implements result-driven field visibility across the refactored pathogen test form, adds IPI-specific serotyping captions and display logic, fixes enum value deduplication, and improves test validation and presentation. The changes span API types, backend logic, form integration, and disease-specific UI components.

Changes

Pathogen Test Form Visibility & Validation Refactoring

Layer / File(s) Summary
API captions and type definitions
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/resources/captions.properties, sormas-api/src/main/resources/enum.properties
New IPI-specific captions for serotyping/serogroup/method; species terminology corrected from "Specie" to "Species"; AST label expanded to "Antibiotic Susceptibility Testing"; SNP_TYPING disease applicability narrowed by removing IPI.
Backend enum deduplication
sormas-backend/src/main/java/de/symeda/sormas/backend/customizableenum/CustomizableEnumFacadeEjb.java, sormas-backend/src/test/java/de/symeda/sormas/backend/customizableenum/CustomizableEnumFacadeEjbTest.java
getEnumValues applies distinct() when combining disease-specific and unspecific cached values; test verifies no duplicates when value exists in both sources.
Form validation and event-driven updates
sormas-ui/src/main/java/de/symeda/sormas/ui/samples/PathogenTestController.java, sormas-ui/src/main/java/de/symeda/sormas/ui/samples/PathogenTestForm.java
Controller enforces lab requirement for non-internal samples and test-date-before-sample-date validation; form switches to event-driven test result updates on variant selection instead of direct field mutation.
Result-driven component visibility
sormas-ui/src/main/java/de/symeda/sormas/ui/samples/components/DiseaseVariantComponent.java, sormas-ui/src/main/java/de/symeda/sormas/ui/samples/components/CtCqValueComponent.java, sormas-ui/src/main/java/de/symeda/sormas/ui/samples/components/FourFoldCtCqComponent.java
DiseaseVariantComponent, CtCqValueComponent, and FourFoldCtCqComponent track test result via event bus and hide/clear fields when result is not POSITIVE; CT-target fields now SARS-CoV-2–specific.
Test method component with disease-aware captions
sormas-ui/src/main/java/de/symeda/sormas/ui/samples/components/TestMethodComponent.java
Renders test type captions via disease-aware method (IPI-specific SEROGROUPING display); marks test date as required with validation and required indicator; validates non-null test date when visible.
Disease-specific visibility and captions
sormas-ui/src/main/java/de/symeda/sormas/ui/samples/diseasesection/DengueSectionComponent.java, sormas-ui/src/main/java/de/symeda/sormas/ui/samples/diseasesection/MalariaSectionComponent.java, sormas-ui/src/main/java/de/symeda/sormas/ui/samples/diseasesection/TuberculosisSectionComponent.java, sormas-ui/src/main/java/de/symeda/sormas/ui/samples/diseasesection/DefaultSectionComponent.java, sormas-ui/src/main/java/de/symeda/sormas/ui/samples/diseasesection/IpiSectionComponent.java
Dengue/Malaria/TB sections now gate serotype/species/scale visibility on POSITIVE result; RSV adds PCR to auto-positive test types; IPI applies localized serotyping captions.
Test list presentation
sormas-ui/src/main/java/de/symeda/sormas/ui/samples/pathogentestlink/PathogenTestList.java, sormas-ui/src/main/java/de/symeda/sormas/ui/samples/pathogentestlink/PathogenTestListEntry.java
Tests sorted by datetime descending (most recent first); result text label now shown for all diseases when flag true and text non-empty; IPI result text prefers serotypeText over serotype.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • SORMAS-Foundation/SORMAS-Project#13934: Both PRs modify PathogenTestType disease-aware toString() and reveal behavior, with this PR's IPI captioning directly building on that PR's foundational type-reveal refactoring.
  • SORMAS-Foundation/SORMAS-Project#13746: Both PRs update PathogenTestForm by ensuring disease context is available for disease-dependent captions and visibility (this PR adds IPI-specific method labeling that depends on correct disease propagation).
  • SORMAS-Foundation/SORMAS-Project#13679: Both PRs modify disease applicability in PathogenTestType by removing Disease.INVASIVE_PNEUMOCOCCAL_INFECTION from certain test type @Diseases lists (ISOLATION vs. SNP_TYPING).

Suggested reviewers

  • obinna-h-n
  • KarnaiahPesula
  • raulbob

Poem

🐰 Tests now shine bright with rules so clear,
Results drive visibility near and far,
Each disease gets captions precise,
No duplicates clutter the frame—
A rabbit rejoices, the form's now fair!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.68% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix/13938 pathogen test form issues' directly references the linked issue and accurately summarizes the main change: fixing multiple issues in the pathogen test form.
Description check ✅ Passed The PR description provides the issue number (#13938) as required by the template, though minimal additional context is given beyond the reference.
Linked Issues check ✅ Passed The PR comprehensively addresses all coding objectives from issue #13938: result-driven field visibility, disease scoping, caption/label updates, test ordering, mandatory test-date validation, and lab requirement for non-internal samples.
Out of Scope Changes check ✅ Passed All changes are directly aligned with the stated objectives in issue #13938, with no unrelated modifications to unrelated systems or scope creep detected.

✏️ 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 fix/13938-pathogen-test-form-issues

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.42.3)
sormas-api/src/main/java/de/symeda/sormas/api/i18n/Captions.java

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.

@roldy roldy merged commit fd8e870 into development May 26, 2026
7 of 8 checks passed
@roldy roldy deleted the fix/13938-pathogen-test-form-issues branch May 26, 2026 08:42
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.

Fix issues in the refactored Pathogen Test Form

2 participants