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

(fix) Add notes to Vitals widget #2047

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/esm-patient-vitals-app/src/common/data.resource.ts
Original file line number Diff line number Diff line change
@@ -181,6 +181,8 @@ export function useVitalsAndBiometrics(patientUuid: string, mode: VitalsAndBiome
return 'weight';
case concepts.midUpperArmCircumferenceUuid:
return 'muac';
case concepts.generalPatientNoteUuid:
return 'generalPatientNote';
default:
return ''; // or throw an error for unknown conceptUuid
}
@@ -195,6 +197,7 @@ export function useVitalsAndBiometrics(patientUuid: string, mode: VitalsAndBiome
concepts.respiratoryRateUuid,
concepts.temperatureUuid,
concepts.weightUuid,
concepts.generalPatientNoteUuid,
],
);

@@ -209,7 +212,7 @@ export function useVitalsAndBiometrics(patientUuid: string, mode: VitalsAndBiome
if (vitalsHashTable.has(recordedDate) && vitalsHashTable.get(recordedDate)) {
vitalsHashTable.set(recordedDate, {
...vitalsHashTable.get(recordedDate),
[getVitalsMapKey(vitalSign.code)]: vitalSign.value,
[getVitalsMapKey(vitalSign.code)]: vitalSign.valueString || vitalSign.value,
[getInterpretationKey(getVitalsMapKey(vitalSign.code))]: vitalSign.interpretation,
});
} else {
@@ -300,6 +303,7 @@ function vitalsProperties(conceptMetadata: Array<ConceptMetadata> | undefined) {
),
recordedDate: resource?.effectiveDateTime,
value: resource?.valueQuantity?.value,
valueString: resource?.valueString,
});
}

2 changes: 2 additions & 0 deletions packages/esm-patient-vitals-app/src/common/types.ts
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ export type MappedVitals = {
interpretation: string;
recordedDate: Date;
value: number;
valueString: string;
};

export interface PatientVitalsAndBiometrics {
@@ -39,6 +40,7 @@ export interface PatientVitalsAndBiometrics {
bmi?: number | null;
respiratoryRate?: number;
muac?: number;
generalPatientNote?: string;
}

export interface VitalsResponse {
1 change: 1 addition & 0 deletions packages/esm-patient-vitals-app/src/config-schema.ts
Original file line number Diff line number Diff line change
@@ -116,6 +116,7 @@ export interface ConfigObject {
weightUuid: string;
respiratoryRateUuid: string;
midUpperArmCircumferenceUuid: string;
generalPatientNoteUuid: string;
};
vitals: {
useFormEngine: boolean;
4 changes: 3 additions & 1 deletion packages/esm-patient-vitals-app/src/vitals/types.ts
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ export interface VitalsTableRow extends PatientVitalsAndBiometrics {
spo2Render: string | number;
temperatureRender: string | number;
respiratoryRateRender: string | number;
generalPatientNoteRender: string;
}

export interface VitalsTableHeader {
@@ -17,7 +18,8 @@ export interface VitalsTableHeader {
| 'bloodPressureRender'
| 'pulseRender'
| 'respiratoryRateRender'
| 'spo2Render';
| 'spo2Render'
| 'generalPatientNoteRender';
header: string;
isSortable?: boolean;
sortFunc: (valueA: VitalsTableRow, valueB: VitalsTableRow) => number;
Original file line number Diff line number Diff line change
@@ -134,6 +134,12 @@ const VitalsOverview: React.FC<VitalsOverviewProps> = ({ patientUuid, pageSize,

sortFunc: (valueA, valueB) => (valueA.spo2 && valueB.spo2 ? valueA.spo2 - valueB.spo2 : 0),
},
{
key: 'generalPatientNoteRender',
header: t('notes', 'Notes'),
isSortable: true,
sortFunc: (valueA, valueB) => new Date(valueA.date).getTime() - new Date(valueB.date).getTime(),
},
];

const tableRows: Array<VitalsTableRow> = useMemo(
@@ -148,6 +154,7 @@ const VitalsOverview: React.FC<VitalsOverviewProps> = ({ patientUuid, pageSize,
spo2Render: vitalSigns.spo2 ?? '--',
temperatureRender: vitalSigns.temperature ?? '--',
respiratoryRateRender: vitalSigns.respiratoryRate ?? '--',
generalPatientNoteRender: vitalSigns.generalPatientNote ?? '--',
};
}),
[vitals],