(feat) O3-5231: Add label printing app for handling printing concerns#2433
(feat) O3-5231: Add label printing app for handling printing concerns#2433denniskigen merged 36 commits intoopenmrs:mainfrom
Conversation
ibacher
left a comment
There was a problem hiding this comment.
I think it may not make sense to merge this into the patient-banner-app, but to create a new app that can hold this (and depend on common reports) that exposes an extension that the patient-banner-app can use.
Thoughts?
| if (!patient?.id) { | ||
| throw new Error('Patient ID not found'); | ||
| } | ||
| return `${window.openmrsBase}/ws/module/commonreports/patientIdSticker?patientUuid=${patient.id}`; |
There was a problem hiding this comment.
So common-reports would now need to be listed as a dependency in the routes.json if we merge this in.
I agree @ibacher - especially because I forsee implementations wanting to add a print action button elsewhere throughout the application (such as in patient-management apps like Queues and clerical views, for a fast-print button; or billing for receipts, etc) so couching this within the banner app feels a bit restrictive. Though I get the initial use case :) |
c4aadcc to
7da2305
Compare
packages/esm-patient-label-printing-app/src/hooks/useSickerPdfPrinter.ts
Outdated
Show resolved
Hide resolved
packages/esm-patient-label-printing-app/src/hooks/useSickerPdfPrinter.tsx
Show resolved
Hide resolved
packages/esm-patient-printing-app/src/hooks/useStickerPdfPrinter.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-label-printing-app/src/hooks/useStickerPdfPrinter.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-label-printing-app/src/hooks/useStickerPdfPrinter.tsx
Outdated
Show resolved
Hide resolved
...inting-app/src/print-identifier-sticker/print-identifier-sticker-action-button.component.tsx
Outdated
Show resolved
Hide resolved
|
Hey @denniskigen and @ibacher I kindly request your review on this. |
...inting-app/src/print-identifier-sticker/print-identifier-sticker-action-button.component.tsx
Outdated
Show resolved
Hide resolved
| showPrintIdentifierStickerButton: { | ||
| _type: Type.Boolean, | ||
| _description: "Whether to display the 'Print identifier sticker' button in the patient banner", | ||
| _default: true, | ||
| }, | ||
| }; |
There was a problem hiding this comment.
For those that might need this button disabled. Since this is not under a feature flag.
...banner-app/src/print-identifier-sticker/print-identifier-sticker-action-button.component.tsx
Outdated
Show resolved
Hide resolved
| import { useCallback, useEffect, useRef, useState } from 'react'; | ||
| import { useTranslation } from 'react-i18next'; | ||
|
|
||
| export const useStickerPdfPrinter = () => { |
There was a problem hiding this comment.
I believe this hook must be improved.
There was a problem hiding this comment.
Below are the improvements i have done.
- Rejected new print requests while one is in progress
- Introduced Uses cleanupRef to store and execute cleanup functions
- Added printCompleted flag to prevent race conditions
- Ensured cleanup happens in all error scenarios
- Added aria-hidden attribute
- Improved base URL parameter parsing
- Added logic to check if the iframe is in DOM before removing
- Added isPrinting to useCallback dependencies
The hook is now more robust and handles edge cases better!
...inting-app/src/print-identifier-sticker/print-identifier-sticker-action-button.component.tsx
Outdated
Show resolved
Hide resolved
|
@jnsereko Could we rename this the label-printing-app? |
|
ping @jnsereko |
Bumps `@openmrs/esm-framework` and the OpenMRS CLI to `8.0.1-pre.3397` and fixes tests that were failing due to changes in the Carbon DataTable component.
…/print-identifier-sticker-action-button.component.tsx Co-authored-by: Dennis Kigen <kigen.work@gmail.com>
…ticker/print-identifier-sticker-action-button.component.tsx Co-authored-by: Dennis Kigen <kigen.work@gmail.com>
Co-authored-by: Dennis Kigen <kigen.work@gmail.com>
Co-authored-by: Dennis Kigen <kigen.work@gmail.com>
Co-authored-by: Dennis Kigen <kigen.work@gmail.com>
Co-authored-by: Dennis Kigen <kigen.work@gmail.com>
Co-authored-by: Dennis Kigen <kigen.work@gmail.com>
Co-authored-by: Dennis Kigen <kigen.work@gmail.com>
Co-authored-by: Dennis Kigen <kigen.work@gmail.com>
- Remove unnecessary setAttribute spy from PDF printer hook test - Add privilege verification test for print identifier button - Ensure UserHasAccess component is properly tested
88ac9bc to
8f383aa
Compare
denniskigen
left a comment
There was a problem hiding this comment.
Thanks, @jnsereko! @ibacher and I have hashed out a loose plan for trying to enable some kind of hard block when modules specified under backendDependencies don't resolve in the future. Also, can you work with @dkayiwa to ensure we get a release of the Patient documents done at some point before the release so we can switch the dependency range to a stable release instead of a SNAPSHOT version?
|
@jnsereko can you do a release on bamboo? |
* (fix): Remove config that enables submission of extra visit attributes (openmrs#2832) * (fix): Remove config that enables submission of extra visit attributes * Review feedback * (feat) O3-5159: Add range selector to generic graph widget (openmrs#2824) * Add range selector to generic graph widget * useMemo the chartColors Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * Remove superfluous 'flat()' calls --------- Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * (chore) Update OpenMRS dependencies (openmrs#2834) * (fix) O3-5049: Remove redundant title attribute from Tag component (openmrs#2819) * (fix) O3-5049: Remove redundant title attribute from Tag component - Removed redundant title attribute from Tag component in encounter list - The title attribute was duplicating the visible text content, creating unnecessary verbosity for screen reader users - Added comprehensive unit tests to verify the fix and prevent regression - All tests pass and code follows OpenMRS linting standards This fix improves accessibility by eliminating redundant information for assistive technology users, following WCAG best practices. Co-authored-by: Ona <no-reply@ona.com> * Useful tweaks --------- Co-authored-by: Ona <no-reply@ona.com> * (chore) Update translations from Transifex (openmrs#2835) * (feat) Use interpretation values sent from backend in vitals and results viewer (openmrs#2828) * (feat): Use interpretation values sent from backend * use interpretation in obstree * Review feedback * Add unit test * (fix) Use correct translation namespace in allergies list extension Fixes cross-app translation namespace for the allergies list extension by using the `translateFrom` function with the `moduleName` as the first argument instead of the `useTranslation` hook. This ensures that the translation strings are loaded from the allergies app's namespace when the extension is rendered in other apps (e.g., medications app via the `allergy-list-pills-slot` extension slot). It also removes unused `translateFrom` imports from conditions, lists, and programs apps. * (fix) : resolve validation error on drug order for for dosageForm field (openmrs#2826) * (fix) : resolve validation error on drug order for for `dosageForm` field * add translations * Update packages/esm-patient-medications-app/src/add-drug-order/drug-order-form.component.tsx Co-authored-by: chibongho <cbho@pih.org> --------- Co-authored-by: chibongho <cbho@pih.org> * (fix) O3-5006: Add warning when selecting already prescribed drug in fill prescription form (openmrs#2820) * (fix) O3-5006: add warning when selecting already prescribed drug in fill prescription form * Update packages/esm-patient-medications-app/translations/en.json Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * show better error message from server * fix editing drug orders --------- Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * (fix) Fix order list display (openmrs#2791) * (chore) Update translations from Transifex (openmrs#2837) * (chore) Update translations from Transifex (openmrs#2839) * (feat) O3-5189: Use criteria-based reference ranges from obstree response (openmrs#2840) * (feat) O3-5189: Use criteria-based reference ranges from obstree response The REST web services module's obstree resource now includes: - Interpretation values at the observation level - Reference ranges at both node-level (concept defaults) and observation-level (criteria-based/ patient-specific) Currently, the patient chart only uses concept-level reference ranges. We need to migrate to prioritize criteria-based (observation-level) reference ranges, which are more accurate as they can be patient-specific, age-specific, or gender-specific. This is particularly important because observations are point-in-time values so, e.g., the reference range that applies to an observation depends on the patients age at the time of the observation. That is, the reference range for a value measured when a patient was 9 should not be different because the patient is currently 13. Changes: - Update type definitions to include all reference range fields (hiAbsolute, hiCritical, lowAbsolute, lowCritical, lowNormal, hiNormal) - Implement priority logic: observation-level ranges (criteria-based) > node-level ranges (concept defaults) > "--" - Update interpretation calculation to use observation-level ranges when available - Update display logic across all UI components: * Timeline view: Show most recent observation's range per row * Individual results table: Show each observation's range * Trendline: Use node-level range (aggregate view) * Lab Set Panel: Show observation-level ranges when available - Extract reusable helper functions for range selection and formatting - Add comprehensive test coverage for new functionality - Fix type safety issues and improve code quality * Fixup * (chore) Update translations from Transifex (openmrs#2844) * (docs) Document interpretation priority in vitals assessment Add inline documentation explaining why the vitals app prioritizes `Observation.interpretation` from FHIR Observation responses over client-side calculation, and why a fallback calculation is necessary for backward compatibility with existing observations. * (fix) O3-5046: Resolve form label accessibility violations (openmrs#2842) * (fix) O3-5046: Resolve form label accessibility violations (O3-5046) - Remove orphaned label elements that weren't associated with form controls - Convert improper label usage to semantic span elements for display purposes - Add proper labelText content to Search components instead of empty strings - Implement aria-labelledby association for custom form controls - Fix missing labelText in patient list and visit form components - Add fallback chain for concept display names in lab results - Ensure all form controls have accessible labels for WCAG 2.1 compliance * (chore) Update translations from Transifex (openmrs#2846) * (feat) O3-5189: Implement criteria-based reference ranges from FHIR observations (openmrs#2845) * (feat) Implement criteria-based reference ranges from FHIR observations - Extract observation-level reference ranges and interpretations from FHIR - Merge observation-level and concept-level ranges (observation takes precedence) - Add comprehensive test coverage for extraction helpers - Fix critical bug: ensure value extraction happens before interpretation computation - Add support for valueString observations - Improve null safety and case-insensitive interpretation matching * Fixup * (chore) Update OpenMRS dependencies (openmrs#2847) * (test) Fix strict mode violation in start-and-end-visit test Replace getByText with getByRole('heading') selector to avoid matching multiple elements when checking for the "Visit Type" heading. * (BREAKING) O3-4962: Store visit context in patient chart store (openmrs#2669) * (feat) O3-4962 store visitContext in patient chart store * fix immunization-from test failure * add missing changes * add e2e test for visit context * clear visit context when ending or deleting active visit * migrate visit-context-switcher to use patinet chart store * fix visit context unset incorrectly when ending active visit * address PR feedback * add e2e test steps for visit context when deleting and restoring active visit * fix merge * Rebase * (chore) Update translations from Transifex (openmrs#2850) * (feat) O3-5154 Create visit-form workspace for use outside of patient… (openmrs#2814) * (feat) O3-5154 Create visit-form workspace for use outside of patient chart * update exported visit form * (fix) Filter empty visit attribute tags and improve layout - Extract displayable attributes computation for better readability - Filter out null and empty string values before rendering - Add flexbox layout with proper spacing between tags - Return early when no displayable attributes exist * (chore) Update translations from Transifex (openmrs#2851) * (fix): Add missing translations for drug order form toggle (openmrs#2856) * (chore) Update translations from Transifex (openmrs#2857) * (chore) Update translations from Transifex * Fix flaky edit-existing-visit test by adding field visibility waits The test was timing out when trying to fill the end time field because it attempted to interact with the field before React finished re-rendering after clicking the "Ended" tab. Added explicit waits for the end date field (via testid) and end time field to ensure they're visible before interaction. --------- Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * (fix) Fix visit type search pagination and auto-selection - Use searchResults.length for pagination and auto-selection instead of paginated results or all visit types - Reset pagination to page 1 when search term changes - Replace defaultValue with useEffect for dynamic auto-selection - Make search input controlled * (docs) Enhance immunizations app README (openmrs#2806) * (chore) Update translations from Transifex (openmrs#2859) * (fix) O3-5212: Hide empty immunization history card to prevent layout gaps (openmrs#2858) * (fix) O3-5212: Hide empty immunization history card to prevent layout gaps * (test) Fix potential race condition in edit-existing-visit e2e test * (fix) increase supported emrapi version range to 3.x (openmrs#2862) * (feat) O3-5231: Add label printing app for handling printing concerns (openmrs#2433) * Printing Patient Identifier template should use backend API * allow printing sticker without download to local machine * Move Patient Identifier Sticker logic to a new esm * add translations * Fix CI * Update packages/esm-patient-label-printing-app/README.md Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * clean code * use patient documents backend module * Add ability to enable Sticker by default * add lock file * Update packages/esm-patient-label-printing-app/src/hooks/useStickerPdfPrinter.tsx Co-authored-by: Samuel Male <samuelsmalek@gmail.com> * Update packages/esm-patient-label-printing-app/src/print-identifier-sticker/print-identifier-sticker-action-button.component.tsx Co-authored-by: Samuel Male <samuelsmalek@gmail.com> * (chore) Bump OpenMRS dependencies and fix tests Bumps `@openmrs/esm-framework` and the OpenMRS CLI to `8.0.1-pre.3397` and fixes tests that were failing due to changes in the Carbon DataTable component. * rebase, update the Patient Id Sticker rest API and remove feature flag * rebase, remove feature flag and update API * Update packages/esm-patient-printing-app/src/print-identifier-sticker/print-identifier-sticker-action-button.component.tsx Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * update webpack, printing hook and rename app * update lock file * update lock file * Update packages/esm-patient-label-printing-app/src/print-identifier-sticker/print-identifier-sticker-action-button.component.tsx Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * Update packages/esm-patient-label-printing-app/package.json Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * Update packages/esm-patient-label-printing-app/package.json Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * Update packages/esm-patient-label-printing-app/package.json Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * Update packages/esm-patient-label-printing-app/package.json Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * Update packages/esm-patient-label-printing-app/package.json Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * Update packages/esm-patient-label-printing-app/package.json Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * remove translation changes in non-en files * Trigger CI/CD pipeline * reset form entry webpack to 5.94 to fix CI * add lock file * Update packages/esm-patient-label-printing-app/src/config-schema.ts Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * simplify PDF printer hook logic and cleanup * Trigger CI/CD pipeline * Trigger CI/CD pipeline * Improve label printing test coverage - Remove unnecessary setAttribute spy from PDF printer hook test - Add privilege verification test for print identifier button - Ensure UserHasAccess component is properly tested --------- Co-authored-by: Dennis Kigen <kigen.work@gmail.com> Co-authored-by: Samuel Male <samuelsmalek@gmail.com> * (chore) Update translations from Transifex (openmrs#2864) * (chore) Update OpenMRS dependencies (openmrs#2863) Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * (fix) Extract reference range formatting logic into reusable utility Standardize reference range formatting across test results views by introducing formatRangeWithUnits() helper function. This eliminates duplicate logic in three components and prevents duplicate units from being displayed (e.g., "0 – 50 U/L U/L"). * (chore) Update OpenMRS dependencies (openmrs#2865) * (chore) Update OpenMRS dependencies (openmrs#2866) * (chore) Update OpenMRS dependencies (openmrs#2867) * (fix) Remove redundant role attribute from PatientPhoto wrapper `PatientPhoto` now handles its own accessibility internally with proper aria-labels, making the role="img" attribute on the parent wrapper div redundant. * (fix) Prevent lint-staged from stashing changes on pre-commit failure (openmrs#2868) Add [--no-stash](https://github.com/lint-staged/lint-staged#--no-stash) flag to lint-staged to prevent unstaged changes from being stashed when the pre-commit hook fails. This prevents the confusing situation where developers' work appears to disappear after a failed commit. If changes were previously stashed, they can be recovered with `git stash pop`. * (fix) O3-5328: Setting Free Test Dosage toggle does not clear out coded dosage (openmrs#2869) * (feat) Add ability to add more Test to an Existing Order during Result Entry for the Lab app (openmrs#2670) * (chore) Update OpenMRS dependencies (openmrs#2871) * (chore) Update OpenMRS dependencies (openmrs#2872) * (feat) O3-5188: Horizontal obs should have editable mode (openmrs#2870) * (test) Replace hardcoded ID selector with blur() in program enrollment E2E test Replace `page.locator('#search-1').focus()` with `completionDateYearInput.blur()` to trigger form validation without depending on a hardcoded search input ID. The `search-1` ID is becoming dynamic in openmrs/openmrs-esm-core#1506 with React's useId() hook, making the previous approach brittle. Using blur() on the actual input element is more explicit, maintainable, and resilient to ID changes. * (chore) Update OpenMRS dependencies (openmrs#2873) * (chore) Update translations from Transifex (openmrs#2874) Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * (feat) Add possibility to make primary diagnosis optional (openmrs#2836) * (feat) Add possibility to make primary diagnosis optional * (fix) Remove length from the dep array * (test) Add coverage for optional primary diagnosis and improve config documentation Test changes: - Add tests for `isPrimaryDiagnosisRequired` configuration behavior - Test visit note submission without diagnosis when config is false - Test validation enforcement when config is true - Remove unused `errorMessage` variable Config improvements: - Add missing descriptions for all visit note config properties - Fix `formConceptUuid` type from `ConceptUuid` to `UUID` - Improve `diagnosisConceptClass` description for clarity Related to openmrs#2836 * (feat) O3-5091: Hide empty lab orderable tree items when no test results exist (openmrs#2776) * (fix): Encounter lists should try to use name from concept (openmrs#2852) * (fix): Encounter lists should try to use name from concept * Wrap value mapped key in t function * Review feedback * (chore) Update translations from Transifex (openmrs#2878) * (test) Fix potential race conditions in flaky edit-existing-visit test - Wait for visitStartDateInput before clicking the "Ended" tab to ensure the form is fully loaded before interaction. Fixes flaky timeout where visitStopDateInput fails to appear after clicking the tab. - Wait for dropdown options to be visible before clicking to prevent race conditions when selecting location. * (feat) Improve order basket panel styling (openmrs#2879) Adapts several elements of the order basket panel design to align with the related [Zeroheight designs](https://zeroheight.com/23a080e38/p/71ad91-order-basket). These changes include: - Adding a custom LabIcon component matching the design's icon. The original styling for the icon was removed in openmrs/openmrs-esm-core#1454 where we switched to using unstyled variants of existing icons. - Fixing border styling to align with the design. - Replacing hardcoded hex colors with Carbon color tokens (cyan-20 and purple-20). - Refactoring container classes for responsive background colors. * (feat) Add responsive container classes to lab order basket panel Apply tabletContainer and desktopContainer classes based on device type to ensure proper styling across different screen sizes. Should've been part of f7f5ba2. * (test) Add comprehensive tests for the results viewer (openmrs#2877) * (test) Add comprehensive tests for the results viewer Adds 79 new tests covering filter state management, context providers, UI interactions, and data transformation logic. Refactor trendline component with proper TypeScript types, memoization, and code quality improvements. Tests added: - filter-reducer.test.ts (21 tests) - filter-context.test.tsx (18 tests) - filter-set.test.tsx (17 tests) - useObstreeData.test.ts (15 tests) - tree-view.test.tsx (8 tests) Improvements: - Add TypeScript interfaces for trendline component props - Memoize data transformations for performance - Fix variable shadowing and remove dead code - Fix filter context useEffect dependencies - Optimize filter reducer state copying All tests passing, linting and type checks clean. * Fix e2e test * (fix) Standardize EmptyState padding in test results viewer Remove inconsistent margin wrapper around the `EmptyState` component in the individual test view to match the established pattern across the patient chart. The `.panelViewTimeline` wrapper now only applies its margins when displaying actual data, not when showing the empty state. This ensures consistent spacing for all EmptyState instances in the test results viewer (grouped timeline, tree view, and individual test view). * (chore) Update translations from Transifex (openmrs#2881) * (fix) Trigger revalidation when mutating patient orders (openmrs#2882) Previously, mutateOrders() only invalidated the cache without refetching, causing stale data to persist until manual refresh. Now the `mutateOrders` function explicitly sets `revalidate: true` to ensure orders are refetched immediately after mutations. This ensures the order table updates automatically when orders are added, modified, or cancelled through the order basket. * feat: add AMPATh deployment pipelines * fix: fix build * fix: fix build * fix: fix build * fix: fix build * fix: fix build * (feat) Add SHR Tab to patient visits (#1) * (fix) Swicth from fetch to openmrsFetch in fetching SHR records (#2) * (fix) Change hie url to staging url (#3) --------- Co-authored-by: Nethmi Rodrigo <nethmi@openmrs.org> Co-authored-by: Brandon Istenes <bistenes@gmail.com> Co-authored-by: Dennis Kigen <kigen.work@gmail.com> Co-authored-by: openmrs-bot <infrastructure@openmrs.org> Co-authored-by: Devarasetty Praneeth <89689768+praneeth622@users.noreply.github.com> Co-authored-by: Ona <no-reply@ona.com> Co-authored-by: Donald Kibet <chelashawdonald@yahoo.com> Co-authored-by: chibongho <cbho@pih.org> Co-authored-by: Daphne <89844768+Daphne210@users.noreply.github.com> Co-authored-by: Raj Prakash <rjnt452@gmail.com> Co-authored-by: praneeth <praneeth7077@gmail.com> Co-authored-by: Abhay <abhaynimbalkar03@gmail.com> Co-authored-by: jnsereko <58003327+jnsereko@users.noreply.github.com> Co-authored-by: Samuel Male <samuelsmalek@gmail.com> Co-authored-by: Mark Goodrich <mgoodrich@pih.org> Co-authored-by: Mutesasira Moses <mozzymutesa@gmail.com> Co-authored-by: Oliver Lewandowski <109145288+olewandowski1@users.noreply.github.com> Co-authored-by: Emmanuel Nyachoke <achachiez@gmail.com>
Requirements
Summary
Previous versions of the Patient Identifier Sticker used react libraries to capture and print the sticker. Since this became slow on low processor powered devices, this approach focuses on getting the sticker from the backend using the Reporting tooling.
See backend work here
Screenshots
Screen.Recording.2025-10-15.at.12.32.09.mov
Arabic
Français
Related Issue
https://openmrs.atlassian.net/browse/O3-5231
Other