Skip to content

feat(microbiology): map WHONET specimen codes - #4097

Open
pmanko wants to merge 12 commits into
feat/782-ogc-782-microbiology-r7-analyzer-ast-review-qcfrom
feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping
Open

feat(microbiology): map WHONET specimen codes#4097
pmanko wants to merge 12 commits into
feat/782-ogc-782-microbiology-r7-analyzer-ast-review-qcfrom
feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping

Conversation

@pmanko

@pmanko pmanko commented Aug 19, 2026

Copy link
Copy Markdown
Member

Stack

Behavior contract

  • Export the configured Sample Type WHONET specimen code rather than the local display label.
  • Exclude only rows affected by a missing specimen code and report one exact, scoped warning.
  • Open the owning Sample Type editor with the WHONET field focused.
  • Return explicitly to the same canonical WHONET preview after saving.
  • Keep mapped rows exportable when unrelated rows remain unmapped.
  • Remove the competing generic WHONET terminology authoring path.
  • Use a dedicated service-created UAT fixture with no SQL, fixed persisted IDs, or DAO bypass.

Implementation notes

  • Reuses TypeOfSample.whonetCode as the single specimen mapping owner.
  • Adds no schema change and no Liquibase migration.
  • Preserves the existing long-format CSV contract.
  • Splits the formerly coarse remaining WHONET roadmap into executable follow-on slices.
  • Gives each service-created M4 scenario a distinct, schema-valid sample-type abbreviation. A real persistence integration test protects both uniqueness and the existing 10-character database constraint.

Validation

  • Focused backend suite: 38 passed.
  • Post-fix fixture/controller/dataset subset: 24 passed.
  • Security subset: 6 passed.
  • Real-schema fixture persistence integration: 1 passed.
  • Focused frontend: 16 passed.
  • Registered core-app Playwright: 2 passed locally and 2 passed against the deployed AMR target.
  • Standard desktop demo/video: passed.
  • Java Spotless, targeted formatting, and git diff --check: passed.
  • Slice-level code-qa report: specs/782-ogc-782-microbiology-m10-whonet-export/evidence/code-qa-r8-2026-08-19.md.
  • Repository-wide TypeScript still has pre-existing baseline errors; touched R8 files add zero errors.
  • Review-tooling seed contract and repository contracts pass with AMR-S14:M4 in the official fixture manifest.

Deployment and UAT evidence

  • AMR deployment: 20260820T030323Z-bca303b5be3d.
  • Deployed application commit: bca303b5be3d586d62c5727f611f9042bf33dff3.
  • Deployment health and smoke checks passed; / and /Microbiology/worklist returned 200.
  • The official review-tooling seed successfully provisioned the AMR-S14 M4 fixture.
  • Live registered Playwright proved the blocked preview, focused specimen repair, exact canonical return, partial eligibility, remaining organism warning, and two-row CSV with SPECIMEN_TYPE=BLD.
  • Grist AMR-S14 is version 2.0 with seven required, ordered reviewer steps. The live Review overlay shows the story, full context, and deployed application SHA.
  • PR head 32a09dfb9 adds 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 up can 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Copilot AI lite review requested due to automatic review settings August 24, 2026 05:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.whonetCode into SPECIMEN_TYPE and 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.

@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from 6572317 to aed5a21 Compare August 24, 2026 08:31
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from aed5a21 to a430ddc Compare August 24, 2026 13:22
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from a430ddc to 2d9606d Compare August 24, 2026 15:25
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from 2d9606d to 8de226c Compare August 24, 2026 17:06
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from 8de226c to e996c45 Compare August 24, 2026 17:26
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from e996c45 to af8823a Compare August 24, 2026 18:57
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from af8823a to 7cab84d Compare August 24, 2026 19:40
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from 7cab84d to 3d3e603 Compare August 24, 2026 21:47
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from 3d3e603 to 69ce706 Compare August 24, 2026 22:01
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from 69ce706 to 8f1ffb5 Compare August 24, 2026 22:15
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from 8f1ffb5 to 2ab45de Compare August 24, 2026 22:41
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from 048cddc to e8530db Compare August 25, 2026 22:16
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from e8530db to 3f9e7b1 Compare August 25, 2026 23:34
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from 3f9e7b1 to d73373b Compare August 25, 2026 23:48
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from d73373b to 399c416 Compare August 25, 2026 23:56
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from 399c416 to 90fab21 Compare August 26, 2026 00:44
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from 90fab21 to db090a6 Compare August 26, 2026 02:03
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from db090a6 to 50a8ee9 Compare August 26, 2026 02:26
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from 50a8ee9 to 5d56e62 Compare August 26, 2026 02:34
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r8-whonet-specimen-mapping branch from 5d56e62 to 9332035 Compare August 26, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants