feat(microbiology): map WHONET specimen codes - #4097
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b70f7efde
ℹ️ 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".
There was a problem hiding this comment.
Pull request overview
Implements the R8 WHONET specimen mapping slice by exporting TypeOfSample.whonetCode (instead of the local specimen label), excluding only rows with missing specimen codes, and providing an exact repair/return path via Sample Type Management while removing WHONET as a parallel generic terminology authoring source.
Changes:
- Backend WHONET dataset generation now projects
TypeOfSample.whonetCodeintoSPECIMEN_TYPEand excludes unmapped specimen rows with a scoped warning pointing at the owning Sample Type. - Sample Type admin flow now supports WHONET-focused repair + return-to-preview navigation; WHONET is removed from generic terminology sources.
- Test coverage expanded across unit, security slice, persistence integration, and Playwright (foundational + demo) to protect the mapping/repair contract and schema constraints.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/org/openelisglobal/microbiology/service/MicroWhonetDatasetServiceImpl.java | Excludes isolates missing specimen WHONET code; projects specimen WHONET code + warning metadata into preview/export. |
| src/main/java/org/openelisglobal/microbiology/service/MicrobiologyUatScenarioService.java | Ensures WHONET UAT scenarios create a “pending specimen mapping” sample type and keeps the base UAT sample type mapped. |
| src/main/java/org/openelisglobal/common/management/controller/rest/SampleTypeManagementRestController.java | Removes WHONET from allowed terminology sources while allowing unchanged legacy WHONET mappings to round-trip. |
| src/test/java/org/openelisglobal/microbiology/service/MicroWhonetDatasetServiceTest.java | Adds unit tests asserting mapped specimen export and scoped exclusion/warning for unmapped specimen codes. |
| src/test/java/org/openelisglobal/microbiology/service/MicrobiologyUatScenarioServiceTest.java | Verifies multiple M4 scenarios provision distinct schema-valid sample types and pending mappings through services. |
| src/test/java/org/openelisglobal/microbiology/MicroWhonetPersistenceIntegrationTest.java | Adds persistence integration coverage to enforce distinct sample types + abbreviation constraints through real schema/service. |
| src/test/java/org/openelisglobal/common/management/controller/rest/SampleTypeManagementRestControllerSecurityTest.java | Adds security-slice coverage preventing WHONET as a terminology source while supporting legacy mapping preservation. |
| frontend/src/components/microbiology/WhonetRoutes.js | Adds specimen-type repair URL generation with validated local returnTo preservation. |
| frontend/src/components/microbiology/WhonetRoutes.test.js | Tests specimen repair URL composition and rejection of external return destinations. |
| frontend/src/components/microbiology/WhonetExport.jsx | Renders “Fix specimen mapping” links using canonical return URL state. |
| frontend/src/components/microbiology/tests/WhonetExport.test.jsx | Verifies specimen-mapping warning links point to Sample Type editor with exact preview return. |
| frontend/src/components/admin/sampleTypeManagement/SampleTypeManagement.jsx | Adds WHONET code field + focus-on-repair + explicit return link after save. |
| frontend/src/components/admin/sampleTypeManagement/SampleTypeManagement.test.jsx | Tests WHONET-focused repair flow: focus, save payload, and exact return navigation. |
| frontend/src/components/admin/sampleTypeManagement/sections/TerminologySection.jsx | Removes WHONET from selectable generic terminology sources. |
| frontend/src/languages/en.json | Adds i18n strings for WHONET specimen code field, helper text, return link, and specimen repair action. |
| frontend/playwright/helpers/seed-microbiology-data.ts | Extends WHONET export seed contract to include sampleTypeId for repair navigation. |
| frontend/playwright/tests/foundational/core/microbiology-whonet-export.spec.ts | Foundational E2E validates blocked preview → specimen repair → exact return → CSV includes SPECIMEN_TYPE=BLD. |
| frontend/playwright/tests/demo/core/ogc-782-microbiology-whonet-export.spec.ts | Demo flow updated to record specimen repair and canonical return before remaining organism mapping gap. |
| specs/782-ogc-782-microbiology-mvp-spec/tasks.md | Splits WHONET roadmap into smaller follow-on slices; marks specimen-mapping slice complete. |
| specs/782-ogc-782-microbiology-m10-whonet-export/spec.md | Documents follow-on story and requirements for mapped specimen codes and repair/return behavior. |
| specs/782-ogc-782-microbiology-m10-whonet-export/plan.md | Adds R8 engineering addendum describing reuse of TypeOfSample.whonetCode and removal of WHONET terminology source. |
| specs/782-ogc-782-microbiology-m10-whonet-export/evidence/code-qa-r8-2026-08-19.md | Adds R8 code-QA evidence and validation summary. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
6572317 to
aed5a21
Compare
aed5a21 to
a430ddc
Compare
a430ddc to
2d9606d
Compare
2d9606d to
8de226c
Compare
8de226c to
e996c45
Compare
e996c45 to
af8823a
Compare
af8823a to
7cab84d
Compare
7cab84d to
3d3e603
Compare
3d3e603 to
69ce706
Compare
69ce706 to
8f1ffb5
Compare
8f1ffb5 to
2ab45de
Compare
048cddc to
e8530db
Compare
e8530db to
3f9e7b1
Compare
3f9e7b1 to
d73373b
Compare
d73373b to
399c416
Compare
399c416 to
90fab21
Compare
90fab21 to
db090a6
Compare
db090a6 to
50a8ee9
Compare
50a8ee9 to
5d56e62
Compare
5d56e62 to
9332035
Compare
Stack
Behavior contract
Implementation notes
TypeOfSample.whonetCodeas the single specimen mapping owner.Validation
core-appPlaywright: 2 passed locally and 2 passed against the deployed AMR target.git diff --check: passed.specs/782-ogc-782-microbiology-m10-whonet-export/evidence/code-qa-r8-2026-08-19.md.AMR-S14:M4in the official fixture manifest.Deployment and UAT evidence
20260820T030323Z-bca303b5be3d.bca303b5be3d586d62c5727f611f9042bf33dff3./and/Microbiology/worklistreturned 200.SPECIMEN_TYPE=BLD.32a09dfb9adds only roadmap/evidence closure after the deployed runtime commit, so it was intentionally not redeployed.The external evidence bundle contains a 39-second H.264 MP4 and five stable screenshots covering configure, blocked preview, focused specimen repair, retained organism warning, and CSV generation.
Current check state
GitHub's backend and frontend checkpoints are red as of this update, so this PR is not merge-ready yet. Focused local and deployed validation passed, but that does not override required CI. The failed backend job did not expose failed-step logs through
gh; this needs one grounded CI diagnosis rather than repeated polling.Separate issue observed
Fresh
scripts/dev-stack upcan lose an analyzer-mock create request while attaching the mock container to the network, then poll for an analyzer that was never created. The core OpenELIS stack remains healthy and the defect is unrelated to this WHONET slice; it is recorded in the code-qa report rather than patched here.