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
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
3
3
|
import Generic from './Generic';
|
|
4
|
+
import fhirIcons from '../../../fixtures/example-icons';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
describe('should render the Generic component properly', () => {
|
|
6
7
|
const exampleResource = {
|
|
7
8
|
resourceType: 'UnknownResource',
|
|
8
9
|
id: '12345',
|
|
@@ -10,10 +11,28 @@ it('should render component correctly', () => {
|
|
|
10
11
|
text: 'Resource code text',
|
|
11
12
|
},
|
|
12
13
|
};
|
|
13
|
-
const { container, getByTestId } = render(
|
|
14
|
-
<Generic fhirResource={exampleResource} />,
|
|
15
|
-
);
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
it('should render component correctly', () => {
|
|
16
|
+
const { container, getByTestId, getByAltText } = render(
|
|
17
|
+
<Generic fhirResource={exampleResource} fhirIcons={fhirIcons} />,
|
|
18
|
+
);
|
|
19
|
+
const headerIcon = getByAltText('generic');
|
|
20
|
+
|
|
21
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
22
|
+
expect(getByTestId('title').textContent).toEqual('UnknownResource/12345');
|
|
23
|
+
expect(container.textContent).toContain('Resource code text');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('should fire custom onClick function', () => {
|
|
27
|
+
const onClick = jest.fn();
|
|
28
|
+
const { getByRole } = render(
|
|
29
|
+
<Generic fhirResource={exampleResource} onClick={onClick} />,
|
|
30
|
+
);
|
|
31
|
+
const accordion = getByRole('button');
|
|
32
|
+
fireEvent.click(accordion);
|
|
33
|
+
|
|
34
|
+
const attribute = accordion.getAttribute('data-bs-toggle');
|
|
35
|
+
expect(attribute).not.toEqual('collapse');
|
|
36
|
+
expect(onClick).toHaveBeenCalled();
|
|
37
|
+
});
|
|
19
38
|
});
|
|
@@ -99,9 +99,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
|
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
101
|
|
|
102
|
-
const Goal =
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
const Goal = ({
|
|
103
|
+
fhirResource,
|
|
104
|
+
fhirVersion,
|
|
105
|
+
fhirIcons,
|
|
106
|
+
onClick,
|
|
107
|
+
rawOnClick,
|
|
108
|
+
}) => {
|
|
105
109
|
let fhirResourceData = {};
|
|
106
110
|
try {
|
|
107
111
|
fhirResourceData = resourceDTO(fhirVersion, fhirResource);
|
|
@@ -229,6 +233,8 @@ const Goal = props => {
|
|
|
229
233
|
/>
|
|
230
234
|
}
|
|
231
235
|
bodyContent={<Body tableData={tableData} />}
|
|
236
|
+
onClick={onClick}
|
|
237
|
+
rawOnClick={rawOnClick}
|
|
232
238
|
/>
|
|
233
239
|
</Root>
|
|
234
240
|
);
|
|
@@ -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';
|
|
@@ -187,4 +187,35 @@ describe('should render Goal component properly', () => {
|
|
|
187
187
|
|
|
188
188
|
expect(queryByTestId('priority')).toBeNull();
|
|
189
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
|
+
});
|
|
190
221
|
});
|
|
@@ -103,8 +103,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
|
|
106
|
-
const Immunization =
|
|
107
|
-
|
|
106
|
+
const Immunization = ({
|
|
107
|
+
fhirVersion,
|
|
108
|
+
fhirResource,
|
|
109
|
+
fhirIcons,
|
|
110
|
+
onClick,
|
|
111
|
+
rawOnClick,
|
|
112
|
+
}) => {
|
|
108
113
|
const {
|
|
109
114
|
title,
|
|
110
115
|
status,
|
|
@@ -241,6 +246,8 @@ const Immunization = props => {
|
|
|
241
246
|
/>
|
|
242
247
|
}
|
|
243
248
|
bodyContent={<Body tableData={tableData} />}
|
|
249
|
+
onClick={onClick}
|
|
250
|
+
rawOnClick={rawOnClick}
|
|
244
251
|
/>
|
|
245
252
|
</Root>
|
|
246
253
|
);
|
|
@@ -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,14 @@ 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
|
+
rawOnClick,
|
|
135
|
+
}) => {
|
|
130
136
|
let fhirResourceData = {};
|
|
131
137
|
try {
|
|
132
138
|
fhirResourceData = resourceDTO(fhirVersion, fhirResource, withDaVinciPDex);
|
|
@@ -156,95 +162,138 @@ const List = props => {
|
|
|
156
162
|
usdfPlanIDType,
|
|
157
163
|
} = fhirResourceData;
|
|
158
164
|
|
|
165
|
+
const tableData = [
|
|
166
|
+
{
|
|
167
|
+
label: 'Identifier',
|
|
168
|
+
testId: 'identifier',
|
|
169
|
+
data:
|
|
170
|
+
identifier &&
|
|
171
|
+
identifier.map((id, index) => (
|
|
172
|
+
<div key={`identifier-${index}`}>
|
|
173
|
+
<Identifier fhirData={id} />
|
|
174
|
+
</div>
|
|
175
|
+
)),
|
|
176
|
+
status: identifier,
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
label: 'Mode',
|
|
180
|
+
testId: 'mode',
|
|
181
|
+
data: mode,
|
|
182
|
+
status: mode,
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
label: 'code',
|
|
186
|
+
testId: 'code',
|
|
187
|
+
data: code && <CodeableConcept fhirData={code} />,
|
|
188
|
+
status: code,
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
label: 'Subject',
|
|
192
|
+
testId: 'subject',
|
|
193
|
+
data: subject && <Reference fhirData={subject} />,
|
|
194
|
+
status: subject,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
label: 'Date',
|
|
198
|
+
testId: 'date',
|
|
199
|
+
data: date && <Date fhirData={date} isBlack />,
|
|
200
|
+
status: date,
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
label: 'Source',
|
|
204
|
+
testId: 'source',
|
|
205
|
+
data: source && <Reference fhirData={source} />,
|
|
206
|
+
status: source,
|
|
207
|
+
},
|
|
208
|
+
];
|
|
209
|
+
|
|
210
|
+
const extensionData = [
|
|
211
|
+
{
|
|
212
|
+
label: 'Network',
|
|
213
|
+
testId: 'usdfNetwork',
|
|
214
|
+
data: usdfNetwork,
|
|
215
|
+
status: usdfNetwork,
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
label: 'Summary URL',
|
|
219
|
+
testId: 'usdfSummaryURL',
|
|
220
|
+
data: usdfSummaryURL,
|
|
221
|
+
status: usdfSummaryURL,
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
label: 'Formulary URL',
|
|
225
|
+
testId: 'usdfFormularyURL',
|
|
226
|
+
data: usdfFormularyURL,
|
|
227
|
+
status: usdfFormularyURL,
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
label: 'Email Plan Contact',
|
|
231
|
+
testId: 'usdfEmailPlanContact',
|
|
232
|
+
data: usdfEmailPlanContact,
|
|
233
|
+
status: usdfEmailPlanContact,
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
label: 'Marketing URL',
|
|
237
|
+
testId: 'usdfMarketingURL',
|
|
238
|
+
data: usdfMarketingURL,
|
|
239
|
+
status: usdfMarketingURL,
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
label: 'Plan ID Type',
|
|
243
|
+
testId: 'usdfPlanIDType',
|
|
244
|
+
data: usdfPlanIDType,
|
|
245
|
+
status: usdfPlanIDType,
|
|
246
|
+
},
|
|
247
|
+
];
|
|
248
|
+
|
|
159
249
|
return (
|
|
160
250
|
<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} />}
|
|
251
|
+
<Accordion
|
|
252
|
+
headerContent={
|
|
253
|
+
<Header
|
|
254
|
+
resourceName="List"
|
|
255
|
+
title={`${title || 'List'} ${id && id} `}
|
|
256
|
+
badges={status && <Badge data-testid="status">{status}</Badge>}
|
|
257
|
+
icon={fhirIcons}
|
|
258
|
+
/>
|
|
259
|
+
}
|
|
260
|
+
bodyContent={
|
|
261
|
+
<Body tableData={tableData}>
|
|
262
|
+
{entry && <Entries fhirData={entry} />}
|
|
203
263
|
|
|
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"
|
|
264
|
+
{hasExtensions && (
|
|
265
|
+
<ValueSection
|
|
266
|
+
label="USDF extensions"
|
|
267
|
+
data-testid="usdfExtensions"
|
|
268
|
+
marginTop
|
|
231
269
|
>
|
|
232
|
-
{
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
270
|
+
{usdfDrugTierDefinition && (
|
|
271
|
+
<DrugTierDefinitionExtension
|
|
272
|
+
drugTierDefinitionExtension={usdfDrugTierDefinition}
|
|
273
|
+
data-testid="usdfDrugTierDefinition"
|
|
274
|
+
/>
|
|
275
|
+
)}
|
|
276
|
+
<ValueSection marginTop>
|
|
277
|
+
{extensionData.map(
|
|
278
|
+
(item, index) =>
|
|
279
|
+
item.status && (
|
|
280
|
+
<ValueSectionItem
|
|
281
|
+
key={`extension-item-${index}`}
|
|
282
|
+
label={item.label}
|
|
283
|
+
data-testid={item.testId}
|
|
284
|
+
>
|
|
285
|
+
{item.data}
|
|
286
|
+
</ValueSectionItem>
|
|
287
|
+
),
|
|
288
|
+
)}
|
|
289
|
+
</ValueSection>
|
|
290
|
+
</ValueSection>
|
|
244
291
|
)}
|
|
245
|
-
</
|
|
246
|
-
|
|
247
|
-
|
|
292
|
+
</Body>
|
|
293
|
+
}
|
|
294
|
+
onClick={onClick}
|
|
295
|
+
rawOnClick={rawOnClick}
|
|
296
|
+
/>
|
|
248
297
|
</Root>
|
|
249
298
|
);
|
|
250
299
|
};
|
|
@@ -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);
|