-
Notifications
You must be signed in to change notification settings - Fork 254
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-4430: Make the indications field configurable in the drug order form #2228
base: main
Are you sure you want to change the base?
Conversation
Size Change: +292 B (0%) Total Size: 16.3 MB ℹ️ View Unchanged
|
) : null} | ||
<span> | ||
<span className={styles.label01}>{t('indication', 'Indication').toUpperCase()}</span>{' '} | ||
{medication?.order?.orderReasonNonCoded ?? t('none', 'None')} |
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.
{medication?.order?.orderReasonNonCoded ?? t('none', 'None')} | |
{medication?.order?.orderReasonNonCoded ?? t('noIndication', 'No indication provided')} |
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.
In general, be careful when placing text in front of users indicating the absence of data.
@@ -36,6 +36,11 @@ export const configSchema = { | |||
'Number of milliseconds to delay the search operation in the drug search input by after the user starts typing. The useDebounce hook delays the search by 300ms by default', | |||
_default: 300, | |||
}, | |||
isIndicationFieldOptional: { |
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.
isIndicationFieldOptional: { | |
requireIndication: { |
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.
+1 for requireIndication: { _default: true }
.
Positive phrasing is easier to grok (implies "we require this by default") as opposed to the double negative isIndicationFieldOptional: { _default: false }
(implies "it's optional by default").
The validation logic reads better as well:
// Current validation logic
if (!isIndicationFieldOptional) { /* require indication */ }
// With requireIndication
if (requireIndication) { /* require indication */ }
isIndicationFieldOptional: { | ||
_type: Type.Boolean, | ||
_description: 'Whether to make the indication field optional in the drug order form', | ||
_default: false, |
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.
_default: false, | |
_default: true, |
<span> | ||
<span className={styles.label01}>{t('indication', 'Indication').toUpperCase()}</span>{' '} | ||
{medication.orderReasonNonCoded ?? t('none', 'None')} | ||
</span> |
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 actually think the previous implementation here is better. Can we reverse this please?
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.
Actually the quantity
text right after the Indication text has a &mdash
, hence when we don't have indication, the row looks like: - QUANTITY 5 tablets
, hence I needed to put a fallback value for the missing indication.
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 see. I think I'd prefer just tracking whether or not we need to render the em-dash.
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.
The rule I'm going for is consistency: we should either render a "placeholder" for every field without data or, if, as we've done, we only selectively render fields when the convey some piece of information, we should do so consistently here.
@@ -207,8 +207,9 @@ const OrderDetailsTable: React.FC<OrderDetailsProps> = ({ patientUuid, showAddBu | |||
dosage: | |||
order.type === 'drugorder' ? ( | |||
<div className={styles.singleLineText}>{`${t('indication', 'Indication').toUpperCase()} | |||
${order.orderReasonNonCoded} ${'-'} ${t('quantity', 'Quantity').toUpperCase()} ${order.quantity} ${order | |||
?.quantityUnits?.display} `}</div> | |||
${order.orderReasonNonCoded ?? t('none', 'None')} ${'-'} ${t('quantity', 'Quantity').toUpperCase()} ${ |
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.
"No indication provided"
packages/esm-patient-medications-app/src/add-drug-order/drug-order-form.component.tsx
Show resolved
Hide resolved
@@ -36,6 +36,11 @@ export const configSchema = { | |||
'Number of milliseconds to delay the search operation in the drug search input by after the user starts typing. The useDebounce hook delays the search by 300ms by default', | |||
_default: 300, | |||
}, | |||
isIndicationFieldOptional: { |
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.
+1 for requireIndication: { _default: true }
.
Positive phrasing is easier to grok (implies "we require this by default") as opposed to the double negative isIndicationFieldOptional: { _default: false }
(implies "it's optional by default").
The validation logic reads better as well:
// Current validation logic
if (!isIndicationFieldOptional) { /* require indication */ }
// With requireIndication
if (requireIndication) { /* require indication */ }
Co-authored-by: Ian <52504170+ibacher@users.noreply.github.com>
7ed27d0
to
0062335
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.
Thanks, @vasharma05!
Requirements
Summary
This PR allows configuring the indication field as optional when saving the drug order form
Screenshots
Related Issue
https://openmrs.atlassian.net/issues/O3-4430
Other