-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
UHM-7439, add queue table metrics #1118
Conversation
Size Change: -49.3 kB (-1%) Total Size: 3.53 MB
ℹ️ View Unchanged
|
packages/esm-service-queues-app/src/queue-table/queue-table-metrics.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-service-queues-app/src/queue-table/queue-table-metrics.component.tsx
Outdated
Show resolved
Hide resolved
packages/esm-service-queues-app/src/queue-table/queue-table-metrics-card.component.tsx
Show resolved
Hide resolved
Overall idea looks good to me. |
Thanks @mseaton and @chibongho ! I've got the queue statuses to render dynamically along with the number of queue entries for each status: Next, I will work on the styling to see if I could get it to look close to the designs. Thanks! |
@mseaton , can I merge in this PR? Thanks! |
|
||
return ( | ||
<div className={styles.metricsBorder}> | ||
<QueueTableMetricsCard value={queueEntries.length} headerLabel={t('totalPatients', 'Total Patients')} /> |
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.
use totalCount
returned from useQueueEntries()
instead. queueEntries.length
is technically incorrect because the REST endpoint limits the max returned result count to 50 by default.
This also means the per-status metrics are not calculated correctly as is, but I don't really know what's the best solution to that. We have a related ticket regarding this.
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 @chibongho ! I have updated the PR to use totalCount. Thanks!
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.
If the same totalCount
can't be applied to the per-status counts @cioan , then one way to solve this would be via multiple calls to the queue-entry-metrics
endpoint that is here: https://github.com/openmrs/openmrs-module-queue/blob/main/omod/src/main/java/org/openmrs/module/queue/web/QueueEntryMetricRestController.java . Not sure if this will be too much overhead with the multiple calls, but it would provide the most accurate data.
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 @mseaton ! I was able to use the queue-entry-metrics REST API to provide an accurate count of the queue entries by status. Please review the updated PR. Thanks!
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.
Looking pretty good @cioan . A few additional comments to address
const { t } = useTranslation(); | ||
|
||
const allowedStatuses = selectedQueue.allowedStatuses; | ||
const { totalCount } = useQueueEntries({ queue: selectedQueue.uuid, isEnded: 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.
Should this also use the metric endpoint for consistency?
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.
Sure, np. I have updated the PR.
<QueueTableMetricsCard | ||
queueUuid={selectedQueue.uuid} | ||
serviceUuid={selectedQueue.service.uuid} | ||
status={status.display} |
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.
Why are you passing in the status display name here? This should be status.uuid
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.
Changed to status.uuid. Thanks!
return ( | ||
<QueueTableMetricsCard | ||
queueUuid={selectedQueue.uuid} | ||
serviceUuid={selectedQueue.service.uuid} |
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.
serviceUuid is totally unnecessary - you are already passing in the queue, the service is redundant.
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.
OK, I removed it.
@chibongho and @mseaton , before I go and implement all those configurable statuses and the number of patients in each table, just wanted to make sure if the following components are the right components to implement? Thanks!