Skip to content

#13589 - Added update of person address when external message is proc…#13644

Merged
raulbob merged 2 commits intodevelopmentfrom
change-13589-persons_address_update_external_message
Nov 10, 2025
Merged

#13589 - Added update of person address when external message is proc…#13644
raulbob merged 2 commits intodevelopmentfrom
change-13589-persons_address_update_external_message

Conversation

@raulbob
Copy link
Copy Markdown
Contributor

@raulbob raulbob commented Nov 7, 2025

Implements #13589.

Summary by CodeRabbit

  • New Features
    • External message processing now updates existing person address fields (street, house number, city, postal code, country) from incoming messages.
  • API
    • Facade now exposes a safe operation to persist person updates from external messages.
  • Deprecated
    • Several physicians‑report UI components and related processing flows are now marked deprecated.
  • Tests
    • Tests updated to include more complete person data (name and sex) for scenarios that create or associate persons.

…essed

- Deprecated PhysiciansReport classes due to not being used anymore
- Deprecated ExternalMessageController.processPhysiciansReport() due to not being used anymore
@raulbob raulbob linked an issue Nov 7, 2025 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 7, 2025

Walkthrough

Adds a person-update hook to the external message processing flow: an abstract doPersonUpdates(EntitySelection<PersonDto>) is declared and invoked in the processing flow, implemented in the base to update person address fields and persisted via a new ExternalMessageProcessingFacade.updatePerson(...). Several physicians-report classes/methods are deprecated.

Changes

Cohort / File(s) Summary
Processing flow + base implementation
sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/AbstractProcessingFlow.java, sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/AbstractMessageProcessingFlowBase.java
Added abstract hook doPersonUpdates(EntitySelection<PersonDto>) to AbstractProcessingFlow and invoked it at two continuation points. Implemented doPersonUpdates in AbstractMessageProcessingFlowBase to copy address fields (house number, street, city, postal code, country) from message data into existing PersonDto with null guards and early return when no update required.
Facade: person persistence
sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/ExternalMessageProcessingFacade.java
Added public void updatePerson(PersonDto) which null-checks inputs and delegates to personFacade.save(personDto).
Physicians report deprecations
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/ExternalMessageController.java, sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/AbstractPhysiciansReportProcessingFlow.java, sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseEditComponent.java, sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseImmunizationsComponent.java, sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportProcessingFlow.java
Marked processPhysiciansReport(...) and several physicians-report classes as @Deprecated. AbstractPhysiciansReportProcessingFlow provides an empty override of doPersonUpdates.
Test data update
sormas-backend/src/test/java/de/symeda/sormas/backend/externalmessage/processing/labmessage/AbstractLabMessageProcessingFlowTest.java
Enriched test data: set last name and sex on PersonDto in testPickOrCreatePerson.

Sequence Diagram(s)

sequenceDiagram
    participant Flow as AbstractProcessingFlow
    participant Base as AbstractMessageProcessingFlowBase
    participant Facade as ExternalMessageProcessingFacade
    participant PersonSvc as PersonFacade

    Flow->>Flow: personSelection continuation
    Flow->>Base: doPersonUpdates(personSelection)
    activate Base
    Base->>Base: extract PersonDto & message Location
    opt address fields present
        Base->>Base: compare and set houseNo/street/city/postal/country
        alt any change
            Base->>Facade: updatePerson(personDto)
            activate Facade
            Facade->>PersonSvc: save(personDto)
            Facade-->>Base: saved
            deactivate Facade
        else no change
            Base-->>Flow: return (no-op)
        end
    end
    deactivate Base
    Flow->>Flow: continue processing
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Heterogeneous changes across API, UI, facade, and tests require checking integration points.
  • Review focus:
    • Correctness of null/empty checks and comparison logic in doPersonUpdates.
    • Proper invocation points in AbstractProcessingFlow (do they cover all required continuations).
    • Behavior and visibility of ExternalMessageProcessingFacade.updatePerson() relative to existing facade patterns.
    • Deprecation annotations on UI classes for any downstream usage.

