(feat) O3-5572: Allow adding non-coded custom diagnoses#3224
(feat) O3-5572: Allow adding non-coded custom diagnoses#3224ToNyRANDRIAMANANTSOA wants to merge 10 commits into
Conversation
denniskigen
left a comment
There was a problem hiding this comment.
Thanks for working on this, @ToNyRANDRIAMANANTSOA! The search-first, custom-fallback UX is a nice improvement over a separate "Other" field.
One note: this adds a new nonCoded diagnosis path (add, remove, duplicate prevention, payload shape) but doesn't add targeted tests for any of it. I'd strongly recommend adding coverage before merge.
| // still allow proposing adding it as a custom free-text diagnosis | ||
| !searchResults | ||
| .map((diagnosis) => diagnosis.display.toLocaleLowerCase()) | ||
| .includes(value.toLocaleLowerCase()) && ( |
There was a problem hiding this comment.
This condition only checks whether the search term appears in the API results. It doesn't check whether the same free-text string has already been selected as a custom diagnosis.
Common scenario: a clinician adds "malaria xyz" as a custom diagnosis, then searches for it again later. The API returns fuzzy coded matches (e.g. "Malaria") but not the exact string. This button reappears and creates a second identical nonCoded diagnosis on the same note.
Please gate this with isDiagnosisNotSelected({ display: value }), the same way the zero-results path does.
| const isPrimaryDiagnosisSelected = selectedPrimaryDiagnoses.some((selectedDiagnosis) => | ||
| diagnosis.uuid | ||
| ? diagnosis.uuid === selectedDiagnosis.diagnosis.coded | ||
| : diagnosis.display === selectedDiagnosis.diagnosis.nonCoded, |
There was a problem hiding this comment.
isDiagnosisNotSelected compares non-coded diagnoses case-sensitively (diagnosis.display === selectedDiagnosis.diagnosis.nonCoded). After adding a custom diagnosis like "Malaria", searching for "malaria" in the zero-results path still allows adding it again because the duplicate check uses strict equality. Please normalize both sides before comparing (e.g. .toLocaleLowerCase()).
…s on search case sensitivity and duplication prevention
… value access via optional chaining short-circuiting before calling .toLocaleLowercase()
…es for responsivity
…or Order Favorites
Requirements
Summary
Hi @O3-Team,
I’m working on improving the Visit Notes and Patient Chart diagnoses data entry experience. Currently, if a clinician cannot find a coded concept, the flow stops at "No results found."
I’m proposing we move toward an inline "Add Custom" dropdown option rather than a separate "Other" free-text field, like what is already available in the allergies form.
The Proposed Approach:
The autocomplete displays a virtual option:
Add "[Search Term]" as custom diagnosis:Selecting this maps the value to the
diagnosis.nonCodedattribute.nonCodedfor Diagnoses.Screenshots
Related Issue
Other
Why I think this is a better UX: