(fix) O3-5479: Implement safe patient display parsing with validation and fallbacks - #654
Conversation
|
@ELVIS-KATO ,help review this |
|
Thanks @omeriinnocent for the fix. The changes address the ticket and the functionality looks good. So could you please remove those comments? |
|
Thanks @ELVIS-KATO , |
|
hi @denniskigen ,can you have a look at this? |
|
Isn’t the hyphenated display the default way in OpenMRS and not likely to change? @dkayiwa @denniskigen |
@NethmiRodrigo I think keeping them doesn't hurt because it's defensive against issues like corrupted data, and maybe future schema changes or third-party system integration |
denniskigen
left a comment
There was a problem hiding this comment.
Thanks for looking into this, @omeriinnocent! Displaying undefined in the UI is definitely a bug worth fixing.
I checked the backend: BillResource exposes patient as Representation.REF, and the patient display comes from the REST module's patient resource getter, which formats it as IDENTIFIER - Given Family using - as the delimiter.
See inline comments for details. This would also benefit from a few unit tests for the parsing function — null input, standard format, hyphenated identifier, no hyphen, etc.
|
thanks @ELVIS-KATO , @EDSONZ-WASSWA for the review feedback, |
|
Hi @denniskigen ,Thanks for the detailed feedback. I’ve addressed the comments and updated the implementation accordingly: These changes aim to fully address the concerns you raised and improve overall reliability. |
The comment about backend sort order is still relevant context for future maintainers.
denniskigen
left a comment
There was a problem hiding this comment.
LGTM. Thanks, @omeriinnocent!
|
wooh,thanks for your time @denniskigen |
Requirements
Summary
The
mapBillPropertiesfunction splitspatient.displayon plain-, which breaks when the identifier or name contains hyphens. It also returnsundefinedwhen the display string is missing or has no separator, causing patient names to render as "undefined" in bills and invoices.This PR extracts a
parsePatientDisplayhelper that:-(space-hyphen-space) as the delimiter, matching the format returned by the REST APIundefinedwhen the display string is missing or has no separatorScreenshots
Related Issue
https://openmrs.atlassian.net/browse/O3-5479
Other