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
|
@@ -6,9 +6,7 @@ import fhirVersions from '../fhirResourceVersions';
|
|
|
6
6
|
import {
|
|
7
7
|
Root,
|
|
8
8
|
Header,
|
|
9
|
-
Title,
|
|
10
9
|
Badge,
|
|
11
|
-
BadgeSecondary,
|
|
12
10
|
Body,
|
|
13
11
|
Value,
|
|
14
12
|
ValueSection,
|
|
@@ -23,6 +21,7 @@ import Coding from '../../datatypes/Coding';
|
|
|
23
21
|
import Reference from '../../datatypes/Reference';
|
|
24
22
|
import CodeableConcept from '../../datatypes/CodeableConcept';
|
|
25
23
|
import { isNotEmptyArray } from '../../../utils';
|
|
24
|
+
import Accordion from '../../containers/Accordion';
|
|
26
25
|
|
|
27
26
|
const prepareParticipantData = data => {
|
|
28
27
|
let participantPatient = [];
|
|
@@ -163,71 +162,98 @@ const Appointment = props => {
|
|
|
163
162
|
serviceCategory,
|
|
164
163
|
} = resourceDTO(fhirVersion, fhirResource);
|
|
165
164
|
|
|
165
|
+
const tableData = [
|
|
166
|
+
{
|
|
167
|
+
label: 'Type',
|
|
168
|
+
testId: 'type',
|
|
169
|
+
data:
|
|
170
|
+
isNotEmptyArray(typeCoding) &&
|
|
171
|
+
typeCoding.map((item, i) => (
|
|
172
|
+
<Coding key={`item-${i}`} fhirData={item} />
|
|
173
|
+
)),
|
|
174
|
+
status: isNotEmptyArray(typeCoding),
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
label: 'Duration [min]',
|
|
178
|
+
testId: 'minutesDuration',
|
|
179
|
+
data: minutesDuration,
|
|
180
|
+
status: minutesDuration,
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
label: 'Reason',
|
|
184
|
+
testId: 'reason',
|
|
185
|
+
data: isNotEmptyArray(reason) && <CodeableConcept fhirData={reason} />,
|
|
186
|
+
status: isNotEmptyArray(reason),
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
label: 'Cancelation Reason',
|
|
190
|
+
testId: 'cancelationReason',
|
|
191
|
+
data: isNotEmptyArray(cancelationReason) && (
|
|
192
|
+
<CodeableConcept fhirData={cancelationReason} />
|
|
193
|
+
),
|
|
194
|
+
status: isNotEmptyArray(cancelationReason),
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
label: 'Service Category',
|
|
198
|
+
testId: 'serviceCategory',
|
|
199
|
+
data: isNotEmptyArray(serviceCategory) && (
|
|
200
|
+
<CodeableConcept fhirData={serviceCategory} />
|
|
201
|
+
),
|
|
202
|
+
status: isNotEmptyArray(serviceCategory),
|
|
203
|
+
},
|
|
204
|
+
];
|
|
205
|
+
|
|
166
206
|
return (
|
|
167
207
|
<Root name="Appointment">
|
|
168
|
-
<
|
|
169
|
-
{
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
{
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
<TableCell>{participantPatient}</TableCell>
|
|
218
|
-
<TableCell>{participantPractitioner}</TableCell>
|
|
219
|
-
<TableCell>{participantLocation}</TableCell>
|
|
220
|
-
</TableRow>
|
|
221
|
-
</tbody>
|
|
222
|
-
</Table>
|
|
223
|
-
</ValueSection>
|
|
224
|
-
)}
|
|
225
|
-
{comment && (
|
|
226
|
-
<Value label="Comment" data-testid="comment">
|
|
227
|
-
{comment}
|
|
228
|
-
</Value>
|
|
229
|
-
)}
|
|
230
|
-
</Body>
|
|
208
|
+
<Accordion
|
|
209
|
+
headerContent={
|
|
210
|
+
<Header
|
|
211
|
+
resourceName={fhirResource.resourceName}
|
|
212
|
+
additionalContent={
|
|
213
|
+
start && (
|
|
214
|
+
<Value label="Start date" data-testid="headerStartDate">
|
|
215
|
+
<Date fhirData={start} isBlack />
|
|
216
|
+
</Value>
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
badges={status && <Badge data-testid="status">{status}</Badge>}
|
|
220
|
+
title={description}
|
|
221
|
+
/>
|
|
222
|
+
}
|
|
223
|
+
bodyContent={
|
|
224
|
+
<Body tableData={tableData}>
|
|
225
|
+
{isNotEmptyArray(participant) && (
|
|
226
|
+
<ValueSection
|
|
227
|
+
label="Participant"
|
|
228
|
+
data-testid="participant"
|
|
229
|
+
marginTop
|
|
230
|
+
>
|
|
231
|
+
<Table>
|
|
232
|
+
<thead>
|
|
233
|
+
<TableRow>
|
|
234
|
+
<TableHeader>Patient</TableHeader>
|
|
235
|
+
<TableHeader>Practitioner</TableHeader>
|
|
236
|
+
<TableHeader>Other</TableHeader>
|
|
237
|
+
</TableRow>
|
|
238
|
+
</thead>
|
|
239
|
+
<tbody className="border-top-0">
|
|
240
|
+
<TableRow>
|
|
241
|
+
<TableCell>{participantPatient}</TableCell>
|
|
242
|
+
<TableCell>{participantPractitioner}</TableCell>
|
|
243
|
+
<TableCell>{participantLocation}</TableCell>
|
|
244
|
+
</TableRow>
|
|
245
|
+
</tbody>
|
|
246
|
+
</Table>
|
|
247
|
+
</ValueSection>
|
|
248
|
+
)}
|
|
249
|
+
{comment && (
|
|
250
|
+
<ValueSection label="Comment" data-testid="comment" marginTop>
|
|
251
|
+
<span className="text-secondary">{comment}</span>
|
|
252
|
+
</ValueSection>
|
|
253
|
+
)}
|
|
254
|
+
</Body>
|
|
255
|
+
}
|
|
256
|
+
/>
|
|
231
257
|
</Root>
|
|
232
258
|
);
|
|
233
259
|
};
|
|
@@ -24,7 +24,7 @@ describe('should render component correctly', () => {
|
|
|
24
24
|
'Discussion on the results',
|
|
25
25
|
);
|
|
26
26
|
expect(getByTestId('status').textContent).toEqual('booked');
|
|
27
|
-
expect(getByTestId('
|
|
27
|
+
expect(getByTestId('headerStartDate').textContent).toContain('12/10/2013');
|
|
28
28
|
expect(getByTestId('type').textContent).toContain('General Discussion');
|
|
29
29
|
expect(getByTestId('participant').textContent).toContain(
|
|
30
30
|
'Peter James Chalmers',
|
|
@@ -71,7 +71,7 @@ describe('should render component correctly', () => {
|
|
|
71
71
|
'Discussion on the results',
|
|
72
72
|
);
|
|
73
73
|
expect(getByTestId('status').textContent).toEqual('booked');
|
|
74
|
-
expect(getByTestId('
|
|
74
|
+
expect(getByTestId('headerStartDate').textContent).toContain('12/10/2013');
|
|
75
75
|
|
|
76
76
|
expect(getByTestId('participant').textContent).toContain(
|
|
77
77
|
'Peter James Chalmers',
|
|
@@ -108,7 +108,7 @@ describe('should render component correctly', () => {
|
|
|
108
108
|
'Discussion on the results',
|
|
109
109
|
);
|
|
110
110
|
expect(getByTestId('status').textContent).toEqual('booked');
|
|
111
|
-
expect(getByTestId('
|
|
111
|
+
expect(getByTestId('headerStartDate').textContent).toContain('12/10/2013');
|
|
112
112
|
|
|
113
113
|
expect(getByTestId('participant').textContent).toContain(
|
|
114
114
|
'Peter James Chalmers',
|
|
@@ -9,7 +9,7 @@ import * as FhirResourceTypes from '../../supportedFhirResourceList';
|
|
|
9
9
|
|
|
10
10
|
import './Bundle.css';
|
|
11
11
|
|
|
12
|
-
export default function Bundle(
|
|
12
|
+
export default function Bundle({ fhirResource, fhirVersion, fhirIcons }) {
|
|
13
13
|
const commonDTO = fhirResource => {
|
|
14
14
|
const type = _get(fhirResource, 'type', null);
|
|
15
15
|
const total = _get(fhirResource, 'total');
|
|
@@ -36,7 +36,6 @@ export default function Bundle(props) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
const { fhirResource, fhirVersion } = props;
|
|
40
39
|
let fhirResourceData = {};
|
|
41
40
|
try {
|
|
42
41
|
fhirResourceData = resourceDTO(fhirVersion, fhirResource);
|
|
@@ -79,6 +78,7 @@ export default function Bundle(props) {
|
|
|
79
78
|
<FhirComponent
|
|
80
79
|
fhirResource={resource}
|
|
81
80
|
fhirVersion={fhirVersion}
|
|
81
|
+
fhirIcons={fhirIcons}
|
|
82
82
|
/>
|
|
83
83
|
</div>
|
|
84
84
|
);
|
|
@@ -17,6 +17,8 @@ import r4Example3 from '../../../fixtures/r4/resources/bundle/example3.json';
|
|
|
17
17
|
import r4Example4 from '../../../fixtures/r4/resources/bundle/example4.json';
|
|
18
18
|
import fhirVersions from '../fhirResourceVersions';
|
|
19
19
|
|
|
20
|
+
import fhirIcons from '../../../fixtures/example-icons';
|
|
21
|
+
|
|
20
22
|
export default {
|
|
21
23
|
title: 'Bundle',
|
|
22
24
|
};
|
|
@@ -24,69 +26,133 @@ export default {
|
|
|
24
26
|
export const Example1OfDSTU2 = () => {
|
|
25
27
|
const fhirResource = object('Resource', dstu2Example1);
|
|
26
28
|
return (
|
|
27
|
-
<Bundle
|
|
29
|
+
<Bundle
|
|
30
|
+
fhirResource={fhirResource}
|
|
31
|
+
fhirVersion={fhirVersions.DSTU2}
|
|
32
|
+
fhirIcons={fhirIcons}
|
|
33
|
+
/>
|
|
28
34
|
);
|
|
29
35
|
};
|
|
30
36
|
|
|
31
37
|
export const Example2OfDSTU2 = () => {
|
|
32
38
|
const fhirResource = object('Resource', dstu2Example2);
|
|
33
39
|
return (
|
|
34
|
-
<Bundle
|
|
40
|
+
<Bundle
|
|
41
|
+
fhirResource={fhirResource}
|
|
42
|
+
fhirVersion={fhirVersions.DSTU2}
|
|
43
|
+
fhirIcons={fhirIcons}
|
|
44
|
+
/>
|
|
35
45
|
);
|
|
36
46
|
};
|
|
37
47
|
|
|
38
48
|
export const Example3OfDSTU2 = () => {
|
|
39
49
|
const fhirResource = object('Resource', dstu2Example3);
|
|
40
50
|
return (
|
|
41
|
-
<Bundle
|
|
51
|
+
<Bundle
|
|
52
|
+
fhirResource={fhirResource}
|
|
53
|
+
fhirVersion={fhirVersions.DSTU2}
|
|
54
|
+
fhirIcons={fhirIcons}
|
|
55
|
+
/>
|
|
42
56
|
);
|
|
43
57
|
};
|
|
44
58
|
|
|
45
59
|
export const Example4OfDSTU2 = () => {
|
|
46
60
|
const fhirResource = object('Resource', dstu2Example4);
|
|
47
61
|
return (
|
|
48
|
-
<Bundle
|
|
62
|
+
<Bundle
|
|
63
|
+
fhirResource={fhirResource}
|
|
64
|
+
fhirVersion={fhirVersions.DSTU2}
|
|
65
|
+
fhirIcons={fhirIcons}
|
|
66
|
+
/>
|
|
49
67
|
);
|
|
50
68
|
};
|
|
51
69
|
|
|
52
70
|
export const Example1OfSTU3 = () => {
|
|
53
71
|
const fhirResource = object('Resource', stu3Example1);
|
|
54
|
-
return
|
|
72
|
+
return (
|
|
73
|
+
<Bundle
|
|
74
|
+
fhirResource={fhirResource}
|
|
75
|
+
fhirVersion={fhirVersions.STU3}
|
|
76
|
+
fhirIcons={fhirIcons}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
55
79
|
};
|
|
56
80
|
|
|
57
81
|
export const Example2OfSTU3 = () => {
|
|
58
82
|
const fhirResource = object('Resource', stu3Example2);
|
|
59
|
-
return
|
|
83
|
+
return (
|
|
84
|
+
<Bundle
|
|
85
|
+
fhirResource={fhirResource}
|
|
86
|
+
fhirVersion={fhirVersions.STU3}
|
|
87
|
+
fhirIcons={fhirIcons}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
60
90
|
};
|
|
61
91
|
|
|
62
92
|
export const Example3OfSTU3 = () => {
|
|
63
93
|
const fhirResource = object('Resource', stu3Example3);
|
|
64
|
-
return
|
|
94
|
+
return (
|
|
95
|
+
<Bundle
|
|
96
|
+
fhirResource={fhirResource}
|
|
97
|
+
fhirVersion={fhirVersions.STU3}
|
|
98
|
+
fhirIcons={fhirIcons}
|
|
99
|
+
/>
|
|
100
|
+
);
|
|
65
101
|
};
|
|
66
102
|
|
|
67
103
|
export const Example4OfSTU3 = () => {
|
|
68
104
|
const fhirResource = object('Resource', stu3Example4);
|
|
69
|
-
return
|
|
105
|
+
return (
|
|
106
|
+
<Bundle
|
|
107
|
+
fhirResource={fhirResource}
|
|
108
|
+
fhirVersion={fhirVersions.STU3}
|
|
109
|
+
fhirIcons={fhirIcons}
|
|
110
|
+
/>
|
|
111
|
+
);
|
|
70
112
|
};
|
|
71
113
|
|
|
72
114
|
export const Example1OfR4 = () => {
|
|
73
115
|
const fhirResource = object('Resource', r4Example1);
|
|
74
|
-
return
|
|
116
|
+
return (
|
|
117
|
+
<Bundle
|
|
118
|
+
fhirResource={fhirResource}
|
|
119
|
+
fhirVersion={fhirVersions.R4}
|
|
120
|
+
fhirIcons={fhirIcons}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
75
123
|
};
|
|
76
124
|
|
|
77
125
|
export const Example2OfR4 = () => {
|
|
78
126
|
const fhirResource = object('Resource', r4Example2);
|
|
79
|
-
return
|
|
127
|
+
return (
|
|
128
|
+
<Bundle
|
|
129
|
+
fhirResource={fhirResource}
|
|
130
|
+
fhirVersion={fhirVersions.R4}
|
|
131
|
+
fhirIcons={fhirIcons}
|
|
132
|
+
/>
|
|
133
|
+
);
|
|
80
134
|
};
|
|
81
135
|
|
|
82
136
|
export const Example3OfR4 = () => {
|
|
83
137
|
const fhirResource = object('Resource', r4Example3);
|
|
84
|
-
return
|
|
138
|
+
return (
|
|
139
|
+
<Bundle
|
|
140
|
+
fhirResource={fhirResource}
|
|
141
|
+
fhirVersion={fhirVersions.R4}
|
|
142
|
+
fhirIcons={fhirIcons}
|
|
143
|
+
/>
|
|
144
|
+
);
|
|
85
145
|
};
|
|
86
146
|
|
|
87
147
|
export const Example4OfR4 = () => {
|
|
88
148
|
const fhirResource = object('Resource', r4Example4);
|
|
89
|
-
return
|
|
149
|
+
return (
|
|
150
|
+
<Bundle
|
|
151
|
+
fhirResource={fhirResource}
|
|
152
|
+
fhirVersion={fhirVersions.R4}
|
|
153
|
+
fhirIcons={fhirIcons}
|
|
154
|
+
/>
|
|
155
|
+
);
|
|
90
156
|
};
|
|
91
157
|
|
|
92
158
|
// export const ExampleWithoutFHIRVersionProperty = () => {
|
|
@@ -8,6 +8,8 @@ import dstu2Example2 from '../../../fixtures/dstu2/resources/bundle/example3.jso
|
|
|
8
8
|
import stu3Example1 from '../../../fixtures/stu3/resources/bundle/example1.json';
|
|
9
9
|
import r4Example1 from '../../../fixtures/r4/resources/bundle/example1.json';
|
|
10
10
|
|
|
11
|
+
import fhirIcons from '../../../fixtures/example-icons';
|
|
12
|
+
|
|
11
13
|
describe('Bundle should render component correctly', () => {
|
|
12
14
|
it('should render component correctly with DSTU2 source data', () => {
|
|
13
15
|
const defaultProps = {
|
|
@@ -29,6 +31,7 @@ describe('Bundle should render component correctly', () => {
|
|
|
29
31
|
const defaultProps = {
|
|
30
32
|
fhirVersion: fhirVersions.DSTU2,
|
|
31
33
|
fhirResource: dstu2Example2,
|
|
34
|
+
fhirIcons: fhirIcons,
|
|
32
35
|
};
|
|
33
36
|
const { getByText, getAllByTestId } = render(<Bundle {...defaultProps} />);
|
|
34
37
|
expect(getAllByTestId('title').map(title => title.textContent)).toEqual([
|
|
@@ -42,7 +42,7 @@ describe('should render component correctly', () => {
|
|
|
42
42
|
expect(getByTestId('subject').textContent).toContain('Peter James');
|
|
43
43
|
expect(getByTestId('subject').textContent).toContain('Patient/example');
|
|
44
44
|
expect(getByTestId('author').textContent).toContain('Dr Adam Careful');
|
|
45
|
-
expect(getByTestId('periodEnd').textContent).toEqual('2017
|
|
45
|
+
expect(getByTestId('periodEnd').textContent).toEqual('6/1/2017');
|
|
46
46
|
expect(getByTestId('basedOn').textContent).toEqual(
|
|
47
47
|
'Management of Type 2 Diabetes',
|
|
48
48
|
);
|
|
@@ -67,7 +67,7 @@ describe('should render component correctly', () => {
|
|
|
67
67
|
expect(getByTestId('subject').textContent).toContain('Peter James');
|
|
68
68
|
expect(getByTestId('subject').textContent).toContain('Patient/example');
|
|
69
69
|
expect(getByTestId('author').textContent).toContain('Dr Adam Careful');
|
|
70
|
-
expect(getByTestId('periodEnd').textContent).toEqual('2017
|
|
70
|
+
expect(getByTestId('periodEnd').textContent).toEqual('6/1/2017');
|
|
71
71
|
expect(getByTestId('basedOn').textContent).toEqual(
|
|
72
72
|
'Management of Type 2 Diabetes',
|
|
73
73
|
);
|
|
@@ -89,7 +89,7 @@ describe('should render component correctly', () => {
|
|
|
89
89
|
expect(getByTestId('goals').textContent).toEqual('#goal');
|
|
90
90
|
expect(getByTestId('subject').textContent).toContain('Eve Everywoman');
|
|
91
91
|
expect(getByTestId('subject').textContent).toContain('Patient/1');
|
|
92
|
-
expect(getByTestId('periodStart').textContent).toEqual('2013
|
|
93
|
-
expect(getByTestId('periodEnd').textContent).toEqual('2013
|
|
92
|
+
expect(getByTestId('periodStart').textContent).toEqual('1/1/2013');
|
|
93
|
+
expect(getByTestId('periodEnd').textContent).toEqual('10/1/2013');
|
|
94
94
|
});
|
|
95
95
|
});
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import _get from 'lodash/get';
|
|
5
|
-
import fhirVersions from '../fhirResourceVersions';
|
|
6
|
-
import DateType from '../../datatypes/Date';
|
|
7
|
-
import CodableConcept from '../../datatypes/CodeableConcept';
|
|
8
|
-
import Reference from '../../datatypes/Reference';
|
|
9
|
-
import CareTeamParticipants from './CareTeamParticipants';
|
|
10
|
-
|
|
11
1
|
import {
|
|
12
|
-
Root,
|
|
13
|
-
Header,
|
|
14
|
-
Title,
|
|
15
2
|
Badge,
|
|
16
3
|
Body,
|
|
17
|
-
|
|
4
|
+
Header,
|
|
18
5
|
MissingValue,
|
|
6
|
+
Root,
|
|
7
|
+
Title,
|
|
8
|
+
Value,
|
|
19
9
|
} from '../../ui';
|
|
20
10
|
|
|
11
|
+
import CareTeamParticipants from './CareTeamParticipants';
|
|
12
|
+
import CodableConcept from '../../datatypes/CodeableConcept';
|
|
13
|
+
import DateType from '../../datatypes/Date';
|
|
14
|
+
import PropTypes from 'prop-types';
|
|
15
|
+
import React from 'react';
|
|
16
|
+
import Reference from '../../datatypes/Reference';
|
|
17
|
+
import _get from 'lodash/get';
|
|
18
|
+
import fhirVersions from '../fhirResourceVersions';
|
|
19
|
+
|
|
21
20
|
const commonDTO = fhirResource => {
|
|
22
21
|
// Default value for title - "Care team"
|
|
23
22
|
const name = _get(fhirResource, 'name', 'Care team');
|
|
@@ -24,7 +24,7 @@ describe('should render the CareTeam component properly', () => {
|
|
|
24
24
|
);
|
|
25
25
|
expect(getByTestId('status').textContent).toEqual('active');
|
|
26
26
|
expect(queryByTestId('periodStart')).toBeNull();
|
|
27
|
-
expect(getByTestId('periodEnd').textContent).toEqual('2013
|
|
27
|
+
expect(getByTestId('periodEnd').textContent).toEqual('1/1/2013');
|
|
28
28
|
expect(getByTestId('category').textContent.trim()).toEqual('(encounter)');
|
|
29
29
|
expect(getByTestId('subject').textContent).toContain(
|
|
30
30
|
'Peter James Chalmers',
|
|
@@ -53,7 +53,7 @@ describe('should render the CareTeam component properly', () => {
|
|
|
53
53
|
const periodEnds = getAllByTestId('participant.periodEnd').map(
|
|
54
54
|
n => n.textContent,
|
|
55
55
|
);
|
|
56
|
-
expect(periodEnds).toEqual(['-', '2013
|
|
56
|
+
expect(periodEnds).toEqual(['-', '1/1/2013']);
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
it('should render participants with STU3 source data when structure source data of Participants Role is coding array', () => {
|
|
@@ -83,7 +83,7 @@ describe('should render the CareTeam component properly', () => {
|
|
|
83
83
|
);
|
|
84
84
|
expect(getByTestId('status').textContent).toEqual('active');
|
|
85
85
|
expect(queryByTestId('periodStart')).toBeNull();
|
|
86
|
-
expect(getByTestId('periodEnd').textContent).toEqual('2013
|
|
86
|
+
expect(getByTestId('periodEnd').textContent).toEqual('1/1/2013');
|
|
87
87
|
expect(getByTestId('encounter').textContent).toEqual('Encounter/example');
|
|
88
88
|
expect(getByTestId('category').textContent).toContain(
|
|
89
89
|
'Encounter-focused care team',
|
|
@@ -115,6 +115,6 @@ describe('should render the CareTeam component properly', () => {
|
|
|
115
115
|
const periodEnds = getAllByTestId('participant.periodEnd').map(
|
|
116
116
|
n => n.textContent,
|
|
117
117
|
);
|
|
118
|
-
expect(periodEnds).toEqual(['-', '2013
|
|
118
|
+
expect(periodEnds).toEqual(['-', '1/1/2013']);
|
|
119
119
|
});
|
|
120
120
|
});
|
|
@@ -23,7 +23,7 @@ describe('should render the Claim component properly', () => {
|
|
|
23
23
|
expect(getByTestId('title').textContent).toEqual('Claim #100150');
|
|
24
24
|
expect(getByTestId('use').textContent).toEqual('complete');
|
|
25
25
|
expect(getByTestId('type').textContent).toContain('oral');
|
|
26
|
-
expect(getByTestId('created').textContent).toEqual('2014
|
|
26
|
+
expect(getByTestId('created').textContent).toEqual('8/16/2014');
|
|
27
27
|
expect(getByTestId('priority').textContent).toContain('normal');
|
|
28
28
|
expect(getByTestId('insurer').textContent).toEqual('Organization/2');
|
|
29
29
|
expect(getByTestId('payee.type').textContent).toContain('provider');
|
|
@@ -45,7 +45,7 @@ describe('should render the Claim component properly', () => {
|
|
|
45
45
|
expect(getByTestId('title').textContent).toEqual('Claim #100150');
|
|
46
46
|
expect(getByTestId('use').textContent).toEqual('complete');
|
|
47
47
|
expect(getByTestId('type').textContent).toContain('oral');
|
|
48
|
-
expect(getByTestId('created').textContent).toEqual('2014
|
|
48
|
+
expect(getByTestId('created').textContent).toEqual('8/16/2014');
|
|
49
49
|
expect(getByTestId('priority').textContent).toContain('normal');
|
|
50
50
|
expect(getByTestId('insurer').textContent).toEqual('Organization/2');
|
|
51
51
|
expect(getByTestId('payee.type').textContent).toContain('provider');
|
|
@@ -112,7 +112,7 @@ describe('should render the Claim component properly', () => {
|
|
|
112
112
|
};
|
|
113
113
|
const { getByTestId } = render(<Claim {...defaultProps} />);
|
|
114
114
|
|
|
115
|
-
expect(getByTestId('accident.date').textContent).toEqual('2014
|
|
115
|
+
expect(getByTestId('accident.date').textContent).toEqual('7/9/2014');
|
|
116
116
|
expect(getByTestId('accident.type').textContent).toContain(
|
|
117
117
|
'Sporting Accident',
|
|
118
118
|
);
|
|
@@ -151,7 +151,7 @@ describe('should render the Claim component properly', () => {
|
|
|
151
151
|
const { getByTestId } = render(<Claim {...defaultProps} />);
|
|
152
152
|
|
|
153
153
|
expect(getByTestId('employmentImpacted').textContent).toEqual(
|
|
154
|
-
'2014
|
|
154
|
+
'8/16/2014 - 8/16/2014',
|
|
155
155
|
);
|
|
156
156
|
});
|
|
157
157
|
|
|
@@ -163,7 +163,7 @@ describe('should render the Claim component properly', () => {
|
|
|
163
163
|
const { getByTestId } = render(<Claim {...defaultProps} />);
|
|
164
164
|
|
|
165
165
|
expect(getByTestId('hospitalization').textContent).toEqual(
|
|
166
|
-
'2014
|
|
166
|
+
'8/15/2014 - 8/16/2014',
|
|
167
167
|
);
|
|
168
168
|
});
|
|
169
169
|
|
|
@@ -251,7 +251,7 @@ describe('should render the Claim component properly', () => {
|
|
|
251
251
|
expect(getByTestId('title').textContent).toEqual('Claim #100150');
|
|
252
252
|
expect(getByTestId('use').textContent).toEqual('claim');
|
|
253
253
|
expect(getByTestId('type').textContent).toContain('oral');
|
|
254
|
-
expect(getByTestId('created').textContent).toEqual('2014
|
|
254
|
+
expect(getByTestId('created').textContent).toEqual('8/16/2014');
|
|
255
255
|
expect(getByTestId('priority').textContent).toContain('normal');
|
|
256
256
|
expect(getByTestId('insurer').textContent).toEqual('Organization/2');
|
|
257
257
|
expect(getByTestId('payee.type').textContent).toContain('provider');
|
|
@@ -23,7 +23,7 @@ describe('should render the ClaimResponse component properly', () => {
|
|
|
23
23
|
|
|
24
24
|
expect(getByTestId('title').textContent).toEqual('Claim response #R3500');
|
|
25
25
|
expect(getByTestId('outcome').textContent).toEqual('complete');
|
|
26
|
-
expect(getByTestId('created').textContent).toEqual('2014
|
|
26
|
+
expect(getByTestId('created').textContent).toEqual('8/16/2014');
|
|
27
27
|
expect(getByTestId('disposition').textContent).toEqual(
|
|
28
28
|
'Claim settled as per contract.',
|
|
29
29
|
);
|
|
@@ -40,7 +40,7 @@ describe('should render the ClaimResponse component properly', () => {
|
|
|
40
40
|
expect(
|
|
41
41
|
getByTestId('payment.amount').textContent.replace(nbspRegex, ' '),
|
|
42
42
|
).toEqual('100.47 USD');
|
|
43
|
-
expect(getByTestId('payment.date').textContent).toEqual('2014
|
|
43
|
+
expect(getByTestId('payment.date').textContent).toEqual('8/31/2014');
|
|
44
44
|
expect(
|
|
45
45
|
getByTestId('payment.ref').textContent.replace(nbspRegex, ' '),
|
|
46
46
|
).toEqual('Identifier: 201408-2-1569478');
|
|
@@ -76,7 +76,7 @@ describe('should render the ClaimResponse component properly', () => {
|
|
|
76
76
|
|
|
77
77
|
expect(getByTestId('title').textContent).toEqual('Claim response #R3500');
|
|
78
78
|
expect(getByTestId('outcome').textContent).toEqual('complete');
|
|
79
|
-
expect(getByTestId('created').textContent).toEqual('2014
|
|
79
|
+
expect(getByTestId('created').textContent).toEqual('8/16/2014');
|
|
80
80
|
expect(getByTestId('disposition').textContent).toEqual(
|
|
81
81
|
'Claim settled as per contract.',
|
|
82
82
|
);
|
|
@@ -93,7 +93,7 @@ describe('should render the ClaimResponse component properly', () => {
|
|
|
93
93
|
expect(
|
|
94
94
|
getByTestId('payment.amount').textContent.replace(nbspRegex, ' '),
|
|
95
95
|
).toEqual('100.47 USD');
|
|
96
|
-
expect(getByTestId('payment.date').textContent).toEqual('2014
|
|
96
|
+
expect(getByTestId('payment.date').textContent).toEqual('8/31/2014');
|
|
97
97
|
expect(
|
|
98
98
|
getByTestId('payment.ref').textContent.replace(nbspRegex, ' '),
|
|
99
99
|
).toEqual('Identifier: 201408-2-1569478');
|
|
@@ -169,7 +169,7 @@ describe('should render the ClaimResponse component properly', () => {
|
|
|
169
169
|
expect(getByTestId('title').textContent).toEqual('Claim response #R3500');
|
|
170
170
|
expect(getByTestId('status').textContent).toEqual('active');
|
|
171
171
|
expect(queryByTestId('outcome')).toBeNull();
|
|
172
|
-
expect(getByTestId('created').textContent).toEqual('2014
|
|
172
|
+
expect(getByTestId('created').textContent).toEqual('8/16/2014');
|
|
173
173
|
expect(getByTestId('disposition').textContent).toEqual(
|
|
174
174
|
'Claim settled as per contract.',
|
|
175
175
|
);
|
|
@@ -189,7 +189,7 @@ describe('should render the ClaimResponse component properly', () => {
|
|
|
189
189
|
expect(
|
|
190
190
|
getByTestId('payment.amount').textContent.replace(nbspRegex, ' '),
|
|
191
191
|
).toEqual('100.47 USD');
|
|
192
|
-
expect(getByTestId('payment.date').textContent).toEqual('2014
|
|
192
|
+
expect(getByTestId('payment.date').textContent).toEqual('8/31/2014');
|
|
193
193
|
expect(
|
|
194
194
|
getByTestId('payment.ref').textContent.replace(nbspRegex, ' '),
|
|
195
195
|
).toEqual('Identifier: 201408-2-1569478');
|