@openmrs/esm-ward-app 9.2.1-pre.7384 → 9.2.1-pre.7387

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.
Files changed (99) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/1119.js +1 -1
  3. package/dist/1197.js +1 -1
  4. package/dist/1987.js +1 -1
  5. package/dist/1987.js.map +1 -1
  6. package/dist/2146.js +1 -1
  7. package/dist/2690.js +1 -1
  8. package/dist/3099.js +1 -1
  9. package/dist/3584.js +1 -1
  10. package/dist/4055.js +1 -1
  11. package/dist/4132.js +1 -1
  12. package/dist/4335.js +1 -1
  13. package/dist/439.js +1 -1
  14. package/dist/4618.js +1 -1
  15. package/dist/4652.js +1 -1
  16. package/dist/4944.js +1 -1
  17. package/dist/5173.js +1 -1
  18. package/dist/5241.js +1 -1
  19. package/dist/5442.js +1 -1
  20. package/dist/5661.js +1 -1
  21. package/dist/6022.js +1 -1
  22. package/dist/6468.js +1 -1
  23. package/dist/6589.js +1 -1
  24. package/dist/6679.js +1 -1
  25. package/dist/6840.js +1 -1
  26. package/dist/6859.js +1 -1
  27. package/dist/7097.js +1 -1
  28. package/dist/7159.js +1 -1
  29. package/dist/723.js +1 -1
  30. package/dist/7512.js +1 -1
  31. package/dist/7512.js.map +1 -1
  32. package/dist/7617.js +1 -1
  33. package/dist/795.js +1 -1
  34. package/dist/8163.js +1 -1
  35. package/dist/8349.js +1 -1
  36. package/dist/8371.js +1 -1
  37. package/dist/8618.js +1 -1
  38. package/dist/890.js +1 -1
  39. package/dist/9214.js +1 -1
  40. package/dist/9538.js +1 -1
  41. package/dist/9569.js +1 -1
  42. package/dist/986.js +1 -1
  43. package/dist/9879.js +1 -1
  44. package/dist/9895.js +1 -1
  45. package/dist/9900.js +1 -1
  46. package/dist/9913.js +1 -1
  47. package/dist/main.js +1 -1
  48. package/dist/main.js.map +1 -1
  49. package/dist/openmrs-esm-ward-app.js.buildmanifest.json +130 -130
  50. package/dist/routes.json +1 -1
  51. package/package.json +1 -1
  52. package/src/config-schema.ts +7 -0
  53. package/src/ward-workspace/ward-patient-notes/history/note.component.tsx +1 -7
  54. package/src/ward-workspace/ward-patient-notes/history/notes-container.component.tsx +6 -6
  55. package/src/ward-workspace/ward-patient-notes/history/notes-container.test.tsx +5 -4
  56. package/src/ward-workspace/ward-patient-notes/notes.resource.ts +18 -26
  57. package/src/ward-workspace/ward-patient-notes/notes.test.tsx +5 -2
  58. package/src/ward-workspace/ward-patient-notes/types.ts +0 -3
  59. package/translations/am.json +2 -2
  60. package/translations/ar.json +2 -2
  61. package/translations/ar_SY.json +2 -2
  62. package/translations/bn.json +2 -2
  63. package/translations/cs.json +2 -2
  64. package/translations/de.json +2 -2
  65. package/translations/en_US.json +2 -2
  66. package/translations/es.json +2 -2
  67. package/translations/es_MX.json +2 -2
  68. package/translations/fr.json +2 -2
  69. package/translations/he.json +2 -2
  70. package/translations/hi.json +2 -2
  71. package/translations/hi_IN.json +2 -2
  72. package/translations/id.json +2 -2
  73. package/translations/it.json +2 -2
  74. package/translations/ka.json +2 -2
  75. package/translations/km.json +2 -2
  76. package/translations/ku.json +2 -2
  77. package/translations/ky.json +2 -2
  78. package/translations/lg.json +2 -2
  79. package/translations/ne.json +2 -2
  80. package/translations/pl.json +2 -2
  81. package/translations/pt.json +2 -2
  82. package/translations/pt_BR.json +2 -2
  83. package/translations/qu.json +2 -2
  84. package/translations/ro_RO.json +2 -2
  85. package/translations/ru_RU.json +2 -2
  86. package/translations/si.json +2 -2
  87. package/translations/sq.json +2 -2
  88. package/translations/sw.json +2 -2
  89. package/translations/sw_KE.json +2 -2
  90. package/translations/tr.json +2 -2
  91. package/translations/tr_TR.json +2 -2
  92. package/translations/uk.json +2 -2
  93. package/translations/uz.json +2 -2
  94. package/translations/uz@Latn.json +2 -2
  95. package/translations/uz_UZ.json +2 -2
  96. package/translations/vi.json +2 -2
  97. package/translations/zh.json +2 -2
  98. package/translations/zh_CN.json +2 -2
  99. package/translations/zh_TW.json +2 -2
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.2.0","emrapi":">=2.0.0 <4.0.0"},"optionalBackendDependencies":{"bedmanagement":{"version":"^6.0.0 || 6.0.0-SNAPSHOT","feature":{"flagName":"bedmanagement-module","label":"Ward App Patient Service","description":"This module, if installed, provides services for managing patients admitted to the ward."}}},"extensions":[{"name":"ward-dashboard-link","component":"wardDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"ward","slot":"ward-dashboard-slot","title":"Wards"}},{"component":"root","name":"ward-dashboard","slot":"ward-dashboard-slot"},{"component":"wardView","name":"ward-view","slot":"ward-view-slot"},{"component":"wardPatientActionButtonExtension","name":"ward-patient-action-button","slot":"action-menu-ward-patient-items-slot"},{"component":"coloredObsTagCardRowExtension","name":"colored-obs-tags-card-row","slot":"ward-patient-card-slot"},{"name":"patient-discharge-siderail-button","slot":"action-menu-ward-patient-items-slot","component":"patientDischargeWorkspaceSideRailIcon"},{"component":"defaultWardView","name":"default-ward","slot":"default-ward"},{"component":"maternalWardView","name":"maternal-ward","slot":"maternal-ward"},{"component":"wardPatientWorkspaceBanner","name":"ward-patient-workspace-banner","slot":"ward-workspace-patient-banner-slot"}],"workspaces2":[{"name":"admission-requests-workspace","component":"admissionRequestWorkspace","window":"pending-admissions"},{"name":"transfer-elsewhere-workspace","component":"patientTransferRequestWorkspace","window":"pending-admissions"},{"name":"cancel-admission-request-workspace","component":"cancelAdmissionRequestWorkspace","window":"pending-admissions"},{"name":"admit-patient-form-workspace","component":"admitPatientFormWorkspace","window":"pending-admissions"},{"name":"ward-app-patient-search-workspace","component":"@openmrs/esm-patient-search-app#patientSearchWorkspace2","window":"add-patient-to-ward"},{"name":"ward-app-start-visit-workspace","component":"@openmrs/esm-patient-chart-app#exportedVisitForm","window":"add-patient-to-ward"},{"name":"create-admission-encounter-workspace","component":"createAdmissionEncounterWorkspace","window":"add-patient-to-ward"},{"name":"ward-patient-workspace","component":"wardPatientWorkspace","window":"ward-patient"},{"name":"ward-patient-vitals-workspace","component":"@openmrs/esm-patient-vitals-app#exportedVitalsBiometricsFormWorkspace","window":"ward-patient"},{"name":"ward-patient-notes-workspace","component":"wardPatientNotesWorkspace","window":"ward-patient-notes"},{"name":"ward-patient-transfer-swap-workspace","component":"patientTransferAndSwapWorkspace","window":"ward-patient-transfer-swap"},{"name":"patient-discharge-workspace","component":"patientDischargeWorkspace","window":"ward-patient-discharge"},{"name":"ward-patient-clinical-forms-workspace","component":"@openmrs/esm-patient-forms-app#exportedClinicalFormsWorkspace","window":"ward-patient-clinical-forms"},{"name":"ward-patient-form-entry-workspace","component":"@openmrs/esm-patient-forms-app#exportedPatientFormEntryWorkspace","window":"ward-patient-clinical-forms"},{"name":"ward-patient-cancel-admission-request-workspace","component":"wardPatientCancelAdmissionRequestWorkspace","window":"ward-patient-cancel-admission-request"},{"name":"ward-patient-order-basket-workspace","component":"@openmrs/esm-patient-orders-app#exportedOrderBasketWorkspace","window":"ward-patient-order-basket"},{"name":"ward-patient-order-basket-add-drug-order-workspace","component":"@openmrs/esm-patient-medications-app#exportedAddDrugOrderWorkspace","window":"ward-patient-order-basket"},{"name":"ward-patient-order-basket-add-lab-order-workspace","component":"@openmrs/esm-patient-tests-app#exportedAddLabOrderWorkspace","window":"ward-patient-order-basket"},{"name":"ward-patient-order-basket-add-general-order-workspace","component":"@openmrs/esm-patient-orders-app#exportedOrderBasketWorkspace","window":"ward-patient-order-basket"}],"workspaceWindows2":[{"name":"pending-admissions","group":"ward-manage-admissions","icon":"admissionRequestsWorkspaceSideRailIcon","width":"wider"},{"name":"add-patient-to-ward","group":"ward-manage-admissions","icon":"createAdmissionEncounterWorkspaceSideRailIcon"},{"name":"ward-patient","group":"ward-patient","icon":"wardPatientActionButton","width":"wider"},{"name":"ward-patient-notes","group":"ward-patient","icon":"wardPatientNotesActionButton"},{"name":"ward-patient-transfer-swap","group":"ward-patient","icon":"patientTransferAndSwapWorkspaceSiderailIcon"},{"name":"ward-patient-discharge","group":"ward-patient","icon":"patientDischargeWorkspaceSideRailIcon"},{"name":"ward-patient-clinical-forms","group":"ward-patient","icon":"clinicalFormWorkspaceSideRailIcon"},{"name":"ward-patient-order-basket","group":"ward-patient","icon":"orderBasketWorkspaceSideRailIcon"},{"name":"ward-patient-cancel-admission-request","group":"ward-patient"}],"workspaceGroups2":[{"name":"ward-manage-admissions","overlay":true,"persistence":"closable"},{"name":"ward-patient","overlay":true,"persistence":"closable"}],"version":"9.2.1-pre.7384"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.2.0","emrapi":">=2.0.0 <4.0.0"},"optionalBackendDependencies":{"bedmanagement":{"version":"^6.0.0 || 6.0.0-SNAPSHOT","feature":{"flagName":"bedmanagement-module","label":"Ward App Patient Service","description":"This module, if installed, provides services for managing patients admitted to the ward."}}},"extensions":[{"name":"ward-dashboard-link","component":"wardDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"ward","slot":"ward-dashboard-slot","title":"Wards"}},{"component":"root","name":"ward-dashboard","slot":"ward-dashboard-slot"},{"component":"wardView","name":"ward-view","slot":"ward-view-slot"},{"component":"wardPatientActionButtonExtension","name":"ward-patient-action-button","slot":"action-menu-ward-patient-items-slot"},{"component":"coloredObsTagCardRowExtension","name":"colored-obs-tags-card-row","slot":"ward-patient-card-slot"},{"name":"patient-discharge-siderail-button","slot":"action-menu-ward-patient-items-slot","component":"patientDischargeWorkspaceSideRailIcon"},{"component":"defaultWardView","name":"default-ward","slot":"default-ward"},{"component":"maternalWardView","name":"maternal-ward","slot":"maternal-ward"},{"component":"wardPatientWorkspaceBanner","name":"ward-patient-workspace-banner","slot":"ward-workspace-patient-banner-slot"}],"workspaces2":[{"name":"admission-requests-workspace","component":"admissionRequestWorkspace","window":"pending-admissions"},{"name":"transfer-elsewhere-workspace","component":"patientTransferRequestWorkspace","window":"pending-admissions"},{"name":"cancel-admission-request-workspace","component":"cancelAdmissionRequestWorkspace","window":"pending-admissions"},{"name":"admit-patient-form-workspace","component":"admitPatientFormWorkspace","window":"pending-admissions"},{"name":"ward-app-patient-search-workspace","component":"@openmrs/esm-patient-search-app#patientSearchWorkspace2","window":"add-patient-to-ward"},{"name":"ward-app-start-visit-workspace","component":"@openmrs/esm-patient-chart-app#exportedVisitForm","window":"add-patient-to-ward"},{"name":"create-admission-encounter-workspace","component":"createAdmissionEncounterWorkspace","window":"add-patient-to-ward"},{"name":"ward-patient-workspace","component":"wardPatientWorkspace","window":"ward-patient"},{"name":"ward-patient-vitals-workspace","component":"@openmrs/esm-patient-vitals-app#exportedVitalsBiometricsFormWorkspace","window":"ward-patient"},{"name":"ward-patient-notes-workspace","component":"wardPatientNotesWorkspace","window":"ward-patient-notes"},{"name":"ward-patient-transfer-swap-workspace","component":"patientTransferAndSwapWorkspace","window":"ward-patient-transfer-swap"},{"name":"patient-discharge-workspace","component":"patientDischargeWorkspace","window":"ward-patient-discharge"},{"name":"ward-patient-clinical-forms-workspace","component":"@openmrs/esm-patient-forms-app#exportedClinicalFormsWorkspace","window":"ward-patient-clinical-forms"},{"name":"ward-patient-form-entry-workspace","component":"@openmrs/esm-patient-forms-app#exportedPatientFormEntryWorkspace","window":"ward-patient-clinical-forms"},{"name":"ward-patient-cancel-admission-request-workspace","component":"wardPatientCancelAdmissionRequestWorkspace","window":"ward-patient-cancel-admission-request"},{"name":"ward-patient-order-basket-workspace","component":"@openmrs/esm-patient-orders-app#exportedOrderBasketWorkspace","window":"ward-patient-order-basket"},{"name":"ward-patient-order-basket-add-drug-order-workspace","component":"@openmrs/esm-patient-medications-app#exportedAddDrugOrderWorkspace","window":"ward-patient-order-basket"},{"name":"ward-patient-order-basket-add-lab-order-workspace","component":"@openmrs/esm-patient-tests-app#exportedAddLabOrderWorkspace","window":"ward-patient-order-basket"},{"name":"ward-patient-order-basket-add-general-order-workspace","component":"@openmrs/esm-patient-orders-app#exportedOrderBasketWorkspace","window":"ward-patient-order-basket"}],"workspaceWindows2":[{"name":"pending-admissions","group":"ward-manage-admissions","icon":"admissionRequestsWorkspaceSideRailIcon","width":"wider"},{"name":"add-patient-to-ward","group":"ward-manage-admissions","icon":"createAdmissionEncounterWorkspaceSideRailIcon"},{"name":"ward-patient","group":"ward-patient","icon":"wardPatientActionButton","width":"wider"},{"name":"ward-patient-notes","group":"ward-patient","icon":"wardPatientNotesActionButton"},{"name":"ward-patient-transfer-swap","group":"ward-patient","icon":"patientTransferAndSwapWorkspaceSiderailIcon"},{"name":"ward-patient-discharge","group":"ward-patient","icon":"patientDischargeWorkspaceSideRailIcon"},{"name":"ward-patient-clinical-forms","group":"ward-patient","icon":"clinicalFormWorkspaceSideRailIcon"},{"name":"ward-patient-order-basket","group":"ward-patient","icon":"orderBasketWorkspaceSideRailIcon"},{"name":"ward-patient-cancel-admission-request","group":"ward-patient"}],"workspaceGroups2":[{"name":"ward-manage-admissions","overlay":true,"persistence":"closable"},{"name":"ward-patient","overlay":true,"persistence":"closable"}],"version":"9.2.1-pre.7387"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-ward-app",
3
- "version": "9.2.1-pre.7384",
3
+ "version": "9.2.1-pre.7387",
4
4
  "description": "Ward and bed management module for O3",
