Skip to content

feat(microbiology): add WHONET export population filters - #4103

Open
pmanko wants to merge 21 commits into
feat/782-ogc-782-microbiology-r8-whonet-specimen-mappingfrom
feat/782-ogc-782-microbiology-r9-whonet-export-filters
Open

feat(microbiology): add WHONET export population filters#4103
pmanko wants to merge 21 commits into
feat/782-ogc-782-microbiology-r8-whonet-specimen-mappingfrom
feat/782-ogc-782-microbiology-r9-whonet-export-filters

Conversation

@pmanko

@pmanko pmanko commented Aug 20, 2026

Copy link
Copy Markdown
Member

Behavior delivered

  • Adds combinable WHONET population filters for specimen type, organism,
    patient origin, and isolate significance using authoritative case data.
  • Applies one normalized selection to both server-side preview and CSV
    generation, and stores that selection with the completed export record.
  • Preserves the complete selection as canonical repeated query parameters so
    Configure and Preview can be bookmarked, reloaded, and shared.
  • Places the single WHONET navigation entry under Reports while preserving the
    stable /Microbiology/whonet route and Reports breadcrumb.
  • Uses a compact Carbon Configure -> Preview -> Generate workflow with filter
    funnel counts, all eligible AST readings, and exact mapping-repair links.
  • Handles incomplete historical origin labels, empty reporting periods, and
    valid unidentified isolates without failing filter options or preview.

Product boundary

This slice does not infer screening or surveillance from Program, patient
origin, specimen, organism, location, or AMR eligibility. The next roadmap row
captures explicit Culture purpose as Clinical diagnosis/treatment or Active
screening/carriage, with historical missing data shown as Unspecified.

Export History, scheduling, AST-worklist and individual-case entry points,
advanced first-isolate policies, output-format qualification, and additional
readiness catalogs remain later M-09 roadmap slices. OpenELIS Work is
authoritative for workflow and visual intent.

Engineering notes

  • Liquibase change 087-microbiology-whonet-export-selection.xml adds the one
    data-model field needed to retain export provenance and includes rollback.
  • One typed selection and compiler drive filter options, preview, generation,
    and persisted provenance; there is no second filter implementation.
  • Patient/sample context is batch-loaded through the existing worklist-context
    query rather than per-case service calls.
  • Property-gated WHONET_FILTERS fixtures use authenticated application
    services only: no SQL seed, fixed primary key, DAO bypass, or production
    fixture endpoint exposure.
  • Functional and video suites share one Playwright helper for canonical query
    construction, supported Carbon multi-select interaction, readiness, fixture
    labels, and CSV reading.

Verification

scripts/run-java21 mvn -Dtest=MicroWhonetDatasetServiceTest test
scripts/run-java21 mvn -Dtest=MicrobiologyUatScenarioServiceTest test
scripts/run-java21 mvn -Dtest=MicroWhonetPersistenceIntegrationTest,MicrobiologyWhonetExportSelectionLiquibaseTest,MicroWorklistContextHqlValidationTest,WHONetReportServiceMicrobiologyTest test
cd frontend && npm test -- --run src/components/microbiology/WhonetRoutes.test.js src/components/microbiology/WhonetService.test.js src/components/microbiology/__tests__/WhonetExport.test.jsx
BASE_URL=https://amr.openelis-global.org scripts/dev-stack playwright playwright/tests/foundational/core/microbiology-whonet-export.spec.ts
PLAYWRIGHT_MOBILE_EVIDENCE=on BASE_URL=https://amr.openelis-global.org scripts/dev-stack playwright --project=core-demo-video playwright/tests/demo/core/ogc-782-r9-whonet-export-filters.spec.ts
  • Dataset service: 17/17 passed, including the unidentified-isolate regression.
  • Deployed functional Playwright: shared auth and both journeys passed (3/3).
  • Standard evidence project: shared auth plus desktop/mobile stories passed
    (3/3), producing five inspected screenshots and two titled MP4s.
  • The Carbon interactions use the active listbox and Escape; there are no
    forced interactions or sleeps for test synchronization. Video-only pauses
    display title cards for human review.
  • Code-qa R9 report

Stack and review evidence

  • Native GitHub stack: this PR targets the open parent branch from
    PR #4097.
    OGC-788 Macro is a separate product stack and is not part of this PR's
    application scope; its current base relationship must be corrected
    independently before merge.
  • Companion review-tooling change: PR #15.
  • Authoritative mock: OpenELIS Work M-09.
  • Live UAT source: AMR Review checklist, with distinct story AMR-S30.
  • Deployment contract: AMR target.

