@pih/esm-commons-app 2.1.1-pre.112 → 2.1.1-pre.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","pages":[{"component":"root","route":"appointments"},{"component":"root","route":"service-queues"},{"component":"root","route":"dispensing2"},{"component":"root","route":"ward"}],"extensions":[{"name":"o2-pregnancy-infant-dashboard","component":"o2PregnancyInfantDashboard","slot":"ward-patient-workspace-content-slot"},{"name":"triage-waiting-queue-actions","component":"triageWaitingQueueActions","slot":"queue-table-triage-waiting-queue-actions-slot"}],"workspaces2":[{"name":"o2-visit-summary-workspace","component":"o2VisitSummaryWorkspace","window":"o2-visit-summary-window"},{"name":"o2-vital-signs-workspace","component":"o2VitalSignsWorkspace","window":"o2-vital-signs-window"},{"name":"maternal-triage-form-workspace","component":"maternalTriageFormWorkspace","window":"maternal-triage-form-window"}],"workspaceWindows2":[{"name":"o2-visit-summary-window","icon":"o2VisitSummaryWorkspaceSideRailIcon","group":"ward-patient","width":"extra-wide","canMaximize":true},{"name":"o2-vital-signs-window","icon":"o2VitalSignsWorkspaceSideRailIcon","group":"ward-patient","width":"extra-wide","canMaximize":true},{"name":"maternal-triage-form-window","group":"service-queues","width":"extra-wide","canMaximize":true}],"version":"2.1.1-pre.112"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","pages":[{"component":"root","route":"appointments"},{"component":"root","route":"service-queues"},{"component":"root","route":"dispensing2"},{"component":"root","route":"ward"}],"extensions":[{"name":"o2-pregnancy-infant-dashboard","component":"o2PregnancyInfantDashboard","slot":"ward-patient-workspace-content-slot"},{"name":"triage-waiting-queue-actions","component":"triageWaitingQueueActions","slot":"queue-table-triage-waiting-queue-actions-slot"}],"workspaces2":[{"name":"o2-visit-summary-workspace","component":"o2VisitSummaryWorkspace","window":"o2-visit-summary-window"},{"name":"o2-vital-signs-workspace","component":"o2VitalSignsWorkspace","window":"o2-vital-signs-window"},{"name":"maternal-triage-form-workspace","component":"maternalTriageFormWorkspace","window":"maternal-triage-form-window"}],"workspaceWindows2":[{"name":"o2-visit-summary-window","icon":"o2VisitSummaryWorkspaceSideRailIcon","group":"ward-patient","width":"extra-wide","canMaximize":true},{"name":"o2-vital-signs-window","icon":"o2VitalSignsWorkspaceSideRailIcon","group":"ward-patient","width":"extra-wide","canMaximize":true},{"name":"maternal-triage-form-window","group":"service-queues","width":"extra-wide","canMaximize":true}],"version":"2.1.1-pre.119"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pih/esm-commons-app",
3
- "version": "2.1.1-pre.112",
3
+ "version": "2.1.1-pre.119",
4
4
  "description": "An app to define extensions to be slotted into other apps that are not PIH specific.",
5
5
  "browser": "dist/pih-esm-commons-app.js",
6
6
  "main": "src/index.ts",
@@ -21,6 +21,11 @@ export const configSchema = {
21
21
  _default: '1440AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
22
22
  _description: 'UUID for the Fetal heart rate concept',
23
23
  },
24
+ secondFhrUuid: {
25
+ _type: Type.ConceptUuid,
26
+ _default: 'fee3bcb1-209e-4eb2-9204-fbf7ca4a05d1',
27
+ _description: 'UUID for the Heart beat of 2nd fetus concept',
28
+ },
24
29
  },
25
30
  };
26
31
 
@@ -11,7 +11,7 @@ import {
11
11
  TableRow,
12
12
  Button,
13
13
  } from '@carbon/react';
14
- import { restBaseUrl, useConfig, useOpenmrsFetchAll, usePagination } from '@openmrs/esm-framework';
14
+ import { restBaseUrl, useConfig, useOpenmrsFetchAll, usePagination, usePatient } from '@openmrs/esm-framework';
15
15
  import { Pagination, NumericObservation } from '@openmrs/esm-styleguide';