5
5
  "browser": "dist/openmrs-esm-ward-app.js",
6
6
  "main": "src/index.ts",
@@ -257,6 +257,12 @@ export const configSchema = {
257
257
  _default: false,
258
258
  _description: 'Configure whether to hide vital history and record vital links in the ward patient workspace.',
259
259
  },
260
+ additionalInpatientNotesConceptUuids: {
261
+ _type: Type.Array,
262
+ _default: [],
263
+ _description:
264
+ 'List of uuids of concepts that represent notes to display in the notes view in addition to the consultFreeTextCommentsConcept defined by EMR-API',
265
+ },
260
266
  };
261
267
 
262
268
  export interface WardConfigObject {
@@ -270,6 +276,7 @@ export interface WardConfigObject {
270
276
  };
271
277
  wards: Array<WardDefinition>;
272
278
  hideWorkspaceVitalsLinks: boolean;
279
+ additionalInpatientNotesConceptUuids: Array<string>;
273
280
  }
274
281
 
275
282
  export interface PendingItemsElementConfig {
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import dayjs from 'dayjs';
3
3
  import { useTranslation } from 'react-i18next';
4
- import { SkeletonText, Tag, Tile } from '@carbon/react';
4
+ import { SkeletonText, Tile } from '@carbon/react';
5
5
  import { type PatientNote } from '../types';
6
6
  import styles from './styles.scss';
7
7
 
@@ -38,12 +38,6 @@ const InPatientNote: React.FC<InPatientNoteProps> = ({ note }) => {
38
38
  {formattedDate}, {formattedTime}
39
39
  </span>
40
40
  </div>
41
- {note.diagnoses &&
42
- note.diagnoses.split(',').map((diagnosis, index) => (
43
- <Tag key={index} type="red">
44
- {diagnosis.trim()}
45
- </Tag>
46
- ))}
47
41
  <div className={styles.noteBody}>{note.encounterNote}</div>
48
42
  <div className={styles.noteProviderName}>{note.encounterProvider}</div>
49
43
  </Tile>
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
- import { type PatientUuid } from '@openmrs/esm-framework';
3
+ import { type PatientUuid, useConfig } from '@openmrs/esm-framework';
4
4
  import { usePatientNotes } from '../notes.resource';
5
5
  import InPatientNote, { InPatientNoteSkeleton } from './note.component';
6
6
  import styles from './styles.scss';
7
7
  import { InlineNotification } from '@carbon/react';
8
8
  import useEmrConfiguration from '../../../hooks/useEmrConfiguration';
9
+ import { type WardConfigObject } from '../../../config-schema';
9
10
 
10
11
  interface PatientNotesHistoryProps {
11
12
  patientUuid: PatientUuid;
@@ -15,13 +16,12 @@ interface PatientNotesHistoryProps {
15
16
  const PatientNotesHistory: React.FC<PatientNotesHistoryProps> = ({ patientUuid, visitUuid }) => {
16
17
  const { t } = useTranslation();
17
18
  const { emrConfiguration, isLoadingEmrConfiguration } = useEmrConfiguration();
19
+ const config = useConfig<WardConfigObject>();
18
20
 
19
- const { patientNotes, isLoadingPatientNotes, errorFetchingPatientNotes } = usePatientNotes(
20
- patientUuid,
21
- visitUuid,
22
- emrConfiguration?.inpatientNoteEncounterType?.uuid,
21
+ const { patientNotes, isLoadingPatientNotes, errorFetchingPatientNotes } = usePatientNotes(patientUuid, visitUuid, [
23
22
  emrConfiguration?.consultFreeTextCommentsConcept.uuid,
24
- );
23
+ ...config.additionalInpatientNotesConceptUuids,
24
+ ]);
25
25
 
26
26
  const isLoading = isLoadingPatientNotes || isLoadingEmrConfiguration;
27
27
 
@@ -4,6 +4,10 @@ import PatientNotesHistory from './notes-container.component';
4
4
  import { usePatientNotes } from '../notes.resource';
5
5
  import useEmrConfiguration from '../../../hooks/useEmrConfiguration';
6
6
  import { emrConfigurationMock } from '__mocks__';
7
+ import { getDefaultsFromConfigSchema, useConfig } from '@openmrs/esm-framework';
8
+ import { configSchema, type WardConfigObject } from '../../../config-schema';
9
+
10
+ const mockUseConfig = jest.mocked(useConfig<WardConfigObject>);
7
11
 
8
12
  const mockedUseEmrConfiguration = jest.mocked(useEmrConfiguration);
9
13
 
@@ -19,26 +23,23 @@ const mockPatientNotes = [
19
23
  {
20
24
  id: 'note-1',
21
25
  diagnoses: '',
22
- encounterDate: '2024-08-01',
23
26
  encounterNote: 'Patient shows improvement with current medication.',
24
27
  encounterNoteRecordedAt: '2024-08-01T12:34:56Z',
25
28
  encounterProvider: 'Dr. John Doe',
26
- encounterProviderRole: 'Endocrinologist',
27
29
  },
28
30
  {
29
31
  id: 'note-2',
30
32
  diagnoses: '',
31
- encounterDate: '2024-08-02',
32
33
  encounterNote: 'Blood pressure is slightly elevated. Consider adjusting medication.',
33
34
  encounterNoteRecordedAt: '2024-08-02T14:22:00Z',
34
35
  encounterProvider: 'Dr. Jane Smith',
35
- encounterProviderRole: 'Cardiologist',
36
36
  },
37
37
  ];
38
38
 
39
39
  describe('PatientNotesHistory', () => {
40
40
  beforeEach(() => {
41
41
  jest.resetAllMocks();
42
+ mockUseConfig.mockReturnValue(getDefaultsFromConfigSchema<WardConfigObject>(configSchema));
42
43
  });
43
44
 
44
45
  test('displays loading skeletons when loading', () => {
@@ -14,46 +14,38 @@ export function savePatientNote(payload: EncounterPayload, abortController: Abor
14
14
  });
15
15
  }
16
16
 
17
- export function usePatientNotes(
18
- patientUuid: string,
19
- visitUuid: string,
20
- encounterType: string,
21
- conceptUuid: string,
22
- ): UsePatientNotes {
17
+ export function usePatientNotes(patientUuid: string, visitUuid: string, conceptUuids: Array<string>): UsePatientNotes {
23
18
  const customRepresentation =
24
- 'custom:(uuid,display,encounterDatetime,patient,obs,' +
25
- 'encounterProviders:(uuid,display,' +
26
- 'encounterRole:(uuid,display),' +
27
- 'provider:(uuid,person:(uuid,display))),' +
28
- 'diagnoses';
29
- const encountersApiUrl = `${restBaseUrl}/encounter?patient=${patientUuid}&encounterType=${encounterType}&visit=${visitUuid}&v=${customRepresentation}`;
19
+ 'custom:(uuid,patient:(uuid),obs:(uuid,concept:(uuid),obsDatetime,value:(uuid)),' +
20
+ 'encounterProviders:(uuid,provider:(uuid,person:(uuid,display)))';
21
+ const encountersApiUrl = `${restBaseUrl}/encounter?patient=${patientUuid}&visit=${visitUuid}&v=${customRepresentation}`;
30
22
 
31
23
  const { data, error, isLoading, isValidating, mutate } = useOpenmrsFetchAll<RESTPatientNote>(
32
- patientUuid && encounterType ? encountersApiUrl : null,
24
+ patientUuid ? encountersApiUrl : null,
33
25
  );
34
26
 
35
27
  const patientNotes: Array<PatientNote> | null = useMemo(
36
28
  () =>
37
29
  data
38
30
  ? data
39
- .map((encounter) => {
40
- const noteObs = encounter.obs.find((obs) => obs.concept.uuid === conceptUuid);
41
-
42
- return {
43
- id: encounter.uuid,
44
- diagnoses: encounter.diagnoses.map((d) => d.display).join(', '),
45
- encounterDate: encounter.encounterDatetime,
46
- encounterNote: noteObs ? noteObs.value : '',
47
- encounterNoteRecordedAt: noteObs ? noteObs.obsDatetime : '',
48
- encounterProvider: encounter.encounterProviders.map((ep) => ep.provider.person.display).join(', '),
49
- encounterProviderRole: encounter.encounterProviders.map((ep) => ep.encounterRole.display).join(', '),
50
- };
31
+ .flatMap((encounter) => {
32
+ return encounter.obs?.reduce((acc, obs) => {
33
+ if (conceptUuids.includes(obs.concept.uuid)) {
34
+ acc.push({
35
+ id: encounter.uuid,
36
+ encounterNote: obs ? obs.value : '',
37
+ encounterNoteRecordedAt: obs ? obs.obsDatetime : '',
38
+ encounterProvider: encounter.encounterProviders.map((ep) => ep.provider.person.display).join(', '),
39
+ });
40
+ }
41
+ return acc;
42
+ }, []);
51
43
  })
52
44
  .sort(
53
45
  (a, b) => new Date(b.encounterNoteRecordedAt).getTime() - new Date(a.encounterNoteRecordedAt).getTime(),
54
46
  )
55
47
  : [],
56
- [data, conceptUuid],
48
+ [data, conceptUuids],
57
49
  );
58
50
 
59
51
  return useMemo(
@@ -1,12 +1,13 @@
1
1
  import React from 'react';
2
2
  import userEvent from '@testing-library/user-event';
3
3
  import { render, screen } from '@testing-library/react';
4
- import { createErrorHandler, ResponsiveWrapper, showSnackbar, translateFrom, useSession } from '@openmrs/esm-framework';
4
+ import { getDefaultsFromConfigSchema, showSnackbar, useConfig } from '@openmrs/esm-framework';
5
5
  import { savePatientNote, usePatientNotes } from './notes.resource';
6
6
  import WardPatientNotesWorkspace from './notes.workspace';
7
- import { emrConfigurationMock, mockInpatientRequestAlice, mockPatient, mockPatientAlice, mockSession } from '__mocks__';
7
+ import { emrConfigurationMock, mockInpatientRequestAlice, mockPatientAlice } from '__mocks__';
8
8
  import useEmrConfiguration from '../../hooks/useEmrConfiguration';
9
9
  import { type WardPatient, type WardPatientWorkspaceDefinition } from '../../types';
10
+ import { configSchema, type WardConfigObject } from '../../config-schema';
10
11
 
11
12
  const mockWardPatientAlice: WardPatient = {
12
13
  visit: mockInpatientRequestAlice.visit,
@@ -41,6 +42,7 @@ jest.mock('../../hooks/useEmrConfiguration', () => jest.fn());
41
42
 
42
43
  const mockedUseEmrConfiguration = jest.mocked(useEmrConfiguration);
43
44
  const mockedUsePatientNotes = jest.mocked(usePatientNotes);
45
+ const mockUseConfig = jest.mocked(useConfig<WardConfigObject>);
44
46
 
45
47
  mockedUseEmrConfiguration.mockReturnValue({
46
48
  emrConfiguration: emrConfigurationMock,
@@ -50,6 +52,7 @@ mockedUseEmrConfiguration.mockReturnValue({
50
52
  });
51
53
 
52
54
  describe('<WardPatientNotesWorkspace>', () => {
55
+ mockUseConfig.mockReturnValue(getDefaultsFromConfigSchema<WardConfigObject>(configSchema));
53
56
  mockedUsePatientNotes.mockReturnValue({
54
57
  patientNotes: [],
55
58
  errorFetchingPatientNotes: undefined,
@@ -13,12 +13,9 @@ export interface RESTPatientNote extends OpenmrsResource {
13
13
 
14
14
  export interface PatientNote {
15
15
  id: string;
16
- diagnoses: string;
17
- encounterDate: string;
18
16
  encounterNote: string;
19
17
  encounterNoteRecordedAt: string;
20
18
  encounterProvider: string;
21
- encounterProviderRole: string;
22
19
  }
23
20
 
24
21
  export interface UsePatientNotes {
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Bed swap",
18
18
  "cancel": "Cancel",
19
19
  "cancelAdmissionRequest": "Cancel admission request",
20
- "capacity": "Capacity",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Choose an option",
23
21
  "clinicalForms": "Clinical forms",
24
22
  "clinicalNoteLabel": "Write your notes",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Some parts of the form didn't load",
121
119
  "timeOnWard": "Time on this ward: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Admitted: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transfer",
124
124
  "transferElsewhere": "Transfer elsewhere",
125
125
  "transferPatient": "Transfer patient",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Bed swap",
18
18
  "cancel": "Cancel",
19
19
  "cancelAdmissionRequest": "Cancel admission request",
20
- "capacity": "Capacity",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Choose an option",
23
21
  "clinicalForms": "Clinical forms",
24
22
  "clinicalNoteLabel": "Write your notes",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Some parts of the form didn't load",
121
119
  "timeOnWard": "Time on this ward: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Admitted: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transfer",
124
124
  "transferElsewhere": "Transfer elsewhere",
125
125
  "transferPatient": "Transfer patient",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Bed swap",
18
18
  "cancel": "Cancel",
19
19
  "cancelAdmissionRequest": "Cancel admission request",
20
- "capacity": "Capacity",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Choose an option",
23
21
  "clinicalForms": "Clinical forms",
24
22
  "clinicalNoteLabel": "Write your notes",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Some parts of the form didn't load",
121
119
  "timeOnWard": "Time on this ward: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Admitted: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transfer",
124
124
  "transferElsewhere": "Transfer elsewhere",
125
125
  "transferPatient": "Transfer patient",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Bed swap",
18
18
  "cancel": "Cancel",
19
19
  "cancelAdmissionRequest": "Cancel admission request",
20
- "capacity": "Capacity",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Choose an option",
23
21
  "clinicalForms": "Clinical forms",
24
22
  "clinicalNoteLabel": "Write your notes",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Some parts of the form didn't load",
121
119
  "timeOnWard": "Time on this ward: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Admitted: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transfer",
124
124
  "transferElsewhere": "Transfer elsewhere",
125
125
  "transferPatient": "Transfer patient",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Bed swap",
18
18
  "cancel": "Cancel",
19
19
  "cancelAdmissionRequest": "Cancel admission request",
20
- "capacity": "Capacity",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Choose an option",
23
21
  "clinicalForms": "Clinical forms",
24
22
  "clinicalNoteLabel": "Write your notes",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Some parts of the form didn't load",
121
119
  "timeOnWard": "Time on this ward: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Admitted: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transfer",
124
124
  "transferElsewhere": "Transfer elsewhere",
125
125
  "transferPatient": "Transfer patient",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Bed swap",
18
18
  "cancel": "Cancel",
19
19
  "cancelAdmissionRequest": "Cancel admission request",
20
- "capacity": "Capacity",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Choose an option",
23
21
  "clinicalForms": "Clinical forms",
24
22
  "clinicalNoteLabel": "Write your notes",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Some parts of the form didn't load",
121
119
  "timeOnWard": "Time on this ward: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Admitted: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transfer",
124
124
  "transferElsewhere": "Transfer elsewhere",
125
125
  "transferPatient": "Transfer patient",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Bed swap",
18
18
  "cancel": "Cancel",
19
19
  "cancelAdmissionRequest": "Cancel admission request",
20
- "capacity": "Capacity",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Choose an option",
23
21
  "clinicalForms": "Clinical forms",
24
22
  "clinicalNoteLabel": "Write your notes",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Some parts of the form didn't load",
121
119
  "timeOnWard": "Time on this ward: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Admitted: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transfer",
124
124
  "transferElsewhere": "Transfer elsewhere",
125
125
  "transferPatient": "Transfer patient",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Cambio de cama",
18
18
  "cancel": "Cancelar",
19
19
  "cancelAdmissionRequest": "Cancelar solicitud de admisión",
20
- "capacity": "Capacidad",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Elegir una opción",
23
21
  "clinicalForms": "Formularios clínicos",
24
22
  "clinicalNoteLabel": "Escribe tus notas",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Algunas partes del formulario no cargaron",
121
119
  "timeOnWard": "Tiempo en esta unidad: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Admitted: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transferir",
124
124
  "transferElsewhere": "Transferir a otro lado",
125
125
  "transferPatient": "Transferir paciente",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Bed swap",
18
18
  "cancel": "Cancel",
19
19
  "cancelAdmissionRequest": "Cancel admission request",
20
- "capacity": "Capacity",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Choose an option",
23
21
  "clinicalForms": "Clinical forms",
24
22
  "clinicalNoteLabel": "Write your notes",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Some parts of the form didn't load",
121
119
  "timeOnWard": "Time on this ward: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Admitted: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transfer",
124
124
  "transferElsewhere": "Transfer elsewhere",
125
125
  "transferPatient": "Transfer patient",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Échange de lit",
18
18
  "cancel": "Annuler",
19
19
  "cancelAdmissionRequest": "Annuler la demande d'admission",
20
- "capacity": "Capacité",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Sélectionnez une option",
23
21
  "clinicalForms": "Formulaires",
24
22
  "clinicalNoteLabel": "Inscrivez vos notes",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Certaines parties du formulaire ne se sont pas chargées correctement",
121
119
  "timeOnWard": "Temps passé dans ce service : {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Admis : {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transfert",
124
124
  "transferElsewhere": "Transférer vers une autre unité",
125
125
  "transferPatient": "Transférer le patient",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Bed swap",
18
18
  "cancel": "Cancel",
19
19
  "cancelAdmissionRequest": "Cancel admission request",
20
- "capacity": "Capacity",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Choose an option",
23
21
  "clinicalForms": "Clinical forms",
24
22
  "clinicalNoteLabel": "Write your notes",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Some parts of the form didn't load",
121
119
  "timeOnWard": "Time on this ward: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Admitted: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transfer",
124
124
  "transferElsewhere": "Transfer elsewhere",
125
125
  "transferPatient": "Transfer patient",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Bed swap",
18
18
  "cancel": "Cancel",
19
19
  "cancelAdmissionRequest": "Cancel admission request",
20
- "capacity": "Capacity",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Choose an option",
23
21
  "clinicalForms": "Clinical forms",
24
22
  "clinicalNoteLabel": "Write your notes",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Some parts of the form didn't load",
121
119
  "timeOnWard": "Time on this ward: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Admitted: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transfer",
124
124
  "transferElsewhere": "Transfer elsewhere",
125
125
  "transferPatient": "Transfer patient",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Bed swap",
18
18
  "cancel": "Cancel",
19
19
  "cancelAdmissionRequest": "Cancel admission request",
20
- "capacity": "Capacity",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Choose an option",
23
21
  "clinicalForms": "Clinical forms",
24
22
  "clinicalNoteLabel": "Write your notes",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Some parts of the form didn't load",
121
119
  "timeOnWard": "Time on this ward: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Admitted: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transfer",
124
124
  "transferElsewhere": "Transfer elsewhere",
125
125
  "transferPatient": "Transfer patient",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Tukar tempat tidur",
18
18
  "cancel": "Batal",
19
19
  "cancelAdmissionRequest": "Batalkan permintaan penerimaan",
20
- "capacity": "Kapasitas",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Pilih opsi",
23
21
  "clinicalForms": "Formulir klinis",
24
22
  "clinicalNoteLabel": "Tulis catatan Anda",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Beberapa bagian formulir tidak dimuat",
121
119
  "timeOnWard": "Waktu di bangsal ini: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Diterima: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transfer",
124
124
  "transferElsewhere": "Transfer ke tempat lain",
125
125
  "transferPatient": "Transfer pasien",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Scambio letto",
18
18
  "cancel": "Annulla",
19
19
  "cancelAdmissionRequest": "Annulla richiesta di ricovero",
20
- "capacity": "Capacità",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Scegli un'opzione",
23
21
  "clinicalForms": "Moduli clinici",
24
22
  "clinicalNoteLabel": "Scrivi le tue note",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Alcune parti del modulo non sono state caricate",
121
119
  "timeOnWard": "Tempo trascorso in questo reparto: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Ricoverato: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Trasferimento",
124
124
  "transferElsewhere": "Trasferisci altrove",
125
125
  "transferPatient": "Trasferisci paziente",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "საწოლის გადაცვლა",
18
18
  "cancel": "გაუქმება",
19
19
  "cancelAdmissionRequest": "მიღების მთხოვნის გაუქმება",
20
- "capacity": "მოცულობა",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "აირჩიეთ პარამეტრი",
23
21
  "clinicalForms": "კლინიკური ფორმები",
24
22
  "clinicalNoteLabel": "დაწერეთ თქვენი შენიშვნები",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Some parts of the form didn't load",
121
119
  "timeOnWard": "Time on this ward: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "მიღებიდან გავიდა: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "გადაყვანა",
124
124
  "transferElsewhere": "სხვაგან გადაყვანა",
125
125
  "transferPatient": "პაციენტის გადაყვანა",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Bed swap",
18
18
  "cancel": "Cancel",
19
19
  "cancelAdmissionRequest": "Cancel admission request",
20
- "capacity": "Capacity",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Choose an option",
23
21
  "clinicalForms": "Clinical forms",
24
22
  "clinicalNoteLabel": "Write your notes",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Some parts of the form didn't load",
121
119
  "timeOnWard": "Time on this ward: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Admitted: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transfer",
124
124
  "transferElsewhere": "Transfer elsewhere",
125
125
  "transferPatient": "Transfer patient",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Bed swap",
18
18
  "cancel": "Cancel",
19
19
  "cancelAdmissionRequest": "Cancel admission request",
20
- "capacity": "Capacity",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Choose an option",
23
21
  "clinicalForms": "Clinical forms",
24
22
  "clinicalNoteLabel": "Write your notes",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Some parts of the form didn't load",
121
119
  "timeOnWard": "Time on this ward: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Admitted: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transfer",
124
124
  "transferElsewhere": "Transfer elsewhere",
125
125
  "transferPatient": "Transfer patient",
@@ -17,8 +17,6 @@
17
17
  "bedSwap": "Bed swap",
18
18
  "cancel": "Cancel",
19
19
  "cancelAdmissionRequest": "Cancel admission request",
20
- "capacity": "Capacity",
21
- "capacityMetricValue": "{{ metricValue }} %",
22
20
  "chooseAnOption": "Choose an option",
23
21
  "clinicalForms": "Clinical forms",
24
22
  "clinicalNoteLabel": "Write your notes",
@@ -120,6 +118,8 @@
120
118
  "somePartsOfTheFormDidntLoad": "Some parts of the form didn't load",
121
119
  "timeOnWard": "Time on this ward: {{timeOnWard}}",
122
120
  "timeSinceAdmission": "Admitted: {{timeSinceAdmission}}",
121
+ "totalBeds": "Total beds",
122
+ "totalBedsMetricValue": "{{ metricValue }}",
123
123
  "transfer": "Transfer",
124
124
  "transferElsewhere": "Transfer elsewhere",
125
125
  "transferPatient": "Transfer patient",