fhir-react 0.3.6 → 0.3.9
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/.circleci/config.yml +1 -1
- package/.eslintrc +10 -1
- package/.stylelintrc +6 -2
- package/README.md +19 -1
- package/build/index.js +15 -11
- package/build/style.css +11 -10
- package/package.json +55 -54
- package/src/assets/containers/AdverseEvent/adverse-event.svg +6 -0
- package/src/assets/containers/Coverage/coverage.svg +4 -0
- package/src/assets/containers/Generic/generic.svg +3 -0
- package/src/assets/containers/Medication/medication.svg +5 -0
- package/src/assets/containers/MedicationDispense/medication-dispense.svg +5 -0
- package/src/assets/containers/Organization/organization.svg +5 -0
- package/src/assets/containers/PractitionerRole/practitioner-role.svg +5 -0
- package/src/assets/containers/ReferralRequest/referral-request.svg +8 -0
- package/src/assets/containers/RelatedPerson/related-person.svg +6 -0
- package/src/components/containers/Accordion/Accordion.js +44 -13
- package/src/components/containers/ResourceContainer/ResourceContainer.css +4 -0
- package/src/components/containers/ResourceContainer/ResourceContainer.js +28 -37
- package/src/components/containers/ResourceContainer/ResourceContainer.stories.js +23 -1
- package/src/components/datatypes/Attachment/Attachment.css +5 -0
- package/src/components/datatypes/Attachment/Attachment.js +7 -2
- package/src/components/datatypes/CodeableConcept/CodeableConcept.js +6 -3
- package/src/components/datatypes/Coding/Coding.js +7 -3
- package/src/components/datatypes/Identifier/Identifier.js +7 -3
- package/src/components/datatypes/Reference/Reference.js +7 -1
- package/src/components/datatypes/Telecom/Telecom.js +2 -3
- package/src/components/resources/AdverseEvent/AdverseEvent.js +88 -42
- package/src/components/resources/AdverseEvent/AdverseEvent.stories.js +12 -2
- package/src/components/resources/AdverseEvent/AdverseEvent.test.js +109 -2
- package/src/components/resources/AllergyIntolerance/AllergyIntolerance.js +9 -1
- package/src/components/resources/AllergyIntolerance/AllergyIntolerance.test.js +36 -1
- package/src/components/resources/Appointment/Appointment.js +9 -1
- package/src/components/resources/Appointment/Appointment.test.js +36 -1
- package/src/components/resources/Binary/Binary.js +2 -1
- package/src/components/resources/Bundle/Bundle.css +7 -0
- package/src/components/resources/Bundle/Bundle.js +15 -11
- package/src/components/resources/Bundle/Bundle.stories.js +12 -78
- package/src/components/resources/Bundle/Bundle.test.js +0 -3
- package/src/components/resources/CarePlan/CarePlan.js +9 -1
- package/src/components/resources/CarePlan/CarePlan.test.js +42 -6
- package/src/components/resources/CareTeam/CareTeam.js +79 -50
- package/src/components/resources/CareTeam/CareTeam.stories.js +20 -3
- package/src/components/resources/CareTeam/CareTeam.test.js +109 -1
- package/src/components/resources/CareTeam/CareTeamParticipants.js +1 -1
- package/src/components/resources/Claim/CareTeam.js +55 -0
- package/src/components/resources/Claim/Claim.css +2 -11
- package/src/components/resources/Claim/Claim.js +165 -309
- package/src/components/resources/Claim/Claim.stories.js +37 -5
- package/src/components/resources/Claim/Claim.test.js +104 -1
- package/src/components/resources/Claim/Diagnosis.js +61 -0
- package/src/components/resources/Claim/Insurance.js +58 -0
- package/src/components/resources/Claim/Item.js +79 -0
- package/src/components/resources/Claim/Items.js +29 -0
- package/src/components/resources/ClaimResponse/AddedItem.js +61 -11
- package/src/components/resources/ClaimResponse/AddedItems.js +5 -9
- package/src/components/resources/ClaimResponse/ClaimResponse.js +144 -83
- package/src/components/resources/ClaimResponse/ClaimResponse.stories.js +15 -2
- package/src/components/resources/ClaimResponse/ClaimResponse.test.js +112 -1
- package/src/components/resources/ClaimResponse/Item.js +44 -9
- package/src/components/resources/ClaimResponse/Items.js +5 -4
- package/src/components/resources/Condition/Condition.js +10 -3
- package/src/components/resources/Condition/Condition.test.js +37 -4
- package/src/components/resources/Coverage/Coverage.js +104 -69
- package/src/components/resources/Coverage/Coverage.stories.js +31 -5
- package/src/components/resources/Coverage/Coverage.test.js +111 -4
- package/src/components/resources/Device/Device.js +9 -1
- package/src/components/resources/Device/Device.test.js +36 -1
- package/src/components/resources/DiagnosticReport/DiagnosticReport.js +9 -2
- package/src/components/resources/DiagnosticReport/DiagnosticReport.test.js +36 -1
- package/src/components/resources/DocumentReference/DocumentReference.js +9 -2
- package/src/components/resources/DocumentReference/DocumentReference.test.js +42 -1
- package/src/components/resources/Encounter/Encounter.js +9 -1
- package/src/components/resources/Encounter/Encounter.test.js +36 -1
- package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +4 -0
- package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.test.js +38 -1
- package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.js +9 -2
- package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.test.js +36 -1
- package/src/components/resources/Generic/Generic.js +21 -7
- package/src/components/resources/Generic/Generic.stories.js +2 -1
- package/src/components/resources/Generic/Generic.test.js +26 -7
- package/src/components/resources/Goal/Goal.js +9 -3
- package/src/components/resources/Goal/Goal.test.js +32 -1
- package/src/components/resources/Immunization/Immunization.js +9 -2
- package/src/components/resources/Immunization/Immunization.test.js +36 -1
- package/src/components/resources/List/DrugTierDefinitionExtension.js +79 -35
- package/src/components/resources/List/Entries.js +3 -3
- package/src/components/resources/List/List.js +137 -88
- package/src/components/resources/List/List.stories.js +38 -5
- package/src/components/resources/List/List.test.js +105 -1
- package/src/components/resources/Location/Location.js +66 -47
- package/src/components/resources/Location/Location.stories.js +11 -4
- package/src/components/resources/Location/Location.test.js +106 -4
- package/src/components/resources/Medication/Medication.js +98 -51
- package/src/components/resources/Medication/Medication.stories.js +37 -7
- package/src/components/resources/Medication/Medication.test.js +114 -5
- package/src/components/resources/MedicationAdministration/MedicationAdministration.js +88 -62
- package/src/components/resources/MedicationAdministration/MedicationAdministration.stories.js +7 -0
- package/src/components/resources/MedicationAdministration/MedicationAdministration.test.js +117 -1
- package/src/components/resources/MedicationDispense/DosageInstruction.js +25 -0
- package/src/components/resources/MedicationDispense/MedicationDispense.js +70 -68
- package/src/components/resources/MedicationDispense/MedicationDispense.stories.js +7 -0
- package/src/components/resources/MedicationDispense/MedicationDispense.test.js +108 -1
- package/src/components/resources/MedicationKnowledge/MedicationKnowledge.js +117 -66
- package/src/components/resources/MedicationKnowledge/MedicationKnowledge.stories.js +6 -0
- package/src/components/resources/MedicationKnowledge/MedicationKnowledge.test.js +110 -1
- package/src/components/resources/MedicationOrder/MedicationOrder.js +3 -3
- package/src/components/resources/MedicationOrder/MedicationOrder.test.js +35 -4
- package/src/components/resources/MedicationRequest/MedicationRequest.js +8 -1
- package/src/components/resources/MedicationRequest/MedicationRequest.test.js +33 -4
- package/src/components/resources/MedicationStatement/MedicationStatement.js +9 -2
- package/src/components/resources/MedicationStatement/MedicationStatement.test.js +36 -1
- package/src/components/resources/Observation/Observation.js +3 -1
- package/src/components/resources/Observation/Observation.test.js +30 -1
- package/src/components/resources/Observation/ObservationGraph.js +1 -1
- package/src/components/resources/Organization/Organization.js +63 -37
- package/src/components/resources/Organization/Organization.stories.js +15 -2
- package/src/components/resources/Organization/Organization.test.js +109 -1
- package/src/components/resources/Patient/Patient.js +4 -0
- package/src/components/resources/Patient/Patient.test.js +31 -2
- package/src/components/resources/Practitioner/Practitioner.js +9 -1
- package/src/components/resources/Practitioner/Practitioner.test.js +36 -1
- package/src/components/resources/PractitionerRole/PractitionerRole.js +52 -29
- package/src/components/resources/PractitionerRole/PractitionerRole.stories.js +7 -0
- package/src/components/resources/PractitionerRole/PractitionerRole.test.js +108 -1
- package/src/components/resources/Procedure/Procedure.js +3 -2
- package/src/components/resources/Procedure/Procedure.test.js +30 -1
- package/src/components/resources/Questionnaire/Group.js +53 -0
- package/src/components/resources/Questionnaire/Items.js +45 -0
- package/src/components/resources/Questionnaire/Questionnaire.css +24 -5
- package/src/components/resources/Questionnaire/Questionnaire.js +38 -170
- package/src/components/resources/Questionnaire/Questionnaire.stories.js +8 -0
- package/src/components/resources/Questionnaire/Questionnaire.test.js +194 -15
- package/src/components/resources/Questionnaire/Questions.js +40 -0
- package/src/components/resources/Questionnaire/getQuestionText.js +20 -0
- package/src/components/resources/QuestionnaireResponse/Answers.js +59 -0
- package/src/components/resources/QuestionnaireResponse/Group.js +70 -0
- package/src/components/resources/QuestionnaireResponse/Items.js +45 -0
- package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.css +33 -8
- package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.js +54 -236
- package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.stories.js +8 -0
- package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.test.js +38 -3
- package/src/components/resources/QuestionnaireResponse/Questions.js +43 -0
- package/src/components/resources/QuestionnaireResponse/getQuestionText.js +22 -0
- package/src/components/resources/ReferralRequest/ReferralRequest.js +72 -40
- package/src/components/resources/ReferralRequest/ReferralRequest.test.js +111 -11
- package/src/components/resources/RelatedPerson/RelatedPerson.js +158 -0
- package/src/components/resources/RelatedPerson/RelatedPerson.stories.js +46 -0
- package/src/components/resources/RelatedPerson/RelatedPerson.test.js +156 -0
- package/src/components/resources/RelatedPerson/index.js +3 -0
- package/src/components/resources/ResearchStudy/ResearchStudy.js +167 -130
- package/src/components/resources/ResearchStudy/ResearchStudy.stories.js +2 -0
- package/src/components/resources/ResearchStudy/ResearchStudy.test.js +108 -1
- package/src/components/resources/ResourceCategory/ResourceCategory.js +1 -1
- package/src/components/ui/index.js +56 -32
- package/src/fixtures/dstu2/resources/relatedPerson/example1.json +79 -0
- package/src/fixtures/example-icons.jsx +63 -0
- package/src/fixtures/r4/resources/relatedPerson/example1.json +64 -0
- package/src/fixtures/stu3/resources/relatedPerson/example1.json +43 -0
- package/src/style.scss +14 -1
|
@@ -17,8 +17,6 @@ import r4Example3 from '../../../fixtures/r4/resources/bundle/example3.json';
|
|
|
17
17
|
import r4Example4 from '../../../fixtures/r4/resources/bundle/example4.json';
|
|
18
18
|
import fhirVersions from '../fhirResourceVersions';
|
|
19
19
|
|
|
20
|
-
import fhirIcons from '../../../fixtures/example-icons';
|
|
21
|
-
|
|
22
20
|
export default {
|
|
23
21
|
title: 'Bundle',
|
|
24
22
|
};
|
|
@@ -26,133 +24,69 @@ export default {
|
|
|
26
24
|
export const Example1OfDSTU2 = () => {
|
|
27
25
|
const fhirResource = object('Resource', dstu2Example1);
|
|
28
26
|
return (
|
|
29
|
-
<Bundle
|
|
30
|
-
fhirResource={fhirResource}
|
|
31
|
-
fhirVersion={fhirVersions.DSTU2}
|
|
32
|
-
fhirIcons={fhirIcons}
|
|
33
|
-
/>
|
|
27
|
+
<Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.DSTU2} />
|
|
34
28
|
);
|
|
35
29
|
};
|
|
36
30
|
|
|
37
31
|
export const Example2OfDSTU2 = () => {
|
|
38
32
|
const fhirResource = object('Resource', dstu2Example2);
|
|
39
33
|
return (
|
|
40
|
-
<Bundle
|
|
41
|
-
fhirResource={fhirResource}
|
|
42
|
-
fhirVersion={fhirVersions.DSTU2}
|
|
43
|
-
fhirIcons={fhirIcons}
|
|
44
|
-
/>
|
|
34
|
+
<Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.DSTU2} />
|
|
45
35
|
);
|
|
46
36
|
};
|
|
47
37
|
|
|
48
38
|
export const Example3OfDSTU2 = () => {
|
|
49
39
|
const fhirResource = object('Resource', dstu2Example3);
|
|
50
40
|
return (
|
|
51
|
-
<Bundle
|
|
52
|
-
fhirResource={fhirResource}
|
|
53
|
-
fhirVersion={fhirVersions.DSTU2}
|
|
54
|
-
fhirIcons={fhirIcons}
|
|
55
|
-
/>
|
|
41
|
+
<Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.DSTU2} />
|
|
56
42
|
);
|
|
57
43
|
};
|
|
58
44
|
|
|
59
45
|
export const Example4OfDSTU2 = () => {
|
|
60
46
|
const fhirResource = object('Resource', dstu2Example4);
|
|
61
47
|
return (
|
|
62
|
-
<Bundle
|
|
63
|
-
fhirResource={fhirResource}
|
|
64
|
-
fhirVersion={fhirVersions.DSTU2}
|
|
65
|
-
fhirIcons={fhirIcons}
|
|
66
|
-
/>
|
|
48
|
+
<Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.DSTU2} />
|
|
67
49
|
);
|
|
68
50
|
};
|
|
69
51
|
|
|
70
52
|
export const Example1OfSTU3 = () => {
|
|
71
53
|
const fhirResource = object('Resource', stu3Example1);
|
|
72
|
-
return
|
|
73
|
-
<Bundle
|
|
74
|
-
fhirResource={fhirResource}
|
|
75
|
-
fhirVersion={fhirVersions.STU3}
|
|
76
|
-
fhirIcons={fhirIcons}
|
|
77
|
-
/>
|
|
78
|
-
);
|
|
54
|
+
return <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.STU3} />;
|
|
79
55
|
};
|
|
80
56
|
|
|
81
57
|
export const Example2OfSTU3 = () => {
|
|
82
58
|
const fhirResource = object('Resource', stu3Example2);
|
|
83
|
-
return
|
|
84
|
-
<Bundle
|
|
85
|
-
fhirResource={fhirResource}
|
|
86
|
-
fhirVersion={fhirVersions.STU3}
|
|
87
|
-
fhirIcons={fhirIcons}
|
|
88
|
-
/>
|
|
89
|
-
);
|
|
59
|
+
return <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.STU3} />;
|
|
90
60
|
};
|
|
91
61
|
|
|
92
62
|
export const Example3OfSTU3 = () => {
|
|
93
63
|
const fhirResource = object('Resource', stu3Example3);
|
|
94
|
-
return
|
|
95
|
-
<Bundle
|
|
96
|
-
fhirResource={fhirResource}
|
|
97
|
-
fhirVersion={fhirVersions.STU3}
|
|
98
|
-
fhirIcons={fhirIcons}
|
|
99
|
-
/>
|
|
100
|
-
);
|
|
64
|
+
return <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.STU3} />;
|
|
101
65
|
};
|
|
102
66
|
|
|
103
67
|
export const Example4OfSTU3 = () => {
|
|
104
68
|
const fhirResource = object('Resource', stu3Example4);
|
|
105
|
-
return
|
|
106
|
-
<Bundle
|
|
107
|
-
fhirResource={fhirResource}
|
|
108
|
-
fhirVersion={fhirVersions.STU3}
|
|
109
|
-
fhirIcons={fhirIcons}
|
|
110
|
-
/>
|
|
111
|
-
);
|
|
69
|
+
return <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.STU3} />;
|
|
112
70
|
};
|
|
113
71
|
|
|
114
72
|
export const Example1OfR4 = () => {
|
|
115
73
|
const fhirResource = object('Resource', r4Example1);
|
|
116
|
-
return
|
|
117
|
-
<Bundle
|
|
118
|
-
fhirResource={fhirResource}
|
|
119
|
-
fhirVersion={fhirVersions.R4}
|
|
120
|
-
fhirIcons={fhirIcons}
|
|
121
|
-
/>
|
|
122
|
-
);
|
|
74
|
+
return <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />;
|
|
123
75
|
};
|
|
124
76
|
|
|
125
77
|
export const Example2OfR4 = () => {
|
|
126
78
|
const fhirResource = object('Resource', r4Example2);
|
|
127
|
-
return
|
|
128
|
-
<Bundle
|
|
129
|
-
fhirResource={fhirResource}
|
|
130
|
-
fhirVersion={fhirVersions.R4}
|
|
131
|
-
fhirIcons={fhirIcons}
|
|
132
|
-
/>
|
|
133
|
-
);
|
|
79
|
+
return <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />;
|
|
134
80
|
};
|
|
135
81
|
|
|
136
82
|
export const Example3OfR4 = () => {
|
|
137
83
|
const fhirResource = object('Resource', r4Example3);
|
|
138
|
-
return
|
|
139
|
-
<Bundle
|
|
140
|
-
fhirResource={fhirResource}
|
|
141
|
-
fhirVersion={fhirVersions.R4}
|
|
142
|
-
fhirIcons={fhirIcons}
|
|
143
|
-
/>
|
|
144
|
-
);
|
|
84
|
+
return <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />;
|
|
145
85
|
};
|
|
146
86
|
|
|
147
87
|
export const Example4OfR4 = () => {
|
|
148
88
|
const fhirResource = object('Resource', r4Example4);
|
|
149
|
-
return
|
|
150
|
-
<Bundle
|
|
151
|
-
fhirResource={fhirResource}
|
|
152
|
-
fhirVersion={fhirVersions.R4}
|
|
153
|
-
fhirIcons={fhirIcons}
|
|
154
|
-
/>
|
|
155
|
-
);
|
|
89
|
+
return <Bundle fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />;
|
|
156
90
|
};
|
|
157
91
|
|
|
158
92
|
// export const ExampleWithoutFHIRVersionProperty = () => {
|
|
@@ -8,8 +8,6 @@ import dstu2Example2 from '../../../fixtures/dstu2/resources/bundle/example3.jso
|
|
|
8
8
|
import stu3Example1 from '../../../fixtures/stu3/resources/bundle/example1.json';
|
|
9
9
|
import r4Example1 from '../../../fixtures/r4/resources/bundle/example1.json';
|
|
10
10
|
|
|
11
|
-
import fhirIcons from '../../../fixtures/example-icons';
|
|
12
|
-
|
|
13
11
|
describe('Bundle should render component correctly', () => {
|
|
14
12
|
it('should render component correctly with DSTU2 source data', () => {
|
|
15
13
|
const defaultProps = {
|
|
@@ -31,7 +29,6 @@ describe('Bundle should render component correctly', () => {
|
|
|
31
29
|
const defaultProps = {
|
|
32
30
|
fhirVersion: fhirVersions.DSTU2,
|
|
33
31
|
fhirResource: dstu2Example2,
|
|
34
|
-
fhirIcons: fhirIcons,
|
|
35
32
|
};
|
|
36
33
|
const { getByText, getAllByTestId } = render(<Bundle {...defaultProps} />);
|
|
37
34
|
expect(getAllByTestId('title').map(title => title.textContent)).toEqual([
|
|
@@ -162,7 +162,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
|
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
164
|
|
|
165
|
-
const CarePlan = ({
|
|
165
|
+
const CarePlan = ({
|
|
166
|
+
fhirResource,
|
|
167
|
+
fhirVersion,
|
|
168
|
+
fhirIcons,
|
|
169
|
+
onClick,
|
|
170
|
+
rawOnClick,
|
|
171
|
+
}) => {
|
|
166
172
|
let fhirResourceData = {};
|
|
167
173
|
try {
|
|
168
174
|
fhirResourceData = resourceDTO(fhirVersion, fhirResource);
|
|
@@ -304,6 +310,8 @@ const CarePlan = ({ fhirResource, fhirVersion, fhirIcons }) => {
|
|
|
304
310
|
)}
|
|
305
311
|
</Body>
|
|
306
312
|
}
|
|
313
|
+
onClick={onClick}
|
|
314
|
+
rawOnClick={rawOnClick}
|
|
307
315
|
/>
|
|
308
316
|
</Root>
|
|
309
317
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
3
3
|
import CarePlan from './CarePlan';
|
|
4
4
|
import fhirVersions from '../fhirResourceVersions';
|
|
5
5
|
|
|
@@ -111,8 +111,9 @@ describe('should render component correctly', () => {
|
|
|
111
111
|
expect(getByTestId('activity').textContent).toContain('3141-9');
|
|
112
112
|
expect(getByTestId('intent').textContent).toEqual('plan');
|
|
113
113
|
expect(getByTestId('description').textContent).toContain('Manage obesity');
|
|
114
|
-
expect(getByTestId('subject').textContent).toContain(
|
|
115
|
-
|
|
114
|
+
expect(getByTestId('subject').textContent).toContain(
|
|
115
|
+
'Peter James Chalmers',
|
|
116
|
+
);
|
|
116
117
|
expect(getByTestId('author').textContent).toContain('Dr Adam Careful');
|
|
117
118
|
expect(getByTestId('periodEnd').textContent).toEqual('6/1/2017');
|
|
118
119
|
expect(getByTestId('basedOn').textContent).toEqual(
|
|
@@ -136,8 +137,9 @@ describe('should render component correctly', () => {
|
|
|
136
137
|
expect(getByTestId('intent').textContent).toEqual('plan');
|
|
137
138
|
expect(getByTestId('goals').textContent).toEqual('Goal/example');
|
|
138
139
|
expect(getByTestId('description').textContent).toContain('Manage obesity');
|
|
139
|
-
expect(getByTestId('subject').textContent).toContain(
|
|
140
|
-
|
|
140
|
+
expect(getByTestId('subject').textContent).toContain(
|
|
141
|
+
'Peter James Chalmers',
|
|
142
|
+
);
|
|
141
143
|
expect(getByTestId('author').textContent).toContain('Dr Adam Careful');
|
|
142
144
|
expect(getByTestId('periodEnd').textContent).toEqual('6/1/2017');
|
|
143
145
|
expect(getByTestId('basedOn').textContent).toEqual(
|
|
@@ -160,8 +162,42 @@ describe('should render component correctly', () => {
|
|
|
160
162
|
expect(getByTestId('intent').textContent).toEqual('plan');
|
|
161
163
|
expect(getByTestId('goals').textContent).toEqual('#goal');
|
|
162
164
|
expect(getByTestId('subject').textContent).toContain('Eve Everywoman');
|
|
163
|
-
expect(getByTestId('subject').textContent).toContain('Patient/1');
|
|
164
165
|
expect(getByTestId('periodStart').textContent).toEqual('1/1/2013');
|
|
165
166
|
expect(getByTestId('periodEnd').textContent).toEqual('10/1/2013');
|
|
166
167
|
});
|
|
168
|
+
|
|
169
|
+
it('should fire custom onClick function', () => {
|
|
170
|
+
const defaultProps = {
|
|
171
|
+
fhirResource: example2CarePlanR4,
|
|
172
|
+
fhirVersion: fhirVersions.R4,
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const onClick = jest.fn();
|
|
176
|
+
const { getByRole } = render(
|
|
177
|
+
<CarePlan {...defaultProps} onClick={onClick} />,
|
|
178
|
+
);
|
|
179
|
+
const accordion = getByRole('button');
|
|
180
|
+
fireEvent.click(accordion);
|
|
181
|
+
|
|
182
|
+
const attribute = accordion.getAttribute('data-bs-toggle');
|
|
183
|
+
expect(attribute).not.toEqual('collapse');
|
|
184
|
+
expect(onClick).toHaveBeenCalled();
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('should not fire custom onClick function', () => {
|
|
188
|
+
const defaultProps = {
|
|
189
|
+
fhirResource: example2CarePlanR4,
|
|
190
|
+
fhirVersion: fhirVersions.R4,
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const onClick = 'test';
|
|
194
|
+
const { getByRole } = render(
|
|
195
|
+
<CarePlan {...defaultProps} onClick={onClick} />,
|
|
196
|
+
);
|
|
197
|
+
const accordion = getByRole('button');
|
|
198
|
+
fireEvent.click(accordion);
|
|
199
|
+
|
|
200
|
+
const attribute = accordion.getAttribute('data-bs-toggle');
|
|
201
|
+
expect(attribute).toEqual('collapse');
|
|
202
|
+
});
|
|
167
203
|
});
|
|
@@ -4,8 +4,7 @@ import {
|
|
|
4
4
|
Header,
|
|
5
5
|
MissingValue,
|
|
6
6
|
Root,
|
|
7
|
-
|
|
8
|
-
Value,
|
|
7
|
+
ValueSection,
|
|
9
8
|
} from '../../ui';
|
|
10
9
|
|
|
11
10
|
import CareTeamParticipants from './CareTeamParticipants';
|
|
@@ -16,6 +15,7 @@ import React from 'react';
|
|
|
16
15
|
import Reference from '../../datatypes/Reference';
|
|
17
16
|
import _get from 'lodash/get';
|
|
18
17
|
import fhirVersions from '../fhirResourceVersions';
|
|
18
|
+
import Accordion from '../../containers/Accordion';
|
|
19
19
|
|
|
20
20
|
const commonDTO = fhirResource => {
|
|
21
21
|
// Default value for title - "Care team"
|
|
@@ -83,8 +83,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
|
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
const CareTeam =
|
|
87
|
-
|
|
86
|
+
const CareTeam = ({
|
|
87
|
+
fhirResource,
|
|
88
|
+
fhirVersion,
|
|
89
|
+
fhirIcons,
|
|
90
|
+
onClick,
|
|
91
|
+
rawOnClick,
|
|
92
|
+
}) => {
|
|
88
93
|
const {
|
|
89
94
|
name,
|
|
90
95
|
status,
|
|
@@ -98,54 +103,78 @@ const CareTeam = props => {
|
|
|
98
103
|
} = resourceDTO(fhirVersion, fhirResource);
|
|
99
104
|
const hasParticipants = participants.length > 0;
|
|
100
105
|
|
|
106
|
+
const tableData = [
|
|
107
|
+
{
|
|
108
|
+
label: 'Category',
|
|
109
|
+
testId: 'category',
|
|
110
|
+
data: category && <CodableConcept fhirData={category} isCursive />,
|
|
111
|
+
status: category,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
label: 'Subject',
|
|
115
|
+
testId: 'subject',
|
|
116
|
+
data: subject && <Reference fhirData={subject} />,
|
|
117
|
+
status: subject,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
label: 'Encounter',
|
|
121
|
+
testId: 'encounter',
|
|
122
|
+
data: encounter && <Reference fhirData={encounter} />,
|
|
123
|
+
status: encounter,
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
label: 'Managing organization',
|
|
127
|
+
testId: 'managingOrganization',
|
|
128
|
+
data: managingOrganization && (
|
|
129
|
+
<Reference fhirData={managingOrganization} />
|
|
130
|
+
),
|
|
131
|
+
status: managingOrganization,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
label: 'Care Period Start',
|
|
135
|
+
testId: 'periodStart',
|
|
136
|
+
data: periodStart ? (
|
|
137
|
+
<DateType fhirData={periodStart} isBlack />
|
|
138
|
+
) : (
|
|
139
|
+
<MissingValue />
|
|
140
|
+
),
|
|
141
|
+
status: periodStart,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
label: 'Care Period End',
|
|
145
|
+
testId: 'periodEnd',
|
|
146
|
+
data: periodEnd ? (
|
|
147
|
+
<DateType fhirData={periodEnd} isBlack />
|
|
148
|
+
) : (
|
|
149
|
+
<MissingValue />
|
|
150
|
+
),
|
|
151
|
+
status: periodEnd,
|
|
152
|
+
},
|
|
153
|
+
];
|
|
154
|
+
|
|
101
155
|
return (
|
|
102
156
|
<Root name="CareTeam">
|
|
103
|
-
<
|
|
104
|
-
{
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
<Value
|
|
125
|
-
label="Managing organization"
|
|
126
|
-
data-testid="managingOrganization"
|
|
127
|
-
>
|
|
128
|
-
<Reference fhirData={managingOrganization} />
|
|
129
|
-
</Value>
|
|
130
|
-
)}
|
|
131
|
-
{periodStart && (
|
|
132
|
-
<Value label="Care Period Start" data-testid="periodStart">
|
|
133
|
-
{periodStart ? (
|
|
134
|
-
<DateType fhirData={periodStart} />
|
|
135
|
-
) : (
|
|
136
|
-
<MissingValue />
|
|
137
|
-
)}
|
|
138
|
-
</Value>
|
|
139
|
-
)}
|
|
140
|
-
{periodEnd && (
|
|
141
|
-
<Value label="Care Period End" data-testid="periodEnd">
|
|
142
|
-
{periodEnd ? <DateType fhirData={periodEnd} /> : <MissingValue />}
|
|
143
|
-
</Value>
|
|
144
|
-
)}
|
|
145
|
-
{hasParticipants && (
|
|
146
|
-
<CareTeamParticipants participants={participants} />
|
|
147
|
-
)}
|
|
148
|
-
</Body>
|
|
157
|
+
<Accordion
|
|
158
|
+
headerContent={
|
|
159
|
+
<Header
|
|
160
|
+
resourceName={'CareTeam'}
|
|
161
|
+
icon={fhirIcons}
|
|
162
|
+
title={name}
|
|
163
|
+
badges={status && <Badge data-testid="status">{status}</Badge>}
|
|
164
|
+
/>
|
|
165
|
+
}
|
|
166
|
+
bodyContent={
|
|
167
|
+
<Body tableData={tableData}>
|
|
168
|
+
<ValueSection>
|
|
169
|
+
{hasParticipants && (
|
|
170
|
+
<CareTeamParticipants participants={participants} />
|
|
171
|
+
)}
|
|
172
|
+
</ValueSection>
|
|
173
|
+
</Body>
|
|
174
|
+
}
|
|
175
|
+
onClick={onClick}
|
|
176
|
+
rawOnClick={rawOnClick}
|
|
177
|
+
/>
|
|
149
178
|
</Root>
|
|
150
179
|
);
|
|
151
180
|
};
|
|
@@ -7,6 +7,9 @@ import example_STU3 from '../../../fixtures/stu3/resources/careTeam/example1.jso
|
|
|
7
7
|
import example2_STU3 from '../../../fixtures/stu3/resources/careTeam/example2.json';
|
|
8
8
|
import example_R4 from '../../../fixtures/r4/resources/careTeam/example1.json';
|
|
9
9
|
|
|
10
|
+
import fhirIcons from '../../../fixtures/example-icons';
|
|
11
|
+
import CareTeamIcon from '../../../assets/containers/CareTeam/care-team.svg';
|
|
12
|
+
|
|
10
13
|
export default {
|
|
11
14
|
title: 'CareTeam',
|
|
12
15
|
};
|
|
@@ -14,18 +17,32 @@ export default {
|
|
|
14
17
|
export const ExampleSTU3 = () => {
|
|
15
18
|
const fhirResource = object('Resource', example_STU3);
|
|
16
19
|
return (
|
|
17
|
-
<CareTeam
|
|
20
|
+
<CareTeam
|
|
21
|
+
fhirResource={fhirResource}
|
|
22
|
+
fhirVersion={fhirVersions.STU3}
|
|
23
|
+
fhirIcons={CareTeamIcon}
|
|
24
|
+
/>
|
|
18
25
|
);
|
|
19
26
|
};
|
|
20
27
|
|
|
21
28
|
export const Example2OfSTU3 = () => {
|
|
22
29
|
const fhirResource = object('Resource', example2_STU3);
|
|
23
30
|
return (
|
|
24
|
-
<CareTeam
|
|
31
|
+
<CareTeam
|
|
32
|
+
fhirResource={fhirResource}
|
|
33
|
+
fhirVersion={fhirVersions.STU3}
|
|
34
|
+
fhirIcons={fhirIcons}
|
|
35
|
+
/>
|
|
25
36
|
);
|
|
26
37
|
};
|
|
27
38
|
|
|
28
39
|
export const ExampleR4 = () => {
|
|
29
40
|
const fhirResource = object('Resource', example_R4);
|
|
30
|
-
return
|
|
41
|
+
return (
|
|
42
|
+
<CareTeam
|
|
43
|
+
fhirResource={fhirResource}
|
|
44
|
+
fhirVersion={fhirVersions.R4}
|
|
45
|
+
fhirIcons={false}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
31
48
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
import CareTeam from './CareTeam';
|
|
5
5
|
import fhirVersions from '../fhirResourceVersions';
|
|
@@ -8,7 +8,80 @@ import stu3Example1 from '../../../fixtures/stu3/resources/careTeam/example1.jso
|
|
|
8
8
|
import stu3Example2 from '../../../fixtures/stu3/resources/careTeam/example2.json';
|
|
9
9
|
import r4Example1 from '../../../fixtures/r4/resources/careTeam/example1.json';
|
|
10
10
|
|
|
11
|
+
import fhirIcons from '../../../fixtures/example-icons';
|
|
12
|
+
|
|
11
13
|
describe('should render the CareTeam component properly', () => {
|
|
14
|
+
it('component without a fhirIcons props should render a default icon', () => {
|
|
15
|
+
const defaultProps = {
|
|
16
|
+
fhirVersion: fhirVersions.STU3,
|
|
17
|
+
fhirResource: stu3Example1,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const { getByAltText } = render(<CareTeam {...defaultProps} />);
|
|
21
|
+
const headerIcon = getByAltText('care team');
|
|
22
|
+
|
|
23
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('component with a false as a fhirIcons props should render a placeholder', () => {
|
|
27
|
+
const defaultProps = {
|
|
28
|
+
fhirVersion: fhirVersions.STU3,
|
|
29
|
+
fhirResource: stu3Example1,
|
|
30
|
+
fhirIcons: false,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const { getByTestId } = render(<CareTeam {...defaultProps} />);
|
|
34
|
+
const headerIcon = getByTestId('placeholder');
|
|
35
|
+
|
|
36
|
+
expect(headerIcon).toBeTruthy();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('component with the img as a fhirIcons props should render an img', () => {
|
|
40
|
+
const defaultProps = {
|
|
41
|
+
fhirVersion: fhirVersions.STU3,
|
|
42
|
+
fhirResource: stu3Example1,
|
|
43
|
+
fhirIcons: (
|
|
44
|
+
<img
|
|
45
|
+
src={require('../assets/containers/CareTeam/care-team.svg')}
|
|
46
|
+
alt="group of people"
|
|
47
|
+
/>
|
|
48
|
+
),
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const { getByAltText } = render(<CareTeam {...defaultProps} />);
|
|
52
|
+
const headerIcon = getByAltText('group of people');
|
|
53
|
+
|
|
54
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('component with the resources object as a fhirIcons props should render an img', () => {
|
|
58
|
+
const defaultProps = {
|
|
59
|
+
fhirVersion: fhirVersions.STU3,
|
|
60
|
+
fhirResource: stu3Example1,
|
|
61
|
+
fhirIcons: fhirIcons,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const { getByAltText } = render(<CareTeam {...defaultProps} />);
|
|
65
|
+
const headerIcon = getByAltText('group of people');
|
|
66
|
+
|
|
67
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('component with the url as a fhirIcons props should render an img', () => {
|
|
71
|
+
const avatarSrc =
|
|
72
|
+
'https://www.gravatar.com/avatar/?s=50&r=any&default=identicon&forcedefault=1';
|
|
73
|
+
const defaultProps = {
|
|
74
|
+
fhirVersion: fhirVersions.STU3,
|
|
75
|
+
fhirResource: stu3Example1,
|
|
76
|
+
fhirIcons: avatarSrc,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const { getByAltText } = render(<CareTeam {...defaultProps} />);
|
|
80
|
+
const headerIcon = getByAltText('header icon');
|
|
81
|
+
|
|
82
|
+
expect(headerIcon.getAttribute('src')).toContain(avatarSrc);
|
|
83
|
+
});
|
|
84
|
+
|
|
12
85
|
it('should render with STU3 source data', () => {
|
|
13
86
|
const defaultProps = {
|
|
14
87
|
fhirResource: stu3Example1,
|
|
@@ -117,4 +190,39 @@ describe('should render the CareTeam component properly', () => {
|
|
|
117
190
|
);
|
|
118
191
|
expect(periodEnds).toEqual(['-', '1/1/2013']);
|
|
119
192
|
});
|
|
193
|
+
|
|
194
|
+
it('should fire custom onClick function', () => {
|
|
195
|
+
const defaultProps = {
|
|
196
|
+
fhirResource: r4Example1,
|
|
197
|
+
fhirVersion: fhirVersions.R4,
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const onClick = jest.fn();
|
|
201
|
+
const { getByRole } = render(
|
|
202
|
+
<CareTeam {...defaultProps} onClick={onClick} />,
|
|
203
|
+
);
|
|
204
|
+
const accordion = getByRole('button');
|
|
205
|
+
fireEvent.click(accordion);
|
|
206
|
+
|
|
207
|
+
const attribute = accordion.getAttribute('data-bs-toggle');
|
|
208
|
+
expect(attribute).not.toEqual('collapse');
|
|
209
|
+
expect(onClick).toHaveBeenCalled();
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it('should not fire custom onClick function', () => {
|
|
213
|
+
const defaultProps = {
|
|
214
|
+
fhirResource: r4Example1,
|
|
215
|
+
fhirVersion: fhirVersions.R4,
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const onClick = 'test';
|
|
219
|
+
const { getByRole } = render(
|
|
220
|
+
<CareTeam {...defaultProps} onClick={onClick} />,
|
|
221
|
+
);
|
|
222
|
+
const accordion = getByRole('button');
|
|
223
|
+
fireEvent.click(accordion);
|
|
224
|
+
|
|
225
|
+
const attribute = accordion.getAttribute('data-bs-toggle');
|
|
226
|
+
expect(attribute).toEqual('collapse');
|
|
227
|
+
});
|
|
120
228
|
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MissingValue,
|
|
3
|
+
Table,
|
|
4
|
+
TableCell,
|
|
5
|
+
TableHeader,
|
|
6
|
+
TableRow,
|
|
7
|
+
ValueSection,
|
|
8
|
+
} from '../../ui';
|
|
9
|
+
import Reference from '../../datatypes/Reference';
|
|
10
|
+
import Coding from '../../datatypes/Coding';
|
|
11
|
+
import React from 'react';
|
|
12
|
+
|
|
13
|
+
const CareTeam = ({ careTeam }) => {
|
|
14
|
+
return (
|
|
15
|
+
<ValueSection label="Care Team" data-testid="careTeam" marginTop>
|
|
16
|
+
<Table>
|
|
17
|
+
<thead>
|
|
18
|
+
<TableRow>
|
|
19
|
+
<TableHeader>Provider</TableHeader>
|
|
20
|
+
<TableHeader>Role</TableHeader>
|
|
21
|
+
<TableHeader>Qualification</TableHeader>
|
|
22
|
+
</TableRow>
|
|
23
|
+
</thead>
|
|
24
|
+
<tbody className="border-top-0">
|
|
25
|
+
{careTeam.map((member, idx) => (
|
|
26
|
+
<TableRow key={idx}>
|
|
27
|
+
<TableCell data-testid="careTeam.provider" className="col-md-4">
|
|
28
|
+
<Reference fhirData={member.provider} />
|
|
29
|
+
</TableCell>
|
|
30
|
+
<TableCell data-testid="careTeam.role" className="col-md-4">
|
|
31
|
+
{member.role ? (
|
|
32
|
+
<Coding fhirData={member.role} />
|
|
33
|
+
) : (
|
|
34
|
+
<MissingValue />
|
|
35
|
+
)}
|
|
36
|
+
</TableCell>
|
|
37
|
+
<TableCell
|
|
38
|
+
data-testid="careTeam.qualification"
|
|
39
|
+
className="col-md-4"
|
|
40
|
+
>
|
|
41
|
+
{careTeam.qualification ? (
|
|
42
|
+
<Coding fhirData={member.qualification} />
|
|
43
|
+
) : (
|
|
44
|
+
<MissingValue />
|
|
45
|
+
)}
|
|
46
|
+
</TableCell>
|
|
47
|
+
</TableRow>
|
|
48
|
+
))}
|
|
49
|
+
</tbody>
|
|
50
|
+
</Table>
|
|
51
|
+
</ValueSection>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default CareTeam;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
height: 50px;
|
|
4
|
-
margin: -12px;
|
|
5
|
-
display: flex;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.fhir-resource__Claim__item-level-fill {
|
|
9
|
-
width: 10px;
|
|
10
|
-
height: 100%;
|
|
11
|
-
background: #dee2e6;
|
|
1
|
+
.table-expandable-row {
|
|
2
|
+
--bs-table-striped-bg: #eef1f3;
|
|
12
3
|
}
|