Bugfix 13507 imi case classification issue#13594
Conversation
WalkthroughAdds backend logic to set a case’s epidemiologicalConfirmation during updates based on whether a known source contact’s case is CONFIRMED, and updates the UI so creating a source contact saves the associated case before refreshing the view. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant UI as UI: SourceContactListComponent
participant CF as CaseFacade
participant DB as Database
rect rgb(230,240,255)
note over UI: Create Source Contact
UI->>CF: create(contact for caseReference)
CF->>DB: persist Contact
DB-->>CF: Contact persisted
end
rect rgb(235,255,235)
note over UI: Save related Case then refresh
UI->>CF: getByUuid(caseReference.uuid)
CF-->>UI: Case entity
UI->>CF: save(Case)
CF->>DB: update Case
DB-->>CF: Case saved
UI->>UI: refreshView()
end
sequenceDiagram
autonumber
participant Svc as CaseFacadeEjb.onCaseChanged (update)
participant Repo as Contact/Case Repository
participant Case as CaseEntity
Note over Svc: existingCase != null and newCase.epiData != null
Svc->>Repo: fetch contacts with resultingCase = existingCase
Repo-->>Svc: contacts (may map to related cases)
Svc->>Svc: filter related cases by same disease and CONFIRMED
alt contactWithSourceCaseKnown == YES and confirmed source exists
Svc->>Case: set epidemiologicalConfirmation = YES
else if contactWithSourceCaseKnown == YES
Svc->>Case: set epidemiologicalConfirmation = NO
else if contactWithSourceCaseKnown == NO
Svc->>Case: set epidemiologicalConfirmation = NO
else
Svc->>Case: set epidemiologicalConfirmation = UNKNOWN
end
Note over Svc: continue with existing update follow-up
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks (1 passed, 2 warnings)❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
Poem
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.38.6)sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseFacadeEjb.java📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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). (1)
✨ Finishing touches
🧪 Generate unit tests
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: 1
🧹 Nitpick comments (3)
sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseFacadeEjb.java (1)
2210-2213: Typo in comment.“epidemiolist” → “epidemiologist”.
- // If contact with source case is known by epidemiolist, && its classified as confirmed, then set epidemiological confirmation to YES + // If contact with source case is known by epidemiologist and the source case is confirmed, set epidemiological confirmation to YESsormas-ui/src/main/java/de/symeda/sormas/ui/contact/SourceContactListComponent.java (2)
80-85: Avoid duplicate lookups; minor clean-up.Reuse the facade instance; keeps the code concise and avoids two static lookups.
- e -> view.showUnsavedChangesPopup(() -> ControllerProvider.getContactController().create(caseReference, true, () -> { - // For case classification effectiveness, extra save is needed. - // Ideally, we should mark the epi case data form as dirty when a contact is created, but we couldn't find a way to do that. - FacadeProvider.getCaseFacade().save(FacadeProvider.getCaseFacade().getByUuid(caseReference.getUuid())); - SormasUI.refreshView(); - })), + e -> view.showUnsavedChangesPopup(() -> ControllerProvider.getContactController().create(caseReference, true, () -> { + // Persist case once to trigger onCaseChanged and classification updates. + final var caseFacade = FacadeProvider.getCaseFacade(); + caseFacade.save(caseFacade.getByUuid(caseReference.getUuid())); + SormasUI.refreshView(); + })),
80-85: Move “trigger classification after contact creation” into backend flow.UI-level “save case” as a side-effect can add latency and inadvertently trigger unrelated onCaseChanged side effects (e.g., share sync). Prefer firing this from ContactFacade on successful creation so the backend remains the single source of truth for classification updates.
Would you like a backend-side proposal (ContactFacade/CaseFacade API) that updates epidemiological confirmation without a full case save?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseFacadeEjb.java(1 hunks)sormas-ui/src/main/java/de/symeda/sormas/ui/contact/SourceContactListComponent.java(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
sormas-ui/src/main/java/de/symeda/sormas/ui/contact/SourceContactListComponent.java (2)
sormas-api/src/main/java/de/symeda/sormas/api/FacadeProvider.java (1)
FacadeProvider(127-594)sormas-ui/src/main/java/de/symeda/sormas/ui/ControllerProvider.java (1)
ControllerProvider(69-362)
⏰ 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). (1)
- GitHub Check: SORMAS CI
🔇 Additional comments (1)
sormas-ui/src/main/java/de/symeda/sormas/ui/contact/SourceContactListComponent.java (1)
28-28: Import looks fine.
Fixes #
Summary by CodeRabbit