fhir-react 0.3.12 → 0.3.13
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/README.md +1 -1
- package/build/index.js +1 -1
- package/build/style.css +1 -1
- package/package.json +1 -1
- package/src/components/containers/Accordion/Accordion.js +5 -4
- package/src/components/containers/ResourceContainer/ResourceContainer.css +1 -3
- package/src/components/datatypes/Date/Date.js +1 -0
- package/src/components/datatypes/DatePeriod/DatePeriod.js +2 -2
- package/src/components/resources/AdverseEvent/AdverseEvent.test.js +2 -2
- package/src/components/resources/AllergyIntolerance/AllergyIntolerance.js +17 -2
- package/src/components/resources/AllergyIntolerance/AllergyIntolerance.test.js +8 -4
- package/src/components/resources/CarePlan/CarePlan.test.js +4 -4
- package/src/components/resources/CareTeam/CareTeam.test.js +4 -4
- package/src/components/resources/Claim/Claim.test.js +6 -6
- package/src/components/resources/ClaimResponse/ClaimResponse.test.js +6 -6
- package/src/components/resources/Condition/Condition.js +25 -3
- package/src/components/resources/Condition/Condition.test.js +5 -5
- package/src/components/resources/DiagnosticReport/DiagnosticReport.test.js +4 -2
- package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +3 -1
- package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.test.js +7 -7
- package/src/components/resources/Goal/Goal.test.js +2 -2
- package/src/components/resources/Immunization/Immunization.js +8 -2
- package/src/components/resources/MedicationAdministration/MedicationAdministration.test.js +7 -7
- package/src/components/resources/MedicationDispense/MedicationDispense.test.js +2 -2
- package/src/components/resources/MedicationRequest/MedicationRequest.test.js +4 -4
- package/src/components/resources/Observation/Observation.js +15 -3
- package/src/components/resources/Observation/Observation.test.js +1 -1
- package/src/components/resources/Patient/Patient.js +1 -1
- package/src/components/resources/Patient/Patient.test.js +6 -6
- package/src/components/resources/Procedure/Procedure.test.js +1 -1
- package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.test.js +4 -4
- package/src/components/resources/ResearchStudy/ResearchStudy.test.js +1 -1
- package/src/components/ui/index.js +5 -1
- package/src/utils/formatDate.js +3 -0
- package/src/utils/formatDate.test.js +2 -2
- package/src/utils/getResourceDate.js +9 -0
package/build/style.css
CHANGED
|
@@ -28,4 +28,4 @@
|
|
|
28
28
|
.fhir-resource__Questionnaire-list{list-style:none;padding:2px;margin:2px}.fhir-resource__Questionnaire-list-title{padding:2px 2px 8px 2px;font-weight:bold}.fhir-resource__Questionnaire-list-title-question{background:#f8f9fa;align-items:center;margin-bottom:56px;padding-left:16px;border-radius:4px;color:#adb5bd}.fhir-resource__Questionnaire-questions-list{list-style:none;padding-left:0;display:block;color:#adb5bd}.fhir-resource__Questionnaire-questions-list li{display:block;margin-bottom:56px}.fhir-resource__Questionnaire-questions-list-element{background:#f8f9fa;border-radius:4px;width:100%;padding-left:16px;margin-bottom:56px}.fhir-resource__Questionnaire-questions-list li:last-child{border-bottom:none}.fhir-resource__Questionnaire-questions-list-item-details{font-size:80%}.fhir-resource__Questionnaire-questions-list-item-details-el{display:inline-block;margin-right:15px}
|
|
29
29
|
.fhir-resource__QuestionnaireResponse-list{list-style:none;padding:0;margin:0}.fhir-resource__QuestionnaireResponse-list:first-of-type{padding-top:20px}.fhir-resource__QuestionnaireResponse-list-title{padding:2px 2px 8px 2px;font-weight:bold}.fhir-resource__QuestionnaireResponse-list-title-question{background:#f8f9fa;align-items:center;margin-bottom:56px;padding-left:16px;border-radius:4px;color:#adb5bd}.fhir-resource__QuestionnaireResponse-questions-list{list-style:none;padding-left:0;display:block;color:#adb5bd}.fhir-resource__QuestionnaireResponse-questions-list li{display:block;margin-bottom:56px}.fhir-resource__QuestionnaireResponse-questions-list-element{background:#f8f9fa;border-radius:4px;width:100%;padding-left:16px;margin-bottom:56px}.fhir-resource__QuestionnaireResponse-questions-list li:last-child{border-bottom:none}.fhir-resource__QuestionnaireResponse-questions-list-item-details{margin:-30px 0}.fhir-resource__QuestionnaireResponse-questions-list-item-details-el{display:inline-block;color:#000;margin-right:15px;margin-left:20px}
|
|
30
30
|
.fhir-container__CodeBlock{padding:1.5rem;color:#f8f9fa;background-color:#343a40;border-radius:.25rem;word-break:break-word;font-family:monospace;font-size:16px;overflow-x:scroll}
|
|
31
|
-
.fhir-container__ResourceContainer__card{border:0;position:relative;display:flex;flex-direction:column;min-width:0;word-wrap:break-word;background-clip:border-box;border-radius:.25rem}.fhir-container__ResourceContainer__card-body{flex:1 1 auto;padding:1.25rem}.fhir-container__ResourceContainer__json-button-wrapper{
|
|
31
|
+
.fhir-container__ResourceContainer__card{border:0;position:relative;display:flex;flex-direction:column;min-width:0;word-wrap:break-word;background-clip:border-box;border-radius:.25rem}.fhir-container__ResourceContainer__card-body{flex:1 1 auto;padding:1.25rem}.fhir-container__ResourceContainer__json-button-wrapper{padding-right:5px}.fhir-container__ResourceContainer__json-button-wrapper-accordion{margin-top:10px}.fhir-container__ResourceContainer__json--visible{display:block;padding-top:10px}.fhir-container__ResourceContainer__json--hidden{display:none}.fhir-container__ResourceContainer__json-button{color:#6c757d;border-color:#6c757d;cursor:pointer;padding:.15rem .5rem;font-size:.875rem;line-height:1rem;border-radius:.2rem;display:inline-block;font-weight:400;text-align:center;vertical-align:middle;user-select:none;border:1px solid #6c6c6c;transition:all .15s ease-in-out}.fhir-container__ResourceContainer__json-button:hover{color:#fff;background-color:#6c757d;border-color:#6c757d}
|
package/package.json
CHANGED
|
@@ -68,7 +68,6 @@ const Accordion = props => {
|
|
|
68
68
|
|
|
69
69
|
return (
|
|
70
70
|
<div className="fhir-container__Accordion accordion">
|
|
71
|
-
{typeof rawOnClick === 'function' && !isRawInAccordion && rawButton}
|
|
72
71
|
<div className="fhir-container__Accordion__body accordion-body">
|
|
73
72
|
<div className="fhir-container__Accordion__body-data accordion-item border-1 shadow-sm">
|
|
74
73
|
<div
|
|
@@ -76,9 +75,7 @@ const Accordion = props => {
|
|
|
76
75
|
id="flush-headingOne"
|
|
77
76
|
>
|
|
78
77
|
<button
|
|
79
|
-
className={`fhir-container__Accordion__header-button w-100 p-0 border-0 rounded-1 collapsed text-dark bg-white shadow-none point
|
|
80
|
-
isAccordionOpenable() ? '' : 'pe-none'
|
|
81
|
-
}`}
|
|
78
|
+
className={`fhir-container__Accordion__header-button w-100 p-0 border-0 rounded-1 collapsed text-dark bg-white shadow-none point`}
|
|
82
79
|
type="button"
|
|
83
80
|
data-bs-target={`#${accordionId}`}
|
|
84
81
|
data-bs-toggle={
|
|
@@ -95,6 +92,10 @@ const Accordion = props => {
|
|
|
95
92
|
<div className="fhir-container__Accordion__header-text d-flex w-100 justify-content-start position-relative">
|
|
96
93
|
{React.cloneElement(headerContent, {
|
|
97
94
|
isAccordionOpenable: isAccordionOpenable(),
|
|
95
|
+
rawButton:
|
|
96
|
+
typeof rawOnClick === 'function' &&
|
|
97
|
+
!isRawInAccordion &&
|
|
98
|
+
rawButton,
|
|
98
99
|
})}
|
|
99
100
|
{typeof onClick !== 'function' && getChevron()}
|
|
100
101
|
</div>
|
|
@@ -20,13 +20,13 @@ const DatePeriod = props => {
|
|
|
20
20
|
return (
|
|
21
21
|
<div className="d-flex flex-column flex-sm-row align-items-start align-items-sm-start">
|
|
22
22
|
{periodBeginDate && (
|
|
23
|
-
<div className="d-flex flex-wrap">
|
|
23
|
+
<div className="d-flex flex-wrap align-items-center">
|
|
24
24
|
<SingleDateSpan label={periodBeginLabel} />
|
|
25
25
|
<Date testId={periodBeginTestId} isBlack fhirData={periodBeginDate} />
|
|
26
26
|
</div>
|
|
27
27
|
)}
|
|
28
28
|
{periodEndDate && (
|
|
29
|
-
<div className="ms-sm-4 d-flex flex-wrap">
|
|
29
|
+
<div className="ms-sm-4 d-flex flex-wrap align-items-center">
|
|
30
30
|
<SingleDateSpan label={periodEndLabel} />
|
|
31
31
|
<Date testId={periodEndTestId} isBlack fhirData={periodEndDate} />
|
|
32
32
|
</div>
|
|
@@ -88,7 +88,7 @@ describe('should render component correctly', () => {
|
|
|
88
88
|
|
|
89
89
|
expect(getByTestId('title').textContent).toContain('Patient');
|
|
90
90
|
|
|
91
|
-
expect(getByTestId('date').textContent).toEqual('
|
|
91
|
+
expect(getByTestId('date').textContent).toEqual('01/29/2017');
|
|
92
92
|
|
|
93
93
|
expect(getByTestId('event').textContent).toContain('304386008');
|
|
94
94
|
|
|
@@ -108,7 +108,7 @@ describe('should render component correctly', () => {
|
|
|
108
108
|
|
|
109
109
|
expect(getByTestId('title').textContent).toContain('Patient');
|
|
110
110
|
|
|
111
|
-
expect(getByTestId('date').textContent).toEqual('
|
|
111
|
+
expect(getByTestId('date').textContent).toEqual('01/29/2017');
|
|
112
112
|
|
|
113
113
|
expect(getByTestId('hasSeriousness').textContent).toContain('Non-serious');
|
|
114
114
|
|
|
@@ -13,6 +13,7 @@ import Annotation from '../../datatypes/Annotation';
|
|
|
13
13
|
|
|
14
14
|
import { Root, Header, Badge, BadgeSecondary, Body } from '../../ui';
|
|
15
15
|
import CodeableConcept from '../../datatypes/CodeableConcept';
|
|
16
|
+
import { getResourceDate } from '../../../utils/getResourceDate';
|
|
16
17
|
|
|
17
18
|
const commonDTO = fhirResource => {
|
|
18
19
|
const hasReaction = _get(fhirResource, 'reaction.0.manifestation');
|
|
@@ -221,6 +222,19 @@ const AllergyIntolerance = ({
|
|
|
221
222
|
},
|
|
222
223
|
];
|
|
223
224
|
|
|
225
|
+
const allergyDatesPaths = [
|
|
226
|
+
'meta.lastUpdated',
|
|
227
|
+
'onsetPeriod.start',
|
|
228
|
+
'onset',
|
|
229
|
+
'reaction[0].onset',
|
|
230
|
+
'recordedDate',
|
|
231
|
+
'onsetDateTime',
|
|
232
|
+
'assertedDate',
|
|
233
|
+
];
|
|
234
|
+
|
|
235
|
+
const headerDate =
|
|
236
|
+
getResourceDate(fhirResource, allergyDatesPaths) || recordedDate;
|
|
237
|
+
|
|
224
238
|
return (
|
|
225
239
|
<Root name="AllergyIntolerance">
|
|
226
240
|
<Accordion
|
|
@@ -231,9 +245,10 @@ const AllergyIntolerance = ({
|
|
|
231
245
|
title={title}
|
|
232
246
|
icon={fhirIcons}
|
|
233
247
|
rightAdditionalContent={
|
|
234
|
-
|
|
248
|
+
headerDate && (
|
|
235
249
|
<BadgeSecondary data-testid="recordedDate">
|
|
236
|
-
recorded on
|
|
250
|
+
recorded on
|
|
251
|
+
<Date fhirData={headerDate} />
|
|
237
252
|
</BadgeSecondary>
|
|
238
253
|
)
|
|
239
254
|
}
|
|
@@ -93,7 +93,7 @@ describe('should render component correctly', () => {
|
|
|
93
93
|
|
|
94
94
|
expect(getByTestId('status').textContent).toContain('unconfirmed');
|
|
95
95
|
|
|
96
|
-
expect(getByTestId('recordedDate').textContent).toContain('
|
|
96
|
+
expect(getByTestId('recordedDate').textContent).toContain('03/01/2010');
|
|
97
97
|
|
|
98
98
|
expect(getByTestId('substance').textContent).toContain('PENICILLIN');
|
|
99
99
|
|
|
@@ -117,7 +117,9 @@ describe('should render component correctly', () => {
|
|
|
117
117
|
|
|
118
118
|
expect(getByTestId('status').textContent).toContain('confirmed');
|
|
119
119
|
|
|
120
|
-
expect(getByTestId('recordedDate').textContent).toContain(
|
|
120
|
+
expect(getByTestId('recordedDate').textContent).toContain(
|
|
121
|
+
'recorded on 06/12/2012',
|
|
122
|
+
);
|
|
121
123
|
|
|
122
124
|
expect(getByTestId('substance').textContent).toContain(
|
|
123
125
|
'allergenic extract',
|
|
@@ -149,7 +151,9 @@ describe('should render component correctly', () => {
|
|
|
149
151
|
|
|
150
152
|
expect(getByTestId('status').textContent).toContain('Confirmed');
|
|
151
153
|
|
|
152
|
-
expect(getByTestId('recordedDate').textContent).toContain(
|
|
154
|
+
expect(getByTestId('recordedDate').textContent).toContain(
|
|
155
|
+
'recorded on 06/12/2012',
|
|
156
|
+
);
|
|
153
157
|
|
|
154
158
|
expect(getByTestId('substance').textContent).toContain(
|
|
155
159
|
'allergenic extract',
|
|
@@ -185,7 +189,7 @@ describe('should render component correctly', () => {
|
|
|
185
189
|
|
|
186
190
|
expect(getByTestId('status').textContent).toContain('Confirmed');
|
|
187
191
|
|
|
188
|
-
expect(getByTestId('recordedDate').textContent).toContain('
|
|
192
|
+
expect(getByTestId('recordedDate').textContent).toContain('08/06/2015');
|
|
189
193
|
|
|
190
194
|
expect(getByTestId('patient').textContent).toEqual('Patient/mom');
|
|
191
195
|
|
|
@@ -115,7 +115,7 @@ describe('should render component correctly', () => {
|
|
|
115
115
|
'Peter James Chalmers',
|
|
116
116
|
);
|
|
117
117
|
expect(getByTestId('author').textContent).toContain('Dr Adam Careful');
|
|
118
|
-
expect(getByTestId('periodEnd').textContent).toEqual('
|
|
118
|
+
expect(getByTestId('periodEnd').textContent).toEqual('06/01/2017');
|
|
119
119
|
expect(getByTestId('basedOn').textContent).toEqual(
|
|
120
120
|
'Management of Type 2 Diabetes',
|
|
121
121
|
);
|
|
@@ -141,7 +141,7 @@ describe('should render component correctly', () => {
|
|
|
141
141
|
'Peter James Chalmers',
|
|
142
142
|
);
|
|
143
143
|
expect(getByTestId('author').textContent).toContain('Dr Adam Careful');
|
|
144
|
-
expect(getByTestId('periodEnd').textContent).toEqual('
|
|
144
|
+
expect(getByTestId('periodEnd').textContent).toEqual('06/01/2017');
|
|
145
145
|
expect(getByTestId('basedOn').textContent).toEqual(
|
|
146
146
|
'Management of Type 2 Diabetes',
|
|
147
147
|
);
|
|
@@ -162,8 +162,8 @@ describe('should render component correctly', () => {
|
|
|
162
162
|
expect(getByTestId('intent').textContent).toEqual('plan');
|
|
163
163
|
expect(getByTestId('goals').textContent).toEqual('#goal');
|
|
164
164
|
expect(getByTestId('subject').textContent).toContain('Eve Everywoman');
|
|
165
|
-
expect(getByTestId('periodStart').textContent).toEqual('
|
|
166
|
-
expect(getByTestId('periodEnd').textContent).toEqual('10/
|
|
165
|
+
expect(getByTestId('periodStart').textContent).toEqual('01/01/2013');
|
|
166
|
+
expect(getByTestId('periodEnd').textContent).toEqual('10/01/2013');
|
|
167
167
|
});
|
|
168
168
|
|
|
169
169
|
it('should fire custom onClick function', () => {
|
|
@@ -97,7 +97,7 @@ describe('should render the CareTeam component properly', () => {
|
|
|
97
97
|
);
|
|
98
98
|
expect(getByTestId('status').textContent).toEqual('active');
|
|
99
99
|
expect(queryByTestId('periodStart')).toBeNull();
|
|
100
|
-
expect(getByTestId('periodEnd').textContent).toEqual('
|
|
100
|
+
expect(getByTestId('periodEnd').textContent).toEqual('01/01/2013');
|
|
101
101
|
expect(getByTestId('category').textContent.trim()).toEqual('(encounter)');
|
|
102
102
|
expect(getByTestId('subject').textContent).toContain(
|
|
103
103
|
'Peter James Chalmers',
|
|
@@ -126,7 +126,7 @@ describe('should render the CareTeam component properly', () => {
|
|
|
126
126
|
const periodEnds = getAllByTestId('participant.periodEnd').map(
|
|
127
127
|
n => n.textContent,
|
|
128
128
|
);
|
|
129
|
-
expect(periodEnds).toEqual(['-', '
|
|
129
|
+
expect(periodEnds).toEqual(['-', '01/01/2013']);
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
it('should render participants with STU3 source data when structure source data of Participants Role is coding array', () => {
|
|
@@ -156,7 +156,7 @@ describe('should render the CareTeam component properly', () => {
|
|
|
156
156
|
);
|
|
157
157
|
expect(getByTestId('status').textContent).toEqual('active');
|
|
158
158
|
expect(queryByTestId('periodStart')).toBeNull();
|
|
159
|
-
expect(getByTestId('periodEnd').textContent).toEqual('
|
|
159
|
+
expect(getByTestId('periodEnd').textContent).toEqual('01/01/2013');
|
|
160
160
|
expect(getByTestId('encounter').textContent).toEqual('Encounter/example');
|
|
161
161
|
expect(getByTestId('category').textContent).toContain(
|
|
162
162
|
'Encounter-focused care team',
|
|
@@ -188,7 +188,7 @@ describe('should render the CareTeam component properly', () => {
|
|
|
188
188
|
const periodEnds = getAllByTestId('participant.periodEnd').map(
|
|
189
189
|
n => n.textContent,
|
|
190
190
|
);
|
|
191
|
-
expect(periodEnds).toEqual(['-', '
|
|
191
|
+
expect(periodEnds).toEqual(['-', '01/01/2013']);
|
|
192
192
|
});
|
|
193
193
|
|
|
194
194
|
it('should fire custom onClick function', () => {
|
|
@@ -95,7 +95,7 @@ describe('should render the Claim component properly', () => {
|
|
|
95
95
|
expect(getByTestId('title').textContent).toEqual('Claim #100150');
|
|
96
96
|
expect(getByTestId('use').textContent).toEqual('complete');
|
|
97
97
|
expect(getByTestId('type').textContent).toContain('oral');
|
|
98
|
-
expect(getByTestId('created').textContent).toEqual('
|
|
98
|
+
expect(getByTestId('created').textContent).toEqual('08/16/2014');
|
|
99
99
|
expect(getByTestId('priority').textContent).toContain('normal');
|
|
100
100
|
expect(getByTestId('insurer').textContent).toEqual('Organization/2');
|
|
101
101
|
expect(getByTestId('payee.type').textContent).toContain('provider');
|
|
@@ -117,7 +117,7 @@ describe('should render the Claim component properly', () => {
|
|
|
117
117
|
expect(getByTestId('title').textContent).toEqual('Claim #100150');
|
|
118
118
|
expect(getByTestId('use').textContent).toEqual('complete');
|
|
119
119
|
expect(getByTestId('type').textContent).toContain('oral');
|
|
120
|
-
expect(getByTestId('created').textContent).toEqual('
|
|
120
|
+
expect(getByTestId('created').textContent).toEqual('08/16/2014');
|
|
121
121
|
expect(getByTestId('priority').textContent).toContain('normal');
|
|
122
122
|
expect(getByTestId('insurer').textContent).toEqual('Organization/2');
|
|
123
123
|
expect(getByTestId('payee.type').textContent).toContain('provider');
|
|
@@ -184,7 +184,7 @@ describe('should render the Claim component properly', () => {
|
|
|
184
184
|
};
|
|
185
185
|
const { getByTestId } = render(<Claim {...defaultProps} />);
|
|
186
186
|
|
|
187
|
-
expect(getByTestId('accident.date').textContent).toEqual('
|
|
187
|
+
expect(getByTestId('accident.date').textContent).toEqual('07/09/2014');
|
|
188
188
|
expect(getByTestId('accident.type').textContent).toContain(
|
|
189
189
|
'Sporting Accident',
|
|
190
190
|
);
|
|
@@ -223,7 +223,7 @@ describe('should render the Claim component properly', () => {
|
|
|
223
223
|
const { getByTestId } = render(<Claim {...defaultProps} />);
|
|
224
224
|
|
|
225
225
|
expect(getByTestId('employmentImpacted').textContent).toEqual(
|
|
226
|
-
'
|
|
226
|
+
'08/16/2014 - 08/16/2014',
|
|
227
227
|
);
|
|
228
228
|
});
|
|
229
229
|
|
|
@@ -235,7 +235,7 @@ describe('should render the Claim component properly', () => {
|
|
|
235
235
|
const { getByTestId } = render(<Claim {...defaultProps} />);
|
|
236
236
|
|
|
237
237
|
expect(getByTestId('hospitalization').textContent).toEqual(
|
|
238
|
-
'
|
|
238
|
+
'08/15/2014 - 08/16/2014',
|
|
239
239
|
);
|
|
240
240
|
});
|
|
241
241
|
|
|
@@ -323,7 +323,7 @@ describe('should render the Claim component properly', () => {
|
|
|
323
323
|
expect(getByTestId('title').textContent).toEqual('Claim #100150');
|
|
324
324
|
expect(getByTestId('use').textContent).toEqual('claim');
|
|
325
325
|
expect(getByTestId('type').textContent).toContain('oral');
|
|
326
|
-
expect(getByTestId('created').textContent).toEqual('
|
|
326
|
+
expect(getByTestId('created').textContent).toEqual('08/16/2014');
|
|
327
327
|
expect(getByTestId('priority').textContent).toContain('normal');
|
|
328
328
|
expect(getByTestId('insurer').textContent).toEqual('Organization/2');
|
|
329
329
|
expect(getByTestId('payee.type').textContent).toContain('provider');
|
|
@@ -99,7 +99,7 @@ describe('should render the ClaimResponse component properly', () => {
|
|
|
99
99
|
|
|
100
100
|
expect(getByTestId('title').textContent).toEqual('Claim response #R3500');
|
|
101
101
|
expect(getByTestId('outcome').textContent).toEqual('complete');
|
|
102
|
-
expect(getByTestId('created').textContent).toEqual('
|
|
102
|
+
expect(getByTestId('created').textContent).toEqual('08/16/2014');
|
|
103
103
|
expect(getByTestId('disposition').textContent).toEqual(
|
|
104
104
|
'Claim settled as per contract.',
|
|
105
105
|
);
|
|
@@ -116,7 +116,7 @@ describe('should render the ClaimResponse component properly', () => {
|
|
|
116
116
|
expect(
|
|
117
117
|
getByTestId('payment.amount').textContent.replace(nbspRegex, ' '),
|
|
118
118
|
).toEqual('100.47 USD');
|
|
119
|
-
expect(getByTestId('payment.date').textContent).toEqual('
|
|
119
|
+
expect(getByTestId('payment.date').textContent).toEqual('08/31/2014');
|
|
120
120
|
expect(
|
|
121
121
|
getByTestId('payment.ref').textContent.replace(nbspRegex, ' '),
|
|
122
122
|
).toEqual('Identifier: 201408-2-1569478');
|
|
@@ -152,7 +152,7 @@ describe('should render the ClaimResponse component properly', () => {
|
|
|
152
152
|
|
|
153
153
|
expect(getByTestId('title').textContent).toEqual('Claim response #R3500');
|
|
154
154
|
expect(getByTestId('outcome').textContent).toEqual('complete');
|
|
155
|
-
expect(getByTestId('created').textContent).toEqual('
|
|
155
|
+
expect(getByTestId('created').textContent).toEqual('08/16/2014');
|
|
156
156
|
expect(getByTestId('disposition').textContent).toEqual(
|
|
157
157
|
'Claim settled as per contract.',
|
|
158
158
|
);
|
|
@@ -169,7 +169,7 @@ describe('should render the ClaimResponse component properly', () => {
|
|
|
169
169
|
expect(
|
|
170
170
|
getByTestId('payment.amount').textContent.replace(nbspRegex, ' '),
|
|
171
171
|
).toEqual('100.47 USD');
|
|
172
|
-
expect(getByTestId('payment.date').textContent).toEqual('
|
|
172
|
+
expect(getByTestId('payment.date').textContent).toEqual('08/31/2014');
|
|
173
173
|
expect(
|
|
174
174
|
getByTestId('payment.ref').textContent.replace(nbspRegex, ' '),
|
|
175
175
|
).toEqual('Identifier: 201408-2-1569478');
|
|
@@ -245,7 +245,7 @@ describe('should render the ClaimResponse component properly', () => {
|
|
|
245
245
|
expect(getByTestId('title').textContent).toEqual('Claim response #R3500');
|
|
246
246
|
expect(getByTestId('status').textContent).toEqual('active');
|
|
247
247
|
expect(queryByTestId('outcome')).toBeNull();
|
|
248
|
-
expect(getByTestId('created').textContent).toEqual('
|
|
248
|
+
expect(getByTestId('created').textContent).toEqual('08/16/2014');
|
|
249
249
|
expect(getByTestId('disposition').textContent).toEqual(
|
|
250
250
|
'Claim settled as per contract.',
|
|
251
251
|
);
|
|
@@ -265,7 +265,7 @@ describe('should render the ClaimResponse component properly', () => {
|
|
|
265
265
|
expect(
|
|
266
266
|
getByTestId('payment.amount').textContent.replace(nbspRegex, ' '),
|
|
267
267
|
).toEqual('100.47 USD');
|
|
268
|
-
expect(getByTestId('payment.date').textContent).toEqual('
|
|
268
|
+
expect(getByTestId('payment.date').textContent).toEqual('08/31/2014');
|
|
269
269
|
expect(
|
|
270
270
|
getByTestId('payment.ref').textContent.replace(nbspRegex, ' '),
|
|
271
271
|
).toEqual('Identifier: 201408-2-1569478');
|
|
@@ -9,6 +9,7 @@ import Reference from '../../datatypes/Reference';
|
|
|
9
9
|
import _get from 'lodash/get';
|
|
10
10
|
import _has from 'lodash/has';
|
|
11
11
|
import fhirVersions from '../fhirResourceVersions';
|
|
12
|
+
import { getResourceDate } from '../../../utils/getResourceDate';
|
|
12
13
|
|
|
13
14
|
const commonDTO = fhirResource => {
|
|
14
15
|
const codeText =
|
|
@@ -98,7 +99,6 @@ const Condition = ({
|
|
|
98
99
|
const {
|
|
99
100
|
codeText,
|
|
100
101
|
severityText,
|
|
101
|
-
onsetDateTime,
|
|
102
102
|
hasAsserter,
|
|
103
103
|
asserter,
|
|
104
104
|
hasBodySite,
|
|
@@ -122,6 +122,28 @@ const Condition = ({
|
|
|
122
122
|
},
|
|
123
123
|
];
|
|
124
124
|
|
|
125
|
+
const conditionStartDatesPaths = [
|
|
126
|
+
'meta.lastUpdated',
|
|
127
|
+
'onsetPeriod.start',
|
|
128
|
+
'onsetDateTime',
|
|
129
|
+
'recordedDate',
|
|
130
|
+
'dateRecorded',
|
|
131
|
+
'assertedDate',
|
|
132
|
+
];
|
|
133
|
+
|
|
134
|
+
const conditionEndDatesPaths = [
|
|
135
|
+
'meta.lastUpdated',
|
|
136
|
+
'abatementPeriod.end',
|
|
137
|
+
'abatementDateTime',
|
|
138
|
+
];
|
|
139
|
+
|
|
140
|
+
const headerStartDate = getResourceDate(
|
|
141
|
+
fhirResource,
|
|
142
|
+
conditionStartDatesPaths,
|
|
143
|
+
);
|
|
144
|
+
const headerEndDate =
|
|
145
|
+
getResourceDate(fhirResource, conditionEndDatesPaths) || dateRecorded;
|
|
146
|
+
|
|
125
147
|
return (
|
|
126
148
|
<Root name="condition">
|
|
127
149
|
<Accordion
|
|
@@ -131,10 +153,10 @@ const Condition = ({
|
|
|
131
153
|
additionalContent={
|
|
132
154
|
<DatePeriod
|
|
133
155
|
periodBeginLabel="Onset Date"
|
|
134
|
-
periodBeginDate={
|
|
156
|
+
periodBeginDate={headerStartDate}
|
|
135
157
|
periodBeginTestId="onsetDate"
|
|
136
158
|
periodEndLabel="Date recorded"
|
|
137
|
-
periodEndDate={
|
|
159
|
+
periodEndDate={headerEndDate}
|
|
138
160
|
periodEndTestId="dateRecorded"
|
|
139
161
|
/>
|
|
140
162
|
}
|
|
@@ -107,7 +107,7 @@ describe('should render component correctly', () => {
|
|
|
107
107
|
|
|
108
108
|
expect(getByTestId('clinicalStatus').textContent).toEqual('active');
|
|
109
109
|
expect(getByTestId('severity').textContent).toEqual('Medium severity');
|
|
110
|
-
expect(getByTestId('onsetDate').textContent).toEqual('
|
|
110
|
+
expect(getByTestId('onsetDate').textContent).toEqual('12/02/2019');
|
|
111
111
|
expect(getByTestId('asserter').textContent).toEqual('MOORE, NICK');
|
|
112
112
|
});
|
|
113
113
|
|
|
@@ -137,7 +137,7 @@ describe('should render component correctly', () => {
|
|
|
137
137
|
expect(getByTestId('severity').textContent).toEqual(
|
|
138
138
|
'Moderate to severe severity',
|
|
139
139
|
);
|
|
140
|
-
expect(getByTestId('onsetDate').textContent).toEqual('
|
|
140
|
+
expect(getByTestId('onsetDate').textContent).toEqual('03/08/2013');
|
|
141
141
|
expect(getByTestId('asserter').textContent).toEqual('Practitioner/f201');
|
|
142
142
|
});
|
|
143
143
|
|
|
@@ -153,7 +153,7 @@ describe('should render component correctly', () => {
|
|
|
153
153
|
|
|
154
154
|
expect(getByTestId('clinicalStatus').textContent).toEqual('active');
|
|
155
155
|
expect(getByTestId('severity').textContent).toEqual('Severe severity');
|
|
156
|
-
expect(getByTestId('onsetDate').textContent).toEqual('
|
|
156
|
+
expect(getByTestId('onsetDate').textContent).toEqual('05/24/2012');
|
|
157
157
|
expect(queryAllByTestId('asserter').length).toEqual(0);
|
|
158
158
|
expect(queryAllByTestId('dateRecorded').length).toEqual(0);
|
|
159
159
|
});
|
|
@@ -185,9 +185,9 @@ describe('should render component correctly', () => {
|
|
|
185
185
|
|
|
186
186
|
expect(getByTestId('clinicalStatus').textContent).toEqual('resolved');
|
|
187
187
|
expect(getByTestId('severity').textContent).toEqual('Mild severity');
|
|
188
|
-
expect(getByTestId('onsetDate').textContent).toEqual('
|
|
188
|
+
expect(getByTestId('onsetDate').textContent).toEqual('04/02/2013');
|
|
189
189
|
expect(getByTestId('asserter').textContent).toEqual('Practitioner/f201');
|
|
190
|
-
expect(getByTestId('dateRecorded').textContent).toEqual('
|
|
190
|
+
expect(getByTestId('dateRecorded').textContent).toEqual('04/04/2013');
|
|
191
191
|
});
|
|
192
192
|
|
|
193
193
|
it('should fire custom onClick function', () => {
|
|
@@ -90,10 +90,12 @@ describe('should render component correctly', () => {
|
|
|
90
90
|
expect(getByTestId('title').textContent).toContain(
|
|
91
91
|
'blood count (hemogram)',
|
|
92
92
|
);
|
|
93
|
-
expect(getByTestId('effectiveDateTime').textContent).toContain(
|
|
93
|
+
expect(getByTestId('effectiveDateTime').textContent).toContain(
|
|
94
|
+
'04/02/2013',
|
|
95
|
+
);
|
|
94
96
|
|
|
95
97
|
expect(getByTestId('categoryCoding').textContent).toContain('Haematology');
|
|
96
|
-
expect(getByTestId('issued').textContent).toContain('
|
|
98
|
+
expect(getByTestId('issued').textContent).toContain('05/15/2013');
|
|
97
99
|
expect(getByTestId('performer').textContent).toContain(
|
|
98
100
|
'University Medical ',
|
|
99
101
|
);
|
|
@@ -126,7 +126,9 @@ const r4DTO = fhirResource => {
|
|
|
126
126
|
*/
|
|
127
127
|
const prepareServiceItem = services =>
|
|
128
128
|
services.map(serviceItem => {
|
|
129
|
-
const coding =
|
|
129
|
+
const coding =
|
|
130
|
+
_get(serviceItem, 'revenue.coding.0') ||
|
|
131
|
+
_get(serviceItem, 'productOrService.coding.0');
|
|
130
132
|
const servicedDate = _get(serviceItem, 'servicedDate');
|
|
131
133
|
const servicedPeriod = _get(serviceItem, 'servicedPeriod');
|
|
132
134
|
const quantity = _get(serviceItem, 'quantity.value');
|
|
@@ -95,7 +95,7 @@ describe('should render ExplanationOfBenefit component properly', () => {
|
|
|
95
95
|
expect(container).not.toBeNull();
|
|
96
96
|
|
|
97
97
|
expect(getByTestId('title').textContent).toContain('Claim settled as ');
|
|
98
|
-
expect(getByTestId('created').textContent).toContain('
|
|
98
|
+
expect(getByTestId('created').textContent).toContain('08/16/2014');
|
|
99
99
|
expect(getByTestId('insurer').textContent).toContain('Organization/2');
|
|
100
100
|
});
|
|
101
101
|
|
|
@@ -111,7 +111,7 @@ describe('should render ExplanationOfBenefit component properly', () => {
|
|
|
111
111
|
expect(container).not.toBeNull();
|
|
112
112
|
|
|
113
113
|
expect(getByTestId('title').textContent).toContain('Claim settled as ');
|
|
114
|
-
expect(getByTestId('created').textContent).toContain('
|
|
114
|
+
expect(getByTestId('created').textContent).toContain('08/16/2014');
|
|
115
115
|
expect(getByTestId('metricAmount').textContent).toContain('$135.57');
|
|
116
116
|
expect(
|
|
117
117
|
getByTestId('planDiscount').textContent.replace(nbspRegex, ' '),
|
|
@@ -153,7 +153,7 @@ describe('should render ExplanationOfBenefit component properly', () => {
|
|
|
153
153
|
expect(getByTestId('title').textContent).toEqual(
|
|
154
154
|
'Claim settled as per contract.',
|
|
155
155
|
);
|
|
156
|
-
expect(getByTestId('created').textContent).toEqual('
|
|
156
|
+
expect(getByTestId('created').textContent).toEqual('08/16/2014');
|
|
157
157
|
expect(getByTestId('insurer').textContent).toEqual('Organization/3');
|
|
158
158
|
expect(getByTestId('provider').textContent).toEqual('Practitioner/1');
|
|
159
159
|
expect(getByTestId('totalSum').textContent).toContain('135.57');
|
|
@@ -184,7 +184,7 @@ describe('should render ExplanationOfBenefit component properly', () => {
|
|
|
184
184
|
const explanationServicedDate = getAllByTestId(
|
|
185
185
|
'explanation.servicedDate',
|
|
186
186
|
).map(n => n.textContent);
|
|
187
|
-
expect(explanationServicedDate).toEqual(['
|
|
187
|
+
expect(explanationServicedDate).toEqual(['08/16/2014', '08/16/2014']);
|
|
188
188
|
|
|
189
189
|
const explanationQuantity = getAllByTestId('explanation.quantity').map(
|
|
190
190
|
n => n.textContent,
|
|
@@ -244,7 +244,7 @@ describe('should render ExplanationOfBenefit component properly', () => {
|
|
|
244
244
|
} = render(<ExplanationOfBenefit {...defaultProps} />);
|
|
245
245
|
expect(container).not.toBeNull();
|
|
246
246
|
|
|
247
|
-
expect(getByTestId('created').textContent).toEqual('
|
|
247
|
+
expect(getByTestId('created').textContent).toEqual('01/05/2017');
|
|
248
248
|
expect(getByTestId('identifier').textContent).toContain(
|
|
249
249
|
'c145d3fe-d56e-dc26-75e9-01e90672f506',
|
|
250
250
|
);
|
|
@@ -259,7 +259,7 @@ describe('should render ExplanationOfBenefit component properly', () => {
|
|
|
259
259
|
'Organization/iAxXvHiphwGGAL48m3B7XXtKlLZg6yXnC1ch84x1up',
|
|
260
260
|
);
|
|
261
261
|
expect(getByTestId('billablePeriod').textContent).toEqual(
|
|
262
|
-
'From:
|
|
262
|
+
'From: 01/05/2017; To: 01/05/2018',
|
|
263
263
|
);
|
|
264
264
|
expect(getByTestId('patient').textContent).toEqual(
|
|
265
265
|
'Patient/f56391c2-dd54-b378-46ef-87c1643a2ba0',
|
|
@@ -276,7 +276,7 @@ describe('should render ExplanationOfBenefit component properly', () => {
|
|
|
276
276
|
'clmrecvddate',
|
|
277
277
|
);
|
|
278
278
|
expect(getByTestId('supportingInfo.0.timingDate').textContent).toEqual(
|
|
279
|
-
'
|
|
279
|
+
'01/05/2017',
|
|
280
280
|
);
|
|
281
281
|
expect(getByTestId('supportingInfo.1.category').textContent).toContain(
|
|
282
282
|
'dayssupply',
|
|
@@ -139,7 +139,7 @@ describe('should render Goal component properly', () => {
|
|
|
139
139
|
'Peter James Chalmers',
|
|
140
140
|
);
|
|
141
141
|
|
|
142
|
-
expect(getByTestId('statusDate').textContent).toEqual('
|
|
142
|
+
expect(getByTestId('statusDate').textContent).toEqual('02/14/2016');
|
|
143
143
|
|
|
144
144
|
expect(getByTestId('description').textContent).toEqual(
|
|
145
145
|
'Target weight is 160 to 180 lbs.',
|
|
@@ -169,7 +169,7 @@ describe('should render Goal component properly', () => {
|
|
|
169
169
|
|
|
170
170
|
expect(getByTestId('status').textContent).toEqual('completed');
|
|
171
171
|
|
|
172
|
-
expect(getByTestId('headerStartDate').textContent).toEqual('
|
|
172
|
+
expect(getByTestId('headerStartDate').textContent).toEqual('04/05/2015');
|
|
173
173
|
|
|
174
174
|
expect(getByTestId('subject').textContent).toContain(
|
|
175
175
|
'Peter James Chalmers',
|
|
@@ -11,6 +11,7 @@ import _get from 'lodash/get';
|
|
|
11
11
|
import _has from 'lodash/has';
|
|
12
12
|
import fhirVersions from '../fhirResourceVersions';
|
|
13
13
|
import { Value } from '../../ui';
|
|
14
|
+
import { getResourceDate } from '../../../utils/getResourceDate';
|
|
14
15
|
|
|
15
16
|
const commonDTO = fhirResource => {
|
|
16
17
|
const title =
|
|
@@ -228,6 +229,11 @@ const Immunization = ({
|
|
|
228
229
|
},
|
|
229
230
|
];
|
|
230
231
|
|
|
232
|
+
const immunizationDatesPaths = ['occurrenceDateTime'];
|
|
233
|
+
|
|
234
|
+
const headerDate =
|
|
235
|
+
getResourceDate(fhirResource, immunizationDatesPaths) || providedDate;
|
|
236
|
+
|
|
231
237
|
return (
|
|
232
238
|
<Root name="Immunization">
|
|
233
239
|
<Accordion
|
|
@@ -235,9 +241,9 @@ const Immunization = ({
|
|
|
235
241
|
<Header
|
|
236
242
|
resourceName="Immunization"
|
|
237
243
|
additionalContent={
|
|
238
|
-
|
|
244
|
+
headerDate && (
|
|
239
245
|
<Value label="Start date" data-testid="headerStartDate">
|
|
240
|
-
<Date fhirData={
|
|
246
|
+
<Date fhirData={headerDate} isBlack />
|
|
241
247
|
</Value>
|
|
242
248
|
)
|
|
243
249
|
}
|