-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(feat) O3-3276: Add support for printing patient identification stickers #1847
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jnsereko for this. I think it would be great to also configure the identifiers to show on the print view, some are very sensitive
@CynthiaKamau, do you mean the implementer choosing which identifier types to include? something like |
packages/esm-patient-banner-app/src/banner/patient-banner.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner/patient-banner.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.scss
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
afb0b38
to
e4a5e94
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very close, @jnsereko. I've left a few more suggestions.
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.scss
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.scss
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.scss
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.scss
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
Please fix the conflicts with |
@denniskigen I have been banging my head on the wall since yesterday but not yet sure why this is happening |
1531053
to
dd8f2b5
Compare
A few other random notes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bunch of miscellaneous thoughts. I think, though, that the main thing is to look at this example vs the code here. Note in particular, we are doing nothing that ensures isPrinting
is true
before the promise resolves.
|
||
const identifiers = | ||
patient?.identifier?.filter( | ||
(identifier) => !excludePatientIdentifierCodeTypes?.uuids.includes(identifier.type.coding[0].code), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think an allow-list of identifiers to include is better than a list of identifiers to exclude. It would also be nice to not necessarily tie this directly to UUIDs, e.g., it would be nice to be able to specify these by identifier name.
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
Could you clarify this a bit more, @ibacher? |
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx
Outdated
Show resolved
Hide resolved
@denniskigen I think I was wrong about that... |
About? |
Sorry responding to this:
|
As we discussed elsewhere, we thinking the issue is related to the library, right? |
Something like that. The ReactToPrint library works by copying the DOM of the passed-in |
@jnsereko I've squashed your commits into a single commit to ensure a cleaner commit history. This should simplify future rebasing and merges. Thank you for your understanding and contributions! |
2690375
to
226f6e0
Compare
@ibacher FWIW, this is the actual error (from logging inside the It's happening in the Also, removing all the Carbon bits doesn't resolve the issue. Nor does switching to the FunctionalComponent implementation. |
exactly @denniskigen |
So at least this is something. That looks like the failure is occurring here (although oddly in code that's trying to format a nice error message). |
So here's my best guess of what's going on:
Basically, there's no changes we can make to our code that will make this behaviour go away, but the behaviour only occurs in development mode (you can verify this by modifying the However, the upshot of all this is that it is extremely likely that ReactToPrint is incompatible with React 19. |
Thanks for the deep dive, @ibacher. Is the takeaway then that merging this in will mean it will work as expected in production? If so, then let's focus on getting it in. |
Yeah, I think it's very likely to work as expected in production. We just may need to have a medium-term strategy to either update or replace ReactToPrint too. |
Update packages/esm-patient-banner-app/src/config-schema.ts Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/config-schema.ts Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/config-schema.ts Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner/patient-banner.component.tsx Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx Co-authored-by: Dennis Kigen <[email protected]> O3-3276: Add support for printing patient identification stickers Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.scss Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/translations/en.json Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/config-schema.ts Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.scss Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.scss Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.scss Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/translations/en.json Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.test.tsx Co-authored-by: Dennis Kigen <[email protected]> Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx Co-authored-by: Dennis Kigen <[email protected]> add retry attemp on printing Update packages/esm-patient-banner-app/src/banner-tags/print-identifier-sticker.component.tsx Co-authored-by: Ian <[email protected]>
ba674cf
to
ac436d0
Compare
Anyway we can set the print rotation to default to landscape? I think that will likely work better. For future work, we probably want to allow implementations to specify custom CSS that could be used to style the identifier badge to meet local requirements, but LGTM. |
<style type="text/css" media="print"> | ||
{` | ||
@page { | ||
size: ${printIdentifierStickerSize}; | ||
} | ||
`} | ||
</style> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ibacher it's trivial to add a config property that governs which orientation to default to and then it would leverage this approach. Should I add one and make it default to portrait
? (@jnsereko is there a specific requirement for a default orientation for this feature?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scratch that, it appears that it's not so straightforward to change the orientation for custom sizes (like the default 4in 6in
value). For standard page sizes, something like this works well:
const { printPageOrientation } = useConfig();
<style type="text/css" media="print">
{`
@page {
size: A3 ${printPageOrientation};
}
`}
</style>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this is something else worth looking into when evaluating whether to move away from this library. I'm proceeding to merge to unblock Madiro for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to create a follow up ticket to investigate what's breaking the Library and how to move on. Thank you so much @denniskigen
|
Requirements
Summary
Print a sticker at the registration desk with basic patient information like Patient ID, First name, last name, age, gender.
Screenshots
Screen.Recording.2024-05-23.at.13.06.11.mov
Related Issue
https://openmrs.atlassian.net/browse/O3-3276
Other
cc @michaelbontyes @pirupius @denniskigen @ibacher @hadijahkyampeire