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

O3-3210 ward app - configuration system for ward patient cards #1184

Merged
merged 24 commits into from
Jun 12, 2024
Merged

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 introduces a configuration system to ward app, as mocked up here.

The configuration models each Ward Patient Card as a list of rows. In the link above, a card has 3 rows: the header, middle section (baby info), and footer. On other pages in the mock up, there can be other types of rows as well. (For example, here some cards can have extra rows.) The patient's card (and sometimes only its header) can also appear in different contexts, either fully (in the workspace) or patially with the header (also in the workspace).

The most common type of row is the "Bento Box" row, which can contain 1 or more elements displaying patient attributes. In the first link, the header, baby info, and footer rows should theoretically all be modeled as a bento box row.

The configuration system defines a card as having the header row, and any other additional row can be slotted in as extension. The header row gets special treatment (instead of it being just another extension) as it can sometimes be rendered (with the other rows) in different contexts.

In this PR, 4 types of bento elements (bed number, patient name, patient age, patient address) are defined and can be configured to appear in any bento boxes. In future PRs, more bento elements will be defined to support other elements defined in the mockups.

Screenshots

image

Related Issue

Other

Copy link
Contributor

github-actions bot commented Jun 10, 2024

Size Change: -13.9 kB (-0.4%)

Total Size: 3.48 MB