Possibly related PRs

Suggested reviewers

  • obinna-h-n
  • KarnaiahPesula

Poem

🐇 I nibble fields and hop along,
Updating streets where they belong.
Deprecated paths whisper low,
New hooks help the addresses grow.
A tiny rabbit, patch in paw—now on we go!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The description references the related issue #13589 but lacks detailed explanation of what changes were made, why they were needed, and how to verify them. Expand the description to explain the specific changes made (new hook method, person updates logic), the motivation behind the implementation, and any testing performed.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding an update of person address when external messages are processed, which aligns with the primary purpose of the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch change-13589-persons_address_update_external_message

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.39.7)
sormas-backend/src/test/java/de/symeda/sormas/backend/externalmessage/processing/labmessage/AbstractLabMessageProcessingFlowTest.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.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (6)
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/AbstractPhysiciansReportProcessingFlow.java (1)

40-40: Document the deprecation with JavaDoc.

The @Deprecated annotation should be accompanied by a JavaDoc @deprecated tag explaining why this class is deprecated, what should be used instead, and when it will be removed.

Apply this diff to add proper deprecation documentation:

+/**
+ * @deprecated This physicians report processing flow is deprecated. Use the new external message processing flow instead.
+ */
 @Deprecated
 public abstract class AbstractPhysiciansReportProcessingFlow extends AbstractProcessingFlow {
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseImmunizationsComponent.java (1)

63-63: Document the deprecation with JavaDoc.

The @Deprecated annotation should be accompanied by a JavaDoc @deprecated tag explaining why this component is deprecated, what should be used instead, and when it will be removed.

Apply this diff to add proper deprecation documentation:

+/**
+ * @deprecated This component is deprecated as part of the physicians report flow deprecation.
+ */
 @Deprecated
 public class PhysiciansReportCaseImmunizationsComponent extends CommitDiscardWrapperComponent<VerticalLayout> {
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/ExternalMessageController.java (1)

212-212: Document the deprecation with JavaDoc.

The @Deprecated annotation should be accompanied by a JavaDoc @deprecated tag explaining why this method is deprecated, what should be used instead, and when it will be removed.

Apply this diff to add proper deprecation documentation:

+	/**
+	 * @deprecated This method is deprecated as part of the physicians report flow deprecation.
+	 */
 	@Deprecated
 	public void processPhysiciansReport(String uuid) {
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseEditComponent.java (1)

45-45: Document the deprecation with JavaDoc.

The @Deprecated annotation should be accompanied by a JavaDoc @deprecated tag explaining why this component is deprecated, what should be used instead, and when it will be removed.

Apply this diff to add proper deprecation documentation:

+/**
+ * @deprecated This component is deprecated as part of the physicians report flow deprecation.
+ */
 @Deprecated
 public class PhysiciansReportCaseEditComponent extends CommitDiscardWrapperComponent<VerticalLayout> {
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportProcessingFlow.java (1)

44-44: Document the deprecation with JavaDoc.

The @Deprecated annotation should be accompanied by a JavaDoc @deprecated tag explaining why this class is deprecated, what should be used instead, and when it will be removed.

Apply this diff to add proper deprecation documentation:

+/**
+ * @deprecated This processing flow is deprecated as part of the physicians report flow deprecation.
+ */
 @Deprecated
 public class PhysiciansReportProcessingFlow extends AbstractPhysiciansReportProcessingFlow {
sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/ExternalMessageProcessingFacade.java (1)

250-259: Remove redundant null check and consider adding logging.

The personFacade null check at line 251 is unnecessary since personFacade is a protected final field initialized in the constructor (line 108). This check can never be true in normal operation.

Additionally, consider adding debug logging to track when person updates occur for better observability.

Apply this diff to improve the implementation:

 	public void updatePerson(PersonDto personDto) {
-		if(personFacade == null) {
-			return;
-		}
 		if(personDto == null) {
 			return;
 		}
 
 		personFacade.save(personDto);
 	}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b715df4 and b173e4d.

📒 Files selected for processing (8)
  • sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/AbstractMessageProcessingFlowBase.java (3 hunks)
  • sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/AbstractProcessingFlow.java (2 hunks)
  • sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/ExternalMessageProcessingFacade.java (1 hunks)
  • sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/ExternalMessageController.java (1 hunks)
  • sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/AbstractPhysiciansReportProcessingFlow.java (2 hunks)
  • sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseEditComponent.java (1 hunks)
  • sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseImmunizationsComponent.java (1 hunks)
  • sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportProcessingFlow.java (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (5)
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseEditComponent.java (1)
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportProcessingFlow.java (1)
  • Deprecated (44-109)
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/AbstractPhysiciansReportProcessingFlow.java (3)
sormas-api/src/main/java/de/symeda/sormas/api/utils/dataprocessing/EntitySelection.java (1)
  • EntitySelection (18-40)
sormas-api/src/main/java/de/symeda/sormas/api/utils/dataprocessing/HandlerCallback.java (1)
  • HandlerCallback (20-35)
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportProcessingFlow.java (1)
  • Deprecated (44-109)
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/ExternalMessageController.java (4)
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/AbstractPhysiciansReportProcessingFlow.java (1)
  • Deprecated (40-146)
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseEditComponent.java (1)
  • Deprecated (45-239)
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseImmunizationsComponent.java (1)
  • Deprecated (63-353)
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportProcessingFlow.java (1)
  • Deprecated (44-109)
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportProcessingFlow.java (4)
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/AbstractPhysiciansReportProcessingFlow.java (1)
  • Deprecated (40-146)
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseEditComponent.java (1)
  • Deprecated (45-239)
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/physiciansreport/PhysiciansReportCaseImmunizationsComponent.java (1)
  • Deprecated (63-353)
sormas-backend/src/test/java/de/symeda/sormas/backend/TestDataCreator.java (1)
  • Deprecated (2494-2508)
sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/AbstractMessageProcessingFlowBase.java (1)
sormas-api/src/main/java/de/symeda/sormas/api/utils/dataprocessing/EntitySelection.java (1)
  • EntitySelection (18-40)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: android app test (26)
  • GitHub Check: android app test (27)
  • GitHub Check: android app test (28)
  • GitHub Check: SORMAS CI
🔇 Additional comments (1)
sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/AbstractProcessingFlow.java (1)

154-178: LGTM! Well-designed extension point.

The addition of the doPersonUpdates hook is well-placed in the processing flow, invoked after person selection and before building the result. The abstract method ensures all subclasses must provide an implementation (even if empty), making the contract explicit.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
sormas-backend/src/test/java/de/symeda/sormas/backend/externalmessage/processing/labmessage/AbstractLabMessageProcessingFlowTest.java (1)

448-451: LGTM! Test data enrichment looks good.

The addition of lastName and sex fields enriches the test data for the person selection scenario, which is helpful for ensuring the lab message processing flow handles these fields correctly.

Minor observation: The lastName "Ftest" matches the firstName, creating "Ftest Ftest", while testCreatePerson() uses distinct values ("Ftest"/"Ltest"). This inconsistency is minor since it's just test fixture data, but using distinct values might make the test data clearer.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b173e4d and 506740d.

📒 Files selected for processing (1)
  • sormas-backend/src/test/java/de/symeda/sormas/backend/externalmessage/processing/labmessage/AbstractLabMessageProcessingFlowTest.java (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: android app test (28)
  • GitHub Check: android app test (26)
  • GitHub Check: android app test (27)
  • GitHub Check: SORMAS CI

@sormas-vitagroup
Copy link
Copy Markdown
Contributor

@raulbob raulbob merged commit 39756f6 into development Nov 10, 2025
8 of 13 checks passed
@raulbob raulbob deleted the change-13589-persons_address_update_external_message branch November 10, 2025 09:00
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.

Update Person's Address when processing External Messages

3 participants