@openmrs/esm-patient-orders-app 11.3.1-pre.9383 → 11.3.1-pre.9390
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 +10 -13
- package/dist/1571.js +1 -1
- package/dist/1571.js.map +1 -1
- package/dist/2717.js +1 -0
- package/dist/2717.js.map +1 -0
- package/dist/4300.js +1 -1
- package/dist/8625.js +1 -1
- package/dist/8625.js.map +1 -1
- package/dist/8803.js +1 -1
- package/dist/8803.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-patient-orders-app.js +1 -1
- package/dist/openmrs-esm-patient-orders-app.js.buildmanifest.json +42 -42
- package/dist/routes.json +1 -1
- package/package.json +2 -2
- package/src/components/test-order.component.tsx +53 -49
- package/src/lab-results/lab-results-form.component.tsx +121 -41
- package/src/lab-results/lab-results-form.test.tsx +432 -283
- package/src/lab-results/lab-results-schema.resource.tsx +13 -4
- package/src/lab-results/lab-results.resource.ts +113 -0
- package/translations/en.json +2 -0
- package/dist/7202.js +0 -1
- package/dist/7202.js.map +0 -1
|
@@ -2,31 +2,34 @@ import React from 'react';
|
|
|
2
2
|
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
useOrderConceptsByUuids,
|
|
6
6
|
useLabEncounter,
|
|
7
7
|
useObservation,
|
|
8
8
|
type LabOrderConcept,
|
|
9
9
|
updateOrderResult,
|
|
10
10
|
type Datatype,
|
|
11
|
-
|
|
11
|
+
useCompletedLabResultsArray,
|
|
12
12
|
} from './lab-results.resource';
|
|
13
|
+
import { usePatient } from '@openmrs/esm-framework/src';
|
|
13
14
|
import LabResultsForm from './lab-results-form.component';
|
|
14
15
|
import { type Order } from '@openmrs/esm-patient-common-lib';
|
|
15
16
|
import { type Encounter } from '../types/encounter';
|
|
16
17
|
import { mockPatient } from 'tools';
|
|
17
18
|
|
|
18
|
-
const
|
|
19
|
+
const mockUseOrderConceptByUuids = jest.mocked(useOrderConceptsByUuids);
|
|
19
20
|
const mockUseLabEncounter = jest.mocked(useLabEncounter);
|
|
20
21
|
const mockUseObservation = jest.mocked(useObservation);
|
|
21
|
-
const
|
|
22
|
+
const mockUseCompletedLabResultsArray = jest.mocked(useCompletedLabResultsArray);
|
|
23
|
+
const mockUsePatient = jest.mocked(usePatient);
|
|
22
24
|
|
|
23
25
|
jest.mock('./lab-results.resource', () => ({
|
|
24
26
|
...jest.requireActual('./lab-results.resource'),
|
|
25
27
|
useOrderConceptByUuid: jest.fn(),
|
|
28
|
+
useOrderConceptsByUuids: jest.fn(),
|
|
26
29
|
useLabEncounter: jest.fn(),
|
|
27
30
|
useObservation: jest.fn(),
|
|
28
31
|
updateOrderResult: jest.fn().mockResolvedValue({}),
|
|
29
|
-
|
|
32
|
+
useCompletedLabResultsArray: jest.fn(),
|
|
30
33
|
}));
|
|
31
34
|
|
|
32
35
|
const mockOrder = {
|
|
@@ -53,21 +56,23 @@ const testProps = {
|
|
|
53
56
|
|
|
54
57
|
describe('LabResultsForm', () => {
|
|
55
58
|
beforeEach(() => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
59
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
60
|
+
concepts: [
|
|
61
|
+
{
|
|
62
|
+
uuid: 'concept-uuid',
|
|
63
|
+
display: 'Test Concept',
|
|
64
|
+
setMembers: [],
|
|
65
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
66
|
+
hiAbsolute: 100,
|
|
67
|
+
hiCritical: 80,
|
|
68
|
+
hiNormal: 70,
|
|
69
|
+
lowAbsolute: 0,
|
|
70
|
+
lowCritical: 40,
|
|
71
|
+
lowNormal: 50,
|
|
72
|
+
units: 'mg/dL',
|
|
73
|
+
allowDecimal: false,
|
|
74
|
+
},
|
|
75
|
+
] as LabOrderConcept[],
|
|
71
76
|
isLoading: false,
|
|
72
77
|
error: null,
|
|
73
78
|
isValidating: false,
|
|
@@ -87,12 +92,18 @@ describe('LabResultsForm', () => {
|
|
|
87
92
|
isValidating: false,
|
|
88
93
|
mutate: jest.fn(),
|
|
89
94
|
});
|
|
90
|
-
|
|
91
|
-
|
|
95
|
+
mockUseCompletedLabResultsArray.mockReturnValue({
|
|
96
|
+
completeLabResults: [],
|
|
92
97
|
isLoading: false,
|
|
93
98
|
error: null,
|
|
94
99
|
mutate: jest.fn(),
|
|
95
100
|
});
|
|
101
|
+
mockUsePatient.mockReturnValue({
|
|
102
|
+
isLoading: false,
|
|
103
|
+
patient: mockPatient,
|
|
104
|
+
patientUuid: '',
|
|
105
|
+
error: null,
|
|
106
|
+
});
|
|
96
107
|
});
|
|
97
108
|
|
|
98
109
|
test('validates numeric input correctly', async () => {
|
|
@@ -113,21 +124,23 @@ describe('LabResultsForm', () => {
|
|
|
113
124
|
test('validate when we have a concept with allowDecimal set to true', async () => {
|
|
114
125
|
const user = userEvent.setup();
|
|
115
126
|
// if allowDecimal is true, we should allow decimal values
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
128
|
+
concepts: [
|
|
129
|
+
{
|
|
130
|
+
uuid: 'concept-uuid',
|
|
131
|
+
display: 'Test Concept',
|
|
132
|
+
setMembers: [],
|
|
133
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
134
|
+
hiAbsolute: 100,
|
|
135
|
+
lowAbsolute: null,
|
|
136
|
+
lowCritical: null,
|
|
137
|
+
lowNormal: null,
|
|
138
|
+
hiCritical: null,
|
|
139
|
+
hiNormal: null,
|
|
140
|
+
units: 'mg/dL',
|
|
141
|
+
allowDecimal: true,
|
|
142
|
+
},
|
|
143
|
+
] as LabOrderConcept[],
|
|
131
144
|
isLoading: false,
|
|
132
145
|
error: null,
|
|
133
146
|
isValidating: false,
|
|
@@ -193,20 +206,22 @@ describe('LabResultsForm', () => {
|
|
|
193
206
|
|
|
194
207
|
test('validate numeric input with concept having only hiAbsolute', async () => {
|
|
195
208
|
const user = userEvent.setup();
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
210
|
+
concepts: [
|
|
211
|
+
{
|
|
212
|
+
uuid: 'concept-uuid',
|
|
213
|
+
display: 'Test Concept',
|
|
214
|
+
setMembers: [],
|
|
215
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
216
|
+
hiAbsolute: 100,
|
|
217
|
+
lowAbsolute: null,
|
|
218
|
+
lowCritical: null,
|
|
219
|
+
lowNormal: null,
|
|
220
|
+
hiCritical: null,
|
|
221
|
+
hiNormal: null,
|
|
222
|
+
units: 'mg/dL',
|
|
223
|
+
},
|
|
224
|
+
] as LabOrderConcept[],
|
|
210
225
|
isLoading: false,
|
|
211
226
|
error: null,
|
|
212
227
|
isValidating: false,
|
|
@@ -229,20 +244,22 @@ describe('LabResultsForm', () => {
|
|
|
229
244
|
|
|
230
245
|
test('validate numeric input with concept having only lowAbsolute', async () => {
|
|
231
246
|
const user = userEvent.setup();
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
247
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
248
|
+
concepts: [
|
|
249
|
+
{
|
|
250
|
+
uuid: 'concept-uuid',
|
|
251
|
+
display: 'Test Concept',
|
|
252
|
+
setMembers: [],
|
|
253
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
254
|
+
lowAbsolute: 0,
|
|
255
|
+
lowCritical: null,
|
|
256
|
+
lowNormal: null,
|
|
257
|
+
hiCritical: null,
|
|
258
|
+
hiNormal: null,
|
|
259
|
+
hiAbsolute: null,
|
|
260
|
+
units: 'mg/dL',
|
|
261
|
+
},
|
|
262
|
+
] as LabOrderConcept[],
|
|
246
263
|
isLoading: false,
|
|
247
264
|
error: null,
|
|
248
265
|
isValidating: false,
|
|
@@ -263,6 +280,63 @@ describe('LabResultsForm', () => {
|
|
|
263
280
|
});
|
|
264
281
|
});
|
|
265
282
|
|
|
283
|
+
test('validate numeric input for multiple fields', async () => {
|
|
284
|
+
const user = userEvent.setup();
|
|
285
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
286
|
+
concepts: [
|
|
287
|
+
{
|
|
288
|
+
uuid: 'concept-uuid',
|
|
289
|
+
display: 'Test Concept',
|
|
290
|
+
setMembers: [],
|
|
291
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
292
|
+
hiAbsolute: 60,
|
|
293
|
+
lowAbsolute: 0,
|
|
294
|
+
lowCritical: null,
|
|
295
|
+
lowNormal: null,
|
|
296
|
+
hiCritical: null,
|
|
297
|
+
hiNormal: null,
|
|
298
|
+
units: 'mg/dL',
|
|
299
|
+
allowDecimal: true,
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
uuid: 'concept-uuid2',
|
|
303
|
+
display: 'Test Concept Percentage',
|
|
304
|
+
setMembers: [],
|
|
305
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
306
|
+
hiAbsolute: 100,
|
|
307
|
+
lowAbsolute: 0,
|
|
308
|
+
lowCritical: null,
|
|
309
|
+
lowNormal: null,
|
|
310
|
+
hiCritical: null,
|
|
311
|
+
hiNormal: null,
|
|
312
|
+
units: '%',
|
|
313
|
+
allowDecimal: true,
|
|
314
|
+
},
|
|
315
|
+
] as LabOrderConcept[],
|
|
316
|
+
isLoading: false,
|
|
317
|
+
error: null,
|
|
318
|
+
isValidating: false,
|
|
319
|
+
mutate: jest.fn(),
|
|
320
|
+
});
|
|
321
|
+
render(<LabResultsForm {...testProps} />);
|
|
322
|
+
|
|
323
|
+
const input = await screen.findByLabelText(`Test Concept (0 - 60 mg/dL)`);
|
|
324
|
+
await user.type(input, '80');
|
|
325
|
+
|
|
326
|
+
const input2 = await screen.findByLabelText(`Test Concept Percentage (0 - 100 %)`);
|
|
327
|
+
await user.type(input2, '120');
|
|
328
|
+
|
|
329
|
+
const saveButton = screen.getByRole('button', { name: /Save and close/i });
|
|
330
|
+
await user.click(saveButton);
|
|
331
|
+
|
|
332
|
+
await waitFor(() => {
|
|
333
|
+
expect(screen.getByText('Test Concept must be between 0 and 60')).toBeInTheDocument();
|
|
334
|
+
});
|
|
335
|
+
await waitFor(() => {
|
|
336
|
+
expect(screen.getByText('Test Concept Percentage must be between 0 and 100')).toBeInTheDocument();
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
|
|
266
340
|
test('submits form with valid data', async () => {
|
|
267
341
|
const user = userEvent.setup();
|
|
268
342
|
const mockCloseWorkspace = jest.fn();
|
|
@@ -287,49 +361,114 @@ describe('LabResultsForm', () => {
|
|
|
287
361
|
});
|
|
288
362
|
});
|
|
289
363
|
|
|
364
|
+
test('submits form with valid data for multiple Results', async () => {
|
|
365
|
+
const user = userEvent.setup();
|
|
366
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
367
|
+
concepts: [
|
|
368
|
+
{
|
|
369
|
+
uuid: 'concept-uuid',
|
|
370
|
+
display: 'Test Concept',
|
|
371
|
+
setMembers: [],
|
|
372
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
373
|
+
hiAbsolute: 60,
|
|
374
|
+
lowAbsolute: 0,
|
|
375
|
+
lowCritical: null,
|
|
376
|
+
lowNormal: null,
|
|
377
|
+
hiCritical: null,
|
|
378
|
+
hiNormal: null,
|
|
379
|
+
units: 'mg/dL',
|
|
380
|
+
allowDecimal: true,
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
uuid: 'concept-uuid2',
|
|
384
|
+
display: 'Test Concept Percentage',
|
|
385
|
+
setMembers: [],
|
|
386
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
387
|
+
hiAbsolute: 100,
|
|
388
|
+
lowAbsolute: 0,
|
|
389
|
+
lowCritical: null,
|
|
390
|
+
lowNormal: null,
|
|
391
|
+
hiCritical: null,
|
|
392
|
+
hiNormal: null,
|
|
393
|
+
units: '%',
|
|
394
|
+
allowDecimal: true,
|
|
395
|
+
},
|
|
396
|
+
] as LabOrderConcept[],
|
|
397
|
+
isLoading: false,
|
|
398
|
+
error: null,
|
|
399
|
+
isValidating: false,
|
|
400
|
+
mutate: jest.fn(),
|
|
401
|
+
});
|
|
402
|
+
const mockCloseWorkspace = jest.fn();
|
|
403
|
+
const mockCloseWorkspaceWithSavedChanges = jest.fn();
|
|
404
|
+
|
|
405
|
+
render(
|
|
406
|
+
<LabResultsForm
|
|
407
|
+
{...testProps}
|
|
408
|
+
closeWorkspace={mockCloseWorkspace}
|
|
409
|
+
closeWorkspaceWithSavedChanges={mockCloseWorkspaceWithSavedChanges}
|
|
410
|
+
/>,
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
const input = await screen.findByLabelText(`Test Concept (0 - 60 mg/dL)`);
|
|
414
|
+
await user.type(input, '50');
|
|
415
|
+
|
|
416
|
+
const input2 = await screen.findByLabelText(`Test Concept Percentage (0 - 100 %)`);
|
|
417
|
+
await user.type(input2, '90');
|
|
418
|
+
|
|
419
|
+
const saveButton = screen.getByRole('button', { name: /Save and close/i });
|
|
420
|
+
await user.click(saveButton);
|
|
421
|
+
|
|
422
|
+
await waitFor(() => {
|
|
423
|
+
expect(mockCloseWorkspaceWithSavedChanges).toHaveBeenCalled();
|
|
424
|
+
});
|
|
425
|
+
});
|
|
426
|
+
|
|
290
427
|
test('validate numeric input where concept is a set', async () => {
|
|
291
428
|
const user = userEvent.setup();
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
429
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
430
|
+
concepts: [
|
|
431
|
+
{
|
|
432
|
+
uuid: 'concept-uuid',
|
|
433
|
+
display: 'Test Concept',
|
|
434
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
435
|
+
lowAbsolute: 0,
|
|
436
|
+
lowCritical: null,
|
|
437
|
+
lowNormal: null,
|
|
438
|
+
hiCritical: null,
|
|
439
|
+
hiNormal: null,
|
|
440
|
+
hiAbsolute: null,
|
|
441
|
+
units: 'mg/dL',
|
|
442
|
+
setMembers: [
|
|
443
|
+
{
|
|
444
|
+
uuid: 'set-member-uuid',
|
|
445
|
+
display: 'Set Member',
|
|
446
|
+
setMembers: [],
|
|
447
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
448
|
+
lowAbsolute: 50,
|
|
449
|
+
lowCritical: 70,
|
|
450
|
+
lowNormal: 80,
|
|
451
|
+
hiCritical: 140,
|
|
452
|
+
hiNormal: 120,
|
|
453
|
+
hiAbsolute: 150,
|
|
454
|
+
units: 'mg/dL',
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
uuid: 'set-member-uuid-2',
|
|
458
|
+
display: 'Set Member 2',
|
|
459
|
+
setMembers: [],
|
|
460
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
461
|
+
lowAbsolute: 5,
|
|
462
|
+
lowCritical: 10,
|
|
463
|
+
lowNormal: 15,
|
|
464
|
+
hiCritical: 20,
|
|
465
|
+
hiNormal: 25,
|
|
466
|
+
hiAbsolute: 30,
|
|
467
|
+
units: 'mg/dL',
|
|
468
|
+
},
|
|
469
|
+
],
|
|
470
|
+
},
|
|
471
|
+
] as LabOrderConcept[],
|
|
333
472
|
isLoading: false,
|
|
334
473
|
error: null,
|
|
335
474
|
isValidating: false,
|
|
@@ -363,20 +502,22 @@ describe('LabResultsForm', () => {
|
|
|
363
502
|
|
|
364
503
|
test('lab results form submits the correct lab result payload when the concept is not a set', async () => {
|
|
365
504
|
const user = userEvent.setup();
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
505
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
506
|
+
concepts: [
|
|
507
|
+
{
|
|
508
|
+
uuid: 'concept-uuid',
|
|
509
|
+
display: 'Test Concept',
|
|
510
|
+
setMembers: [],
|
|
511
|
+
datatype: { display: 'Text', hl7Abbreviation: 'ST' } as Datatype,
|
|
512
|
+
hiAbsolute: 100,
|
|
513
|
+
lowAbsolute: 0,
|
|
514
|
+
lowCritical: null,
|
|
515
|
+
lowNormal: null,
|
|
516
|
+
hiCritical: null,
|
|
517
|
+
hiNormal: null,
|
|
518
|
+
units: 'mg/dL',
|
|
519
|
+
},
|
|
520
|
+
] as LabOrderConcept[],
|
|
380
521
|
isLoading: false,
|
|
381
522
|
error: null,
|
|
382
523
|
isValidating: false,
|
|
@@ -410,48 +551,50 @@ describe('LabResultsForm', () => {
|
|
|
410
551
|
|
|
411
552
|
test('lab results forms submits correct payload when the concept is a set and one set member is keyed', async () => {
|
|
412
553
|
const user = userEvent.setup();
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
554
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
555
|
+
concepts: [
|
|
556
|
+
{
|
|
557
|
+
uuid: 'concept-uuid',
|
|
558
|
+
display: 'Test Concept',
|
|
559
|
+
set: true,
|
|
560
|
+
setMembers: [
|
|
561
|
+
{
|
|
562
|
+
uuid: 'set-member-uuid-1',
|
|
563
|
+
display: 'Set Member 1',
|
|
564
|
+
concept: { uuid: 'concept-uuid-1', display: 'Concept 1' },
|
|
565
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' } as Datatype,
|
|
566
|
+
hiAbsolute: 100,
|
|
567
|
+
lowAbsolute: 0,
|
|
568
|
+
lowCritical: null,
|
|
569
|
+
lowNormal: null,
|
|
570
|
+
hiCritical: null,
|
|
571
|
+
hiNormal: null,
|
|
572
|
+
units: 'mg/dL',
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
uuid: 'set-member-uuid-2',
|
|
576
|
+
display: 'Set Member 2',
|
|
577
|
+
concept: { uuid: 'concept-uuid-2', display: 'Concept 2' },
|
|
578
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' } as Datatype,
|
|
579
|
+
hiAbsolute: 80,
|
|
580
|
+
lowAbsolute: 0,
|
|
581
|
+
lowCritical: null,
|
|
582
|
+
lowNormal: null,
|
|
583
|
+
hiCritical: null,
|
|
584
|
+
hiNormal: null,
|
|
585
|
+
units: 'mmol/L',
|
|
586
|
+
},
|
|
587
|
+
],
|
|
588
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
589
|
+
hiAbsolute: 100,
|
|
590
|
+
lowAbsolute: 0,
|
|
591
|
+
lowCritical: null,
|
|
592
|
+
lowNormal: null,
|
|
593
|
+
hiCritical: null,
|
|
594
|
+
hiNormal: null,
|
|
595
|
+
units: 'mg/dL',
|
|
596
|
+
},
|
|
597
|
+
] as unknown as LabOrderConcept[],
|
|
455
598
|
isLoading: false,
|
|
456
599
|
error: null,
|
|
457
600
|
isValidating: false,
|
|
@@ -514,48 +657,50 @@ describe('LabResultsForm', () => {
|
|
|
514
657
|
|
|
515
658
|
test('lab results form submits correct payload when the concept is a set and both set members are keyed', async () => {
|
|
516
659
|
const user = userEvent.setup();
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
660
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
661
|
+
concepts: [
|
|
662
|
+
{
|
|
663
|
+
uuid: 'concept-uuid',
|
|
664
|
+
display: 'Test Concept',
|
|
665
|
+
set: true,
|
|
666
|
+
setMembers: [
|
|
667
|
+
{
|
|
668
|
+
uuid: 'set-member-uuid-1',
|
|
669
|
+
display: 'Set Member 1',
|
|
670
|
+
concept: { uuid: 'concept-uuid-1', display: 'Concept 1' },
|
|
671
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
672
|
+
hiAbsolute: 100,
|
|
673
|
+
lowAbsolute: 0,
|
|
674
|
+
lowCritical: null,
|
|
675
|
+
lowNormal: null,
|
|
676
|
+
hiCritical: null,
|
|
677
|
+
hiNormal: null,
|
|
678
|
+
units: 'mg/dL',
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
uuid: 'set-member-uuid-2',
|
|
682
|
+
display: 'Set Member 2',
|
|
683
|
+
concept: { uuid: 'concept-uuid-2', display: 'Concept 2' },
|
|
684
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
685
|
+
hiAbsolute: 80,
|
|
686
|
+
lowAbsolute: 0,
|
|
687
|
+
lowCritical: null,
|
|
688
|
+
lowNormal: null,
|
|
689
|
+
hiCritical: null,
|
|
690
|
+
hiNormal: null,
|
|
691
|
+
units: 'mmol/L',
|
|
692
|
+
},
|
|
693
|
+
],
|
|
694
|
+
datatype: { display: 'Numeric' },
|
|
695
|
+
hiAbsolute: 100,
|
|
696
|
+
lowAbsolute: 0,
|
|
697
|
+
lowCritical: null,
|
|
698
|
+
lowNormal: null,
|
|
699
|
+
hiCritical: null,
|
|
700
|
+
hiNormal: null,
|
|
701
|
+
units: 'mg/dL',
|
|
702
|
+
},
|
|
703
|
+
] as unknown as LabOrderConcept[],
|
|
559
704
|
isLoading: false,
|
|
560
705
|
error: null,
|
|
561
706
|
isValidating: false,
|
|
@@ -630,13 +775,15 @@ describe('LabResultsForm', () => {
|
|
|
630
775
|
});
|
|
631
776
|
|
|
632
777
|
test('display error notification when the concept datatype is N/A', async () => {
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
778
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
779
|
+
concepts: [
|
|
780
|
+
{
|
|
781
|
+
uuid: 'concept-uuid',
|
|
782
|
+
display: 'Test Concept',
|
|
783
|
+
setMembers: [],
|
|
784
|
+
datatype: { display: 'N/A' },
|
|
785
|
+
},
|
|
786
|
+
] as LabOrderConcept[],
|
|
640
787
|
isLoading: false,
|
|
641
788
|
error: null,
|
|
642
789
|
isValidating: false,
|
|
@@ -655,78 +802,80 @@ describe('LabResultsForm', () => {
|
|
|
655
802
|
|
|
656
803
|
test('should display second level of set members for a given concept, if present', () => {
|
|
657
804
|
const user = userEvent.setup();
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
805
|
+
mockUseOrderConceptByUuids.mockReturnValue({
|
|
806
|
+
concepts: [
|
|
807
|
+
{
|
|
808
|
+
uuid: 'concept-uuid',
|
|
809
|
+
display: 'Test Concept',
|
|
810
|
+
set: true,
|
|
811
|
+
setMembers: [
|
|
812
|
+
{
|
|
813
|
+
uuid: 'set-member-uuid-1',
|
|
814
|
+
display: 'Set Member 1',
|
|
815
|
+
concept: { uuid: 'concept-uuid-1', display: 'Concept 1' },
|
|
816
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
817
|
+
hiAbsolute: 100,
|
|
818
|
+
lowAbsolute: 0,
|
|
819
|
+
lowCritical: null,
|
|
820
|
+
lowNormal: null,
|
|
821
|
+
hiCritical: null,
|
|
822
|
+
hiNormal: null,
|
|
823
|
+
units: 'mg/dL',
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
uuid: 'set-member-uuid-2',
|
|
827
|
+
display: 'Set Member 2',
|
|
828
|
+
concept: { uuid: 'concept-uuid-2', display: 'Concept 2' },
|
|
829
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
830
|
+
hiAbsolute: 80,
|
|
831
|
+
lowAbsolute: 0,
|
|
832
|
+
lowCritical: null,
|
|
833
|
+
lowNormal: null,
|
|
834
|
+
hiCritical: null,
|
|
835
|
+
hiNormal: null,
|
|
836
|
+
units: 'mmol/L',
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
uuid: 'set-member-uuid-3',
|
|
840
|
+
display: 'Set Member 3',
|
|
841
|
+
concept: { uuid: 'concept-uuid-3', display: 'Concept 3' },
|
|
842
|
+
datatype: { display: 'N/A', hl7Abbreviation: 'ZZ' },
|
|
843
|
+
set: true,
|
|
844
|
+
setMembers: [
|
|
845
|
+
{
|
|
846
|
+
uuid: 'set-member-uuid-3.1',
|
|
847
|
+
display: 'Set Member 3.1',
|
|
848
|
+
concept: { uuid: 'concept-uuid-3.1', display: 'Concept 3.1' },
|
|
849
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
850
|
+
hiAbsolute: 80,
|
|
851
|
+
lowAbsolute: 0,
|
|
852
|
+
lowCritical: null,
|
|
853
|
+
lowNormal: null,
|
|
854
|
+
units: 'mg/dL',
|
|
855
|
+
},
|
|
856
|
+
{
|
|
857
|
+
uuid: 'set-member-uuid-3.2',
|
|
858
|
+
display: 'Set Member 3.2',
|
|
859
|
+
concept: { uuid: 'concept-uuid-3.2', display: 'Concept 3.2' },
|
|
860
|
+
datatype: { display: 'Numeric', hl7Abbreviation: 'NM' },
|
|
861
|
+
hiAbsolute: 80,
|
|
862
|
+
lowAbsolute: 0,
|
|
863
|
+
lowCritical: null,
|
|
864
|
+
units: 'mg/dL',
|
|
865
|
+
},
|
|
866
|
+
],
|
|
867
|
+
},
|
|
868
|
+
],
|
|
869
|
+
datatype: { display: 'Numeric' },
|
|
870
|
+
hiAbsolute: 100,
|
|
871
|
+
lowAbsolute: 0,
|
|
872
|
+
lowCritical: null,
|
|
873
|
+
lowNormal: null,
|
|
874
|
+
hiCritical: null,
|
|
875
|
+
hiNormal: null,
|
|
876
|
+
units: 'mg/dL',
|
|
877
|
+
},
|
|
878
|
+
] as unknown as LabOrderConcept[],
|
|
730
879
|
isLoading: false,
|
|
731
880
|
error: null,
|
|
732
881
|
isValidating: false,
|