@openmrs/esm-patient-tests-app 11.3.1-patch.9064 → 11.3.1-patch.9310
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/.turbo/turbo-build.log +22 -19
- package/dist/1479.js +1 -1
- package/dist/1479.js.map +1 -1
- package/dist/3509.js +1 -1
- package/dist/4055.js +1 -1
- package/dist/4300.js +1 -1
- package/dist/{1935.js → 5348.js} +1 -1
- package/dist/5348.js.map +1 -0
- package/dist/5670.js +1 -1
- package/dist/5670.js.map +1 -1
- package/dist/6231.js +1 -1
- package/dist/6231.js.map +1 -1
- package/dist/6301.js +1 -1
- package/dist/6301.js.map +1 -1
- package/dist/6336.js +1 -0
- package/dist/6336.js.map +1 -0
- package/dist/790.js +1 -1
- package/dist/790.js.map +1 -1
- package/dist/8307.js +2 -0
- package/dist/8307.js.map +1 -0
- package/dist/9540.js +2 -0
- package/dist/9540.js.map +1 -0
- package/dist/9838.js +1 -0
- package/dist/9838.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-patient-tests-app.js +1 -1
- package/dist/openmrs-esm-patient-tests-app.js.buildmanifest.json +172 -193
- package/dist/openmrs-esm-patient-tests-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +3 -3
- package/src/edit-test-results/modal/edit-lab-results.modal.tsx +8 -4
- package/src/routes.json +3 -4
- package/src/test-orders/add-test-order/add-test-order.component.tsx +125 -0
- package/src/test-orders/add-test-order/add-test-order.test.tsx +23 -43
- package/src/test-orders/add-test-order/add-test-order.workspace.tsx +21 -116
- package/src/test-orders/add-test-order/exported-add-test-order.workspace.tsx +30 -0
- package/src/test-orders/add-test-order/test-order-form.component.tsx +67 -25
- package/src/test-orders/add-test-order/test-order.ts +3 -3
- package/src/test-orders/add-test-order/test-type-search.component.tsx +40 -24
- package/src/test-orders/api.ts +6 -2
- package/src/test-orders/lab-order-basket-panel/lab-order-basket-item-tile.component.tsx +1 -1
- package/src/test-orders/lab-order-basket-panel/lab-order-basket-panel.extension.tsx +30 -48
- package/src/test-orders/lab-order-basket-panel/lab-order-basket-panel.test.tsx +15 -4
- package/src/test-results/filter/filter-types.ts +19 -0
- package/src/test-results/grouped-timeline/grouped-timeline.test.tsx +49 -0
- package/src/test-results/grouped-timeline/reference-range-helpers.test.ts +272 -0
- package/src/test-results/grouped-timeline/reference-range-helpers.ts +112 -0
- package/src/test-results/grouped-timeline/timeline-data-group.component.tsx +10 -3
- package/src/test-results/grouped-timeline/useObstreeData.ts +71 -9
- package/src/test-results/individual-results-table/individual-results-table.component.tsx +23 -6
- package/src/test-results/individual-results-table/individual-results-table.test.tsx +65 -3
- package/src/test-results/individual-results-table-tablet/helper.tsx +8 -2
- package/src/test-results/individual-results-table-tablet/individual-results-table-tablet.component.tsx +2 -2
- package/src/test-results/individual-results-table-tablet/lab-set-panel.component.tsx +5 -1
- package/src/test-results/loadPatientTestData/helpers.test.ts +834 -0
- package/src/test-results/loadPatientTestData/helpers.ts +114 -0
- package/src/test-results/loadPatientTestData/loadPatientData.ts +66 -11
- package/src/test-results/loadPatientTestData/usePatientResultsData.ts +3 -3
- package/src/test-results/overview/common-datatable.component.tsx +1 -1
- package/src/test-results/overview/useOverviewData.ts +22 -10
- package/src/test-results/results-viewer/results-viewer.extension.tsx +4 -3
- package/src/test-results/tree-view/tree-view.component.tsx +14 -4
- package/src/test-results/trendline/trendline-resource.tsx +48 -5
- package/src/types.ts +20 -10
- package/translations/en.json +2 -0
- package/translations/fr.json +2 -2
- package/dist/1935.js.map +0 -1
- package/dist/2537.js +0 -1
- package/dist/2537.js.map +0 -1
- package/dist/34.js +0 -1
- package/dist/34.js.map +0 -1
- package/dist/4918.js +0 -1
- package/dist/4918.js.map +0 -1
- package/dist/5836.js +0 -2
- package/dist/5836.js.map +0 -1
- package/dist/7053.js +0 -2
- package/dist/7053.js.map +0 -1
- /package/dist/{7053.js.LICENSE.txt → 8307.js.LICENSE.txt} +0 -0
- /package/dist/{5836.js.LICENSE.txt → 9540.js.LICENSE.txt} +0 -0
|
@@ -21,10 +21,41 @@ describe('IndividualResultsTable', () => {
|
|
|
21
21
|
units: 'copies/ml',
|
|
22
22
|
flatName: 'HIV viral load-HIV viral load',
|
|
23
23
|
hasData: true,
|
|
24
|
+
range: '0 – 50', // Node-level range
|
|
25
|
+
lowNormal: 0,
|
|
26
|
+
hiNormal: 50,
|
|
24
27
|
},
|
|
25
28
|
],
|
|
26
29
|
} as GroupedObservation;
|
|
27
30
|
|
|
31
|
+
const mockSubRowsWithObservationRange = {
|
|
32
|
+
key: 'Alkaline phosphatase',
|
|
33
|
+
date: '2024-10-15',
|
|
34
|
+
flatName: 'Alkaline phosphatase',
|
|
35
|
+
entries: [
|
|
36
|
+
{
|
|
37
|
+
obsDatetime: '2024-10-15 03:20:19.0',
|
|
38
|
+
value: '15',
|
|
39
|
+
interpretation: 'CRITICALLY_LOW',
|
|
40
|
+
key: 'Alkaline phosphatase',
|
|
41
|
+
datatype: 'Numeric',
|
|
42
|
+
lowAbsolute: 0,
|
|
43
|
+
display: 'Alkaline phosphatase',
|
|
44
|
+
conceptUuid: '785AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
45
|
+
units: 'U/L',
|
|
46
|
+
flatName: 'Alkaline phosphatase',
|
|
47
|
+
hasData: true,
|
|
48
|
+
range: '35 – 147', // Observation-level range (different from node-level)
|
|
49
|
+
lowNormal: 35,
|
|
50
|
+
hiNormal: 147,
|
|
51
|
+
lowCritical: 25,
|
|
52
|
+
hiCritical: 200,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
range: '0 – 270', // Node-level range (fallback)
|
|
56
|
+
units: 'U/L',
|
|
57
|
+
} as GroupedObservation;
|
|
58
|
+
|
|
28
59
|
const mockEmptySubRows = {
|
|
29
60
|
key: 'HIV viral load',
|
|
30
61
|
date: '2024-10-15',
|
|
@@ -33,18 +64,49 @@ describe('IndividualResultsTable', () => {
|
|
|
33
64
|
} as GroupedObservation;
|
|
34
65
|
|
|
35
66
|
it('renders a loading skeleton when fetching results data', () => {
|
|
36
|
-
render(
|
|
67
|
+
render(
|
|
68
|
+
<IndividualResultsTable
|
|
69
|
+
patientUuid={'patient-uuid'}
|
|
70
|
+
isLoading={true}
|
|
71
|
+
subRows={mockEmptySubRows}
|
|
72
|
+
index={0}
|
|
73
|
+
title={'HIV viral load'}
|
|
74
|
+
/>,
|
|
75
|
+
);
|
|
37
76
|
|
|
38
77
|
expect(screen.getByRole('progressbar')).toBeInTheDocument();
|
|
39
78
|
});
|
|
40
79
|
|
|
41
80
|
it('renders a tabular overview of the available test result data', () => {
|
|
42
|
-
render(
|
|
81
|
+
render(
|
|
82
|
+
<IndividualResultsTable
|
|
83
|
+
patientUuid={'patient-uuid'}
|
|
84
|
+
isLoading={false}
|
|
85
|
+
subRows={mockSubRows}
|
|
86
|
+
index={0}
|
|
87
|
+
title={'HIV viral load'}
|
|
88
|
+
/>,
|
|
89
|
+
);
|
|
43
90
|
|
|
44
91
|
expect(screen.getByRole('table')).toBeInTheDocument();
|
|
45
92
|
expect(screen.getByText(/15-Oct-2024/i)).toBeInTheDocument();
|
|
46
93
|
expect(screen.getByText(/test name/i)).toBeInTheDocument();
|
|
47
94
|
expect(screen.getByText(/reference range/i)).toBeInTheDocument();
|
|
48
|
-
expect(screen.getByRole('row', { name: /hiv viral load 45 copies\/ml
|
|
95
|
+
expect(screen.getByRole('row', { name: /hiv viral load 45 copies\/ml 0 – 50 copies\/ml/i })).toBeInTheDocument();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('uses observation-level range when available', () => {
|
|
99
|
+
render(
|
|
100
|
+
<IndividualResultsTable
|
|
101
|
+
patientUuid={'patient-uuid'}
|
|
102
|
+
isLoading={false}
|
|
103
|
+
subRows={mockSubRowsWithObservationRange}
|
|
104
|
+
index={0}
|
|
105
|
+
title={'Alkaline phosphatase'}
|
|
106
|
+
/>,
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
// Should display observation-level range (35 – 147) not node-level (0 – 270)
|
|
110
|
+
expect(screen.getByRole('row', { name: /alkaline phosphatase 15 u\/l 35 – 147 u\/l/i })).toBeInTheDocument();
|
|
49
111
|
});
|
|
50
112
|
});
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { type OBSERVATION_INTERPRETATION } from '@openmrs/esm-patient-common-lib';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
type Concept,
|
|
4
|
+
type ConceptMeta,
|
|
5
|
+
type FHIRObservationResource,
|
|
6
|
+
type ObsRecord,
|
|
7
|
+
observationInterpretation,
|
|
8
|
+
} from '../../types';
|
|
3
9
|
import styles from './lab-set-panel.scss';
|
|
4
10
|
|
|
5
|
-
export const getConceptUuid = (obs: FHIRObservationResource) => obs?.code.coding[0]
|
|
11
|
+
export const getConceptUuid = (obs: FHIRObservationResource | ObsRecord) => obs?.code.coding?.[0]?.code;
|
|
6
12
|
|
|
7
13
|
export const getClass = (interpretation: OBSERVATION_INTERPRETATION) => {
|
|
8
14
|
switch (interpretation) {
|
|
@@ -233,7 +233,7 @@ const IndividualResultsTableTabletHeader: React.FC<IndividualResultsTableTabletH
|
|
|
233
233
|
<Form onSubmit={handleSearchTerm} className={styles.flexBaseline}>
|
|
234
234
|
<Search
|
|
235
235
|
autoFocus
|
|
236
|
-
labelText=
|
|
236
|
+
labelText={t('searchByTestName', 'Search by test name')}
|
|
237
237
|
onChange={(e) => setLocalSearchTerm(e.target.value)}
|
|
238
238
|
placeholder={t('searchByTestName', 'Search by test name')}
|
|
239
239
|
size="sm"
|
|
@@ -263,7 +263,7 @@ const IndividualResultsTableTabletHeader: React.FC<IndividualResultsTableTabletH
|
|
|
263
263
|
<Form onSubmit={handleSearchTerm} className={classNames(styles.flex)}>
|
|
264
264
|
<Search
|
|
265
265
|
autoFocus
|
|
266
|
-
labelText=
|
|
266
|
+
labelText={t('searchByTestName', 'Search by test name')}
|
|
267
267
|
onChange={(e) => setLocalSearchTerm(e.target.value)}
|
|
268
268
|
placeholder={t('searchByTestName', 'Search by test name')}
|
|
269
269
|
size="lg"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { rangeAlreadyHasUnits } from '../grouped-timeline/reference-range-helpers';
|
|
4
5
|
import {
|
|
5
6
|
DataTable,
|
|
6
7
|
TableContainer,
|
|
@@ -70,7 +71,10 @@ const LabSetPanel: React.FC<LabSetPanelProps> = ({ panel, activePanel, setActive
|
|
|
70
71
|
hasRange
|
|
71
72
|
? panel.entries.map((test) => {
|
|
72
73
|
const units = test.units ?? '';
|
|
73
|
-
|
|
74
|
+
// Check if range already includes units to avoid duplication
|
|
75
|
+
// formatReferenceRange includes units, so if range has units, don't append again
|
|
76
|
+
const hasUnits = rangeAlreadyHasUnits(test.range, units);
|
|
77
|
+
const range = hasUnits ? test.range : test.range ? `${test.range} ${units}` : '--';
|
|
74
78
|
return {
|
|
75
79
|
id: test.conceptUuid,
|
|
76
80
|
testName: test.display,
|