fhir-react 0.2.1 → 0.3.0
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/.github/workflows/publish_npmjs.yml +18 -0
- package/.storybook/config.js +9 -3
- package/.storybook/presets.js +1 -0
- package/.storybook/preview-head.html +4 -0
- package/README.md +86 -55
- package/package.json +13 -4
- package/src/assets/common/chevron-right.svg +3 -0
- package/src/assets/containers/AllergyIntolerance/allergy-intolerance.svg +9 -0
- package/src/assets/containers/Appointment/appointment.svg +14 -0
- package/src/assets/containers/CarePlan/care-plan.svg +10 -0
- package/src/assets/containers/CareTeam/care-team.svg +10 -0
- package/src/assets/containers/Claim/claim.svg +6 -0
- package/src/assets/containers/ClaimResponse/claim-response.svg +7 -0
- package/src/assets/containers/Condition/condition.svg +11 -0
- package/src/assets/containers/Device/device.svg +8 -0
- package/src/assets/containers/DiagnosticReport/diagnostic-report.svg +14 -0
- package/src/assets/containers/DocumentReference/document-reference.svg +10 -0
- package/src/assets/containers/Encounter/encounter.svg +10 -0
- package/src/assets/containers/ExplanationOfBenefit/explanation-of-benefit.svg +3 -0
- package/src/assets/containers/FamilyMemberHistory/family-member-history.svg +7 -0
- package/src/assets/containers/Goal/goal.svg +11 -0
- package/src/assets/containers/Immunization/immunization.svg +7 -0
- package/src/assets/containers/List/list.svg +3 -0
- package/src/assets/containers/Location/location.svg +4 -0
- package/src/assets/containers/Medication/medication.svg +5 -0
- package/src/assets/containers/MedicationAdministration/medication-administration.svg +6 -0
- package/src/assets/containers/MedicationKnowledge/medication-knowledge.svg +11 -0
- package/src/assets/containers/MedicationStatement/medication-statement.svg +5 -0
- package/src/assets/containers/Observation/observation.svg +12 -0
- package/src/assets/containers/Practitioner/practitioner.svg +5 -0
- package/src/assets/containers/Procedure/procedure.svg +9 -0
- package/src/assets/containers/Questionnaire/questionnaire.svg +6 -0
- package/src/assets/containers/QuestionnaireResponse/questionnaire-response.svg +6 -0
- package/src/assets/containers/QustionnaireResponse/questionnaire-response.svg +6 -0
- package/src/assets/containers/ResearchStudy/research-study.svg +9 -0
- package/src/assets/containers/ResourceCategory/resource-placeholder.svg +3 -0
- package/src/components/containers/Accordion/Accordion.js +80 -0
- package/src/components/containers/Accordion/Accordion.stories.js +76 -0
- package/src/components/containers/Accordion/index.js +3 -0
- package/src/components/containers/ResourceContainer/ResourceContainer.css +0 -1
- package/src/components/containers/ResourceContainer/ResourceContainer.js +1 -1
- package/src/components/datatypes/AccountBalance/AccountBalance.js +33 -0
- package/src/components/datatypes/AccountBalance/index.js +3 -0
- package/src/components/datatypes/Annotation/Annotation.js +1 -1
- package/src/components/datatypes/Coding/Coding.js +1 -1
- package/src/components/datatypes/Date/Date.js +14 -4
- package/src/components/datatypes/DatePeriod/DatePeriod.js +38 -0
- package/src/components/datatypes/DatePeriod/index.js +3 -0
- package/src/components/datatypes/HeaderIcon/HeaderIcon.js +31 -0
- package/src/components/datatypes/HeaderIcon/index.js +3 -0
- package/src/components/datatypes/HumanName/HumanName.js +6 -21
- package/src/components/datatypes/Reference/Reference.js +3 -6
- package/src/components/resources/AdverseEvent/AdverseEvent.test.js +2 -2
- package/src/components/resources/AllergyIntolerance/AllergyIntolerance.test.js +4 -4
- package/src/components/resources/Appointment/Appointment.js +91 -65
- package/src/components/resources/Appointment/Appointment.test.js +3 -3
- package/src/components/resources/Bundle/Bundle.js +2 -2
- package/src/components/resources/Bundle/Bundle.stories.js +78 -12
- package/src/components/resources/Bundle/Bundle.test.js +3 -0
- package/src/components/resources/CarePlan/CarePlan.test.js +4 -4
- package/src/components/resources/CareTeam/CareTeam.js +13 -14
- package/src/components/resources/CareTeam/CareTeam.test.js +4 -4
- package/src/components/resources/Claim/Claim.test.js +6 -6
- package/src/components/resources/ClaimResponse/ClaimResponse.test.js +6 -6
- package/src/components/resources/Condition/Condition.js +63 -47
- package/src/components/resources/Condition/Condition.stories.js +41 -8
- package/src/components/resources/Condition/Condition.test.js +20 -14
- package/src/components/resources/DiagnosticReport/DiagnosticReport.test.js +5 -7
- package/src/components/resources/DocumentReference/DocumentReference.js +1 -1
- package/src/components/resources/DocumentReference/DocumentReference.test.js +3 -3
- package/src/components/resources/Encounter/Encounter.js +66 -36
- package/src/components/resources/Encounter/EncounterParticipants.js +2 -2
- package/src/components/resources/ExplanationOfBenefit/CareTeam.js +2 -2
- package/src/components/resources/ExplanationOfBenefit/Diagnosis.js +31 -5
- package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +272 -201
- package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.stories.js +12 -0
- package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.test.js +96 -62
- package/src/components/resources/ExplanationOfBenefit/Items.js +2 -2
- package/src/components/resources/ExplanationOfBenefit/PriceLabel.js +20 -0
- package/src/components/resources/ExplanationOfBenefit/Related.js +3 -3
- package/src/components/resources/ExplanationOfBenefit/SupportingInfo.js +14 -3
- package/src/components/resources/ExplanationOfBenefit/TotalGraph.js +68 -0
- package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.js +89 -0
- package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.stories.js +78 -0
- package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.test.js +51 -0
- package/src/components/resources/ExplanationOfBenefitGraph/index.js +3 -0
- package/src/components/resources/Goal/Goal.test.js +1 -1
- package/src/components/resources/Immunization/Immunization.js +125 -94
- package/src/components/resources/Immunization/Immunization.stories.js +23 -4
- package/src/components/resources/Immunization/Immunization.test.js +17 -12
- package/src/components/resources/List/DrugTierDefinitionExtension.js +139 -0
- package/src/components/resources/List/Entries.js +66 -0
- package/src/components/resources/List/List.js +262 -0
- package/src/components/resources/List/List.stories.js +75 -0
- package/src/components/resources/List/List.test.js +95 -0
- package/src/components/resources/List/index.js +3 -0
- package/src/components/resources/List/utils.js +6 -0
- package/src/components/resources/MedicationAdministration/MedicationAdministration.test.js +7 -7
- package/src/components/resources/MedicationDispense/MedicationDispense.test.js +2 -2
- package/src/components/resources/MedicationKnowledge/MedicationKnowledge.js +217 -0
- package/src/components/resources/MedicationKnowledge/MedicationKnowledge.stories.js +78 -0
- package/src/components/resources/MedicationKnowledge/MedicationKnowledge.test.js +69 -0
- package/src/components/resources/MedicationKnowledge/index.js +3 -0
- package/src/components/resources/MedicationKnowledge/utils.js +8 -0
- package/src/components/resources/MedicationRequest/MedicationRequest.test.js +4 -4
- package/src/components/resources/Observation/Observation.js +72 -54
- package/src/components/resources/Observation/Observation.test.js +6 -18
- package/src/components/resources/Observation/ObservationGraph.js +159 -55
- package/src/components/resources/Observation/ObservationGraph.test.js +47 -26
- package/src/components/resources/Patient/Patient.js +79 -97
- package/src/components/resources/Patient/Patient.test.js +10 -10
- package/src/components/resources/Practitioner/Practitioner.js +80 -60
- package/src/components/resources/Practitioner/Practitioner.test.js +4 -4
- package/src/components/resources/Procedure/Procedure.js +99 -87
- package/src/components/resources/Procedure/Procedure.stories.js +8 -6
- package/src/components/resources/Procedure/Procedure.test.js +11 -8
- package/src/components/resources/Questionnaire/Questionnaire.test.js +3 -3
- package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.test.js +5 -5
- package/src/components/resources/ReferralRequest/ReferralRequest.test.js +2 -2
- package/src/components/resources/ResearchStudy/ResearchStudy.test.js +1 -1
- package/src/components/resources/ResourceCategory/ResourceCategory.js +56 -0
- package/src/components/resources/ResourceCategory/ResourceCategory.stories.js +29 -0
- package/src/components/resources/ResourceCategory/ResourceCategory.test.js +101 -0
- package/src/components/resources/ResourceCategory/index.js +3 -0
- package/src/components/supportedFhirResourceList.js +4 -0
- package/src/components/ui/_header.scss +3 -0
- package/src/components/ui/bootstrap-reboot.min.css +2 -22
- package/src/components/ui/index.js +191 -29
- package/src/constants/badge-status.jsx +98 -0
- package/src/fixtures/dstu2/resources/condition/condition.svg +35 -0
- package/src/fixtures/dstu2/resources/immunization/immunization.svg +10 -0
- package/src/fixtures/dstu2/resources/list/example1.json +49 -0
- package/src/fixtures/dstu2/resources/list/example2.json +116 -0
- package/src/fixtures/dstu2/resources/list/example3.json +380 -0
- package/src/fixtures/example-icons.jsx +169 -0
- package/src/fixtures/r4/resources/explanationOfBenefit/c4bbExtendedDiagnosis.json +446 -0
- package/src/fixtures/r4/resources/list/example1.json +45 -0
- package/src/fixtures/r4/resources/list/example2.json +282 -0
- package/src/fixtures/r4/resources/list/example3.json +298 -0
- package/src/fixtures/r4/resources/medicationKnowledge/example1.json +42 -0
- package/src/fixtures/r4/resources/medicationKnowledge/example2.json +59 -0
- package/src/fixtures/r4/resources/medicationKnowledge/example3.json +59 -0
- package/src/fixtures/r4/resources/medicationKnowledge/example4.json +59 -0
- package/src/fixtures/stu3/resources/list/example1.json +46 -0
- package/src/fixtures/stu3/resources/list/example2.json +298 -0
- package/src/fixtures/stu3/resources/list/example3.json +115 -0
- package/src/index.js +6 -1
- package/src/style.scss +176 -0
- package/src/utils/formatDate.js +21 -0
- package/src/utils/formatDate.test.js +22 -0
- package/src/utils/getBadgeColor.js +6 -0
- package/src/utils/getBadgeColor.test.js +14 -0
- package/src/utils/isUrl.js +9 -0
- package/src/utils/isUrl.test.js +12 -0
- package/src/utils.js +7 -0
- package/build/bootstrap-reboot.min.css +0 -414
- package/build/index.js +0 -15
- package/build/style.css +0 -459
- package/src/components/datatypes/HumanName/HumanName.css +0 -15
- package/src/components/datatypes/Reference/Reference.css +0 -8
- package/src/components/resources/Observation/ObservationGraph.css +0 -51
- package/src/components/resources/Patient/Patient.css +0 -19
- package/src/components/ui/index.css +0 -123
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import { Badge, Body, Header, Root } from '../../ui';
|
|
3
2
|
|
|
4
|
-
import
|
|
3
|
+
import Accordion from '../../containers/Accordion';
|
|
4
|
+
import Annotation from '../../datatypes/Annotation';
|
|
5
5
|
import Coding from '../../datatypes/Coding';
|
|
6
|
+
import Date from '../../datatypes/Date';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import Reference from '../../datatypes/Reference';
|
|
6
10
|
import _get from 'lodash/get';
|
|
7
11
|
import _has from 'lodash/has';
|
|
8
|
-
import Date from '../../datatypes/Date';
|
|
9
|
-
import Annotation from '../../datatypes/Annotation';
|
|
10
12
|
import fhirVersions from '../fhirResourceVersions';
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
Root,
|
|
14
|
-
Header,
|
|
15
|
-
Title,
|
|
16
|
-
Badge,
|
|
17
|
-
BadgeSecondary,
|
|
18
|
-
Body,
|
|
19
|
-
Value,
|
|
20
|
-
} from '../../ui';
|
|
13
|
+
import { Value } from '../../ui';
|
|
21
14
|
|
|
22
15
|
const commonDTO = fhirResource => {
|
|
23
16
|
const title =
|
|
@@ -111,13 +104,11 @@ const resourceDTO = (fhirVersion, fhirResource) => {
|
|
|
111
104
|
};
|
|
112
105
|
|
|
113
106
|
const Immunization = props => {
|
|
114
|
-
const { fhirVersion, fhirResource } = props;
|
|
115
|
-
|
|
107
|
+
const { fhirVersion, fhirResource, fhirIcons } = props;
|
|
116
108
|
const {
|
|
117
109
|
title,
|
|
118
110
|
status,
|
|
119
111
|
providedDate,
|
|
120
|
-
reported,
|
|
121
112
|
manufacturerText,
|
|
122
113
|
hasLotNumber,
|
|
123
114
|
lotNumber,
|
|
@@ -134,84 +125,124 @@ const Immunization = props => {
|
|
|
134
125
|
note,
|
|
135
126
|
} = resourceDTO(fhirVersion, fhirResource);
|
|
136
127
|
|
|
128
|
+
const headerIcon = fhirIcons[_get(fhirResource, 'resourceType')];
|
|
129
|
+
const tableData = [
|
|
130
|
+
{
|
|
131
|
+
label: 'Manufacturer Text',
|
|
132
|
+
testId: '',
|
|
133
|
+
data: manufacturerText,
|
|
134
|
+
status: manufacturerText,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
label: 'Manufacturer Text',
|
|
138
|
+
testId: 'lotNumber',
|
|
139
|
+
data: (
|
|
140
|
+
<>
|
|
141
|
+
{lotNumber}
|
|
142
|
+
{lotNumberExpirationDate && (
|
|
143
|
+
<span>
|
|
144
|
+
{' '}
|
|
145
|
+
expires on{' '}
|
|
146
|
+
<Date
|
|
147
|
+
testId="lotNumberExpirationDate"
|
|
148
|
+
fhirData={lotNumberExpirationDate}
|
|
149
|
+
isBlack
|
|
150
|
+
/>
|
|
151
|
+
</span>
|
|
152
|
+
)}
|
|
153
|
+
</>
|
|
154
|
+
),
|
|
155
|
+
status: hasLotNumber,
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
label: 'Dosage',
|
|
159
|
+
testId: 'doseQuantity',
|
|
160
|
+
data:
|
|
161
|
+
doseQuantity &&
|
|
162
|
+
[
|
|
163
|
+
_get(doseQuantity, 'value'),
|
|
164
|
+
_get(doseQuantity, 'unit') || _get(doseQuantity, 'code'),
|
|
165
|
+
].join(' '),
|
|
166
|
+
status: hasDoseQuantity,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
label: 'Patient',
|
|
170
|
+
testId: 'patient',
|
|
171
|
+
data: patient && <Reference fhirData={patient} />,
|
|
172
|
+
status: patient,
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
label: 'Requester',
|
|
176
|
+
testId: 'requester',
|
|
177
|
+
data: requester && <Reference fhirData={requester} />,
|
|
178
|
+
status: requester,
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
label: 'Performer',
|
|
182
|
+
testId: 'performer',
|
|
183
|
+
data: performer && <Reference fhirData={performer} />,
|
|
184
|
+
status: performer,
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
label: 'Note',
|
|
188
|
+
testId: 'note',
|
|
189
|
+
data: note && <Annotation fhirData={note} />,
|
|
190
|
+
status: note,
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
label: 'Route',
|
|
194
|
+
testId: 'route',
|
|
195
|
+
data: hasRoute && route && (
|
|
196
|
+
<>
|
|
197
|
+
{route.map((coding, i) => {
|
|
198
|
+
return (
|
|
199
|
+
<div key={`item-${i}`}>
|
|
200
|
+
<Coding fhirData={coding} />
|
|
201
|
+
</div>
|
|
202
|
+
);
|
|
203
|
+
})}
|
|
204
|
+
</>
|
|
205
|
+
),
|
|
206
|
+
status: hasRoute,
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
label: 'Site',
|
|
210
|
+
testId: 'site',
|
|
211
|
+
data: hasSite && site && (
|
|
212
|
+
<>
|
|
213
|
+
{site.map((coding, i) => {
|
|
214
|
+
return (
|
|
215
|
+
<div key={`item-${i}`}>
|
|
216
|
+
<Coding fhirData={coding} />
|
|
217
|
+
</div>
|
|
218
|
+
);
|
|
219
|
+
})}
|
|
220
|
+
</>
|
|
221
|
+
),
|
|
222
|
+
status: hasSite,
|
|
223
|
+
},
|
|
224
|
+
];
|
|
225
|
+
|
|
137
226
|
return (
|
|
138
227
|
<Root name="Immunization">
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
<span data-testid="lotNumberExpirationDate">
|
|
158
|
-
{' '}
|
|
159
|
-
expires on {lotNumberExpirationDate}
|
|
160
|
-
</span>
|
|
161
|
-
)}
|
|
162
|
-
</Value>
|
|
163
|
-
)}
|
|
164
|
-
{hasDoseQuantity && (
|
|
165
|
-
<Value label="Dosage" data-testid="doseQuantity">
|
|
166
|
-
<div>
|
|
167
|
-
{_get(doseQuantity, 'value')}
|
|
168
|
-
{_get(doseQuantity, 'unit') || _get(doseQuantity, 'code')}
|
|
169
|
-
</div>
|
|
170
|
-
</Value>
|
|
171
|
-
)}
|
|
172
|
-
{patient && (
|
|
173
|
-
<Value label="Patient" data-testid="patient">
|
|
174
|
-
<Reference fhirData={patient} />
|
|
175
|
-
</Value>
|
|
176
|
-
)}
|
|
177
|
-
{requester && (
|
|
178
|
-
<Value label="Requester" data-testid="requester">
|
|
179
|
-
<Reference fhirData={requester} />
|
|
180
|
-
</Value>
|
|
181
|
-
)}
|
|
182
|
-
{performer && (
|
|
183
|
-
<Value label="Performer" data-testid="performer">
|
|
184
|
-
<Reference fhirData={performer} />
|
|
185
|
-
</Value>
|
|
186
|
-
)}
|
|
187
|
-
{note && (
|
|
188
|
-
<Value label="Note" data-testid="note">
|
|
189
|
-
<Annotation fhirData={note} />
|
|
190
|
-
</Value>
|
|
191
|
-
)}
|
|
192
|
-
{hasRoute && (
|
|
193
|
-
<Value label="Route" data-testid="route">
|
|
194
|
-
{route.map((coding, i) => {
|
|
195
|
-
return (
|
|
196
|
-
<div key={`item-${i}`}>
|
|
197
|
-
<Coding fhirData={coding} />
|
|
198
|
-
</div>
|
|
199
|
-
);
|
|
200
|
-
})}
|
|
201
|
-
</Value>
|
|
202
|
-
)}
|
|
203
|
-
{hasSite && (
|
|
204
|
-
<Value label="Site" data-testid="site">
|
|
205
|
-
{site.map((coding, i) => {
|
|
206
|
-
return (
|
|
207
|
-
<div key={`item-${i}`}>
|
|
208
|
-
<Coding fhirData={coding} />
|
|
209
|
-
</div>
|
|
210
|
-
);
|
|
211
|
-
})}
|
|
212
|
-
</Value>
|
|
213
|
-
)}
|
|
214
|
-
</Body>
|
|
228
|
+
<Accordion
|
|
229
|
+
headerContent={
|
|
230
|
+
<Header
|
|
231
|
+
resourceName="Immunization"
|
|
232
|
+
additionalContent={
|
|
233
|
+
providedDate && (
|
|
234
|
+
<Value label="Start date" data-testid="headerStartDate">
|
|
235
|
+
<Date fhirData={providedDate} isBlack />
|
|
236
|
+
</Value>
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
badges={status && <Badge data-testid="status">{status}</Badge>}
|
|
240
|
+
icon={headerIcon}
|
|
241
|
+
title={title}
|
|
242
|
+
/>
|
|
243
|
+
}
|
|
244
|
+
bodyContent={<Body tableData={tableData} />}
|
|
245
|
+
/>
|
|
215
246
|
</Root>
|
|
216
247
|
);
|
|
217
248
|
};
|
|
@@ -10,6 +10,7 @@ import stu3Example from '../../../fixtures/stu3/resources/immunization/example1.
|
|
|
10
10
|
import r4Example1 from '../../../fixtures/r4/resources/immunization/example1.json';
|
|
11
11
|
import r4Example2 from '../../../fixtures/r4/resources/immunization/example2.json';
|
|
12
12
|
import r4Example3 from '../../../fixtures/r4/resources/immunization/example3.json';
|
|
13
|
+
import fhirIcons from '../../../fixtures/example-icons';
|
|
13
14
|
|
|
14
15
|
export default {
|
|
15
16
|
title: 'Immunization',
|
|
@@ -21,6 +22,7 @@ export const DefaultVisualizationDSTU2 = () => {
|
|
|
21
22
|
<Immunization
|
|
22
23
|
fhirResource={fhirResource}
|
|
23
24
|
fhirVersion={fhirVersions.DSTU2}
|
|
25
|
+
fhirIcons={fhirIcons}
|
|
24
26
|
/>
|
|
25
27
|
);
|
|
26
28
|
};
|
|
@@ -31,6 +33,7 @@ export const Example2OfDSTU2 = () => {
|
|
|
31
33
|
<Immunization
|
|
32
34
|
fhirResource={fhirResource}
|
|
33
35
|
fhirVersion={fhirVersions.DSTU2}
|
|
36
|
+
fhirIcons={fhirIcons}
|
|
34
37
|
/>
|
|
35
38
|
);
|
|
36
39
|
};
|
|
@@ -38,25 +41,41 @@ export const Example2OfDSTU2 = () => {
|
|
|
38
41
|
export const ExampleSTU3 = () => {
|
|
39
42
|
const fhirResource = object('Resource', stu3Example);
|
|
40
43
|
return (
|
|
41
|
-
<Immunization
|
|
44
|
+
<Immunization
|
|
45
|
+
fhirResource={fhirResource}
|
|
46
|
+
fhirVersion={fhirVersions.STU3}
|
|
47
|
+
fhirIcons={fhirIcons}
|
|
48
|
+
/>
|
|
42
49
|
);
|
|
43
50
|
};
|
|
44
51
|
|
|
45
52
|
export const Example1R4 = () => {
|
|
46
53
|
const fhirResource = object('Resource', r4Example1);
|
|
47
54
|
return (
|
|
48
|
-
<Immunization
|
|
55
|
+
<Immunization
|
|
56
|
+
fhirResource={fhirResource}
|
|
57
|
+
fhirVersion={fhirVersions.R4}
|
|
58
|
+
fhirIcons={fhirIcons}
|
|
59
|
+
/>
|
|
49
60
|
);
|
|
50
61
|
};
|
|
51
62
|
export const Example2R4 = () => {
|
|
52
63
|
const fhirResource = object('Resource', r4Example2);
|
|
53
64
|
return (
|
|
54
|
-
<Immunization
|
|
65
|
+
<Immunization
|
|
66
|
+
fhirResource={fhirResource}
|
|
67
|
+
fhirVersion={fhirVersions.R4}
|
|
68
|
+
fhirIcons={fhirIcons}
|
|
69
|
+
/>
|
|
55
70
|
);
|
|
56
71
|
};
|
|
57
72
|
export const Example3R4 = () => {
|
|
58
73
|
const fhirResource = object('Resource', r4Example3);
|
|
59
74
|
return (
|
|
60
|
-
<Immunization
|
|
75
|
+
<Immunization
|
|
76
|
+
fhirResource={fhirResource}
|
|
77
|
+
fhirVersion={fhirVersions.R4}
|
|
78
|
+
fhirIcons={fhirIcons}
|
|
79
|
+
/>
|
|
61
80
|
);
|
|
62
81
|
};
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
import fhirVersions from '../fhirResourceVersions';
|
|
5
1
|
import Immunization from './Immunization';
|
|
2
|
+
import React from 'react';
|
|
6
3
|
import dstu2Example from '../../../fixtures/dstu2/resources/immunization/example1.json';
|
|
7
|
-
import
|
|
4
|
+
import fhirVersions from '../fhirResourceVersions';
|
|
8
5
|
import r4Example1 from '../../../fixtures/r4/resources/immunization/example1.json';
|
|
9
6
|
import r4Example2 from '../../../fixtures/r4/resources/immunization/example2.json';
|
|
7
|
+
import { render } from '@testing-library/react';
|
|
8
|
+
import stu3Example from '../../../fixtures/stu3/resources/immunization/example1.json';
|
|
9
|
+
|
|
10
|
+
import fhirIcons from '../../../fixtures/example-icons';
|
|
10
11
|
|
|
11
12
|
describe('should render Immunization component properly', () => {
|
|
12
13
|
it('should render with DSTU2 source data', () => {
|
|
13
14
|
const defaultProps = {
|
|
14
15
|
fhirResource: dstu2Example,
|
|
15
16
|
fhirVersion: fhirVersions.DSTU2,
|
|
17
|
+
fhirIcons: fhirIcons,
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
const { container, getByTestId } = render(
|
|
@@ -23,11 +25,11 @@ describe('should render Immunization component properly', () => {
|
|
|
23
25
|
|
|
24
26
|
expect(getByTestId('title').textContent).toContain('Fluvax');
|
|
25
27
|
|
|
26
|
-
expect(getByTestId('providedDate').textContent).toContain('
|
|
28
|
+
expect(getByTestId('providedDate').textContent).toContain('1/10/2013');
|
|
27
29
|
|
|
28
30
|
expect(getByTestId('lotNumber').textContent).toContain('AAJN11K');
|
|
29
31
|
expect(getByTestId('lotNumberExpirationDate').textContent).toContain(
|
|
30
|
-
'2015
|
|
32
|
+
'2/15/2015',
|
|
31
33
|
);
|
|
32
34
|
|
|
33
35
|
expect(getByTestId('doseQuantity').textContent).toContain('5');
|
|
@@ -53,6 +55,7 @@ describe('should render Immunization component properly', () => {
|
|
|
53
55
|
const defaultProps = {
|
|
54
56
|
fhirResource: stu3Example,
|
|
55
57
|
fhirVersion: fhirVersions.STU3,
|
|
58
|
+
fhirIcons: fhirIcons,
|
|
56
59
|
};
|
|
57
60
|
|
|
58
61
|
const { container, getByTestId } = render(
|
|
@@ -63,11 +66,11 @@ describe('should render Immunization component properly', () => {
|
|
|
63
66
|
|
|
64
67
|
expect(getByTestId('title').textContent).toContain('Fluvax');
|
|
65
68
|
|
|
66
|
-
expect(getByTestId('providedDate').textContent).toContain('
|
|
69
|
+
expect(getByTestId('providedDate').textContent).toContain('1/10/2013');
|
|
67
70
|
|
|
68
71
|
expect(getByTestId('lotNumber').textContent).toContain('AAJN11K');
|
|
69
72
|
expect(getByTestId('lotNumberExpirationDate').textContent).toContain(
|
|
70
|
-
'2015
|
|
73
|
+
'2/15/2015',
|
|
71
74
|
);
|
|
72
75
|
|
|
73
76
|
expect(getByTestId('doseQuantity').textContent).toContain('5');
|
|
@@ -87,6 +90,7 @@ describe('should render Immunization component properly', () => {
|
|
|
87
90
|
const defaultProps = {
|
|
88
91
|
fhirResource: r4Example1,
|
|
89
92
|
fhirVersion: fhirVersions.R4,
|
|
93
|
+
fhirIcons: fhirIcons,
|
|
90
94
|
};
|
|
91
95
|
|
|
92
96
|
const { container, getByTestId } = render(
|
|
@@ -97,11 +101,11 @@ describe('should render Immunization component properly', () => {
|
|
|
97
101
|
|
|
98
102
|
expect(getByTestId('title').textContent).toContain('Fluvax');
|
|
99
103
|
|
|
100
|
-
expect(getByTestId('providedDate').textContent).toContain('
|
|
104
|
+
expect(getByTestId('providedDate').textContent).toContain('1/10/2013');
|
|
101
105
|
|
|
102
106
|
expect(getByTestId('lotNumber').textContent).toContain('AAJN11K');
|
|
103
107
|
expect(getByTestId('lotNumberExpirationDate').textContent).toContain(
|
|
104
|
-
'2015
|
|
108
|
+
'2/15/2015',
|
|
105
109
|
);
|
|
106
110
|
|
|
107
111
|
expect(getByTestId('doseQuantity').textContent).toContain('5');
|
|
@@ -121,6 +125,7 @@ describe('should render Immunization component properly', () => {
|
|
|
121
125
|
const defaultProps = {
|
|
122
126
|
fhirResource: r4Example2,
|
|
123
127
|
fhirVersion: fhirVersions.R4,
|
|
128
|
+
fhirIcons: fhirIcons,
|
|
124
129
|
};
|
|
125
130
|
|
|
126
131
|
const { container, getByTestId, queryByTestId } = render(
|
|
@@ -131,7 +136,7 @@ describe('should render Immunization component properly', () => {
|
|
|
131
136
|
|
|
132
137
|
expect(getByTestId('title').textContent).toContain('DTP');
|
|
133
138
|
|
|
134
|
-
expect(getByTestId('providedDate').textContent).toContain('
|
|
139
|
+
expect(getByTestId('providedDate').textContent).toContain('1/10/2013');
|
|
135
140
|
|
|
136
141
|
expect(getByTestId('patient').textContent).toEqual('Patient/example');
|
|
137
142
|
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import _get from 'lodash/get';
|
|
4
|
+
import { getExtension } from './utils';
|
|
5
|
+
import { ValueSection, Value } from '../../ui';
|
|
6
|
+
import CodeableConcept from '../../datatypes/CodeableConcept';
|
|
7
|
+
import Money from '../../datatypes/Money';
|
|
8
|
+
|
|
9
|
+
const DrugTierDefinitionExtension = props => {
|
|
10
|
+
const dto = drugTierDefinitionExtension => {
|
|
11
|
+
const extensions = _get(drugTierDefinitionExtension, 'extension', []);
|
|
12
|
+
const hasExtensions = extensions.length >= 1;
|
|
13
|
+
|
|
14
|
+
const drugTierID = _get(
|
|
15
|
+
getExtension('drugTierID', extensions),
|
|
16
|
+
'valueCodeableConcept',
|
|
17
|
+
);
|
|
18
|
+
const mailOrder = _get(
|
|
19
|
+
getExtension('mailOrder', extensions),
|
|
20
|
+
'valueBoolean',
|
|
21
|
+
);
|
|
22
|
+
const costSharing = _get(
|
|
23
|
+
getExtension('costSharing', extensions),
|
|
24
|
+
'extension',
|
|
25
|
+
null,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const hasConstSharing = costSharing !== null;
|
|
29
|
+
if (hasConstSharing) {
|
|
30
|
+
const pharmacyType = _get(
|
|
31
|
+
getExtension('pharmacyType', costSharing),
|
|
32
|
+
'valueCodeableConcept',
|
|
33
|
+
);
|
|
34
|
+
const copayAmount = _get(
|
|
35
|
+
getExtension('copayAmount', costSharing),
|
|
36
|
+
'valueMoney',
|
|
37
|
+
);
|
|
38
|
+
const copayOption = _get(
|
|
39
|
+
getExtension('copayOption', costSharing),
|
|
40
|
+
'valueCodeableConcept',
|
|
41
|
+
);
|
|
42
|
+
const coinsuranceRate = _get(
|
|
43
|
+
getExtension('coinsuranceRate', costSharing),
|
|
44
|
+
'valueDecimal',
|
|
45
|
+
);
|
|
46
|
+
const coinsuranceOption = _get(
|
|
47
|
+
getExtension('coinsuranceOption', costSharing),
|
|
48
|
+
'valueCodeableConcept',
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
hasExtensions,
|
|
53
|
+
drugTierID,
|
|
54
|
+
mailOrder,
|
|
55
|
+
hasConstSharing,
|
|
56
|
+
pharmacyType,
|
|
57
|
+
copayAmount,
|
|
58
|
+
copayOption,
|
|
59
|
+
coinsuranceRate,
|
|
60
|
+
coinsuranceOption,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
hasExtensions,
|
|
66
|
+
drugTierID,
|
|
67
|
+
mailOrder,
|
|
68
|
+
hasConstSharing,
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const { drugTierDefinitionExtension } = props;
|
|
73
|
+
const {
|
|
74
|
+
hasExtensions,
|
|
75
|
+
drugTierID,
|
|
76
|
+
mailOrder,
|
|
77
|
+
hasConstSharing,
|
|
78
|
+
pharmacyType,
|
|
79
|
+
copayAmount,
|
|
80
|
+
copayOption,
|
|
81
|
+
coinsuranceRate,
|
|
82
|
+
coinsuranceOption,
|
|
83
|
+
} = dto(drugTierDefinitionExtension);
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
hasExtensions && (
|
|
87
|
+
<ValueSection
|
|
88
|
+
label="Drug Tier Definition"
|
|
89
|
+
data-testid="drugTierDefinition"
|
|
90
|
+
>
|
|
91
|
+
{drugTierID && (
|
|
92
|
+
<Value label="Drug Tier ID" data-testid="drugTierID">
|
|
93
|
+
<CodeableConcept fhirData={drugTierID} />
|
|
94
|
+
</Value>
|
|
95
|
+
)}
|
|
96
|
+
{mailOrder && (
|
|
97
|
+
<Value label="Mail order" data-testid="mailOrder">
|
|
98
|
+
{mailOrder ? 'yes' : 'no'}
|
|
99
|
+
</Value>
|
|
100
|
+
)}
|
|
101
|
+
{hasConstSharing && (
|
|
102
|
+
<ValueSection label="Cost sharing" data-testid="costSharing">
|
|
103
|
+
{pharmacyType && (
|
|
104
|
+
<Value label="Pharmacy Type" data-testid="pharmacyType">
|
|
105
|
+
<CodeableConcept fhirData={pharmacyType} />
|
|
106
|
+
</Value>
|
|
107
|
+
)}
|
|
108
|
+
{copayAmount && (
|
|
109
|
+
<Value label="Copay Amount" data-testid="copayAmount">
|
|
110
|
+
<Money fhirData={copayAmount} />
|
|
111
|
+
</Value>
|
|
112
|
+
)}
|
|
113
|
+
{copayOption && (
|
|
114
|
+
<Value label="Copay Option" data-testid="copayOption">
|
|
115
|
+
<CodeableConcept fhirData={copayOption} />
|
|
116
|
+
</Value>
|
|
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>
|
|
127
|
+
)}
|
|
128
|
+
</ValueSection>
|
|
129
|
+
)}
|
|
130
|
+
</ValueSection>
|
|
131
|
+
)
|
|
132
|
+
);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
DrugTierDefinitionExtension.propTypes = {
|
|
136
|
+
drugTierDefinitionExtension: PropTypes.shape({}).isRequired,
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export default DrugTierDefinitionExtension;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import _get from 'lodash/get';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ValueSection,
|
|
6
|
+
Table,
|
|
7
|
+
TableRow,
|
|
8
|
+
TableHeader,
|
|
9
|
+
TableCell,
|
|
10
|
+
MissingValue,
|
|
11
|
+
} from '../../ui/index';
|
|
12
|
+
import Date from '../../datatypes/Date';
|
|
13
|
+
import CodeableConcept from '../../datatypes/CodeableConcept';
|
|
14
|
+
import Reference from '../../datatypes/Reference';
|
|
15
|
+
|
|
16
|
+
const Entries = ({ fhirData: items = [] }) => {
|
|
17
|
+
if (items.length === 0) return null;
|
|
18
|
+
return (
|
|
19
|
+
<ValueSection label="Entries" data-testid="entries">
|
|
20
|
+
<Table>
|
|
21
|
+
<thead>
|
|
22
|
+
<TableRow>
|
|
23
|
+
<TableHeader>Item</TableHeader>
|
|
24
|
+
<TableHeader>Date</TableHeader>
|
|
25
|
+
<TableHeader>Is deleted</TableHeader>
|
|
26
|
+
<TableHeader>Status</TableHeader>
|
|
27
|
+
</TableRow>
|
|
28
|
+
</thead>
|
|
29
|
+
<tbody>
|
|
30
|
+
{items.map((item, idx) => (
|
|
31
|
+
<Entry key={idx} item={item} />
|
|
32
|
+
))}
|
|
33
|
+
</tbody>
|
|
34
|
+
</Table>
|
|
35
|
+
</ValueSection>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const Entry = props => {
|
|
40
|
+
const { item } = props;
|
|
41
|
+
const flag = _get(item, 'flag');
|
|
42
|
+
const deleted = _get(item, 'deleted');
|
|
43
|
+
const date = _get(item, 'date');
|
|
44
|
+
const entry = _get(item, 'item');
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<>
|
|
48
|
+
<TableRow>
|
|
49
|
+
<TableCell data-testid="items.entry">
|
|
50
|
+
<Reference fhirData={entry} />
|
|
51
|
+
</TableCell>
|
|
52
|
+
<TableCell data-testid="items.date">
|
|
53
|
+
{date ? <Date fhirData={date} /> : <MissingValue />}
|
|
54
|
+
</TableCell>
|
|
55
|
+
<TableCell data-testid="items.isDeleted">
|
|
56
|
+
{deleted === true ? 'yes' : 'no'}
|
|
57
|
+
</TableCell>
|
|
58
|
+
<TableCell data-testid="items.flag">
|
|
59
|
+
{flag ? <CodeableConcept fhirData={flag} /> : <MissingValue />}
|
|
60
|
+
</TableCell>
|
|
61
|
+
</TableRow>
|
|
62
|
+
</>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default Entries;
|