16
16
  import {
17
17
  useConceptReferenceRanges,
@@ -64,7 +64,7 @@ const VitalsTable: React.FC<VitalsTableProps> = ({ patientUuid, visitUuid }) =>
64
64
  externalModuleName: '@openmrs/esm-patient-vitals-app',
65
65
  });
66
66
  const { concepts: localConcepts } = useConfig<{
67
- concepts: { hemoglobinUuid: string; glucoseUuid: string; fhrUuid: string };
67
+ concepts: { hemoglobinUuid: string; glucoseUuid: string; fhrUuid: string; secondFhrUuid: string };
68
68
  }>();
69
69
  const vitalsConcepts = {
70
70
  systolic: externalConcepts.systolicBloodPressureUuid,
@@ -76,10 +76,20 @@ const VitalsTable: React.FC<VitalsTableProps> = ({ patientUuid, visitUuid }) =>
76
76
  hemoglobin: localConcepts.hemoglobinUuid,
77
77
  glucose: localConcepts.glucoseUuid,
78
78
  fhr: localConcepts.fhrUuid,
79
+ secondFhr: localConcepts.secondFhrUuid,
79
80
  };
80
81
  const { referenceRangeMap } = useConceptReferenceRanges(patientUuid, Object.values(vitalsConcepts));
81
82
  const { t } = useTranslation();
82
83
  const [showAll, setShowAll] = useState(false);
84
+ const { patient } = usePatient(patientUuid);
85
+
86
+ // Check if patient is less than 30 days old
87
+ const isNewborn = useMemo(() => {
88
+ if (!patient?.birthDate) return false;
89
+ const birthDate = dayjs(patient.birthDate);
90
+ const ageInDays = dayjs().diff(birthDate, 'day');
91
+ return ageInDays < 30;
92
+ }, [patient?.birthDate]);
83
93
 
84
94
  const interpretationLabels: Record<ObservationInterpretation, string> = {
85
95
  normal: t('normal', 'Normal'),
@@ -108,6 +118,7 @@ const VitalsTable: React.FC<VitalsTableProps> = ({ patientUuid, visitUuid }) =>
108
118
  hemoglobin?: VitalCellData;
109
119
  glucose?: VitalCellData;
110
120
  fhr?: VitalCellData;
121
+ secondFhr?: VitalCellData;
111
122
  provider?: string;
112
123
  }
113
124
 
@@ -130,16 +141,27 @@ const VitalsTable: React.FC<VitalsTableProps> = ({ patientUuid, visitUuid }) =>
130
141
  };
131
142
  };
132
143
 
133
- const vitalColumns: Array<{ key: VitalColumnKey; label: string; conceptUuid?: string }> = [
134
- { key: 'bp', label: t('bloodPressure', 'BP') },
135
- { key: 'pulse', label: t('pulse', 'HR'), conceptUuid: vitalsConcepts.pulse },
136
- { key: 'temperature', label: t('temperature', 'Temp'), conceptUuid: vitalsConcepts.temperature },
137
- { key: 'respiratoryRate', label: t('respiratoryRate', 'RR'), conceptUuid: vitalsConcepts.respiratoryRate },
138
- { key: 'oxygenSaturation', label: t('oxygenSaturation', 'O2 Sat'), conceptUuid: vitalsConcepts.oxygenSaturation },
139
- { key: 'hemoglobin', label: t('hemoglobin', 'Hb'), conceptUuid: vitalsConcepts.hemoglobin },
140
- { key: 'glucose', label: t('glucose', 'Glucose'), conceptUuid: vitalsConcepts.glucose },
141
- { key: 'fhr', label: t('fetalHeartRate', 'FHR'), conceptUuid: vitalsConcepts.fhr },
142
- ];
144
+ const vitalColumns: Array<{ key: VitalColumnKey; label: string; conceptUuid?: string }> = useMemo(() => {
145
+ let columns = [
146
+ { key: 'bp', label: t('bloodPressure', 'BP') },
147
+ { key: 'pulse', label: t('pulse', 'HR'), conceptUuid: vitalsConcepts.pulse },
148
+ { key: 'temperature', label: t('temperature', 'Temp'), conceptUuid: vitalsConcepts.temperature },
149
+ { key: 'respiratoryRate', label: t('respiratoryRate', 'RR'), conceptUuid: vitalsConcepts.respiratoryRate },
150
+ { key: 'oxygenSaturation', label: t('oxygenSaturation', 'O2 Sat'), conceptUuid: vitalsConcepts.oxygenSaturation },
151
+ { key: 'glucose', label: t('glucose', 'Glucose'), conceptUuid: vitalsConcepts.glucose },
152
+ ] as Array<{ key: VitalColumnKey; label: string; conceptUuid?: string }>;
153
+
154
+ // Only include hemoglobin, fhr, and secondFhr for patients 30 days or older
155
+ if (!isNewborn) {
156
+ columns.push(
157
+ { key: 'hemoglobin', label: t('hemoglobin', 'Hb'), conceptUuid: vitalsConcepts.hemoglobin },
158
+ { key: 'fhr', label: t('fetalHeartRate', 'FHR'), conceptUuid: vitalsConcepts.fhr },
159
+ { key: 'secondFhr', label: t('secondFetalHeartRate', '2nd FHR'), conceptUuid: vitalsConcepts.secondFhr },
160
+ );
161
+ }
162
+
163
+ return columns;
164
+ }, [isNewborn, vitalsConcepts, t]);
143
165
 