Completion state

  • Distinct R9 story is selectable in the live AMR Review overlay.
  • Deployed foundational Playwright passes without WHONET server errors.
  • Desktop/mobile screenshots were compared with the M-09 mock.
  • Reproducible local evidence bundle created outside git for review.
  • The R9 runtime behavior is deployed to AMR; public target health and smoke
    verification passed, and the deployed authenticated WHONET Playwright journey
    passed. The later roadmap-only commit changes no runtime behavior and is
    intentionally not deployed.
  • Piotr validation, separate from technical merge readiness.

The Review button overlaps one filter in the full-page mobile screenshot. It is
external review-tooling chrome, not OpenELIS layout, and is not hidden with
application or evidence-only CSS.

@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: 5d87913d60

ℹ️ 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 21, 2026 04:22

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

Adds combinable WHONET export population filters (specimen type, organism, patient origin, isolate significance) with a single normalized server-side query contract shared by preview and CSV generation, and relocates the WHONET navigation entry under Reports while preserving the stable /Microbiology/whonet route.

Changes:

  • Backend: Normalize/export population filtering and expose period-scoped filter option endpoint used by UI.
  • Frontend: Add Carbon multiselect filter controls that round-trip via deterministic repeated query params.
  • Tests/docs: Update unit/integration/E2E coverage and align spec artifacts with the new filter slice.

Reviewed changes

