feat(microbiology): add worklist and critical communication (OGC-782) - #4135
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f69ddc433f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for (MicroCase microCase : caseDAO.getOpenCases()) { | ||
| rows.add(toRow(microCase)); |
There was a problem hiding this comment.
Page before hydrating every open case
On laboratories with hundreds of open cases, this loop constructs every row before applying filters or pagination; toRow then performs separate isolate, communication, sibling, and per-isolate AST queries. A request for 20 rows therefore issues hundreds of queries and loads the entire queue, making the new operational worklist increasingly unusable as case volume grows. Fetch the response data in a bounded, joined DAO query and paginate at the database.
AGENTS.md reference: AGENTS.md:L340-L345
Useful? React with 👍 / 👎.
| for (MicroIsolate isolate : isolates) { | ||
| if (MicroIsolateSignificance.CLINICALLY_SIGNIFICANT.name().equals(isolate.getSignificance())) { | ||
| return "AST_ENTRY"; |
There was a problem hiding this comment.
Send reviewed AST cases to case review
When a clinically significant isolate already has only REVIEWED AST runs, needsAstReview is false but this unconditional significance check still returns AST_ENTRY. Consequently a completed AST case—including one at REVIEW_READY—continues to tell the shared queue that AST entry is due instead of advancing to case review.
Useful? React with 👍 / 👎.
| .then(() => { | ||
| setRecipient(""); |
There was a problem hiding this comment.
Preserve failed critical-communication submissions
When the POST returns a validation/server error or encounters a network failure, postToOpenElisServerJsonResponse resolves its callback with an error object or undefined rather than rejecting, so this unconditional success handler clears the recipient and urgent message and refreshes as though the communication were saved. Inspect the returned status before clearing the clinical entry and surface the failure to the user.
Useful? React with 👍 / 👎.
| service={service} | ||
| saving={saving} | ||
| /> | ||
| <CriticalCommunicationPanel caseId={caseDetail.id} service={service} /> |
There was a problem hiding this comment.
Pass available targets into the communication panel
The case detail already contains sampleItemId and isolates, but this invocation passes neither to the panel. Selecting SAMPLE_ITEM therefore produces an empty disabled target and can never be submitted, while isolate targeting falls back to asking users to manually enter an opaque ID instead of presenting the case's isolates; pass the available case context (and report-result IDs when available) through these props.
Useful? React with 👍 / 👎.
| page.getByRole("heading", { name: "Microbiology case" }), | ||
| ).toBeVisible({ timeout: LONG_TIMEOUT }); | ||
|
|
||
| await accordionButton(page, "Critical communication").click(); |
There was a problem hiding this comment.
Match the Playwright flow to the rendered case page
In the newly registered core-app flow, this click always times out because the reviewed MicrobiologyCaseView.jsx renders a flat Stack and neither it nor its children render a Carbon accordion heading named “Critical communication.” The test therefore cannot reach the communication workflow and will fail whenever the foundational project runs; interact with the actual visible panel or add the accordion UI the test expects.
Useful? React with 👍 / 👎.
| )); | ||
| ALTER TABLE clinlims.alert DROP CONSTRAINT chk_alert_entity_id_or_ref; | ||
| </sql> | ||
| <addNotNullConstraint tableName="alert" schemaName="clinlims" columnName="alert_entity_id" columnDataType="bigint"/> |
There was a problem hiding this comment.
Remove ref-backed alerts before restoring NOT NULL
If this feature has created any microbiology alert, its alert_entity_id is null by design, so rollback reaches this addNotNullConstraint while those rows still exist and PostgreSQL rejects it. The rollback cannot complete in exactly the post-use recovery scenario it is intended for; delete or migrate ref-backed rows before restoring the numeric-column constraint.
AGENTS.md reference: AGENTS.md:L423-L431
Useful? React with 👍 / 👎.
| workflow: formatMicrobiologyEnum(row.workflowType), | ||
| stage: formatMicrobiologyEnum(row.stage), | ||
| due: formatMicrobiologyEnum(row.dueAction), | ||
| urgency: formatMicrobiologyEnum(row.urgency), |
There was a problem hiding this comment.
In every non-English locale, these workflow, stage, action, and urgency values remain title-cased English because formatMicrobiologyEnum performs string manipulation rather than a React Intl lookup. The same helper is also used in the new filters and communication panel, leaving core microbiology controls untranslated; map these enum values to message IDs and render them with intl.formatMessage.
AGENTS.md reference: AGENTS.md:L436-L447
Useful? React with 👍 / 👎.
f69ddc4 to
25ecfe8
Compare
There was a problem hiding this comment.
Pull request overview
Adds the microbiology shared worklist (with canonical URL state) and introduces critical-result communication logging with lifecycle synchronization to the existing Alerts surface, plus menu/navigation wiring and supporting DB migrations.
Changes:
- Add microbiology worklist backend service + REST endpoint and corresponding React worklist UI with routing/state preservation.
- Add microbiology critical communication entity/service/endpoints, including projection into generic Alerts and alert lifecycle synchronization.
- Add Liquibase migrations for
micro_critical_communicationand string-keyed alert entities (alert_entity_ref), plus menu configuration overlay for Microbiology navigation.
Reviewed changes
Copilot reviewed 70 out of 70 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| volume/menu/menu_config.json | Adds microbiology menu include + configured menu definition for worklist. |
| src/test/resources/persistence/test-persistence.xml | Registers MicroCriticalCommunication in test JPA persistence. |
| src/test/java/org/openelisglobal/microbiology/service/MicroWorklistServiceTest.java | Unit tests for worklist sorting/filtering/summary behavior. |
| src/test/java/org/openelisglobal/microbiology/service/MicroCriticalCommunicationServiceTest.java | Unit tests for logging/ack/close + alert projection sync. |
| src/test/java/org/openelisglobal/microbiology/service/MicrobiologyCriticalAlertLifecycleListenerTest.java | Tests alert lifecycle listener triggers microbiology sync. |
| src/test/java/org/openelisglobal/microbiology/MicroCriticalCommunicationAlertIntegrationTest.java | Integration test for critical comm ↔ alert dashboard synchronization. |
| src/test/java/org/openelisglobal/microbiology/MicrobiologyOrmValidationTest.java | ORM metamodel validation includes MicroCriticalCommunication. |
| src/test/java/org/openelisglobal/microbiology/MicrobiologyArchitectureTest.java | Ensures new microbiology controllers don’t declare transactions. |
| src/test/java/org/openelisglobal/menu/util/MenuConfigurationLoaderTest.java | Tests config-driven menu materialization/overlay behavior. |
| src/test/java/org/openelisglobal/alert/service/AlertServiceTest.java | Tests string-keyed alerts (entity ref) creation/dedup/filtering. |
| src/main/resources/persistence/persistence.xml | Registers MicroCriticalCommunication in main JPA persistence. |
| src/main/resources/liquibase/3.5.x.x/base.xml | Includes new microbiology/alert lifecycle changelogs. |
| src/main/resources/liquibase/3.5.x.x/058-microbiology-critical-lifecycle.xml | Adds target/lifecycle/alert linkage columns + constraints/indexes. |
| src/main/resources/liquibase/3.5.x.x/057-alert-entity-ref.xml | Adds alert_entity_ref and DB constraint for id-or-ref semantics. |
| src/main/resources/liquibase/3.5.x.x/054-microbiology-worklists-critical.xml | Creates micro_critical_communication table and FKs/indexes. |
| src/main/java/org/openelisglobal/microbiology/valueholder/MicroCriticalCommunicationTargetType.java | Enum for critical comm target types. |
| src/main/java/org/openelisglobal/microbiology/valueholder/MicroCriticalCommunicationStatus.java | Enum for critical comm ack/close statuses. |
| src/main/java/org/openelisglobal/microbiology/valueholder/MicroCriticalCommunication.java | JPA entity for clinical critical communication log. |
| src/main/java/org/openelisglobal/microbiology/valueholder/MicroCaseActivityType.java | Adds activity types for critical communication lifecycle. |
| src/main/java/org/openelisglobal/microbiology/service/MicroWorklistServiceImpl.java | Worklist assembly, filtering, sorting, summary computation. |
| src/main/java/org/openelisglobal/microbiology/service/MicroWorklistService.java | Service interface for microbiology worklist retrieval. |
| src/main/java/org/openelisglobal/microbiology/service/MicroCriticalCommunicationServiceImpl.java | Critical comm logging + alert projection + lifecycle sync logic. |
| src/main/java/org/openelisglobal/microbiology/service/MicroCriticalCommunicationService.java | Service interface for critical communication operations. |
| src/main/java/org/openelisglobal/microbiology/service/MicrobiologyCriticalAlertLifecycleListener.java | Event listener bridging alert actions back to clinical record. |
| src/main/java/org/openelisglobal/microbiology/form/MicroWorklistSummaryForm.java | DTO for worklist summary tile counts. |
| src/main/java/org/openelisglobal/microbiology/form/MicroWorklistRowForm.java | DTO for individual worklist row data. |
| src/main/java/org/openelisglobal/microbiology/form/MicroWorklistQueryForm.java | DTO for server-side worklist query state. |
| src/main/java/org/openelisglobal/microbiology/form/MicroWorklistPageForm.java | DTO for worklist page response (rows + summary + paging). |
| src/main/java/org/openelisglobal/microbiology/form/MicroCriticalCommunicationRequestForm.java | REST request form for critical communication actions. |
| src/main/java/org/openelisglobal/microbiology/form/MicroCriticalCommunicationForm.java | REST response form for critical communication data. |
| src/main/java/org/openelisglobal/microbiology/daoimpl/MicroCriticalCommunicationDAOImpl.java | DAO queries for case- and alert-linked communications. |
| src/main/java/org/openelisglobal/microbiology/daoimpl/MicroCaseDAOImpl.java | Adds getOpenCases() query for worklist source. |
| src/main/java/org/openelisglobal/microbiology/dao/MicroCriticalCommunicationDAO.java | DAO interface for critical communications. |
| src/main/java/org/openelisglobal/microbiology/dao/MicroCaseDAO.java | DAO interface extended with getOpenCases(). |
| src/main/java/org/openelisglobal/microbiology/controller/rest/MicroWorklistRestController.java | REST endpoint for worklist page retrieval. |
| src/main/java/org/openelisglobal/microbiology/controller/rest/MicroCriticalCommunicationRestController.java | REST endpoints for listing/logging/ack/close critical comms. |
| src/main/java/org/openelisglobal/menu/util/MenuUtil.java | Loads config-driven menus into runtime menu tree build. |
| src/main/java/org/openelisglobal/menu/util/MenuConfigurationLoader.java | Implements overlay/materialization of mounted menu config JSON. |
| src/main/java/org/openelisglobal/alert/valueholder/AlertType.java | Adds MICROBIOLOGY_CRITICAL alert type. |
| src/main/java/org/openelisglobal/alert/valueholder/Alert.java | Adds alertEntityRef and makes alertEntityId nullable. |
| src/main/java/org/openelisglobal/alert/service/impl/AlertServiceImpl.java | Adds create/get methods for ref-keyed alerts + dedup by ref. |
| src/main/java/org/openelisglobal/alert/service/AlertService.java | Service API for ref-keyed alerts. |
| src/main/java/org/openelisglobal/alert/form/AlertDTO.java | Adds alertEntityRef to REST DTO. |
| src/main/java/org/openelisglobal/alert/dao/AlertDAOImpl.java | Adds HQL queries for fetching alerts by entity ref. |
| src/main/java/org/openelisglobal/alert/dao/AlertDAO.java | DAO API for fetching alerts by entity ref. |
| src/main/java/org/openelisglobal/alert/controller/rest/AlertRestController.java | Exposes alertEntityRef on REST responses. |
| specs/782-ogc-782-microbiology-mvp-spec/tasks.md | Marks M6 tasks completed. |
| specs/782-ogc-782-microbiology-mvp-spec/playwright-plan.md | Documents M6 Playwright flow plan. |
| frontend/src/pages/MicrobiologyWorklistPage.jsx | Adds page wrapper for microbiology worklist. |
| frontend/src/languages/en.json | Adds i18n keys for microbiology worklist/critical comm + alert type. |
| frontend/src/components/notifications/SlideOverNotifications.jsx | Changes SW registration path logic (currently broken; see comments). |
| frontend/src/components/microbiology/MicrobiologyWorklist.css | Adds worklist layout/styling including mobile table containment. |
| frontend/src/components/microbiology/MicrobiologyService.js | Adds API calls for worklist + critical communications. |
| frontend/src/components/microbiology/MicrobiologyRoutes.test.js | Tests URL composition/parsing determinism for microbiology routes. |
| frontend/src/components/microbiology/MicrobiologyRoutes.js | Adds canonical route helpers and URL state normalization/parsing. |
| frontend/src/components/microbiology/MicrobiologyCaseView.jsx | Adds critical communication panel to case view. |
| frontend/src/components/microbiology/CriticalCommunicationPanel.jsx | Adds UI for logging/ack/closing critical communications. |
| frontend/src/components/microbiology/CaseTimelinePanel.jsx | Refines timeline UI and adds setup details capture fields. |
| frontend/src/components/microbiology/tests/MicrobiologyWorklist.test.jsx | React tests for worklist rendering and URL state updates. |
| frontend/src/components/microbiology/tests/MicrobiologyCaseView.test.jsx | Updates case view tests for new setup/timeline labels and critical stubs. |
| frontend/src/components/microbiology/tests/CriticalCommunicationPanel.test.jsx | React tests for critical comm targets/log/ack/close flow. |
| frontend/src/components/layout/Layout.test.jsx | Adds layout tests for microbiology nav locking behavior. |
| frontend/src/components/layout/Layout.jsx | Adds microbiology route context to layout navigation logic. |
| frontend/src/components/alerts/AlertsDashboard.jsx | Adds microbiology critical type to alert filters. |
| frontend/src/components/alerts/tests/AlertsDashboard.test.jsx | Tests microbiology critical filter option + row rendering. |
| frontend/src/App.jsx | Adds microbiology worklist route + redirects for canonical paths. |
| frontend/playwright/tests/foundational/core/microbiology-worklist-critical.spec.ts | Adds Playwright coverage for worklist + critical comm + mobile containment (currently broken; see comments). |
| frontend/playwright/helpers/seed-microbiology-data.ts | Adds seeded sibling-case setup and improved cleanup for worklist tests. |
| frontend/playwright.config.ts | Registers new microbiology worklist Playwright test in core-app. |
Suppressed comments (1)
frontend/src/components/notifications/SlideOverNotifications.jsx:105
getServiceWorkerUrlis imported fromserviceWorkerRegistrationbut that module doesn't export it, which will break the frontend build. Either add/export that helper or register the service worker using the existing known path string here.
const registration = await navigator.serviceWorker
.register(getServiceWorkerUrl())
.catch((error) => {
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
62b0c86 to
7572230
Compare
c881ddd to
8920bcd
Compare
8920bcd to
1989831
Compare
1989831 to
40d3f64
Compare
40d3f64 to
846e831
Compare
Summary
Third OGC-782 implementation layer: shared microbiology work management and critical-result communication.
Scope
Validation
Stack And Documents