Skip to content
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-4219: Add ability to print patient prescriptions #125

Conversation

Omoshlawi
Copy link
Contributor

@Omoshlawi Omoshlawi commented Nov 25, 2024

Requirements

  • This PR has a title that briefly describes the work done, including the ticket number if there is a ticket.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

Screenshots

prescriptionprint.mp4

Related Issue

https://openmrs.atlassian.net/browse/O3-4219

Other

@ojwanganto
Copy link

Thanks, @Omoshlawi. Was there guidance to introduce the action column considering that other actions are shown when the row is expanded? We need additional guidance by the UI/UX team. Please reach out to Paul.
Kindly update the related ticket in the PR description.

@Omoshlawi
Copy link
Contributor Author

Thanks, @Omoshlawi. Was there guidance to introduce the action column considering that other actions are shown when the row is expanded? We need additional guidance by the UI/UX team. Please reach out to Paul. Kindly update the related ticket in the PR description.

Ok, sure, thankz

@mogoodrich
Copy link
Member

Thanks, @Omoshlawi. Was there guidance to introduce the action column considering that other actions are shown when the row is expanded? We need additional guidance by the UI/UX team. Please reach out to Paul. Kindly update the related ticket in the PR description.

also adding @fiona855 for her thoughts on the design...

Copy link
Member

@mogoodrich mogoodrich left a comment

Choose a reason for hiding this comment

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

One small comment, but defer to others for a deeper code review. Also, I agree we should have a design discussion about where to add this print action (it probably is better as a button under "Prescription Details" where the Dispense-Pause-Close buttons are.

But thanks so much for working on this @Omoshlawi , this is definitely a much-requested feature.

<StructuredListCell head>Patient Name Here</StructuredListCell>
<StructuredListCell head>Facility name here</StructuredListCell>
</StructuredListRow>
</StructuredListHead> */}
Copy link
Member

Choose a reason for hiding this comment

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

Remove this commented out text.

@fiona855
Copy link

Agreed @mogoodrich. In the original designs (which have changed), the print button was a link under the prescription details which makes sense to me.

print

@ojwanganto
Copy link

Thanks, @fiona855 and @mogoodrich for the additions. We'll probably need to wait for Paul's guidance on the best positioning but @fiona855 can guide further.

@Omoshlawi
Copy link
Contributor Author

selectable-printable-prescriptions.mp4

Added ability to select prescriptions to include in the print out

Copy link
Member

@mogoodrich mogoodrich left a comment

Choose a reason for hiding this comment

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

@Omoshlawi I added a few comments but overall looks good to me, though again I defer to others with more O3 experience.

I think the layout and functionality look great... what are your thoughts @fiona855 ?

<StructuredListCell head>
<br />
<br />
<p className={styles.printoutTitle}>Prescription Instructions</p>
Copy link
Member

Choose a reason for hiding this comment

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

This should use t() to localize.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, sure.thanks

{patient.display
.match(/^([A-Za-z\s]+)\s\(/)
?.at(1)
?.toUpperCase()}
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should manipulate the patient display here... I hope we have some sort of existing utility formatting method we can use... @denniskigen @ibacher ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

extracted it into a utility function

<p>{dosageInstruction?.additionalInstruction[0].text}</p>
)}
</StructuredListCell>
</StructuredListRow>
Copy link
Member

Choose a reason for hiding this comment

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

I just scanned this quickly, but during testing we should make sure that this properly displays all the fields we want it to display.

@fiona855
Copy link

Agreed, looks really good @Omoshlawi !

@ojwanganto
Copy link

Thanks @Omoshlawi. It looks nice!
@mogoodrich @fiona855 - should we indicate the date of printing somewhere on the page?

@ojwanganto
Copy link

@Omoshlawi are we good on this one? @mogoodrich anything else that needs to be addressed?

@mogoodrich
Copy link
Member

@Omoshlawi are we good on this one? @mogoodrich anything else that needs to be addressed?

Sorry for the delay, a holiday last week in the US. No blockers on my end, though it would be good to have @ibacher @denniskigen or @chibongho take a look.