Copilot reviewed 47 out of 47 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
volume/menu/menu_config.json Moves WHONET menu entry under Reports and adjusts ordering.
src/main/java/org/openelisglobal/reports/service/WHONetReportService.java Adds service API for filter-options retrieval.
src/main/java/org/openelisglobal/reports/service/WHONetReportServiceImpl.java Implements filter-options retrieval as read-only transactional call.
src/main/java/org/openelisglobal/microbiology/controller/rest/MicroWhonetExportRestController.java Adds /filter-options GET endpoint with authorization.
src/main/java/org/openelisglobal/microbiology/service/MicroWhonetDatasetService.java Extends dataset service contract to include filter-options.
src/main/java/org/openelisglobal/microbiology/service/MicroWhonetDatasetServiceImpl.java Applies combinable filters before deduplication; adds population loading + filter option derivation.
src/main/java/org/openelisglobal/microbiology/form/MicroWhonetExportQueryForm.java Migrates population inputs to repeated-value lists (with single-value JSON compatibility).
src/main/java/org/openelisglobal/microbiology/form/MicroWhonetPreviewForm.java Adds preview counters for each filter stage.
src/main/java/org/openelisglobal/microbiology/form/MicroWhonetFilterOptionsForm.java New DTO for period-scoped filter choices.
src/main/java/org/openelisglobal/microbiology/form/MicroWhonetFilterOptionForm.java New DTO for id/label option pairs.
src/main/java/org/openelisglobal/microbiology/dao/MicroCaseOrderDetailDAO.java Adds DAO method to bulk load order details by case IDs.
src/main/java/org/openelisglobal/microbiology/dao/MicroOrganismDAO.java Adds DAO method to bulk load organisms by IDs.
src/main/java/org/openelisglobal/microbiology/dao/MicroPatientOriginDAO.java Adds DAO method to bulk load patient origins by codes.
src/main/java/org/openelisglobal/microbiology/daoimpl/MicroCaseOrderDetailDAOImpl.java Implements bulk case-id lookup for order details.
src/main/java/org/openelisglobal/microbiology/daoimpl/MicroOrganismDAOImpl.java Implements bulk organism lookup by IDs.
src/main/java/org/openelisglobal/microbiology/daoimpl/MicroPatientOriginDAOImpl.java Implements bulk patient-origin lookup by codes.
src/main/java/org/openelisglobal/microbiology/service/MicrobiologyUatScenarioService.java Provisions required sample status + report test section through services for scenario setup.
src/test/java/org/openelisglobal/reports/service/WHONetReportServiceMicrobiologyTest.java Updates test query to use significance as list.
src/test/java/org/openelisglobal/microbiology/service/MicroWhonetDatasetServiceTest.java Adds tests for combined filtering and period-scoped filter options; updates list-based significance.
src/test/java/org/openelisglobal/microbiology/controller/MicroWhonetExportRestControllerTest.java Adds filter-options endpoint test; updates request binding expectations for repeated params.
src/test/java/org/openelisglobal/menu/util/MenuConfigurationLoaderTest.java Asserts WHONET is exposed only under Reports and keeps stable URL.
src/test/java/org/openelisglobal/microbiology/service/MicrobiologyUatScenarioServiceTest.java Adds tests for service provisioning of sample entered status and report test section.
src/test/java/org/openelisglobal/microbiology/MicroWhonetPersistenceIntegrationTest.java Ensures sample type has WHONET code and updates list-based significance.
src/test/java/org/openelisglobal/microbiology/MicrobiologyReferenceDataIntegrationTest.java Verifies fixture culture setup reuse for same method/workflow.
src/test/java/org/openelisglobal/microbiology/MicrobiologyOrderSaveIntegrationTest.java Uses fixture helper that provisions an active sample type if missing.
src/test/java/org/openelisglobal/microbiology/fixture/MicrobiologyTestFixtures.java Adds getOrCreateActiveSampleType and makes culture setup creation idempotent via service.
src/test/java/org/openelisglobal/microbiology/fixture/MicrobiologyTestFixturesTest.java Adds unit test for provisioning active sample type via services (incl. localization).
src/test/java/org/openelisglobal/inventory/service/InventoryItemServiceTest.java Adds assertion to ensure generated inventory IDs exceed fixture IDs.
src/test/java/org/openelisglobal/BaseWebContextSensitiveTest.java Adds inventory item sequence mapping to avoid fixture/sequence collisions.
specs/782-ogc-782-microbiology-mvp-spec/tasks.md Updates roadmap markers and records the filter slice + next culture-purpose slice.
specs/782-ogc-782-microbiology-mvp-spec/spec.md Adds acceptance coverage for consistent filter application; clarifies terminology.
specs/782-ogc-782-microbiology-mvp-spec/data-model.md Documents culture purpose field as follow-on model addition.
specs/782-ogc-782-microbiology-mvp-spec/evidence/code-qa-r9-2026-08-20.md Adds QA evidence note for this slice.
specs/782-ogc-782-microbiology-m10-whonet-export/spec.md Updates nav acceptance and adds follow-on stories/requirements for population and purpose.
specs/782-ogc-782-microbiology-m10-whonet-export/research.md Adds research/ruling on clinical vs active screening culture purpose.
specs/782-ogc-782-microbiology-m10-whonet-export/plan.md Updates plan for Reports-only nav and introduces R9 addendum for slice split.
frontend/src/languages/en.json Adds i18n keys for filter labels, significance values, and filter-stage metrics.
frontend/src/components/microbiology/WhonetService.js Serializes repeated filter params deterministically; adds filter-options fetch.
frontend/src/components/microbiology/WhonetService.test.js Updates preview query serialization and adds filter-options request test.
frontend/src/components/microbiology/WhonetRoutes.js Adds parsing/building of repeated population filters and legacy significance=ALL normalization.
frontend/src/components/microbiology/WhonetRoutes.test.js Adds tests for round-tripping repeated filters and legacy ALL links.
frontend/src/components/microbiology/WhonetExport.scss Adds filter grid styling and tightens layout toward operational compaction.
frontend/src/components/microbiology/WhonetExport.jsx Adds multiselect filter UI backed by period-scoped filter options + preview metrics.
frontend/src/components/microbiology/tests/WhonetExport.test.jsx Updates component tests for multiselect controls, canonical URL state, and list-based request.
frontend/playwright/tests/foundational/core/microbiology-whonet-export.spec.ts Updates journeys to use Reports nav and validates filter preservation + metrics.
frontend/playwright/tests/demo/core/ogc-782-microbiology-whonet-export.spec.ts Updates demo assertions for multiselect inclusion and mapping repair return flow.
frontend/playwright/helpers/seed-microbiology-data.ts Extends seeding to set patient origin and significance for filter-focused fixtures.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread frontend/src/components/microbiology/WhonetExport.jsx
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r9-whonet-export-filters branch from e313ecd to 484a138 Compare August 24, 2026 08:33
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r9-whonet-export-filters branch from 484a138 to 94f10a0 Compare August 24, 2026 13:24
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r9-whonet-export-filters branch from 94f10a0 to 479f3ee Compare August 24, 2026 15:25
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r9-whonet-export-filters branch from 479f3ee to 3a53085 Compare August 24, 2026 17:06
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r9-whonet-export-filters branch from 3a53085 to 6807e77 Compare August 24, 2026 17:26
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r9-whonet-export-filters branch from 6807e77 to cdc46f0 Compare August 24, 2026 18:57
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r9-whonet-export-filters branch from cdc46f0 to f0bafbd Compare August 24, 2026 19:40
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r9-whonet-export-filters branch from f0bafbd to b01dadf Compare August 24, 2026 21:47
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r9-whonet-export-filters branch from b01dadf to fecfad7 Compare August 24, 2026 22:01
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r9-whonet-export-filters branch from fecfad7 to 2420017 Compare August 24, 2026 22:15
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r9-whonet-export-filters branch from 2420017 to 7bbaa7f Compare August 24, 2026 22:41
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r9-whonet-export-filters branch from 61000f3 to 338fed3 Compare August 26, 2026 00:44
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r9-whonet-export-filters branch from 338fed3 to ee516ee Compare August 26, 2026 02:03
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r9-whonet-export-filters branch from ee516ee to 30fe27c Compare August 26, 2026 02:26
@pmanko
pmanko force-pushed the feat/782-ogc-782-microbiology-r9-whonet-export-filters branch from 30fe27c to 3179492 Compare August 26, 2026 02:34
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