144
166
  const renderVitalCell = (
145
167
  cellData: VitalCellData | { systolic?: VitalCellData; diastolic?: VitalCellData } | undefined,
@@ -216,19 +238,20 @@ const VitalsTable: React.FC<VitalsTableProps> = ({ patientUuid, visitUuid }) =>
216
238
  id: encounter.uuid,
217
239
  date: dayjs(encounter.encounterDatetime).format('DD/MM/YYYY HH:mm'),
218
240
  bp: {
219
- systolic: createVitalCellData(vitalsMap[vitalsConcepts.systolic], vitalsConcepts.systolic),
220
- diastolic: createVitalCellData(vitalsMap[vitalsConcepts.diastolic], vitalsConcepts.diastolic),
241
+ systolic: createVitalCellData(vitalsMap[vitalsConcepts.systolic]),
242
+ diastolic: createVitalCellData(vitalsMap[vitalsConcepts.diastolic]),
221
243
  },
222
- pulse: createVitalCellData(vitalsMap[vitalsConcepts.pulse], vitalsConcepts.pulse),
223
- temperature: createVitalCellData(vitalsMap[vitalsConcepts.temperature], vitalsConcepts.temperature),
244
+ pulse: createVitalCellData(vitalsMap[vitalsConcepts.pulse]),
245
+ temperature: createVitalCellData(vitalsMap[vitalsConcepts.temperature]),
224
246
  oxygenSaturation: createVitalCellData(
225
247
  vitalsMap[vitalsConcepts.oxygenSaturation],
226
248
  vitalsConcepts.oxygenSaturation,
227
249
  ),
228
- respiratoryRate: createVitalCellData(vitalsMap[vitalsConcepts.respiratoryRate], vitalsConcepts.respiratoryRate),
229
- hemoglobin: createVitalCellData(vitalsMap[vitalsConcepts.hemoglobin], vitalsConcepts.hemoglobin),
230
- glucose: createVitalCellData(vitalsMap[vitalsConcepts.glucose], vitalsConcepts.glucose),
231
- fhr: createVitalCellData(vitalsMap[vitalsConcepts.fhr], vitalsConcepts.fhr),
250
+ respiratoryRate: createVitalCellData(vitalsMap[vitalsConcepts.respiratoryRate]),
251
+ hemoglobin: createVitalCellData(vitalsMap[vitalsConcepts.hemoglobin]),
252
+ glucose: createVitalCellData(vitalsMap[vitalsConcepts.glucose]),
253
+ fhr: createVitalCellData(vitalsMap[vitalsConcepts.fhr]),
254
+ secondFhr: createVitalCellData(vitalsMap[vitalsConcepts.secondFhr]),
232
255
  provider: providerName,
233
256
  };
234
257
  };