fhir-react 0.3.2 → 0.3.3
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/build/index.js +1 -1
- package/package.json +1 -1
- package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +19 -8
- package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.test.js +8 -3
- package/src/components/resources/ExplanationOfBenefit/SupportingInfo.js +21 -6
- package/src/fixtures/r4/resources/explanationOfBenefit/c4bbExample.json +18 -2
package/package.json
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import CareTeam from './CareTeam';
|
|
15
15
|
import CodeableConcept from '../../datatypes/CodeableConcept';
|
|
16
16
|
import Coding from '../../datatypes/Coding';
|
|
17
|
+
import Quantity from '../../datatypes/Quantity';
|
|
17
18
|
import Date from '../../datatypes/Date';
|
|
18
19
|
import Diagnosis from './Diagnosis';
|
|
19
20
|
import Identifier from '../../datatypes/Identifier/Identifier';
|
|
@@ -80,9 +81,10 @@ const stu3DTO = fhirResource => {
|
|
|
80
81
|
services.map(serviceItem => {
|
|
81
82
|
const coding = _get(serviceItem, 'service.coding.0');
|
|
82
83
|
const servicedDate = _get(serviceItem, 'servicedDate');
|
|
84
|
+
const servicedPeriod = _get(serviceItem, 'servicedPeriod');
|
|
83
85
|
const quantity = _get(serviceItem, 'quantity.value');
|
|
84
86
|
const itemCost = _get(serviceItem, 'net');
|
|
85
|
-
return { coding, servicedDate, quantity, itemCost };
|
|
87
|
+
return { coding, servicedDate, servicedPeriod, quantity, itemCost };
|
|
86
88
|
});
|
|
87
89
|
|
|
88
90
|
return {
|
|
@@ -126,9 +128,10 @@ const r4DTO = fhirResource => {
|
|
|
126
128
|
services.map(serviceItem => {
|
|
127
129
|
const coding = _get(serviceItem, 'productOrService.coding.0');
|
|
128
130
|
const servicedDate = _get(serviceItem, 'servicedDate');
|
|
131
|
+
const servicedPeriod = _get(serviceItem, 'servicedPeriod');
|
|
129
132
|
const quantity = _get(serviceItem, 'quantity.value');
|
|
130
133
|
const itemCost = _get(serviceItem, 'net');
|
|
131
|
-
return { coding, servicedDate, quantity, itemCost };
|
|
134
|
+
return { coding, servicedDate, servicedPeriod, quantity, itemCost };
|
|
132
135
|
});
|
|
133
136
|
|
|
134
137
|
return {
|
|
@@ -453,11 +456,12 @@ const ExplanationOfBenefit = props => {
|
|
|
453
456
|
<Coding fhirData={serviceItem.coding} />
|
|
454
457
|
</TableCell>
|
|
455
458
|
<TableCell data-testid="explanation.servicedDate">
|
|
456
|
-
{serviceItem.servicedDate
|
|
459
|
+
{(serviceItem.servicedDate && (
|
|
457
460
|
<Date fhirData={serviceItem.servicedDate} />
|
|
458
|
-
)
|
|
459
|
-
|
|
460
|
-
|
|
461
|
+
)) ||
|
|
462
|
+
(serviceItem.servicedPeriod && (
|
|
463
|
+
<Period fhirData={serviceItem.servicedPeriod} />
|
|
464
|
+
)) || <MissingValue />}
|
|
461
465
|
</TableCell>
|
|
462
466
|
<TableCell data-testid="explanation.quantity">
|
|
463
467
|
{Number.isFinite(Number(serviceItem.quantity)) ? (
|
|
@@ -501,7 +505,14 @@ const ExplanationOfBenefit = props => {
|
|
|
501
505
|
informationItem,
|
|
502
506
|
'category.coding.0',
|
|
503
507
|
);
|
|
504
|
-
const
|
|
508
|
+
const infoKey = Object.keys(informationItem).filter(
|
|
509
|
+
key => {
|
|
510
|
+
return key !== 'sequence' && key !== 'category';
|
|
511
|
+
},
|
|
512
|
+
);
|
|
513
|
+
const infoStatus = _get(informationItem, infoKey);
|
|
514
|
+
const StatusComponent =
|
|
515
|
+
infoKey.toString() === 'timingDate' ? Date : Quantity;
|
|
505
516
|
|
|
506
517
|
return (
|
|
507
518
|
<TableRow key={`serviceItem-${i}`}>
|
|
@@ -514,7 +525,7 @@ const ExplanationOfBenefit = props => {
|
|
|
514
525
|
</TableCell>
|
|
515
526
|
<TableCell>
|
|
516
527
|
{infoStatus ? (
|
|
517
|
-
<
|
|
528
|
+
<StatusComponent fhirData={infoStatus} />
|
|
518
529
|
) : (
|
|
519
530
|
<MissingValue />
|
|
520
531
|
)}
|
|
@@ -200,13 +200,18 @@ describe('should render ExplanationOfBenefit component properly', () => {
|
|
|
200
200
|
'Condition/88bd5ac6-175b-5906-a4ee-6eedd667b0cc',
|
|
201
201
|
);
|
|
202
202
|
expect(getByTestId('diagnosisType').textContent).toContain('principal');
|
|
203
|
-
expect(getByTestId('supportingInfo.category').textContent).toContain(
|
|
203
|
+
expect(getByTestId('supportingInfo.0.category').textContent).toContain(
|
|
204
204
|
'clmrecvddate',
|
|
205
205
|
);
|
|
206
|
-
expect(getByTestId('supportingInfo.timingDate').textContent).toEqual(
|
|
206
|
+
expect(getByTestId('supportingInfo.0.timingDate').textContent).toEqual(
|
|
207
207
|
'1/5/2017',
|
|
208
208
|
);
|
|
209
|
-
|
|
209
|
+
expect(getByTestId('supportingInfo.1.category').textContent).toContain(
|
|
210
|
+
'dayssupply',
|
|
211
|
+
);
|
|
212
|
+
expect(getByTestId('supportingInfo.1.valueQuantity').textContent).toContain(
|
|
213
|
+
'30',
|
|
214
|
+
);
|
|
210
215
|
// checking if text content of each header cell is equal to mocked data
|
|
211
216
|
const headerCells = getAllByRole('columnheader')
|
|
212
217
|
.slice(0, 4)
|
|
@@ -4,6 +4,7 @@ import _get from 'lodash/get';
|
|
|
4
4
|
import { ValueSection, Value } from '../../ui/index';
|
|
5
5
|
import CodeableConcept from '../../datatypes/CodeableConcept';
|
|
6
6
|
import Date from '../../datatypes/Date';
|
|
7
|
+
import Quantity from '../../datatypes/Quantity';
|
|
7
8
|
|
|
8
9
|
const SupportingInfo = ({ fhirData }) => {
|
|
9
10
|
return fhirData.map((supportingInfo, index) => {
|
|
@@ -11,6 +12,7 @@ const SupportingInfo = ({ fhirData }) => {
|
|
|
11
12
|
const category = _get(supportingInfo, 'category');
|
|
12
13
|
const code = _get(supportingInfo, 'code ');
|
|
13
14
|
const timingDate = _get(supportingInfo, 'timingDate');
|
|
15
|
+
const valueQuantity = _get(supportingInfo, 'valueQuantity');
|
|
14
16
|
const timingPeriodStart = _get(supportingInfo, 'timingPeriod.start');
|
|
15
17
|
const timingPeriodEnd = _get(supportingInfo, 'timingPeriod.end');
|
|
16
18
|
|
|
@@ -18,20 +20,24 @@ const SupportingInfo = ({ fhirData }) => {
|
|
|
18
20
|
<div key={`total-${index}`}>
|
|
19
21
|
<ValueSection
|
|
20
22
|
label={`Supporting information ${sequence}.`}
|
|
21
|
-
data-testid=
|
|
23
|
+
data-testid={`supportingInfo.${index}`}
|
|
22
24
|
marginTop
|
|
23
25
|
>
|
|
24
26
|
{category && (
|
|
25
27
|
<Value
|
|
26
28
|
dirColumn
|
|
27
29
|
label="Category"
|
|
28
|
-
data-testid=
|
|
30
|
+
data-testid={`supportingInfo.${index}.category`}
|
|
29
31
|
>
|
|
30
32
|
<CodeableConcept fhirData={category} />
|
|
31
33
|
</Value>
|
|
32
34
|
)}
|
|
33
35
|
{code && (
|
|
34
|
-
<Value
|
|
36
|
+
<Value
|
|
37
|
+
dirColumn
|
|
38
|
+
label="Code"
|
|
39
|
+
data-testid={`supportingInfo.${index}.category`}
|
|
40
|
+
>
|
|
35
41
|
<CodeableConcept fhirData={code} />
|
|
36
42
|
</Value>
|
|
37
43
|
)}
|
|
@@ -39,16 +45,25 @@ const SupportingInfo = ({ fhirData }) => {
|
|
|
39
45
|
<Value
|
|
40
46
|
dirColumn
|
|
41
47
|
label="Date"
|
|
42
|
-
data-testid=
|
|
48
|
+
data-testid={`supportingInfo.${index}.timingDate`}
|
|
43
49
|
>
|
|
44
50
|
<Date fhirData={timingDate} />
|
|
45
51
|
</Value>
|
|
46
52
|
)}
|
|
53
|
+
{valueQuantity && (
|
|
54
|
+
<Value
|
|
55
|
+
dirColumn
|
|
56
|
+
label="Quantity"
|
|
57
|
+
data-testid={`supportingInfo.${index}.valueQuantity`}
|
|
58
|
+
>
|
|
59
|
+
<Quantity fhirData={valueQuantity} />
|
|
60
|
+
</Value>
|
|
61
|
+
)}
|
|
47
62
|
{timingPeriodStart && (
|
|
48
63
|
<Value
|
|
49
64
|
dirColumn
|
|
50
65
|
label="Start date"
|
|
51
|
-
data-testid=
|
|
66
|
+
data-testid={`supportingInfo.${index}.timingPeriodStart`}
|
|
52
67
|
>
|
|
53
68
|
<Date fhirData={timingPeriodStart} />
|
|
54
69
|
</Value>
|
|
@@ -57,7 +72,7 @@ const SupportingInfo = ({ fhirData }) => {
|
|
|
57
72
|
<Value
|
|
58
73
|
dirColumn
|
|
59
74
|
label="End date"
|
|
60
|
-
data-testid=
|
|
75
|
+
data-testid={`supportingInfo.${index}.timingPeriodEnd`}
|
|
61
76
|
>
|
|
62
77
|
<Date fhirData={timingPeriodEnd} />
|
|
63
78
|
</Value>
|
|
@@ -148,13 +148,29 @@
|
|
|
148
148
|
"category": {
|
|
149
149
|
"coding": [
|
|
150
150
|
{
|
|
151
|
+
"code": "clmrecvddate",
|
|
151
152
|
"system": "http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType",
|
|
152
|
-
"
|
|
153
|
+
"display": "Claim Received Date"
|
|
153
154
|
}
|
|
154
155
|
]
|
|
155
156
|
},
|
|
156
157
|
"timingDate": "2017-01-05"
|
|
157
|
-
}
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"sequence": 2,
|
|
161
|
+
"category": {
|
|
162
|
+
"coding": [
|
|
163
|
+
{
|
|
164
|
+
"code": "dayssupply",
|
|
165
|
+
"system": "http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType",
|
|
166
|
+
"display": "Days Supply"
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
"valueQuantity": {
|
|
171
|
+
"value": 30
|
|
172
|
+
}
|
|
173
|
+
}
|
|
158
174
|
],
|
|
159
175
|
"diagnosis": [
|
|
160
176
|
{
|