Filename Size Change
packages/esm-ward-app/dist/663.js 0 B -14.4 kB (removed) 🏆
ℹ️ View Unchanged
Filename Size Change
packages/esm-active-visits-app/dist/130.js 178 kB +234 B (+0.13%)
packages/esm-active-visits-app/dist/255.js 2.5 kB 0 B
packages/esm-active-visits-app/dist/271.js 783 B 0 B
packages/esm-active-visits-app/dist/316.js 42.9 kB 0 B
packages/esm-active-visits-app/dist/319.js 687 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 794 B 0 B
packages/esm-active-visits-app/dist/574.js 592 B 0 B
packages/esm-active-visits-app/dist/635.js 1.22 kB 0 B
packages/esm-active-visits-app/dist/644.js 783 B 0 B
packages/esm-active-visits-app/dist/729.js 3.08 kB 0 B
packages/esm-active-visits-app/dist/757.js 700 B 0 B
packages/esm-active-visits-app/dist/784.js 2.63 kB 0 B
packages/esm-active-visits-app/dist/788.js 590 B 0 B
packages/esm-active-visits-app/dist/807.js 935 B 0 B
packages/esm-active-visits-app/dist/833.js 742 B 0 B
packages/esm-active-visits-app/dist/835.js 14.2 kB 0 B
packages/esm-active-visits-app/dist/875.js 50.5 kB 0 B
packages/esm-active-visits-app/dist/879.js 3.02 kB 0 B
packages/esm-active-visits-app/dist/main.js 69.5 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 178 kB +232 B (+0.13%)
packages/esm-appointments-app/dist/152.js 259 B 0 B
packages/esm-appointments-app/dist/224.js 42.1 kB 0 B
packages/esm-appointments-app/dist/255.js 2.51 kB 0 B
packages/esm-appointments-app/dist/271.js 1.99 kB 0 B
packages/esm-appointments-app/dist/303.js 259 B 0 B
packages/esm-appointments-app/dist/309.js 879 B 0 B
packages/esm-appointments-app/dist/319.js 1.88 kB 0 B
packages/esm-appointments-app/dist/4.js 1.78 kB 0 B
packages/esm-appointments-app/dist/445.js 249 kB 0 B
packages/esm-appointments-app/dist/460.js 2.09 kB 0 B
packages/esm-appointments-app/dist/501.js 7.02 kB 0 B
packages/esm-appointments-app/dist/574.js 1.93 kB 0 B
packages/esm-appointments-app/dist/591.js 16.8 kB 0 B
packages/esm-appointments-app/dist/644.js 1.99 kB 0 B
packages/esm-appointments-app/dist/729.js 3.08 kB 0 B
packages/esm-appointments-app/dist/757.js 1.75 kB 0 B
packages/esm-appointments-app/dist/784.js 2.62 kB 0 B
packages/esm-appointments-app/dist/788.js 1.69 kB 0 B
packages/esm-appointments-app/dist/807.js 2.31 kB 0 B
packages/esm-appointments-app/dist/833.js 1.98 kB 0 B
packages/esm-appointments-app/dist/857.js 14.2 kB 0 B
packages/esm-appointments-app/dist/904.js 20.7 kB 0 B
packages/esm-appointments-app/dist/main.js 307 kB 0 B
packages/esm-appointments-app/dist/openmrs-esm-appointments-app.js 3.39 kB 0 B
packages/esm-patient-list-management-app/dist/130.js 178 kB +234 B (+0.13%)
packages/esm-patient-list-management-app/dist/139.js 22.4 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 1.58 kB 0 B
packages/esm-patient-list-management-app/dist/319.js 1.51 kB 0 B
packages/esm-patient-list-management-app/dist/382.js 1.23 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/548.js 4.79 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.5 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/930.js 98.3 kB 0 B
packages/esm-patient-list-management-app/dist/main.js 125 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 178 kB +218 B (+0.12%)
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/207.js 2.44 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.05 kB 0 B
packages/esm-patient-registration-app/dist/303.js 264 B 0 B
packages/esm-patient-registration-app/dist/319.js 1.99 kB 0 B
packages/esm-patient-registration-app/dist/34.js 61.3 kB 0 B
packages/esm-patient-registration-app/dist/371.js 547 B 0 B
packages/esm-patient-registration-app/dist/460.js 2.15 kB 0 B
packages/esm-patient-registration-app/dist/501.js 7.03 kB 0 B
packages/esm-patient-registration-app/dist/572.js 37.2 kB 0 B
packages/esm-patient-registration-app/dist/574.js 1.71 kB 0 B
packages/esm-patient-registration-app/dist/591.js 16.8 kB 0 B
packages/esm-patient-registration-app/dist/644.js 2.05 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.08 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.71 kB 0 B
packages/esm-patient-registration-app/dist/807.js 2.45 kB 0 B
packages/esm-patient-registration-app/dist/833.js 1.99 kB 0 B
packages/esm-patient-registration-app/dist/879.js 3.03 kB 0 B
packages/esm-patient-registration-app/dist/main.js 101 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 178 kB +233 B (+0.13%)
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/299.js 23.2 kB 0 B
packages/esm-patient-search-app/dist/319.js 861 B 0 B
packages/esm-patient-search-app/dist/354.js 22 kB 0 B
packages/esm-patient-search-app/dist/382.js 1.23 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/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 48.6 kB -1 B (0%)
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 178 kB +234 B (+0.13%)
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/200.js 49.5 kB 0 B
packages/esm-service-queues-app/dist/233.js 1.75 kB 0 B
packages/esm-service-queues-app/dist/237.js 3.17 kB 0 B
packages/esm-service-queues-app/dist/255.js 2.52 kB 0 B
packages/esm-service-queues-app/dist/271.js 4.17 kB 0 B
packages/esm-service-queues-app/dist/276.js 2.24 kB 0 B
packages/esm-service-queues-app/dist/303.js 261 B 0 B
packages/esm-service-queues-app/dist/319.js 3.55 kB 0 B
packages/esm-service-queues-app/dist/382.js 1.23 kB 0 B
packages/esm-service-queues-app/dist/401.js 3.06 kB 0 B
packages/esm-service-queues-app/dist/430.js 156 kB 0 B
packages/esm-service-queues-app/dist/460.js 4.42 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.84 kB 0 B
packages/esm-service-queues-app/dist/591.js 16.8 kB 0 B
packages/esm-service-queues-app/dist/635.js 1.23 kB 0 B
packages/esm-service-queues-app/dist/644.js 4.17 kB 0 B
packages/esm-service-queues-app/dist/650.js 3.29 kB 0 B
packages/esm-service-queues-app/dist/669.js 3.2 kB 0 B
packages/esm-service-queues-app/dist/696.js 1.39 kB 0 B
packages/esm-service-queues-app/dist/703.js 4.17 kB 0 B
packages/esm-service-queues-app/dist/729.js 3.08 kB 0 B
packages/esm-service-queues-app/dist/738.js 1.35 kB 0 B
packages/esm-service-queues-app/dist/757.js 3.55 kB 0 B
packages/esm-service-queues-app/dist/764.js 2.61 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.54 kB 0 B
packages/esm-service-queues-app/dist/806.js 1.62 kB 0 B
packages/esm-service-queues-app/dist/807.js 4.84 kB 0 B
packages/esm-service-queues-app/dist/833.js 4.11 kB 0 B
packages/esm-service-queues-app/dist/877.js 2.98 kB 0 B
packages/esm-service-queues-app/dist/894.js 2.38 kB 0 B
packages/esm-service-queues-app/dist/917.js 2.78 kB 0 B
packages/esm-service-queues-app/dist/940.js 21.4 kB 0 B
packages/esm-service-queues-app/dist/981.js 1.68 kB 0 B
packages/esm-service-queues-app/dist/main.js 208 kB 0 B
packages/esm-service-queues-app/dist/openmrs-esm-service-queues-app.js 3.35 kB 0 B
packages/esm-ward-app/dist/114.js 0 B -3.42 kB (removed) 🏆
packages/esm-ward-app/dist/130.js 178 kB +234 B (+0.13%)
packages/esm-ward-app/dist/443.js 6.97 kB 0 B
packages/esm-ward-app/dist/49.js 5.67 kB 0 B
packages/esm-ward-app/dist/574.js 302 B +24 B (+8.63%) 🔍
packages/esm-ward-app/dist/591.js 16.8 kB 0 B
packages/esm-ward-app/dist/697.js 14.9 kB 0 B
packages/esm-ward-app/dist/729.js 3.07 kB 0 B
packages/esm-ward-app/dist/784.js 2.62 kB 0 B
packages/esm-ward-app/dist/main.js 22.4 kB +2.37 kB (+11.79%) ⚠️
packages/esm-ward-app/dist/openmrs-esm-ward-app.js 3.22 kB -1 B (-0.03%)