@mogoodrich mogoodrich requested a review from chibongho December 2, 2024 15:58
<p className={styles.printoutTitle}>{t('prescriptionInstructions', 'Prescription Instructions')}</p>
{patient && (
<p className={styles.faintText} style={{ textAlign: 'center' }}>
{extractpatientName(patient.display)?.toUpperCase()}
Copy link
Member

Choose a reason for hiding this comment

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

@denniskigen @ibacher @chibongho do we have an existing utility method we could use here instead?

Copy link
Member

Choose a reason for hiding this comment

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

No, but this extractpatientName() method is definitely not it (this regex excludes any accent marks, any non-Latin scripts, which means it does not work in a language-agnostic way). A much better (and simpler) way of doing the exact same thing is this:

display.includes('(') ? display.split('(')[0] : display;

We should probably add something like this to the framework utilities, though.

I'm also not hugely a fan of having the call to toUpperCase() here. A CSS text-transform would be much cleaner here.

Copy link
Member

Choose a reason for hiding this comment

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

One last thing, the mixing of both className and style on a single tag should not be done. Just add a second class.

Copy link
Member

Choose a reason for hiding this comment

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

@Omoshlawi Did you see the above comments?

</span>{' '}
&mdash; {dosageInstruction?.route?.text} &mdash; {dosageInstruction?.timing?.code?.text}{' '}
{dosageInstruction?.timing?.repeat?.duration
? 'for ' +
Copy link
Member

Choose a reason for hiding this comment

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

Any display text must be translatable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed, thanks

<span className={styles.faintText}>{t('datePrescribed', 'Date prescribed')}</span>
{': '} <span>{formatDate(parseDate((request.request as any).authoredOn))}</span>
</p>
{(refillsAllowed || refillsAllowed === 0) && (
Copy link
Member

Choose a reason for hiding this comment

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

It seems like a drug order placed without refills needs to have that prominently noted on the printed prescription.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2024-12-03 at 09 47 09

Displaying Not Refillable explicitly instead of conditional rendering

Copy link
Member

Choose a reason for hiding this comment

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

I would stick with the text "No Refills".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, renamed

@ojwanganto
Copy link

Ping @ibacher @mogoodrich

Copy link
Member

@ibacher ibacher left a comment

Choose a reason for hiding this comment

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

See existing comments

@ojwanganto
Copy link

@Omoshlawi please address the comments and the conflicts.

@Omoshlawi
Copy link
Contributor Author

Omoshlawi commented Dec 10, 2024

@Omoshlawi please address the comments and the conflicts.

conflict resolved

@Omoshlawi
Copy link
Contributor Author

Omoshlawi commented Dec 10, 2024

See existing comments

Just saw the comments and addressed them, thanks

Screenshot 2024-12-10 at 21 19 47

Capitalized patient name from styles
Introduces another class in styles removing inline styling
refactored patient name extractor method

@ibacher ibacher changed the title (feat)O3 4219 add ability to print patient prescriptions (feat) O3-4219: Add ability to print patient prescriptions Dec 11, 2024
@donaldkibet
Copy link
Member

Thanks @Omoshlawi, merging this in since all comments have been addressed.

@donaldkibet donaldkibet requested a review from ibacher December 16, 2024 13:28
@ojwanganto
Copy link

Thanks, @denniskigen for the reviews. @Omoshlawi please address the comments and have this in.

@Omoshlawi
Copy link
Contributor Author

Thanks, @denniskigen for the reviews. @Omoshlawi please address the comments and have this in.

Done, thanks

@denniskigen denniskigen force-pushed the O3-4219-add-ability-to-print-patient-prescriptions branch from 7c8f337 to f6cf58c Compare December 16, 2024 23:21
Copy link
Member

@denniskigen denniskigen left a comment

Choose a reason for hiding this comment

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

Thanks, @Omoshlawi! I've taken the liberty to tack on some useful miscellaneous tweaks. Hope that's fine with you. Also, could you please add a summary of your changes to the PR description for posterity?

@donaldkibet donaldkibet merged commit dd031d5 into openmrs:main Dec 17, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants