fhir-react 0.2.3 → 0.3.2
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 +20 -0
- package/.storybook/config.js +9 -3
- package/.storybook/presets.js +1 -0
- package/.storybook/preview-head.html +4 -0
- package/README.md +48 -4
- package/build/bootstrap-reboot.min.css +2 -22
- package/build/index.js +38 -3
- package/build/style.css +31 -459
- package/package.json +15 -5
- 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 +64 -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/List.test.js +3 -3
- package/src/components/resources/MedicationAdministration/MedicationAdministration.test.js +7 -7
- package/src/components/resources/MedicationDispense/MedicationDispense.test.js +2 -2
- 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 +77 -87
- package/src/components/resources/Patient/Patient.test.js +1 -1
- 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 +55 -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 +2 -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/example-icons.jsx +169 -0
- package/src/fixtures/r4/resources/explanationOfBenefit/c4bbExtendedDiagnosis.json +446 -0
- package/src/index.js +7 -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/webpack.config.js +10 -1
- 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
|
@@ -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');
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import { Badge, Body, Header, Root } from '../../ui';
|
|
3
2
|
|
|
3
|
+
import Accordion from '../../containers/Accordion';
|
|
4
|
+
import CodeableConcept from '../../datatypes/CodeableConcept';
|
|
5
|
+
import DatePeriod from '../../datatypes/DatePeriod/DatePeriod';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import React from 'react';
|
|
4
8
|
import Reference from '../../datatypes/Reference';
|
|
5
9
|
import _get from 'lodash/get';
|
|
6
10
|
import _has from 'lodash/has';
|
|
7
11
|
import fhirVersions from '../fhirResourceVersions';
|
|
8
|
-
import CodeableConcept from '../../datatypes/CodeableConcept';
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
Root,
|
|
12
|
-
Header,
|
|
13
|
-
Title,
|
|
14
|
-
Badge,
|
|
15
|
-
BadgeSecondary,
|
|
16
|
-
Body,
|
|
17
|
-
Value,
|
|
18
|
-
} from '../../ui';
|
|
19
12
|
|
|
20
13
|
const commonDTO = fhirResource => {
|
|
21
14
|
const codeText =
|
|
@@ -94,7 +87,7 @@ const resourceDTO = (fhirVersion, fhirResource) => {
|
|
|
94
87
|
}
|
|
95
88
|
};
|
|
96
89
|
function Condition(props) {
|
|
97
|
-
const { fhirResource, fhirVersion } = props;
|
|
90
|
+
const { fhirResource, fhirVersion, fhirIcons } = props;
|
|
98
91
|
|
|
99
92
|
const {
|
|
100
93
|
codeText,
|
|
@@ -108,41 +101,65 @@ function Condition(props) {
|
|
|
108
101
|
dateRecorded,
|
|
109
102
|
} = resourceDTO(fhirVersion, fhirResource);
|
|
110
103
|
|
|
104
|
+
const headerIcon = fhirIcons && fhirIcons[_get(fhirResource, 'resourceType')];
|
|
105
|
+
|
|
106
|
+
const tableData = [
|
|
107
|
+
{
|
|
108
|
+
label: 'Asserted by',
|
|
109
|
+
testId: 'asserter',
|
|
110
|
+
data: asserter && <Reference fhirData={asserter} />,
|
|
111
|
+
status: hasAsserter,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
label: 'Anatomical locations',
|
|
115
|
+
testId: 'bodySite',
|
|
116
|
+
data: bodySite && <CodeableConcept fhirData={bodySite} />,
|
|
117
|
+
status: hasBodySite,
|
|
118
|
+
},
|
|
119
|
+
];
|
|
120
|
+
|
|
111
121
|
return (
|
|
112
122
|
<Root name="condition">
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
123
|
+
<Accordion
|
|
124
|
+
headerContent={
|
|
125
|
+
<Header
|
|
126
|
+
resourceName="Condition"
|
|
127
|
+
additionalContent={
|
|
128
|
+
<DatePeriod
|
|
129
|
+
periodBeginLabel="Onset Date"
|
|
130
|
+
periodBeginDate={onsetDateTime}
|
|
131
|
+
periodBeginTestId="onsetDate"
|
|
132
|
+
periodEndLabel="Date recorded"
|
|
133
|
+
periodEndDate={dateRecorded}
|
|
134
|
+
periodEndTestId="dateRecorded"
|
|
135
|
+
/>
|
|
136
|
+
}
|
|
137
|
+
badges={
|
|
138
|
+
<>
|
|
139
|
+
{clinicalStatus && (
|
|
140
|
+
<Badge
|
|
141
|
+
bootstrapAlertType="alert-success"
|
|
142
|
+
data-testid="clinicalStatus"
|
|
143
|
+
>
|
|
144
|
+
{clinicalStatus}
|
|
145
|
+
</Badge>
|
|
146
|
+
)}
|
|
147
|
+
</>
|
|
148
|
+
}
|
|
149
|
+
icon={headerIcon}
|
|
150
|
+
title={codeText}
|
|
151
|
+
rightAdditionalContent={
|
|
152
|
+
severityText && (
|
|
153
|
+
<>
|
|
154
|
+
<div className="ps-2" />
|
|
155
|
+
<Badge data-testid="severity">{severityText} severity</Badge>
|
|
156
|
+
</>
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
/>
|
|
160
|
+
}
|
|
161
|
+
bodyContent={<Body tableData={tableData} />}
|
|
162
|
+
/>
|
|
146
163
|
</Root>
|
|
147
164
|
);
|
|
148
165
|
}
|
|
@@ -15,60 +15,93 @@ import example1ConditionR4 from '../../../fixtures/r4/resources/condition/exampl
|
|
|
15
15
|
import example2ConditionR4 from '../../../fixtures/r4/resources/condition/example2.json';
|
|
16
16
|
import example3ConditionR4 from '../../../fixtures/r4/resources/condition/example3.json';
|
|
17
17
|
|
|
18
|
+
import fhirIcons from '../../../fixtures/example-icons';
|
|
18
19
|
export default { title: 'Condition' };
|
|
19
20
|
|
|
20
21
|
export const DefaultVisualizationDSTU2 = () => {
|
|
21
22
|
const fhirResource = object('Resource', exampleConditionSeverity);
|
|
22
23
|
return (
|
|
23
|
-
<Condition
|
|
24
|
+
<Condition
|
|
25
|
+
fhirResource={fhirResource}
|
|
26
|
+
fhirVersion={fhirVersions.DSTU2}
|
|
27
|
+
fhirIcons={fhirIcons}
|
|
28
|
+
/>
|
|
24
29
|
);
|
|
25
30
|
};
|
|
26
31
|
|
|
27
32
|
export const ExampleWithoutSeverityDSTU2 = () => {
|
|
28
33
|
const fhirResource = object('Resource', exampleCondition);
|
|
29
34
|
return (
|
|
30
|
-
<Condition
|
|
35
|
+
<Condition
|
|
36
|
+
fhirResource={fhirResource}
|
|
37
|
+
fhirVersion={fhirVersions.DSTU2}
|
|
38
|
+
fhirIcons={fhirIcons}
|
|
39
|
+
/>
|
|
31
40
|
);
|
|
32
41
|
};
|
|
33
42
|
|
|
34
43
|
export const Example3OfDSTU2 = () => {
|
|
35
44
|
const fhirResource = object('Resource', example3Condition);
|
|
36
45
|
return (
|
|
37
|
-
<Condition
|
|
46
|
+
<Condition
|
|
47
|
+
fhirResource={fhirResource}
|
|
48
|
+
fhirVersion={fhirVersions.DSTU2}
|
|
49
|
+
fhirIcons={fhirIcons}
|
|
50
|
+
/>
|
|
38
51
|
);
|
|
39
52
|
};
|
|
40
53
|
|
|
41
54
|
export const ExampleWithoutSeveritySTU3 = () => {
|
|
42
55
|
const fhirResource = object('Resource', exampleConditionSTU3);
|
|
43
56
|
return (
|
|
44
|
-
<Condition
|
|
57
|
+
<Condition
|
|
58
|
+
fhirResource={fhirResource}
|
|
59
|
+
fhirVersion={fhirVersions.STU3}
|
|
60
|
+
fhirIcons={fhirIcons}
|
|
61
|
+
/>
|
|
45
62
|
);
|
|
46
63
|
};
|
|
47
64
|
|
|
48
65
|
export const ExampleWithSeveritySTU3 = () => {
|
|
49
66
|
const fhirResource = object('Resource', exampleConditionSeveritySTU3);
|
|
50
67
|
return (
|
|
51
|
-
<Condition
|
|
68
|
+
<Condition
|
|
69
|
+
fhirResource={fhirResource}
|
|
70
|
+
fhirVersion={fhirVersions.STU3}
|
|
71
|
+
fhirIcons={fhirIcons}
|
|
72
|
+
/>
|
|
52
73
|
);
|
|
53
74
|
};
|
|
54
75
|
|
|
55
76
|
export const Example1ofR4 = () => {
|
|
56
77
|
const fhirResource = object('Resource', example1ConditionR4);
|
|
57
78
|
return (
|
|
58
|
-
<Condition
|
|
79
|
+
<Condition
|
|
80
|
+
fhirResource={fhirResource}
|
|
81
|
+
fhirVersion={fhirVersions.R4}
|
|
82
|
+
fhirIcons={fhirIcons}
|
|
83
|
+
/>
|
|
59
84
|
);
|
|
60
85
|
};
|
|
61
86
|
|
|
62
87
|
export const Example2ofR4 = () => {
|
|
63
88
|
const fhirResource = object('Resource', example2ConditionR4);
|
|
64
89
|
return (
|
|
65
|
-
<Condition
|
|
90
|
+
<Condition
|
|
91
|
+
fhirResource={fhirResource}
|
|
92
|
+
fhirVersion={fhirVersions.R4}
|
|
93
|
+
fhirIcons={fhirIcons}
|
|
94
|
+
/>
|
|
66
95
|
);
|
|
67
96
|
};
|
|
68
97
|
|
|
69
98
|
export const Example3ofR4 = () => {
|
|
70
99
|
const fhirResource = object('Resource', example3ConditionR4);
|
|
71
100
|
return (
|
|
72
|
-
<Condition
|
|
101
|
+
<Condition
|
|
102
|
+
fhirResource={fhirResource}
|
|
103
|
+
fhirVersion={fhirVersions.R4}
|
|
104
|
+
fhirIcons={fhirIcons}
|
|
105
|
+
/>
|
|
73
106
|
);
|
|
74
107
|
};
|