compressed-size-action

Copy link
Member

@ibacher ibacher left a comment

Choose a reason for hiding this comment

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

Mostly LGTM. A few q.s and suggestions.

{patients.map((patient, index: number) => {
const last = index === patients.length - 1;
return (
<div key={patient.uuid + ' ' + index}>
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't patient.uuid be unique?

Copy link
Contributor

Choose a reason for hiding this comment

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

However you should append a namespace for the key. We don't want random components around the app all having their key equal the patient UUID.

Suggested change
<div key={patient.uuid + ' ' + index}>
<div key={`occupied-bed-pt-${patient.uuid}`}>

packages/esm-ward-app/src/beds/occupied-bed.component.tsx Outdated Show resolved Hide resolved
@@ -0,0 +1,24 @@
@use '@carbon/styles/scss/spacing';
@use '@carbon/styles/scss/type';
@import '~@openmrs/esm-styleguide/src/vars';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@import '~@openmrs/esm-styleguide/src/vars';
@use '@openmrs/esm-styleguide/src/vars';

Requires vars.$ui-02, etc., but slightly friendlier to the Sass compiler.

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't know about this! Does it compile faster, or result in better output, or both?

@denniskigen should we add something about this to the docs, if we have docs on SCSS/style?

Copy link
Member

Choose a reason for hiding this comment

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

Theoretically, it compiles faster and produces more predictable output. However, the strongest reason is that the Sass team has said they're planning on deprecating @import altogether. See here for more. (I say theoretically, because the vars file itself doesn't really add any bloat, but @import parts of Carbon definitely would).

export const configSchema: ConfigSchema = {
wardPatientCards: {
_description: 'Configure the display of ward patient cards',
bentoElementDefinitions: {
Copy link
Member

Choose a reason for hiding this comment

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

What is a bentoElementDefinition? I'm not entirely sure this nomenclature is clear.

Copy link
Member

Choose a reason for hiding this comment

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

I think something like patientCardElement might be clearer.

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, it's the individual elements that can show up within a patient card row (like bed number, patient name, patiant age, patient address). I'll change it to PatientCardRowElement.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see where you're coming from with PatientCardRowElement @chibongho but unfortunately I think the formal logic of the name does not align with intuition—I think it is very easy to read PatientCardRowElement and think the element is supposed to be a row. I think @mseaton 's suggestion of patientCardElement is clearest.

Copy link
Contributor

Choose a reason for hiding this comment

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

So this would be patientCardElementDefinitions

export interface WardPatientCardDefinition {
card: {
id: string;
header: Array<string>; // an array of (either built-in or custom) bento element ids
Copy link
Member

Choose a reason for hiding this comment

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

Convert this into a doc string (/** */)

header: Array<string>; // an array of (either built-in or custom) bento element ids
};
appliedTo?: Array<{
location: string; // locationUuid. If given, only applies to patients at the specified ward locations. (If not provided, applies to all locations)
Copy link
Member

Choose a reason for hiding this comment

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

This would also be useful as a docstring.

Comment on lines 9 to 11
{t('yearsOld', '{{age}} yrs', {
age: patient?.person?.age,
})}
Copy link
Member

Choose a reason for hiding this comment

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

I'd probably suggest using esm-framework's age() function here. That handles years, months, weeks, and days (may need some extension for hours).

Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The backend isn't returning the birthdate either. I'll add a TODO.

Copy link
Contributor

Choose a reason for hiding this comment

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

There is this PR. May be we push for its review

Copy link
Member

Choose a reason for hiding this comment

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

Ah... I hadn't looked into the backend, but it looks like the fields returned from patient are hard-coded. Here's a ticket to adjust that: https://openmrs.atlassian.net/browse/BED-10.


const WardPatientName: WardPatientCardBentoElement = ({ patient }) => {
// TODO: make server return patient.display and use that instead
const { givenName, familyName } = patient?.person?.preferredName;
Copy link
Member

Choose a reason for hiding this comment

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

Better to use patient?.person?.display (patient?.display has the primary identifier as well).

Copy link
Member

Choose a reason for hiding this comment

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

Also there is likely a utility method to get a patient name (or should be) for display. There may be active work ongoing around this, but the way a patient name is formatted is configurable on the backend, and should likely be respected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a displayName function from esm-framework, but it takes in a FHIR patient instead of an OpenMRS Patient. I'll use patient?.person?.display for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually... the REST endpoint we are using (/adminLocation) does not return patient.person.display even with v=full. I'll keep this (and the TODO) for now.

Copy link
Member

Choose a reason for hiding this comment

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

patient?.person?.display, when it exists, is already formatted according to the backend name template. We sort of need a utility function for FHIR, because the display name is (in FHIRPath syntax) Patient.name.where(use='usual').text.first(), but we have a fallback if the text element is not defined which happens in cases where we've constructed a pseudo-FHIR patient out of the results of the REST API.

<span className={admittedPatientHeaderStyles.bedNumber}>{bed.bedNumber}</span>
<span className={`${wardPatientCardStyles.wardPatientBedNumber} ${wardPatientCardStyles.empty}`}>
{bed.bedNumber}
</span>
<p className={styles.emptyBed}>Empty Bed</p>
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be translated.

import styles from './occupied-bed.scss';
import { Tag } from '@carbon/react';
import { useTranslation } from 'react-i18next';
import WardPatientCard from '../ward-patient-card/ward-pateint-card.component';
Copy link
Member

Choose a reason for hiding this comment

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

ward-pateint-card.component is misspelled

const last = index === patients.length - 1;
return (
<div key={patient.uuid + ' ' + index}>
<WardPatientCard patient={patient} bed={bed} status={'admitted'} />
Copy link
Member

Choose a reason for hiding this comment

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

An occupied bed != admitted, it just means the bed is occupied. Admission is a separate, orthongonal concern.

packages/esm-ward-app/src/beds/occupied-bed.component.tsx Outdated Show resolved Hide resolved

export interface ConfigObject {}
export const defaultBentoElementConfig: BentoElementConfig = {
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand why this is and why it has addressFields in it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's supposed to be a common config object for various types of bentoElements. (See comment below)

_description: 'The unique identifier for this card definition. Currently unused, but that might change.',
},
card: {
header: {
Copy link
Member

Choose a reason for hiding this comment

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

Per our discussion, I'm still of the belief that a card should be made up of 1-N sections, which contain 1-N elements. And these sections could have a type associated with them, or otherwise be configured to indicate if they should appear up in particular views (eg. in a minimal view that is used in the Admission Request workspace, or in a maximal view used in the ward cards.

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 think your suggestion of having every Patient Card Rows be modeled as a "bento box", even with rows that don't fit neatly within that paradigm as a bento box with one element (possibly an extension), is worth exploring. I've tried modeling this by having different row types and wasn't that satisfied with how complex it was.

Copy link
Contributor

Choose a reason for hiding this comment

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

@mseaton Yeah @chibongho and I had a nice discussion about this yesterday and arrived at this design. The card has a header row, with name, age, etc, and a bunch of define-in-config elements. It also has a footer row that just has an array of define-in-config elements. The rows in the middle are I think a very good use of the extension system. Using the extension system for this has the following advantages:

  • Simplifies the card config schema. Having rows as define-in-config elements that each contain their own define-in-config elements would make this far more complex than any existing schema. Even in the registration app, which has define-in-config sections containing define-in-config fields, there are not multiple types of sections with different valid types of configuration, as would be required for this.
  • Allows new row types to be defined in other modules. If some implementation comes along with some very specific requirement for a row that should appear in the cards, which is very different than any existing row, they can add that extension to a module that they own and plug it in using configuration.

It allows exactly the same amount of flexibility and configurability.

config?: BentoElementConfig;
};

export interface PatientAddressBentoElementConfig {
Copy link
Member

Choose a reason for hiding this comment

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

This is what I would expect to see, not to have this at the top level

export type WardPatientCardRow = React.FC<WardPatientCardProps>;
export type WardPatientCardBentoElement = React.FC<WardPatientCardProps>;

export type WardPatientStatus = 'admitted' | 'pending';
Copy link
Member

Choose a reason for hiding this comment

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

Patients might be in a bed but not admitted.

Comment on lines 9 to 11
{t('yearsOld', '{{age}} yrs', {
age: patient?.person?.age,
})}
Copy link
Member

Choose a reason for hiding this comment

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

+1


const WardPatientName: WardPatientCardBentoElement = ({ patient }) => {
// TODO: make server return patient.display and use that instead
const { givenName, familyName } = patient?.person?.preferredName;
Copy link
Member

Choose a reason for hiding this comment

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

Also there is likely a utility method to get a patient name (or should be) for display. There may be active work ongoing around this, but the way a patient name is formatted is configurable on the backend, and should likely be respected.

@chibongho chibongho marked this pull request as ready for review June 11, 2024 20:04
@chibongho
Copy link
Contributor Author

Updated with PR feedback and changed the configuration to allow for multiple rows. Hopefully that simplifies things.

@chibongho chibongho requested review from brandones and mseaton June 11, 2024 20:05
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.

This looks great to me @chibongho , thanks! I'm still a little unsure about the address configuration, but it sounds like it has been given lots of thought and attention, so defer more to the experts on that, and if this is the best practice identified, it works for me.

@chibongho chibongho merged commit cdcae15 into main Jun 12, 2024
6 checks passed
@chibongho chibongho deleted the O3-3210 branch June 12, 2024 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants