Skip to content
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

(chore) Refactor ward patient card #1273

Merged
merged 5 commits into from
Aug 9, 2024
Merged

(chore) Refactor ward patient card #1273

merged 5 commits into from
Aug 9, 2024

Conversation

chibongho
Copy link
Contributor

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

This PR refactors the WardPatient type to have values populated from the inpatientAdmission, inpatientRequest and admissionLocation endpoints wrapped in their own fields. It also conslidates a few prop types separated defined for the WardPatientCard, AdissionRequestCard, and workspace PatientBanner into a common type.

Testing done:
Manually verified the follow loads correctly:

  • Ward Patient Card
  • Admission Request Card
  • Patient Banner in the Patient Note workspace
  • Workspace title after clicking on a Ward Patient Card

Screenshots

Related Issue

Other

Copy link
Member

@mogoodrich mogoodrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chibongho generally looks good to me.

I didn't review it with a fine-toothed comb :) but the new WardPatient definition totally makes sense to me, and it looks like most of the other changes were simplifying other props/elements using the new WardPatient type? Great!

* The admission detail. This object is only set if the patient has been
* admitted to the ward
*/
inpatientAdmission: InpatientAdmission;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this need a question mark? Or are you enforcing that it is explicitly set to null?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'd rather explicitly set these to null. (In fact, let me remove the ? from the bed field)

* The admission request. The object is only set if the patient has a
* pending admission / transfer request.
*/
inpatientRequest: InpatientRequest;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here.

<div>{getPatientName(patient)} &nbsp;</div>
<div className={styles.headerPatientDetail}>&middot; &nbsp; {patient.gender}</div>
<div className={styles.headerPatientDetail}>&middot; &nbsp; {age(patient.birthDate)}</div>
<div>{patient.person.display} &nbsp;</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we swtiching back to display here because it applies the name template formatting and getPatientName does not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this workspace to not use usePatient() because we already have the Patient object and don't need another fetch. usePatient() actually returns fhir.Patient, so I need to rework some of this since the fields are a bit different between those 2 types. Patient.display should respect the name template formatting defined server-side, and getPatientName is only used for fhir.Patient.

Copy link
Member

@usamaidrsk usamaidrsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @chibongho,

Thank you for your work on this. Could you please add some screenshots or screen recordings to help illustrate the changes?

Thanks again!

@chibongho
Copy link
Contributor Author

Hi @chibongho,

Thank you for your work on this. Could you please add some screenshots or screen recordings to help illustrate the changes?

Thanks again!

@usamaidrsk there should be no UI changes. Here're some screenshots to verify that the exisiting UI is still behaving correctly:

image
image
image
image

Copy link
Contributor

github-actions bot commented Aug 9, 2024

Size Change: -8.12 kB (-0.14%)

Total Size: 5.9 MB

