fhir-react 0.3.5 → 0.3.8
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 +9 -8
- 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/{ResourceCategory/resource-placeholder.svg → Generic/generic.svg} +0 -0
- package/src/assets/containers/MedicationDispense/medication-dispense.svg +5 -0
- package/src/assets/containers/MedicationOrder/medication-order.svg +5 -0
- package/src/assets/containers/MedicationRequest/medication-request.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/assets/containers/ResourceCategory/resource-category.svg +3 -0
- package/src/components/containers/Accordion/Accordion.js +21 -13
- 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 +81 -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 -5
- package/src/components/resources/AllergyIntolerance/AllergyIntolerance.stories.js +5 -4
- package/src/components/resources/AllergyIntolerance/AllergyIntolerance.test.js +107 -1
- package/src/components/resources/Appointment/Appointment.js +2 -1
- package/src/components/resources/Appointment/Appointment.test.js +36 -1
- package/src/components/resources/Binary/Binary.js +1 -2
- package/src/components/resources/Binary/Binary.stories.js +10 -4
- package/src/components/resources/Binary/Binary.test.js +67 -0
- 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 +2 -1
- package/src/components/resources/CarePlan/CarePlan.stories.js +31 -5
- package/src/components/resources/CarePlan/CarePlan.test.js +114 -6
- package/src/components/resources/CareTeam/CareTeam.js +72 -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 +158 -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 +137 -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 +3 -3
- package/src/components/resources/Condition/Condition.test.js +37 -4
- package/src/components/resources/Coverage/Coverage.js +97 -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 +2 -1
- package/src/components/resources/Device/Device.stories.js +33 -5
- package/src/components/resources/Device/Device.test.js +108 -1
- package/src/components/resources/DiagnosticReport/DiagnosticReport.js +7 -2
- package/src/components/resources/DiagnosticReport/DiagnosticReport.stories.js +5 -4
- package/src/components/resources/DiagnosticReport/DiagnosticReport.test.js +107 -1
- package/src/components/resources/DocumentReference/DocumentReference.js +7 -2
- package/src/components/resources/DocumentReference/DocumentReference.stories.js +3 -2
- package/src/components/resources/DocumentReference/DocumentReference.test.js +113 -1
- package/src/components/resources/Encounter/Encounter.js +2 -1
- package/src/components/resources/Encounter/Encounter.test.js +36 -1
- package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +2 -0
- package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.test.js +38 -1
- package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.js +7 -2
- package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.stories.js +3 -2
- package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.test.js +108 -1
- package/src/components/resources/Generic/Generic.js +20 -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 +3 -5
- package/src/components/resources/Goal/Goal.stories.js +5 -4
- package/src/components/resources/Goal/Goal.test.js +101 -1
- package/src/components/resources/Immunization/Immunization.js +2 -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 +135 -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 +65 -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 +91 -51
- package/src/components/resources/Medication/Medication.stories.js +37 -7
- package/src/components/resources/Medication/Medication.test.js +113 -4
- package/src/components/resources/MedicationAdministration/MedicationAdministration.js +86 -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 +68 -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 +115 -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 -4
- package/src/components/resources/MedicationOrder/MedicationOrder.stories.js +1 -2
- package/src/components/resources/MedicationOrder/MedicationOrder.test.js +102 -4
- package/src/components/resources/MedicationRequest/MedicationRequest.js +3 -4
- package/src/components/resources/MedicationRequest/MedicationRequest.stories.js +11 -6
- package/src/components/resources/MedicationRequest/MedicationRequest.test.js +100 -4
- package/src/components/resources/MedicationStatement/MedicationDosage.js +2 -2
- package/src/components/resources/MedicationStatement/MedicationStatement.js +8 -2
- package/src/components/resources/MedicationStatement/MedicationStatement.stories.js +5 -4
- package/src/components/resources/MedicationStatement/MedicationStatement.test.js +108 -1
- package/src/components/resources/Observation/Observation.js +2 -1
- package/src/components/resources/Observation/Observation.test.js +30 -1
- package/src/components/resources/Organization/Organization.js +56 -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 +2 -0
- package/src/components/resources/Patient/Patient.test.js +31 -2
- package/src/components/resources/Practitioner/Practitioner.js +2 -1
- package/src/components/resources/Practitioner/Practitioner.test.js +36 -1
- package/src/components/resources/PractitionerRole/PractitionerRole.js +50 -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 +2 -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 +31 -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 +52 -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 +65 -40
- package/src/components/resources/ReferralRequest/ReferralRequest.test.js +111 -11
- package/src/components/resources/RelatedPerson/RelatedPerson.js +151 -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 +160 -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 +7 -12
- package/src/components/resources/ResourceCategory/ResourceCategory.stories.js +13 -2
- package/src/components/resources/ResourceCategory/ResourceCategory.test.js +77 -18
- package/src/components/ui/index.js +32 -12
- package/src/fixtures/dstu2/resources/relatedPerson/example1.json +79 -0
- package/src/fixtures/example-icons.jsx +81 -11
- package/src/fixtures/r4/resources/relatedPerson/example1.json +64 -0
- package/src/fixtures/stu3/resources/relatedPerson/example1.json +43 -0
- package/src/style.scss +3 -1
|
@@ -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 Goal from './Goal';
|
|
5
5
|
import fhirVersions from '../fhirResourceVersions';
|
|
@@ -7,8 +7,77 @@ import dstu2Example1 from '../../../fixtures/dstu2/resources/goal/example1.json'
|
|
|
7
7
|
import stu3Example1 from '../../../fixtures/stu3/resources/goal/example1.json';
|
|
8
8
|
import r4Example1 from '../../../fixtures/r4/resources/goal/example1.json';
|
|
9
9
|
import r4Example2 from '../../../fixtures/r4/resources/goal/example2.json';
|
|
10
|
+
import fhirIcons from '../../../fixtures/example-icons';
|
|
10
11
|
|
|
11
12
|
describe('should render Goal component properly', () => {
|
|
13
|
+
it('component without a fhirIcons props should render a default icon', () => {
|
|
14
|
+
const defaultProps = {
|
|
15
|
+
fhirResource: dstu2Example1,
|
|
16
|
+
fhirVersion: fhirVersions.DSTU2,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const { getByAltText } = render(<Goal {...defaultProps} />);
|
|
20
|
+
const headerIcon = getByAltText('goal');
|
|
21
|
+
|
|
22
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('component with a false as a fhirIcons props should render a placeholder', () => {
|
|
26
|
+
const defaultProps = {
|
|
27
|
+
fhirResource: dstu2Example1,
|
|
28
|
+
fhirVersion: fhirVersions.DSTU2,
|
|
29
|
+
fhirIcons: false,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const { getByTestId } = render(<Goal {...defaultProps} />);
|
|
33
|
+
const headerIcon = getByTestId('placeholder');
|
|
34
|
+
|
|
35
|
+
expect(headerIcon).toBeTruthy();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('component with the img as a fhirIcons props should render an img', () => {
|
|
39
|
+
const defaultProps = {
|
|
40
|
+
fhirResource: dstu2Example1,
|
|
41
|
+
fhirVersion: fhirVersions.DSTU2,
|
|
42
|
+
fhirIcons: (
|
|
43
|
+
<img src={require('../assets/containers/Goal/goal.svg')} alt="goal" />
|
|
44
|
+
),
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const { getByAltText } = render(<Goal {...defaultProps} />);
|
|
48
|
+
const headerIcon = getByAltText('goal');
|
|
49
|
+
|
|
50
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('component with the resources object as a fhirIcons props should render an img', () => {
|
|
54
|
+
const defaultProps = {
|
|
55
|
+
fhirResource: dstu2Example1,
|
|
56
|
+
fhirVersion: fhirVersions.DSTU2,
|
|
57
|
+
fhirIcons: fhirIcons,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const { getByAltText } = render(<Goal {...defaultProps} />);
|
|
61
|
+
const headerIcon = getByAltText('goal');
|
|
62
|
+
|
|
63
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('component with the url as a fhirIcons props should render an img', () => {
|
|
67
|
+
const avatarSrc =
|
|
68
|
+
'https://www.gravatar.com/avatar/?s=50&r=any&default=identicon&forcedefault=1';
|
|
69
|
+
const defaultProps = {
|
|
70
|
+
fhirResource: dstu2Example1,
|
|
71
|
+
fhirVersion: fhirVersions.DSTU2,
|
|
72
|
+
fhirIcons: avatarSrc,
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const { getByAltText } = render(<Goal {...defaultProps} />);
|
|
76
|
+
const headerIcon = getByAltText('header icon');
|
|
77
|
+
|
|
78
|
+
expect(headerIcon.getAttribute('src')).toContain(avatarSrc);
|
|
79
|
+
});
|
|
80
|
+
|
|
12
81
|
it('should render with DSTU2 source data', () => {
|
|
13
82
|
const defaultProps = {
|
|
14
83
|
fhirResource: dstu2Example1,
|
|
@@ -118,4 +187,35 @@ describe('should render Goal component properly', () => {
|
|
|
118
187
|
|
|
119
188
|
expect(queryByTestId('priority')).toBeNull();
|
|
120
189
|
});
|
|
190
|
+
|
|
191
|
+
it('should fire custom onClick function', () => {
|
|
192
|
+
const defaultProps = {
|
|
193
|
+
fhirResource: r4Example2,
|
|
194
|
+
fhirVersion: fhirVersions.R4,
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const onClick = jest.fn();
|
|
198
|
+
const { getByRole } = render(<Goal {...defaultProps} onClick={onClick} />);
|
|
199
|
+
const accordion = getByRole('button');
|
|
200
|
+
fireEvent.click(accordion);
|
|
201
|
+
|
|
202
|
+
const attribute = accordion.getAttribute('data-bs-toggle');
|
|
203
|
+
expect(attribute).not.toEqual('collapse');
|
|
204
|
+
expect(onClick).toHaveBeenCalled();
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('should not fire custom onClick function', () => {
|
|
208
|
+
const defaultProps = {
|
|
209
|
+
fhirResource: r4Example2,
|
|
210
|
+
fhirVersion: fhirVersions.R4,
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const onClick = 'test';
|
|
214
|
+
const { getByRole } = render(<Goal {...defaultProps} onClick={onClick} />);
|
|
215
|
+
const accordion = getByRole('button');
|
|
216
|
+
fireEvent.click(accordion);
|
|
217
|
+
|
|
218
|
+
const attribute = accordion.getAttribute('data-bs-toggle');
|
|
219
|
+
expect(attribute).toEqual('collapse');
|
|
220
|
+
});
|
|
121
221
|
});
|
|
@@ -103,8 +103,7 @@ const resourceDTO = (fhirVersion, fhirResource) => {
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
|
|
106
|
-
const Immunization =
|
|
107
|
-
const { fhirVersion, fhirResource, fhirIcons } = props;
|
|
106
|
+
const Immunization = ({ fhirVersion, fhirResource, fhirIcons, onClick }) => {
|
|
108
107
|
const {
|
|
109
108
|
title,
|
|
110
109
|
status,
|
|
@@ -241,6 +240,7 @@ const Immunization = props => {
|
|
|
241
240
|
/>
|
|
242
241
|
}
|
|
243
242
|
bodyContent={<Body tableData={tableData} />}
|
|
243
|
+
onClick={onClick}
|
|
244
244
|
/>
|
|
245
245
|
</Root>
|
|
246
246
|
);
|
|
@@ -4,7 +4,7 @@ import dstu2Example from '../../../fixtures/dstu2/resources/immunization/example
|
|
|
4
4
|
import fhirVersions from '../fhirResourceVersions';
|
|
5
5
|
import r4Example1 from '../../../fixtures/r4/resources/immunization/example1.json';
|
|
6
6
|
import r4Example2 from '../../../fixtures/r4/resources/immunization/example2.json';
|
|
7
|
-
import { render } from '@testing-library/react';
|
|
7
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
8
8
|
import stu3Example from '../../../fixtures/stu3/resources/immunization/example1.json';
|
|
9
9
|
import fhirIcons from '../../../fixtures/example-icons';
|
|
10
10
|
|
|
@@ -222,4 +222,39 @@ describe('should render Immunization component properly', () => {
|
|
|
222
222
|
|
|
223
223
|
expect(queryByTestId('site')).toBeNull();
|
|
224
224
|
});
|
|
225
|
+
|
|
226
|
+
it('should fire custom onClick function', () => {
|
|
227
|
+
const defaultProps = {
|
|
228
|
+
fhirResource: r4Example1,
|
|
229
|
+
fhirVersion: fhirVersions.R4,
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
const onClick = jest.fn();
|
|
233
|
+
const { getByRole } = render(
|
|
234
|
+
<Immunization {...defaultProps} onClick={onClick} />,
|
|
235
|
+
);
|
|
236
|
+
const accordion = getByRole('button');
|
|
237
|
+
fireEvent.click(accordion);
|
|
238
|
+
|
|
239
|
+
const attribute = accordion.getAttribute('data-bs-toggle');
|
|
240
|
+
expect(attribute).not.toEqual('collapse');
|
|
241
|
+
expect(onClick).toHaveBeenCalled();
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
it('should not fire custom onClick function', () => {
|
|
245
|
+
const defaultProps = {
|
|
246
|
+
fhirResource: r4Example1,
|
|
247
|
+
fhirVersion: fhirVersions.R4,
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const onClick = 'test';
|
|
251
|
+
const { getByRole } = render(
|
|
252
|
+
<Immunization {...defaultProps} onClick={onClick} />,
|
|
253
|
+
);
|
|
254
|
+
const accordion = getByRole('button');
|
|
255
|
+
fireEvent.click(accordion);
|
|
256
|
+
|
|
257
|
+
const attribute = accordion.getAttribute('data-bs-toggle');
|
|
258
|
+
expect(attribute).toEqual('collapse');
|
|
259
|
+
});
|
|
225
260
|
});
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import _get from 'lodash/get';
|
|
4
4
|
import { getExtension } from './utils';
|
|
5
|
-
import { ValueSection,
|
|
5
|
+
import { ValueSection, ValueSectionItem } from '../../ui';
|
|
6
6
|
import CodeableConcept from '../../datatypes/CodeableConcept';
|
|
7
7
|
import Money from '../../datatypes/Money';
|
|
8
8
|
|
|
@@ -82,48 +82,92 @@ const DrugTierDefinitionExtension = props => {
|
|
|
82
82
|
coinsuranceOption,
|
|
83
83
|
} = dto(drugTierDefinitionExtension);
|
|
84
84
|
|
|
85
|
+
const drugData = [
|
|
86
|
+
{
|
|
87
|
+
label: 'Drug Tier ID',
|
|
88
|
+
testId: 'drugTierID',
|
|
89
|
+
data: drugTierID && <CodeableConcept fhirData={drugTierID} />,
|
|
90
|
+
status: drugTierID,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: 'Mail order',
|
|
94
|
+
testId: 'mailOrder',
|
|
95
|
+
data: mailOrder ? 'yes' : 'no',
|
|
96
|
+
status: mailOrder,
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
const costData = [
|
|
101
|
+
{
|
|
102
|
+
label: 'Pharmacy Type',
|
|
103
|
+
testId: 'pharmacyType',
|
|
104
|
+
data: pharmacyType && <CodeableConcept fhirData={pharmacyType} />,
|
|
105
|
+
status: pharmacyType,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
label: 'Copay Amount',
|
|
109
|
+
testId: 'copayAmount',
|
|
110
|
+
data: copayAmount && <Money fhirData={copayAmount} />,
|
|
111
|
+
status: copayAmount,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
label: 'Copay Option',
|
|
115
|
+
testId: 'copayOption',
|
|
116
|
+
data: copayOption && <CodeableConcept fhirData={copayOption} />,
|
|
117
|
+
status: copayOption,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
label: 'Coinsurance Rate',
|
|
121
|
+
testId: 'coinsuranceRate',
|
|
122
|
+
data: coinsuranceRate,
|
|
123
|
+
status: coinsuranceRate === 0 || coinsuranceRate,
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
label: 'Coinsurance Option',
|
|
127
|
+
testId: 'coinsuranceOption',
|
|
128
|
+
data: coinsuranceOption && (
|
|
129
|
+
<CodeableConcept fhirData={coinsuranceOption} />
|
|
130
|
+
),
|
|
131
|
+
status: coinsuranceOption,
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
|
|
85
135
|
return (
|
|
86
136
|
hasExtensions && (
|
|
87
137
|
<ValueSection
|
|
88
138
|
label="Drug Tier Definition"
|
|
89
139
|
data-testid="drugTierDefinition"
|
|
140
|
+
marginTop
|
|
90
141
|
>
|
|
91
|
-
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
142
|
+
{drugData.map(
|
|
143
|
+
(item, index) =>
|
|
144
|
+
item.status && (
|
|
145
|
+
<ValueSectionItem
|
|
146
|
+
key={`drug-item-${index}`}
|
|
147
|
+
label={item.label}
|
|
148
|
+
data-testid={item.testId}
|
|
149
|
+
>
|
|
150
|
+
{item.data}
|
|
151
|
+
</ValueSectionItem>
|
|
152
|
+
),
|
|
100
153
|
)}
|
|
101
154
|
{hasConstSharing && (
|
|
102
|
-
<ValueSection
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
{(coinsuranceRate === 0 || coinsuranceRate) && (
|
|
119
|
-
<Value label="Coinsurance Rate" data-testid="coinsuranceRate">
|
|
120
|
-
{coinsuranceRate}
|
|
121
|
-
</Value>
|
|
122
|
-
)}
|
|
123
|
-
{coinsuranceOption && (
|
|
124
|
-
<Value label="Coinsurance Option" data-testid="coinsuranceOption">
|
|
125
|
-
<CodeableConcept fhirData={coinsuranceOption} />
|
|
126
|
-
</Value>
|
|
155
|
+
<ValueSection
|
|
156
|
+
label="Cost sharing"
|
|
157
|
+
data-testid="costSharing"
|
|
158
|
+
marginTop
|
|
159
|
+
>
|
|
160
|
+
{costData.map(
|
|
161
|
+
(item, index) =>
|
|
162
|
+
item.status && (
|
|
163
|
+
<ValueSectionItem
|
|
164
|
+
key={`cost-item-${index}`}
|
|
165
|
+
label={item.label}
|
|
166
|
+
data-testid={item.testId}
|
|
167
|
+
>
|
|
168
|
+
{item.data}
|
|
169
|
+
</ValueSectionItem>
|
|
170
|
+
),
|
|
127
171
|
)}
|
|
128
172
|
</ValueSection>
|
|
129
173
|
)}
|
|
@@ -16,7 +16,7 @@ import Reference from '../../datatypes/Reference';
|
|
|
16
16
|
const Entries = ({ fhirData: items = [] }) => {
|
|
17
17
|
if (items.length === 0) return null;
|
|
18
18
|
return (
|
|
19
|
-
<ValueSection label="Entries" data-testid="entries">
|
|
19
|
+
<ValueSection label="Entries" data-testid="entries" marginTop>
|
|
20
20
|
<Table>
|
|
21
21
|
<thead>
|
|
22
22
|
<TableRow>
|
|
@@ -26,7 +26,7 @@ const Entries = ({ fhirData: items = [] }) => {
|
|
|
26
26
|
<TableHeader>Status</TableHeader>
|
|
27
27
|
</TableRow>
|
|
28
28
|
</thead>
|
|
29
|
-
<tbody>
|
|
29
|
+
<tbody className="border-top-0">
|
|
30
30
|
{items.map((item, idx) => (
|
|
31
31
|
<Entry key={idx} item={item} />
|
|
32
32
|
))}
|
|
@@ -50,7 +50,7 @@ const Entry = props => {
|
|
|
50
50
|
<Reference fhirData={entry} />
|
|
51
51
|
</TableCell>
|
|
52
52
|
<TableCell data-testid="items.date">
|
|
53
|
-
{date ? <Date fhirData={date} /> : <MissingValue />}
|
|
53
|
+
{date ? <Date fhirData={date} isBlack /> : <MissingValue />}
|
|
54
54
|
</TableCell>
|
|
55
55
|
<TableCell data-testid="items.isDeleted">
|
|
56
56
|
{deleted === true ? 'yes' : 'no'}
|
|
@@ -8,11 +8,10 @@ import { getExtension } from './utils';
|
|
|
8
8
|
import {
|
|
9
9
|
Root,
|
|
10
10
|
Header,
|
|
11
|
-
Title,
|
|
12
|
-
Value,
|
|
13
11
|
Body,
|
|
14
12
|
ValueSection,
|
|
15
13
|
Badge,
|
|
14
|
+
ValueSectionItem,
|
|
16
15
|
} from '../../ui';
|
|
17
16
|
import Date from '../../datatypes/Date';
|
|
18
17
|
import Reference from '../../datatypes/Reference';
|
|
@@ -20,6 +19,7 @@ import Entries from './Entries';
|
|
|
20
19
|
import Identifier from '../../datatypes/Identifier/Identifier';
|
|
21
20
|
import CodeableConcept from '../../datatypes/CodeableConcept';
|
|
22
21
|
import DrugTierDefinitionExtension from './DrugTierDefinitionExtension';
|
|
22
|
+
import Accordion from '../../containers/Accordion';
|
|
23
23
|
|
|
24
24
|
const commonDTO = fhirResource => {
|
|
25
25
|
const id = _get(fhirResource, 'id');
|
|
@@ -125,8 +125,13 @@ const resourceDTO = (fhirVersion, fhirResource, withDaVinciPDex) => {
|
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
-
const List =
|
|
129
|
-
|
|
128
|
+
const List = ({
|
|
129
|
+
fhirResource,
|
|
130
|
+
fhirVersion,
|
|
131
|
+
withDaVinciPDex = false,
|
|
132
|
+
fhirIcons,
|
|
133
|
+
onClick,
|
|
134
|
+
}) => {
|
|
130
135
|
let fhirResourceData = {};
|
|
131
136
|
try {
|
|
132
137
|
fhirResourceData = resourceDTO(fhirVersion, fhirResource, withDaVinciPDex);
|
|
@@ -156,95 +161,137 @@ const List = props => {
|
|
|
156
161
|
usdfPlanIDType,
|
|
157
162
|
} = fhirResourceData;
|
|
158
163
|
|
|
164
|
+
const tableData = [
|
|
165
|
+
{
|
|
166
|
+
label: 'Identifier',
|
|
167
|
+
testId: 'identifier',
|
|
168
|
+
data:
|
|
169
|
+
identifier &&
|
|
170
|
+
identifier.map((id, index) => (
|
|
171
|
+
<div key={`identifier-${index}`}>
|
|
172
|
+
<Identifier fhirData={id} />
|
|
173
|
+
</div>
|
|
174
|
+
)),
|
|
175
|
+
status: identifier,
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
label: 'Mode',
|
|
179
|
+
testId: 'mode',
|
|
180
|
+
data: mode,
|
|
181
|
+
status: mode,
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
label: 'code',
|
|
185
|
+
testId: 'code',
|
|
186
|
+
data: code && <CodeableConcept fhirData={code} />,
|
|
187
|
+
status: code,
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
label: 'Subject',
|
|
191
|
+
testId: 'subject',
|
|
192
|
+
data: subject && <Reference fhirData={subject} />,
|
|
193
|
+
status: subject,
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
label: 'Date',
|
|
197
|
+
testId: 'date',
|
|
198
|
+
data: date && <Date fhirData={date} isBlack />,
|
|
199
|
+
status: date,
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
label: 'Source',
|
|
203
|
+
testId: 'source',
|
|
204
|
+
data: source && <Reference fhirData={source} />,
|
|
205
|
+
status: source,
|
|
206
|
+
},
|
|
207
|
+
];
|
|
208
|
+
|
|
209
|
+
const extensionData = [
|
|
210
|
+
{
|
|
211
|
+
label: 'Network',
|
|
212
|
+
testId: 'usdfNetwork',
|
|
213
|
+
data: usdfNetwork,
|
|
214
|
+
status: usdfNetwork,
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
label: 'Summary URL',
|
|
218
|
+
testId: 'usdfSummaryURL',
|
|
219
|
+
data: usdfSummaryURL,
|
|
220
|
+
status: usdfSummaryURL,
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
label: 'Formulary URL',
|
|
224
|
+
testId: 'usdfFormularyURL',
|
|
225
|
+
data: usdfFormularyURL,
|
|
226
|
+
status: usdfFormularyURL,
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
label: 'Email Plan Contact',
|
|
230
|
+
testId: 'usdfEmailPlanContact',
|
|
231
|
+
data: usdfEmailPlanContact,
|
|
232
|
+
status: usdfEmailPlanContact,
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
label: 'Marketing URL',
|
|
236
|
+
testId: 'usdfMarketingURL',
|
|
237
|
+
data: usdfMarketingURL,
|
|
238
|
+
status: usdfMarketingURL,
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
label: 'Plan ID Type',
|
|
242
|
+
testId: 'usdfPlanIDType',
|
|
243
|
+
data: usdfPlanIDType,
|
|
244
|
+
status: usdfPlanIDType,
|
|
245
|
+
},
|
|
246
|
+
];
|
|
247
|
+
|
|
159
248
|
return (
|
|
160
249
|
<Root name="List">
|
|
161
|
-
<
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
</div>
|
|
174
|
-
))}
|
|
175
|
-
</Value>
|
|
176
|
-
)}
|
|
177
|
-
{mode && (
|
|
178
|
-
<Value label="Mode" data-testid="mode">
|
|
179
|
-
{mode}
|
|
180
|
-
</Value>
|
|
181
|
-
)}
|
|
182
|
-
{code && (
|
|
183
|
-
<Value label="code" data-testid="code">
|
|
184
|
-
<CodeableConcept fhirData={code} />
|
|
185
|
-
</Value>
|
|
186
|
-
)}
|
|
187
|
-
{subject && (
|
|
188
|
-
<Value label="Subject" data-testid="subject">
|
|
189
|
-
<Reference fhirData={subject} />
|
|
190
|
-
</Value>
|
|
191
|
-
)}
|
|
192
|
-
{date && (
|
|
193
|
-
<Value label="Date" data-testid="date">
|
|
194
|
-
<Date fhirData={date} />
|
|
195
|
-
</Value>
|
|
196
|
-
)}
|
|
197
|
-
{source && (
|
|
198
|
-
<Value label="Source" data-testid="source">
|
|
199
|
-
<Reference fhirData={source} />
|
|
200
|
-
</Value>
|
|
201
|
-
)}
|
|
202
|
-
{entry && <Entries fhirData={entry} />}
|
|
250
|
+
<Accordion
|
|
251
|
+
headerContent={
|
|
252
|
+
<Header
|
|
253
|
+
resourceName="List"
|
|
254
|
+
title={`${title || 'List'} ${id && id} `}
|
|
255
|
+
badges={status && <Badge data-testid="status">{status}</Badge>}
|
|
256
|
+
icon={fhirIcons}
|
|
257
|
+
/>
|
|
258
|
+
}
|
|
259
|
+
bodyContent={
|
|
260
|
+
<Body tableData={tableData}>
|
|
261
|
+
{entry && <Entries fhirData={entry} />}
|
|
203
262
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
data-testid="usdfDrugTierDefinition"
|
|
210
|
-
/>
|
|
211
|
-
)}
|
|
212
|
-
{usdfNetwork && (
|
|
213
|
-
<Value label="Network" data-testid="usdfNetwork">
|
|
214
|
-
{usdfNetwork}
|
|
215
|
-
</Value>
|
|
216
|
-
)}
|
|
217
|
-
{usdfSummaryURL && (
|
|
218
|
-
<Value label="Summary URL" data-testid="usdfSummaryURL">
|
|
219
|
-
{usdfSummaryURL}
|
|
220
|
-
</Value>
|
|
221
|
-
)}
|
|
222
|
-
{usdfFormularyURL && (
|
|
223
|
-
<Value label="Formulary URL" data-testid="usdfFormularyURL">
|
|
224
|
-
{usdfFormularyURL}
|
|
225
|
-
</Value>
|
|
226
|
-
)}
|
|
227
|
-
{usdfEmailPlanContact && (
|
|
228
|
-
<Value
|
|
229
|
-
label="Email Plan Contact"
|
|
230
|
-
data-testid="usdfEmailPlanContact"
|
|
263
|
+
{hasExtensions && (
|
|
264
|
+
<ValueSection
|
|
265
|
+
label="USDF extensions"
|
|
266
|
+
data-testid="usdfExtensions"
|
|
267
|
+
marginTop
|
|
231
268
|
>
|
|
232
|
-
{
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
269
|
+
{usdfDrugTierDefinition && (
|
|
270
|
+
<DrugTierDefinitionExtension
|
|
271
|
+
drugTierDefinitionExtension={usdfDrugTierDefinition}
|
|
272
|
+
data-testid="usdfDrugTierDefinition"
|
|
273
|
+
/>
|
|
274
|
+
)}
|
|
275
|
+
<ValueSection marginTop>
|
|
276
|
+
{extensionData.map(
|
|
277
|
+
(item, index) =>
|
|
278
|
+
item.status && (
|
|
279
|
+
<ValueSectionItem
|
|
280
|
+
key={`extension-item-${index}`}
|
|
281
|
+
label={item.label}
|
|
282
|
+
data-testid={item.testId}
|
|
283
|
+
>
|
|
284
|
+
{item.data}
|
|
285
|
+
</ValueSectionItem>
|
|
286
|
+
),
|
|
287
|
+
)}
|
|
288
|
+
</ValueSection>
|
|
289
|
+
</ValueSection>
|
|
244
290
|
)}
|
|
245
|
-
</
|
|
246
|
-
|
|
247
|
-
|
|
291
|
+
</Body>
|
|
292
|
+
}
|
|
293
|
+
onClick={onClick}
|
|
294
|
+
/>
|
|
248
295
|
</Root>
|
|
249
296
|
);
|
|
250
297
|
};
|
|
@@ -14,32 +14,65 @@ import example1R4 from '../../../fixtures/r4/resources/list/example1.json';
|
|
|
14
14
|
import example2R4 from '../../../fixtures/r4/resources/list/example2.json';
|
|
15
15
|
import example3R4 from '../../../fixtures/r4/resources/list/example3.json';
|
|
16
16
|
|
|
17
|
+
import fhirIcons from '../../../fixtures/example-icons';
|
|
18
|
+
import ListIcon from '../../../assets/containers/List/list.svg';
|
|
19
|
+
|
|
17
20
|
export default {
|
|
18
21
|
title: 'List',
|
|
19
22
|
};
|
|
20
23
|
|
|
21
24
|
export const DefaultVisualizationDSTU2 = () => {
|
|
22
25
|
const fhirResource = object('Resource', example1Dstu2);
|
|
23
|
-
return
|
|
26
|
+
return (
|
|
27
|
+
<List
|
|
28
|
+
fhirVersion={fhirVersions.DSTU2}
|
|
29
|
+
fhirResource={fhirResource}
|
|
30
|
+
fhirIcons={require('../../../assets/containers/List/list.svg')}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
24
33
|
};
|
|
25
34
|
|
|
26
35
|
export const Example2DSTU2 = () => {
|
|
27
36
|
const fhirResource = object('Resource', example2Dstu2);
|
|
28
|
-
return
|
|
37
|
+
return (
|
|
38
|
+
<List
|
|
39
|
+
fhirVersion={fhirVersions.DSTU2}
|
|
40
|
+
fhirResource={fhirResource}
|
|
41
|
+
fhirIcons={ListIcon}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
29
44
|
};
|
|
30
45
|
export const Example3DSTU2 = () => {
|
|
31
46
|
const fhirResource = object('Resource', example3Dstu2);
|
|
32
|
-
return
|
|
47
|
+
return (
|
|
48
|
+
<List
|
|
49
|
+
fhirVersion={fhirVersions.DSTU2}
|
|
50
|
+
fhirResource={fhirResource}
|
|
51
|
+
fhirIcons={fhirIcons}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
33
54
|
};
|
|
34
55
|
|
|
35
56
|
export const DefaultVisualizationSTU3 = () => {
|
|
36
57
|
const fhirResource = object('Resource', example1Stu3);
|
|
37
|
-
return
|
|
58
|
+
return (
|
|
59
|
+
<List
|
|
60
|
+
fhirVersion={fhirVersions.STU3}
|
|
61
|
+
fhirResource={fhirResource}
|
|
62
|
+
fhirIcons={false}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
38
65
|
};
|
|
39
66
|
|
|
40
67
|
export const Example2STU3 = () => {
|
|
41
68
|
const fhirResource = object('Resource', example2Stu3);
|
|
42
|
-
return
|
|
69
|
+
return (
|
|
70
|
+
<List
|
|
71
|
+
fhirVersion={fhirVersions.STU3}
|
|
72
|
+
fhirResource={fhirResource}
|
|
73
|
+
fhirIcons={'random text'}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
43
76
|
};
|
|
44
77
|
export const Example3STU3 = () => {
|
|
45
78
|
const fhirResource = object('Resource', example3Stu3);
|