The current implementation of Patient ID sticker printing relies on frontend logic, which can introduce delays in PDF generation. To improve performance and maintainability, its recommended to shift the sticker generation process to the backend.
Configuration can look like this
Suggestions
Move Sticker Processing to the Backend
Shift PDF generation from the frontend to the backend to improve performance and reliability.
@jnsereko If you want to solicit feedback on the design here, I think rather than focusing on the implementation details, we need to focus on what the actual input looks like and what sort of output it can generate. That’s where people will have requirements. The technical stuff is just details.
All that said, I’m not sure that system settings are the appropriate place to store these. Again this goes to requirements: does everyone only need a single format or do we need the format to be flexible / adaptable to something about the location / patient / user / etc.
Hi @jnsereko , thanks for bringing up that topic. I really would love to see proper printing functionality available with configurability.
IMO, it looks like leveraging on the OpenMRS Module Reporting and its REST API could already bring us a long way. This has the advantage to not be specific to patient sticker, but be easily extendeded to patient card, prescription, referral letter, consent forms…
To keep your focus on the sticker, you could design a configurable dedicated report, possibly brought by its ow module (openmrs-module-printingtemplates? or something) that others could leverage on.
What do you think?
Those patient cards and stickers need likely to be highly configurable. Not a single facility will want the same layout. Let alone paper format constraints, logos, barcodes, QR codes, patient picture…
Thank you @mksrom. I prefer this approach.
Would it be equally fast (or even faster) like passing a JSON configuration Object and returning a PDF?
We are primarily focused on the approach that ensures the least processing time. Given that nurses handle thousands of patients daily, it is crucial that the PDF is generated and available immediately upon clicking the print button.
That I can’t quite tell. In both cases you would need to retrieve the patient data from the backend. I’m pretty sure such a small report can be instantly generated by the Reporting module.
The added value of using the Reporting framework is that it’s already there, it’s highly tested and testable, highly configurable and the functionality (ability to generate and print OpenMRS Reports from the UI) will become reusable everywhere else in O3.
@mseaton might know better for the technical details.
Additionally, regarding the configurability of a backend report, we have done something similar in our Common Reports (eg, Antenal Report) module where a configuration JSON is provided as config to the report using the jsonkeyvalues domain of Iniz:
Hi @ibacher , @mksrom , @mseaton , @fiona, can you schedule a call together this week to decide on the approach, estimate, and assign some time? Would this Friday at 8:00 am EDT / 2:00 pm CET work for you? Thanks