ℹ️ View Unchanged
Filename Size Change
packages/esm-active-visits-app/dist/106.js 8.63 kB 0 B
packages/esm-active-visits-app/dist/130.js 315 kB 0 B
packages/esm-active-visits-app/dist/255.js 2.5 kB 0 B
packages/esm-active-visits-app/dist/271.js 813 B 0 B
packages/esm-active-visits-app/dist/316.js 42.9 kB 0 B
packages/esm-active-visits-app/dist/319.js 709 B 0 B
packages/esm-active-visits-app/dist/382.js 1.22 kB 0 B
packages/esm-active-visits-app/dist/443.js 6.98 kB 0 B
packages/esm-active-visits-app/dist/460.js 824 B 0 B
packages/esm-active-visits-app/dist/574.js 615 B 0 B
packages/esm-active-visits-app/dist/6.js 26.9 kB 0 B
packages/esm-active-visits-app/dist/635.js 1.22 kB 0 B
packages/esm-active-visits-app/dist/644.js 812 B 0 B
packages/esm-active-visits-app/dist/725.js 632 B 0 B
packages/esm-active-visits-app/dist/729.js 3.08 kB 0 B
packages/esm-active-visits-app/dist/757.js 719 B 0 B
packages/esm-active-visits-app/dist/784.js 2.63 kB 0 B
packages/esm-active-visits-app/dist/788.js 628 B 0 B
packages/esm-active-visits-app/dist/807.js 959 B 0 B
packages/esm-active-visits-app/dist/833.js 765 B 0 B
packages/esm-active-visits-app/dist/879.js 3.02 kB 0 B
packages/esm-active-visits-app/dist/966.js 51.3 kB 0 B
packages/esm-active-visits-app/dist/967.js 600 B 0 B
packages/esm-active-visits-app/dist/main.js 82.6 kB 0 B
packages/esm-active-visits-app/dist/openmrs-esm-active-visits-app.js 3.33 kB 0 B
packages/esm-appointments-app/dist/130.js 315 kB 0 B
packages/esm-appointments-app/dist/152.js 259 B 0 B
packages/esm-appointments-app/dist/23.js 14.4 kB 0 B
packages/esm-appointments-app/dist/255.js 2.51 kB 0 B
packages/esm-appointments-app/dist/265.js 1.79 kB 0 B
packages/esm-appointments-app/dist/271.js 2.31 kB 0 B
packages/esm-appointments-app/dist/303.js 259 B 0 B
packages/esm-appointments-app/dist/319.js 2.15 kB 0 B
packages/esm-appointments-app/dist/460.js 2.37 kB 0 B
packages/esm-appointments-app/dist/501.js 7.02 kB 0 B
packages/esm-appointments-app/dist/574.js 1.94 kB 0 B
packages/esm-appointments-app/dist/581.js 9.03 kB 0 B
packages/esm-appointments-app/dist/591.js 16.8 kB 0 B
packages/esm-appointments-app/dist/644.js 2.31 kB 0 B
packages/esm-appointments-app/dist/646.js 250 kB 0 B
packages/esm-appointments-app/dist/729.js 3.08 kB 0 B
packages/esm-appointments-app/dist/757.js 2.19 kB 0 B
packages/esm-appointments-app/dist/784.js 2.62 kB 0 B
packages/esm-appointments-app/dist/788.js 1.94 kB 0 B
packages/esm-appointments-app/dist/807.js 2.56 kB 0 B
packages/esm-appointments-app/dist/833.js 2.29 kB 0 B
packages/esm-appointments-app/dist/85.js 30.5 kB 0 B
packages/esm-appointments-app/dist/89.js 143 kB 0 B
packages/esm-appointments-app/dist/903.js 879 B 0 B
packages/esm-appointments-app/dist/main.js 410 kB 0 B
packages/esm-appointments-app/dist/openmrs-esm-appointments-app.js 3.39 kB 0 B
packages/esm-bed-management-app/dist/130.js 315 kB 0 B
packages/esm-bed-management-app/dist/148.js 1.22 kB 0 B
packages/esm-bed-management-app/dist/169.js 6.98 kB 0 B
packages/esm-bed-management-app/dist/271.js 680 B 0 B
packages/esm-bed-management-app/dist/319.js 680 B 0 B
packages/esm-bed-management-app/dist/460.js 680 B 0 B
packages/esm-bed-management-app/dist/501.js 7.03 kB 0 B
packages/esm-bed-management-app/dist/542.js 395 B 0 B
packages/esm-bed-management-app/dist/574.js 681 B 0 B
packages/esm-bed-management-app/dist/591.js 16.8 kB 0 B
packages/esm-bed-management-app/dist/644.js 680 B 0 B
packages/esm-bed-management-app/dist/668.js 26.5 kB 0 B
packages/esm-bed-management-app/dist/729.js 3.08 kB 0 B
packages/esm-bed-management-app/dist/757.js 726 B 0 B
packages/esm-bed-management-app/dist/766.js 113 kB 0 B
packages/esm-bed-management-app/dist/784.js 2.63 kB 0 B
packages/esm-bed-management-app/dist/788.js 680 B 0 B
packages/esm-bed-management-app/dist/805.js 49.6 kB 0 B
packages/esm-bed-management-app/dist/807.js 680 B 0 B
packages/esm-bed-management-app/dist/833.js 680 B 0 B
packages/esm-bed-management-app/dist/main.js 3.87 kB 0 B
packages/esm-bed-management-app/dist/openmrs-esm-bed-management-app.js 3.25 kB 0 B
packages/esm-patient-list-management-app/dist/112.js 73.3 kB 0 B
packages/esm-patient-list-management-app/dist/130.js 315 kB 0 B
packages/esm-patient-list-management-app/dist/255.js 2.51 kB 0 B
packages/esm-patient-list-management-app/dist/271.js 99.8 kB 0 B
packages/esm-patient-list-management-app/dist/319.js 1.51 kB 0 B
packages/esm-patient-list-management-app/dist/37.js 9.49 kB 0 B
packages/esm-patient-list-management-app/dist/382.js 1.23 kB 0 B
packages/esm-patient-list-management-app/dist/384.js 1.58 kB 0 B
packages/esm-patient-list-management-app/dist/443.js 6.98 kB 0 B
packages/esm-patient-list-management-app/dist/460.js 1.72 kB 0 B
packages/esm-patient-list-management-app/dist/574.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/591.js 16.9 kB 0 B
packages/esm-patient-list-management-app/dist/635.js 1.23 kB 0 B
packages/esm-patient-list-management-app/dist/644.js 1.58 kB 0 B
packages/esm-patient-list-management-app/dist/729.js 3.08 kB 0 B
packages/esm-patient-list-management-app/dist/757.js 1.51 kB 0 B
packages/esm-patient-list-management-app/dist/784.js 2.63 kB 0 B
packages/esm-patient-list-management-app/dist/788.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/807.js 1.85 kB 0 B
packages/esm-patient-list-management-app/dist/833.js 1.59 kB 0 B
packages/esm-patient-list-management-app/dist/main.js 177 kB 0 B
packages/esm-patient-list-management-app/dist/openmrs-esm-patient-list-management-app.js 3.31 kB 0 B
packages/esm-patient-registration-app/dist/130.js 314 kB 0 B
packages/esm-patient-registration-app/dist/152.js 264 B 0 B
packages/esm-patient-registration-app/dist/169.js 6.71 kB 0 B
packages/esm-patient-registration-app/dist/255.js 2.5 kB 0 B
packages/esm-patient-registration-app/dist/271.js 2.13 kB 0 B
packages/esm-patient-registration-app/dist/290.js 61.6 kB 0 B
packages/esm-patient-registration-app/dist/303.js 264 B 0 B
packages/esm-patient-registration-app/dist/319.js 2.05 kB 0 B
packages/esm-patient-registration-app/dist/371.js 547 B 0 B
packages/esm-patient-registration-app/dist/460.js 2.22 kB 0 B
packages/esm-patient-registration-app/dist/501.js 7.03 kB 0 B
packages/esm-patient-registration-app/dist/540.js 85 kB 0 B
packages/esm-patient-registration-app/dist/574.js 1.78 kB 0 B
packages/esm-patient-registration-app/dist/591.js 16.8 kB 0 B
packages/esm-patient-registration-app/dist/623.js 7.74 kB 0 B
packages/esm-patient-registration-app/dist/644.js 2.13 kB 0 B
packages/esm-patient-registration-app/dist/729.js 3.08 kB 0 B
packages/esm-patient-registration-app/dist/735.js 465 B 0 B
packages/esm-patient-registration-app/dist/757.js 2.15 kB 0 B
packages/esm-patient-registration-app/dist/784.js 2.63 kB 0 B
packages/esm-patient-registration-app/dist/788.js 1.78 kB 0 B
packages/esm-patient-registration-app/dist/807.js 2.51 kB 0 B
packages/esm-patient-registration-app/dist/833.js 2.06 kB 0 B
packages/esm-patient-registration-app/dist/879.js 3.03 kB 0 B
packages/esm-patient-registration-app/dist/main.js 149 kB 0 B
packages/esm-patient-registration-app/dist/openmrs-esm-patient-registration-app.js 3.35 kB 0 B
packages/esm-patient-search-app/dist/130.js 315 kB 0 B
packages/esm-patient-search-app/dist/255.js 2.5 kB 0 B
packages/esm-patient-search-app/dist/271.js 920 B 0 B
packages/esm-patient-search-app/dist/319.js 861 B 0 B
packages/esm-patient-search-app/dist/382.js 1.23 kB 0 B
packages/esm-patient-search-app/dist/420.js 22.4 kB 0 B
packages/esm-patient-search-app/dist/443.js 6.98 kB 0 B
packages/esm-patient-search-app/dist/460.js 939 B 0 B
packages/esm-patient-search-app/dist/574.js 742 B 0 B
packages/esm-patient-search-app/dist/591.js 16.8 kB 0 B
packages/esm-patient-search-app/dist/634.js 75.2 kB 0 B
packages/esm-patient-search-app/dist/635.js 1.23 kB 0 B
packages/esm-patient-search-app/dist/644.js 920 B 0 B
packages/esm-patient-search-app/dist/729.js 3.08 kB 0 B
packages/esm-patient-search-app/dist/757.js 871 B 0 B
packages/esm-patient-search-app/dist/784.js 2.63 kB 0 B
packages/esm-patient-search-app/dist/788.js 736 B 0 B
packages/esm-patient-search-app/dist/807.js 1.04 kB 0 B
packages/esm-patient-search-app/dist/833.js 877 B 0 B
packages/esm-patient-search-app/dist/main.js 101 kB 0 B
packages/esm-patient-search-app/dist/openmrs-esm-patient-search-app.js 3.3 kB 0 B
packages/esm-service-queues-app/dist/130.js 315 kB 0 B
packages/esm-service-queues-app/dist/152.js 261 B 0 B
packages/esm-service-queues-app/dist/169.js 6.98 kB 0 B
packages/esm-service-queues-app/dist/186.js 8.99 kB 0 B
packages/esm-service-queues-app/dist/199.js 1.35 kB 0 B
packages/esm-service-queues-app/dist/236.js 5.86 kB 0 B
packages/esm-service-queues-app/dist/255.js 2.51 kB 0 B
packages/esm-service-queues-app/dist/265.js 118 kB 0 B
packages/esm-service-queues-app/dist/271.js 4.52 kB 0 B
packages/esm-service-queues-app/dist/303.js 261 B 0 B
packages/esm-service-queues-app/dist/319.js 3.82 kB 0 B
packages/esm-service-queues-app/dist/366.js 7.87 kB 0 B
packages/esm-service-queues-app/dist/392.js 7.86 kB 0 B
packages/esm-service-queues-app/dist/460.js 4.74 kB 0 B
packages/esm-service-queues-app/dist/484.js 158 kB 0 B
packages/esm-service-queues-app/dist/501.js 7.03 kB 0 B
packages/esm-service-queues-app/dist/574.js 3.85 kB 0 B
packages/esm-service-queues-app/dist/591.js 16.8 kB 0 B
packages/esm-service-queues-app/dist/6.js 1.75 kB 0 B
packages/esm-service-queues-app/dist/604.js 6.98 kB 0 B
packages/esm-service-queues-app/dist/644.js 4.53 kB 0 B
packages/esm-service-queues-app/dist/670.js 10 kB 0 B
packages/esm-service-queues-app/dist/727.js 8.12 kB 0 B
packages/esm-service-queues-app/dist/729.js 3.08 kB 0 B
packages/esm-service-queues-app/dist/752.js 1.62 kB 0 B
packages/esm-service-queues-app/dist/757.js 3.89 kB 0 B
packages/esm-service-queues-app/dist/760.js 7.14 kB 0 B
packages/esm-service-queues-app/dist/784.js 2.63 kB 0 B
packages/esm-service-queues-app/dist/788.js 3.82 kB 0 B
packages/esm-service-queues-app/dist/800.js 1.68 kB 0 B
packages/esm-service-queues-app/dist/807.js 5.1 kB 0 B
packages/esm-service-queues-app/dist/818.js 2.55 kB 0 B
packages/esm-service-queues-app/dist/828.js 1.39 kB 0 B
packages/esm-service-queues-app/dist/833.js 4.43 kB 0 B
packages/esm-service-queues-app/dist/911.js 7.78 kB 0 B
packages/esm-service-queues-app/dist/940.js 21.4 kB 0 B
packages/esm-service-queues-app/dist/main.js 279 kB 0 B
packages/esm-service-queues-app/dist/openmrs-esm-service-queues-app.js 3.31 kB 0 B
packages/esm-ward-app/dist/130.js 315 kB 0 B
packages/esm-ward-app/dist/152.js 255 B 0 B
packages/esm-ward-app/dist/169.js 6.97 kB 0 B
packages/esm-ward-app/dist/23.js 29.7 kB 0 B
packages/esm-ward-app/dist/255.js 2.5 kB 0 B
packages/esm-ward-app/dist/268.js 0 B -7.85 kB (removed) 🏆
packages/esm-ward-app/dist/303.js 255 B 0 B
packages/esm-ward-app/dist/501.js 7.02 kB 0 B
packages/esm-ward-app/dist/526.js 13 kB 0 B
packages/esm-ward-app/dist/574.js 1.04 kB -37 B (-3.44%)
packages/esm-ward-app/dist/591.js 16.8 kB 0 B
packages/esm-ward-app/dist/725.js 25 kB -91 B (-0.36%)
packages/esm-ward-app/dist/729.js 3.07 kB 0 B
packages/esm-ward-app/dist/749.js 7.89 kB 0 B
packages/esm-ward-app/dist/767.js 648 B 0 B
packages/esm-ward-app/dist/784.js 2.62 kB 0 B
packages/esm-ward-app/dist/882.js 17.3 kB -113 B (-0.65%)
packages/esm-ward-app/dist/940.js 21.4 kB 0 B
packages/esm-ward-app/dist/960.js 342 B 0 B
packages/esm-ward-app/dist/999.js 5.03 kB +41 B (+0.82%)
packages/esm-ward-app/dist/main.js 57.9 kB -67 B (-0.12%)
packages/esm-ward-app/dist/openmrs-esm-ward-app.js 3.3 kB 0 B

compressed-size-action

Copy link
Member

@mseaton mseaton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it

@chibongho chibongho merged commit 2ff5ef0 into main Aug 9, 2024
6 checks passed
@chibongho chibongho deleted the refactor-ward-patient branch August 9, 2024 15:00
@chibongho chibongho changed the title Refactor ward patient card (chore) Refactor ward patient card Aug 9, 2024
@denniskigen denniskigen mentioned this pull request Aug 29, 2024
3 tasks
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants