fhir-react 0.3.10 → 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/.storybook/preview.js +49 -0
- package/README.md +17 -1
- package/build/index.js +9 -9
- package/build/style.css +1 -1
- package/package.json +1 -1
- package/src/components/containers/Accordion/Accordion.js +13 -8
- 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.js +2 -0
- package/src/components/resources/AdverseEvent/AdverseEvent.test.js +2 -2
- package/src/components/resources/AllergyIntolerance/AllergyIntolerance.js +21 -2
- package/src/components/resources/AllergyIntolerance/AllergyIntolerance.test.js +8 -4
- package/src/components/resources/Appointment/Appointment.js +2 -0
- package/src/components/resources/Binary/Binary.js +2 -1
- package/src/components/resources/CarePlan/CarePlan.js +3 -0
- package/src/components/resources/CarePlan/CarePlan.test.js +4 -4
- package/src/components/resources/CareTeam/CareTeam.js +2 -0
- package/src/components/resources/CareTeam/CareTeam.test.js +4 -4
- package/src/components/resources/Claim/Claim.js +3 -0
- package/src/components/resources/Claim/Claim.stories.js +1 -1
- package/src/components/resources/Claim/Claim.test.js +6 -6
- package/src/components/resources/ClaimResponse/ClaimResponse.js +2 -0
- package/src/components/resources/ClaimResponse/ClaimResponse.stories.js +1 -1
- package/src/components/resources/ClaimResponse/ClaimResponse.test.js +6 -6
- package/src/components/resources/Condition/Condition.js +27 -3
- package/src/components/resources/Condition/Condition.test.js +5 -5
- package/src/components/resources/Coverage/Coverage.js +3 -0
- package/src/components/resources/Device/Device.js +3 -0
- package/src/components/resources/DiagnosticReport/DiagnosticReport.js +2 -0
- package/src/components/resources/DiagnosticReport/DiagnosticReport.test.js +4 -2
- package/src/components/resources/DocumentReference/DocumentReference.js +2 -0
- package/src/components/resources/Encounter/Encounter.js +2 -0
- package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +21 -4
- package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.test.js +7 -7
- package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.stories.js +1 -1
- package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.js +2 -0
- package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.stories.js +1 -1
- package/src/components/resources/Generic/Generic.js +8 -1
- package/src/components/resources/Goal/Goal.js +2 -0
- package/src/components/resources/Goal/Goal.test.js +2 -2
- package/src/components/resources/Immunization/Immunization.js +10 -2
- package/src/components/resources/List/List.js +2 -0
- package/src/components/resources/Location/Location.js +8 -1
- package/src/components/resources/Medication/Medication.js +2 -0
- package/src/components/resources/MedicationAdministration/MedicationAdministration.js +4 -2
- package/src/components/resources/MedicationAdministration/MedicationAdministration.test.js +7 -7
- package/src/components/resources/MedicationDispense/MedicationDispense.js +2 -0
- package/src/components/resources/MedicationDispense/MedicationDispense.test.js +2 -2
- package/src/components/resources/MedicationKnowledge/MedicationKnowledge.js +2 -0
- package/src/components/resources/MedicationOrder/MedicationOrder.js +8 -1
- package/src/components/resources/MedicationRequest/MedicationRequest.js +2 -0
- package/src/components/resources/MedicationRequest/MedicationRequest.test.js +4 -4
- package/src/components/resources/MedicationStatement/MedicationStatement.js +2 -0
- package/src/components/resources/Observation/Observation.js +23 -4
- package/src/components/resources/Observation/Observation.test.js +1 -1
- package/src/components/resources/Organization/Organization.js +2 -0
- package/src/components/resources/Patient/Patient.js +3 -1
- package/src/components/resources/Patient/Patient.test.js +6 -6
- package/src/components/resources/Practitioner/Practitioner.js +4 -0
- package/src/components/resources/PractitionerRole/PractitionerRole.js +2 -0
- package/src/components/resources/PractitionerRole/PractitionerRole.stories.js +1 -1
- package/src/components/resources/Procedure/Procedure.js +8 -1
- package/src/components/resources/Procedure/Procedure.test.js +1 -1
- package/src/components/resources/Questionnaire/Questionnaire.js +2 -0
- package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.js +2 -0
- package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.test.js +4 -4
- package/src/components/resources/ReferralRequest/ReferralRequest.js +2 -0
- package/src/components/resources/RelatedPerson/RelatedPerson.js +2 -0
- package/src/components/resources/RelatedPerson/RelatedPerson.stories.js +1 -1
- package/src/components/resources/ResearchStudy/ResearchStudy.js +2 -0
- package/src/components/resources/ResearchStudy/ResearchStudy.test.js +1 -1
- package/src/components/supportedFhirResourceList.js +2 -0
- 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
|
@@ -6,12 +6,16 @@ const CHEVRON_DOWN_COLOR = '#6f83a9';
|
|
|
6
6
|
const CHEVRON_UP_COLOR = '#2a6fd7';
|
|
7
7
|
|
|
8
8
|
const Accordion = props => {
|
|
9
|
-
const { headerContent, bodyContent, onClick, rawOnClick } = props;
|
|
9
|
+
const { headerContent, bodyContent, onClick, rawOnClick, customId } = props;
|
|
10
10
|
const [rotate, setRotate] = useState(false);
|
|
11
11
|
const handleAccordionClick = () => setRotate(!rotate);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
|
|
13
|
+
const accordionIdText = `accordion-type-${headerContent.props.resourceName ||
|
|
14
|
+
'default'}-`;
|
|
15
|
+
const accordionId =
|
|
16
|
+
typeof customId === 'number'
|
|
17
|
+
? `${accordionIdText}${customId}`
|
|
18
|
+
: uniqueId(accordionIdText);
|
|
15
19
|
|
|
16
20
|
const isAccordionOpenable = () => {
|
|
17
21
|
if (bodyContent) {
|
|
@@ -64,7 +68,6 @@ const Accordion = props => {
|
|
|
64
68
|
|
|
65
69
|
return (
|
|
66
70
|
<div className="fhir-container__Accordion accordion">
|
|
67
|
-
{typeof rawOnClick === 'function' && !isRawInAccordion && rawButton}
|
|
68
71
|
<div className="fhir-container__Accordion__body accordion-body">
|
|
69
72
|
<div className="fhir-container__Accordion__body-data accordion-item border-1 shadow-sm">
|
|
70
73
|
<div
|
|
@@ -72,9 +75,7 @@ const Accordion = props => {
|
|
|
72
75
|
id="flush-headingOne"
|
|
73
76
|
>
|
|
74
77
|
<button
|
|
75
|
-
className={`fhir-container__Accordion__header-button w-100 p-0 border-0 rounded-1 collapsed text-dark bg-white shadow-none point
|
|
76
|
-
isAccordionOpenable() ? '' : 'pe-none'
|
|
77
|
-
}`}
|
|
78
|
+
className={`fhir-container__Accordion__header-button w-100 p-0 border-0 rounded-1 collapsed text-dark bg-white shadow-none point`}
|
|
78
79
|
type="button"
|
|
79
80
|
data-bs-target={`#${accordionId}`}
|
|
80
81
|
data-bs-toggle={
|
|
@@ -91,6 +92,10 @@ const Accordion = props => {
|
|
|
91
92
|
<div className="fhir-container__Accordion__header-text d-flex w-100 justify-content-start position-relative">
|
|
92
93
|
{React.cloneElement(headerContent, {
|
|
93
94
|
isAccordionOpenable: isAccordionOpenable(),
|
|
95
|
+
rawButton:
|
|
96
|
+
typeof rawOnClick === 'function' &&
|
|
97
|
+
!isRawInAccordion &&
|
|
98
|
+
rawButton,
|
|
94
99
|
})}
|
|
95
100
|
{typeof onClick !== 'function' && getChevron()}
|
|
96
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>
|
|
@@ -77,6 +77,7 @@ const AdverseEvent = ({
|
|
|
77
77
|
fhirIcons,
|
|
78
78
|
onClick,
|
|
79
79
|
rawOnClick,
|
|
80
|
+
customId,
|
|
80
81
|
}) => {
|
|
81
82
|
let fhirResourceData = {};
|
|
82
83
|
try {
|
|
@@ -172,6 +173,7 @@ const AdverseEvent = ({
|
|
|
172
173
|
}
|
|
173
174
|
onClick={onClick}
|
|
174
175
|
rawOnClick={rawOnClick}
|
|
176
|
+
customId={customId}
|
|
175
177
|
/>
|
|
176
178
|
</Root>
|
|
177
179
|
);
|
|
@@ -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');
|
|
@@ -51,6 +52,7 @@ const dstu2DTO = fhirResource => {
|
|
|
51
52
|
asserter,
|
|
52
53
|
};
|
|
53
54
|
};
|
|
55
|
+
|
|
54
56
|
const stu3DTO = fhirResource => {
|
|
55
57
|
const title = _get(fhirResource, 'code.coding.0.display');
|
|
56
58
|
const status = _get(fhirResource, 'verificationStatus');
|
|
@@ -73,6 +75,7 @@ const stu3DTO = fhirResource => {
|
|
|
73
75
|
hasNote,
|
|
74
76
|
};
|
|
75
77
|
};
|
|
78
|
+
|
|
76
79
|
const r4DTO = fhirResource => {
|
|
77
80
|
const title = _get(fhirResource, 'code.coding.0.display');
|
|
78
81
|
const status = _get(fhirResource, 'verificationStatus.coding[0].display');
|
|
@@ -129,6 +132,7 @@ const AllergyIntolerance = ({
|
|
|
129
132
|
fhirIcons,
|
|
130
133
|
onClick,
|
|
131
134
|
rawOnClick,
|
|
135
|
+
customId,
|
|
132
136
|
}) => {
|
|
133
137
|
let fhirResourceData = {};
|
|
134
138
|
try {
|
|
@@ -218,6 +222,19 @@ const AllergyIntolerance = ({
|
|
|
218
222
|
},
|
|
219
223
|
];
|
|
220
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
|
+
|
|
221
238
|
return (
|
|
222
239
|
<Root name="AllergyIntolerance">
|
|
223
240
|
<Accordion
|
|
@@ -228,9 +245,10 @@ const AllergyIntolerance = ({
|
|
|
228
245
|
title={title}
|
|
229
246
|
icon={fhirIcons}
|
|
230
247
|
rightAdditionalContent={
|
|
231
|
-
|
|
248
|
+
headerDate && (
|
|
232
249
|
<BadgeSecondary data-testid="recordedDate">
|
|
233
|
-
recorded on
|
|
250
|
+
recorded on
|
|
251
|
+
<Date fhirData={headerDate} />
|
|
234
252
|
</BadgeSecondary>
|
|
235
253
|
)
|
|
236
254
|
}
|
|
@@ -239,6 +257,7 @@ const AllergyIntolerance = ({
|
|
|
239
257
|
bodyContent={<Body tableData={tableData} />}
|
|
240
258
|
onClick={onClick}
|
|
241
259
|
rawOnClick={rawOnClick}
|
|
260
|
+
customId={customId}
|
|
242
261
|
/>
|
|
243
262
|
</Root>
|
|
244
263
|
);
|
|
@@ -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
|
|
|
@@ -150,6 +150,7 @@ const Appointment = ({
|
|
|
150
150
|
fhirIcons,
|
|
151
151
|
onClick,
|
|
152
152
|
rawOnClick,
|
|
153
|
+
customId,
|
|
153
154
|
}) => {
|
|
154
155
|
const {
|
|
155
156
|
description,
|
|
@@ -261,6 +262,7 @@ const Appointment = ({
|
|
|
261
262
|
}
|
|
262
263
|
onClick={onClick}
|
|
263
264
|
rawOnClick={rawOnClick}
|
|
265
|
+
customId={customId}
|
|
264
266
|
/>
|
|
265
267
|
</Root>
|
|
266
268
|
);
|
|
@@ -6,7 +6,7 @@ import Accordion from '../../containers/Accordion/Accordion';
|
|
|
6
6
|
import { Body, Header } from '../../ui';
|
|
7
7
|
|
|
8
8
|
const Binary = props => {
|
|
9
|
-
const { fhirResource, fhirIcons, rawOnClick } = props;
|
|
9
|
+
const { fhirResource, fhirIcons, rawOnClick, customId } = props;
|
|
10
10
|
|
|
11
11
|
const loadBinaryFile = () => {
|
|
12
12
|
switch (fhirResource.contentType) {
|
|
@@ -38,6 +38,7 @@ const Binary = props => {
|
|
|
38
38
|
}
|
|
39
39
|
bodyContent={<Body>{loadBinaryFile()}</Body>}
|
|
40
40
|
rawOnClick={rawOnClick}
|
|
41
|
+
customId={customId}
|
|
41
42
|
/>
|
|
42
43
|
</div>
|
|
43
44
|
);
|
|
@@ -75,6 +75,7 @@ const dstu2DTO = fhirResource => {
|
|
|
75
75
|
hasActivity,
|
|
76
76
|
};
|
|
77
77
|
};
|
|
78
|
+
|
|
78
79
|
const stu3DTO = fhirResource => {
|
|
79
80
|
let activity = _get(fhirResource, 'activity');
|
|
80
81
|
const hasActivity = Array.isArray(activity);
|
|
@@ -168,6 +169,7 @@ const CarePlan = ({
|
|
|
168
169
|
fhirIcons,
|
|
169
170
|
onClick,
|
|
170
171
|
rawOnClick,
|
|
172
|
+
customId,
|
|
171
173
|
}) => {
|
|
172
174
|
let fhirResourceData = {};
|
|
173
175
|
try {
|
|
@@ -312,6 +314,7 @@ const CarePlan = ({
|
|
|
312
314
|
}
|
|
313
315
|
onClick={onClick}
|
|
314
316
|
rawOnClick={rawOnClick}
|
|
317
|
+
customId={customId}
|
|
315
318
|
/>
|
|
316
319
|
</Root>
|
|
317
320
|
);
|
|
@@ -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', () => {
|
|
@@ -89,6 +89,7 @@ const CareTeam = ({
|
|
|
89
89
|
fhirIcons,
|
|
90
90
|
onClick,
|
|
91
91
|
rawOnClick,
|
|
92
|
+
customId,
|
|
92
93
|
}) => {
|
|
93
94
|
const {
|
|
94
95
|
name,
|
|
@@ -174,6 +175,7 @@ const CareTeam = ({
|
|
|
174
175
|
}
|
|
175
176
|
onClick={onClick}
|
|
176
177
|
rawOnClick={rawOnClick}
|
|
178
|
+
customId={customId}
|
|
177
179
|
/>
|
|
178
180
|
</Root>
|
|
179
181
|
);
|
|
@@ -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', () => {
|
|
@@ -105,6 +105,7 @@ const dstu2DTO = fhirResource => {
|
|
|
105
105
|
items,
|
|
106
106
|
};
|
|
107
107
|
};
|
|
108
|
+
|
|
108
109
|
const stu3DTO = fhirResource => {
|
|
109
110
|
const status = _get(fhirResource, 'status');
|
|
110
111
|
const typeCoding = _get(fhirResource, 'type.coding[0]');
|
|
@@ -304,6 +305,7 @@ const Claim = ({
|
|
|
304
305
|
fhirIcons,
|
|
305
306
|
onClick,
|
|
306
307
|
rawOnClick,
|
|
308
|
+
customId,
|
|
307
309
|
}) => {
|
|
308
310
|
let fhirResourceData = {};
|
|
309
311
|
try {
|
|
@@ -489,6 +491,7 @@ const Claim = ({
|
|
|
489
491
|
}
|
|
490
492
|
onClick={onClick}
|
|
491
493
|
rawOnClick={rawOnClick}
|
|
494
|
+
customId={customId}
|
|
492
495
|
/>
|
|
493
496
|
</Root>
|
|
494
497
|
);
|
|
@@ -15,7 +15,7 @@ import ClaimIcon from '../../../assets/containers/Claim/claim.svg';
|
|
|
15
15
|
import fhirIcons from '../../../fixtures/example-icons';
|
|
16
16
|
|
|
17
17
|
export default {
|
|
18
|
-
title: 'Claim',
|
|
18
|
+
title: 'ExplanationOfBenefit/Claim',
|
|
19
19
|
component: Claim,
|
|
20
20
|
argTypes: {
|
|
21
21
|
...defaultArgTypes,
|
|
@@ -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');
|
|
@@ -291,6 +291,7 @@ const ClaimResponse = ({
|
|
|
291
291
|
fhirIcons,
|
|
292
292
|
onClick,
|
|
293
293
|
rawOnClick,
|
|
294
|
+
customId,
|
|
294
295
|
}) => {
|
|
295
296
|
let fhirResourceData = {};
|
|
296
297
|
try {
|
|
@@ -456,6 +457,7 @@ const ClaimResponse = ({
|
|
|
456
457
|
}
|
|
457
458
|
onClick={onClick}
|
|
458
459
|
rawOnClick={rawOnClick}
|
|
460
|
+
customId={customId}
|
|
459
461
|
/>
|
|
460
462
|
</Root>
|
|
461
463
|
);
|
|
@@ -14,7 +14,7 @@ import fhirIcons from '../../../fixtures/example-icons';
|
|
|
14
14
|
import ClaimResponseIcon from '../../../assets/containers/ClaimResponse/claim-response.svg';
|
|
15
15
|
|
|
16
16
|
export default {
|
|
17
|
-
title: 'ClaimResponse',
|
|
17
|
+
title: 'ExplanationOfBenefit/ClaimResponse',
|
|
18
18
|
component: ClaimResponse,
|
|
19
19
|
argTypes: {
|
|
20
20
|
...defaultArgTypes,
|
|
@@ -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 =
|
|
@@ -93,11 +94,11 @@ const Condition = ({
|
|
|
93
94
|
fhirIcons,
|
|
94
95
|
onClick,
|
|
95
96
|
rawOnClick,
|
|
97
|
+
customId,
|
|
96
98
|
}) => {
|
|
97
99
|
const {
|
|
98
100
|
codeText,
|
|
99
101
|
severityText,
|
|
100
|
-
onsetDateTime,
|
|
101
102
|
hasAsserter,
|
|
102
103
|
asserter,
|
|
103
104
|
hasBodySite,
|
|
@@ -121,6 +122,28 @@ const Condition = ({
|
|
|
121
122
|
},
|
|
122
123
|
];
|
|
123
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
|
+
|
|
124
147
|
return (
|
|
125
148
|
<Root name="condition">
|
|
126
149
|
<Accordion
|
|
@@ -130,10 +153,10 @@ const Condition = ({
|
|
|
130
153
|
additionalContent={
|
|
131
154
|
<DatePeriod
|
|
132
155
|
periodBeginLabel="Onset Date"
|
|
133
|
-
periodBeginDate={
|
|
156
|
+
periodBeginDate={headerStartDate}
|
|
134
157
|
periodBeginTestId="onsetDate"
|
|
135
158
|
periodEndLabel="Date recorded"
|
|
136
|
-
periodEndDate={
|
|
159
|
+
periodEndDate={headerEndDate}
|
|
137
160
|
periodEndTestId="dateRecorded"
|
|
138
161
|
/>
|
|
139
162
|
}
|
|
@@ -164,6 +187,7 @@ const Condition = ({
|
|
|
164
187
|
bodyContent={<Body tableData={tableData} />}
|
|
165
188
|
onClick={onClick}
|
|
166
189
|
rawOnClick={rawOnClick}
|
|
190
|
+
customId={customId}
|
|
167
191
|
/>
|
|
168
192
|
</Root>
|
|
169
193
|
);
|