fhir-react 0.2.4 → 0.3.3

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.
Files changed (138) hide show
  1. package/.github/workflows/publish_npmjs.yml +20 -0
  2. package/.storybook/config.js +9 -3
  3. package/.storybook/presets.js +1 -0
  4. package/.storybook/preview-head.html +4 -0
  5. package/README.md +48 -4
  6. package/build/bootstrap-reboot.min.css +2 -22
  7. package/build/index.js +38 -3
  8. package/build/style.css +31 -459
  9. package/package.json +15 -5
  10. package/src/assets/common/chevron-right.svg +3 -0
  11. package/src/assets/containers/AllergyIntolerance/allergy-intolerance.svg +9 -0
  12. package/src/assets/containers/Appointment/appointment.svg +14 -0
  13. package/src/assets/containers/CarePlan/care-plan.svg +10 -0
  14. package/src/assets/containers/CareTeam/care-team.svg +10 -0
  15. package/src/assets/containers/Claim/claim.svg +6 -0
  16. package/src/assets/containers/ClaimResponse/claim-response.svg +7 -0
  17. package/src/assets/containers/Condition/condition.svg +11 -0
  18. package/src/assets/containers/Device/device.svg +8 -0
  19. package/src/assets/containers/DiagnosticReport/diagnostic-report.svg +14 -0
  20. package/src/assets/containers/DocumentReference/document-reference.svg +10 -0
  21. package/src/assets/containers/Encounter/encounter.svg +10 -0
  22. package/src/assets/containers/ExplanationOfBenefit/explanation-of-benefit.svg +3 -0
  23. package/src/assets/containers/FamilyMemberHistory/family-member-history.svg +7 -0
  24. package/src/assets/containers/Goal/goal.svg +11 -0
  25. package/src/assets/containers/Immunization/immunization.svg +7 -0
  26. package/src/assets/containers/List/list.svg +3 -0
  27. package/src/assets/containers/Location/location.svg +4 -0
  28. package/src/assets/containers/Medication/medication.svg +5 -0
  29. package/src/assets/containers/MedicationAdministration/medication-administration.svg +6 -0
  30. package/src/assets/containers/MedicationKnowledge/medication-knowledge.svg +11 -0
  31. package/src/assets/containers/MedicationStatement/medication-statement.svg +5 -0
  32. package/src/assets/containers/Observation/observation.svg +12 -0
  33. package/src/assets/containers/Practitioner/practitioner.svg +5 -0
  34. package/src/assets/containers/Procedure/procedure.svg +9 -0
  35. package/src/assets/containers/Questionnaire/questionnaire.svg +6 -0
  36. package/src/assets/containers/QuestionnaireResponse/questionnaire-response.svg +6 -0
  37. package/src/assets/containers/QustionnaireResponse/questionnaire-response.svg +6 -0
  38. package/src/assets/containers/ResearchStudy/research-study.svg +9 -0
  39. package/src/assets/containers/ResourceCategory/resource-placeholder.svg +3 -0
  40. package/src/components/containers/Accordion/Accordion.js +80 -0
  41. package/src/components/containers/Accordion/Accordion.stories.js +76 -0
  42. package/src/components/containers/Accordion/index.js +3 -0
  43. package/src/components/containers/ResourceContainer/ResourceContainer.css +0 -1
  44. package/src/components/containers/ResourceContainer/ResourceContainer.js +1 -1
  45. package/src/components/datatypes/AccountBalance/AccountBalance.js +33 -0
  46. package/src/components/datatypes/AccountBalance/index.js +3 -0
  47. package/src/components/datatypes/Annotation/Annotation.js +1 -1
  48. package/src/components/datatypes/Date/Date.js +14 -4
  49. package/src/components/datatypes/DatePeriod/DatePeriod.js +38 -0
  50. package/src/components/datatypes/DatePeriod/index.js +3 -0
  51. package/src/components/datatypes/HeaderIcon/HeaderIcon.js +31 -0
  52. package/src/components/datatypes/HeaderIcon/index.js +3 -0
  53. package/src/components/datatypes/HumanName/HumanName.js +6 -21
  54. package/src/components/datatypes/Reference/Reference.js +3 -6
  55. package/src/components/resources/AdverseEvent/AdverseEvent.test.js +2 -2
  56. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.test.js +4 -4
  57. package/src/components/resources/Appointment/Appointment.js +91 -65
  58. package/src/components/resources/Appointment/Appointment.test.js +3 -3
  59. package/src/components/resources/Bundle/Bundle.js +2 -2
  60. package/src/components/resources/Bundle/Bundle.stories.js +78 -12
  61. package/src/components/resources/Bundle/Bundle.test.js +3 -0
  62. package/src/components/resources/CarePlan/CarePlan.test.js +4 -4
  63. package/src/components/resources/CareTeam/CareTeam.js +13 -14
  64. package/src/components/resources/CareTeam/CareTeam.test.js +4 -4
  65. package/src/components/resources/Claim/Claim.test.js +6 -6
  66. package/src/components/resources/ClaimResponse/ClaimResponse.test.js +6 -6
  67. package/src/components/resources/Condition/Condition.js +64 -47
  68. package/src/components/resources/Condition/Condition.stories.js +41 -8
  69. package/src/components/resources/Condition/Condition.test.js +20 -14
  70. package/src/components/resources/DiagnosticReport/DiagnosticReport.test.js +5 -7
  71. package/src/components/resources/DocumentReference/DocumentReference.js +1 -1
  72. package/src/components/resources/DocumentReference/DocumentReference.test.js +3 -3
  73. package/src/components/resources/Encounter/Encounter.js +66 -36
  74. package/src/components/resources/Encounter/EncounterParticipants.js +2 -2
  75. package/src/components/resources/ExplanationOfBenefit/CareTeam.js +2 -2
  76. package/src/components/resources/ExplanationOfBenefit/Diagnosis.js +15 -5
  77. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +285 -203
  78. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.test.js +86 -64
  79. package/src/components/resources/ExplanationOfBenefit/Items.js +2 -2
  80. package/src/components/resources/ExplanationOfBenefit/PriceLabel.js +20 -0
  81. package/src/components/resources/ExplanationOfBenefit/Related.js +3 -3
  82. package/src/components/resources/ExplanationOfBenefit/SupportingInfo.js +32 -6
  83. package/src/components/resources/ExplanationOfBenefit/TotalGraph.js +68 -0
  84. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.js +89 -0
  85. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.stories.js +78 -0
  86. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.test.js +51 -0
  87. package/src/components/resources/ExplanationOfBenefitGraph/index.js +3 -0
  88. package/src/components/resources/Goal/Goal.test.js +1 -1
  89. package/src/components/resources/Immunization/Immunization.js +125 -94
  90. package/src/components/resources/Immunization/Immunization.stories.js +23 -4
  91. package/src/components/resources/Immunization/Immunization.test.js +17 -12
  92. package/src/components/resources/List/List.test.js +3 -3
  93. package/src/components/resources/MedicationAdministration/MedicationAdministration.test.js +7 -7
  94. package/src/components/resources/MedicationDispense/MedicationDispense.test.js +2 -2
  95. package/src/components/resources/MedicationRequest/MedicationRequest.test.js +4 -4
  96. package/src/components/resources/Observation/Observation.js +72 -54
  97. package/src/components/resources/Observation/Observation.test.js +6 -18
  98. package/src/components/resources/Observation/ObservationGraph.js +159 -55
  99. package/src/components/resources/Observation/ObservationGraph.test.js +47 -26
  100. package/src/components/resources/Patient/Patient.js +77 -87
  101. package/src/components/resources/Patient/Patient.test.js +1 -1
  102. package/src/components/resources/Practitioner/Practitioner.js +80 -60
  103. package/src/components/resources/Practitioner/Practitioner.test.js +4 -4
  104. package/src/components/resources/Procedure/Procedure.js +99 -87
  105. package/src/components/resources/Procedure/Procedure.stories.js +8 -6
  106. package/src/components/resources/Procedure/Procedure.test.js +11 -8
  107. package/src/components/resources/Questionnaire/Questionnaire.test.js +3 -3
  108. package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.test.js +5 -5
  109. package/src/components/resources/ReferralRequest/ReferralRequest.test.js +2 -2
  110. package/src/components/resources/ResearchStudy/ResearchStudy.test.js +1 -1
  111. package/src/components/resources/ResourceCategory/ResourceCategory.js +55 -0
  112. package/src/components/resources/ResourceCategory/ResourceCategory.stories.js +29 -0
  113. package/src/components/resources/ResourceCategory/ResourceCategory.test.js +101 -0
  114. package/src/components/resources/ResourceCategory/index.js +3 -0
  115. package/src/components/supportedFhirResourceList.js +2 -0
  116. package/src/components/ui/_header.scss +3 -0
  117. package/src/components/ui/bootstrap-reboot.min.css +2 -22
  118. package/src/components/ui/index.js +191 -29
  119. package/src/constants/badge-status.jsx +98 -0
  120. package/src/fixtures/dstu2/resources/condition/condition.svg +35 -0
  121. package/src/fixtures/dstu2/resources/immunization/immunization.svg +10 -0
  122. package/src/fixtures/example-icons.jsx +169 -0
  123. package/src/fixtures/r4/resources/explanationOfBenefit/c4bbExample.json +18 -2
  124. package/src/index.js +7 -1
  125. package/src/style.scss +176 -0
  126. package/src/utils/formatDate.js +21 -0
  127. package/src/utils/formatDate.test.js +22 -0
  128. package/src/utils/getBadgeColor.js +6 -0
  129. package/src/utils/getBadgeColor.test.js +14 -0
  130. package/src/utils/isUrl.js +9 -0
  131. package/src/utils/isUrl.test.js +12 -0
  132. package/src/utils.js +7 -0
  133. package/webpack.config.js +10 -1
  134. package/src/components/datatypes/HumanName/HumanName.css +0 -15
  135. package/src/components/datatypes/Reference/Reference.css +0 -8
  136. package/src/components/resources/Observation/ObservationGraph.css +0 -51
  137. package/src/components/resources/Patient/Patient.css +0 -19
  138. package/src/components/ui/index.css +0 -123
@@ -1,23 +1,23 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
1
  import Condition from './Condition';
4
- import fhirVersions from '../fhirResourceVersions';
5
-
2
+ import React from 'react';
3
+ import example1ConditionSeverityR4 from '../../../fixtures/r4/resources/condition/example1.json';
4
+ import example2ConditionSeverityR4 from '../../../fixtures/r4/resources/condition/example2.json';
5
+ import example3ConditionSeverityR4 from '../../../fixtures/r4/resources/condition/example3.json';
6
6
  import exampleCondition from '../../../fixtures/dstu2/resources/condition/example.json';
7
- import exampleConditionSeverity from '../../../fixtures/dstu2/resources/condition/example-severity.json';
8
-
9
7
  import exampleConditionSTU3 from '../../../fixtures/stu3/resources/condition/example.json';
8
+ import exampleConditionSeverity from '../../../fixtures/dstu2/resources/condition/example-severity.json';
10
9
  import exampleConditionSeveritySTU3 from '../../../fixtures/stu3/resources/condition/example-severity.json';
10
+ import fhirVersions from '../fhirResourceVersions';
11
+ import { render } from '@testing-library/react';
11
12
 
12
- import example1ConditionSeverityR4 from '../../../fixtures/r4/resources/condition/example1.json';
13
- import example2ConditionSeverityR4 from '../../../fixtures/r4/resources/condition/example2.json';
14
- import example3ConditionSeverityR4 from '../../../fixtures/r4/resources/condition/example3.json';
13
+ import fhirIcons from '../../../fixtures/example-icons';
15
14
 
16
15
  describe('should render component correctly', () => {
17
16
  it('DSTU2 - without severity field', () => {
18
17
  const defaultProps = {
19
18
  fhirResource: exampleCondition,
20
19
  fhirVersion: fhirVersions.DSTU2,
20
+ fhirIcons: fhirIcons,
21
21
  };
22
22
  const { getByTestId, queryAllByTestId } = render(
23
23
  <Condition {...defaultProps} />,
@@ -31,12 +31,13 @@ describe('should render component correctly', () => {
31
31
  const defaultProps = {
32
32
  fhirResource: exampleConditionSeverity,
33
33
  fhirVersion: fhirVersions.DSTU2,
34
+ fhirIcons: fhirIcons,
34
35
  };
35
36
  const { getByTestId } = render(<Condition {...defaultProps} />);
36
37
 
37
38
  expect(getByTestId('clinicalStatus').textContent).toEqual('active');
38
39
  expect(getByTestId('severity').textContent).toEqual('Medium severity');
39
- expect(getByTestId('onsetDate').textContent).toEqual('2015-08-24');
40
+ expect(getByTestId('onsetDate').textContent).toEqual('8/24/2015');
40
41
  expect(getByTestId('asserter').textContent).toEqual(
41
42
  'MOORE, NICKPractitioner/f8fedcd9e6e565a21f457909',
42
43
  );
@@ -46,6 +47,7 @@ describe('should render component correctly', () => {
46
47
  const defaultProps = {
47
48
  fhirResource: exampleConditionSTU3,
48
49
  fhirVersion: fhirVersions.STU3,
50
+ fhirIcons: fhirIcons,
49
51
  };
50
52
  const { getByTestId, queryAllByTestId } = render(
51
53
  <Condition {...defaultProps} />,
@@ -59,6 +61,7 @@ describe('should render component correctly', () => {
59
61
  const defaultProps = {
60
62
  fhirResource: exampleConditionSeveritySTU3,
61
63
  fhirVersion: fhirVersions.STU3,
64
+ fhirIcons: fhirIcons,
62
65
  };
63
66
  const { getByTestId } = render(<Condition {...defaultProps} />);
64
67
 
@@ -66,7 +69,7 @@ describe('should render component correctly', () => {
66
69
  expect(getByTestId('severity').textContent).toEqual(
67
70
  'Moderate to severe severity',
68
71
  );
69
- expect(getByTestId('onsetDate').textContent).toEqual('2013-03-08');
72
+ expect(getByTestId('onsetDate').textContent).toEqual('3/8/2013');
70
73
  expect(getByTestId('asserter').textContent).toEqual('Practitioner/f201');
71
74
  });
72
75
 
@@ -74,6 +77,7 @@ describe('should render component correctly', () => {
74
77
  const defaultProps = {
75
78
  fhirResource: example1ConditionSeverityR4,
76
79
  fhirVersion: fhirVersions.R4,
80
+ fhirIcons: fhirIcons,
77
81
  };
78
82
  const { getByTestId, queryAllByTestId } = render(
79
83
  <Condition {...defaultProps} />,
@@ -81,7 +85,7 @@ describe('should render component correctly', () => {
81
85
 
82
86
  expect(getByTestId('clinicalStatus').textContent).toEqual('active');
83
87
  expect(getByTestId('severity').textContent).toEqual('Severe severity');
84
- expect(getByTestId('onsetDate').textContent).toEqual('2012-05-24');
88
+ expect(getByTestId('onsetDate').textContent).toEqual('5/24/2012');
85
89
  expect(queryAllByTestId('asserter').length).toEqual(0);
86
90
  expect(queryAllByTestId('dateRecorded').length).toEqual(0);
87
91
  });
@@ -90,6 +94,7 @@ describe('should render component correctly', () => {
90
94
  const defaultProps = {
91
95
  fhirResource: example2ConditionSeverityR4,
92
96
  fhirVersion: fhirVersions.R4,
97
+ fhirIcons: fhirIcons,
93
98
  };
94
99
  const { getByTestId, queryAllByTestId } = render(
95
100
  <Condition {...defaultProps} />,
@@ -106,13 +111,14 @@ describe('should render component correctly', () => {
106
111
  const defaultProps = {
107
112
  fhirResource: example3ConditionSeverityR4,
108
113
  fhirVersion: fhirVersions.R4,
114
+ fhirIcons: fhirIcons,
109
115
  };
110
116
  const { getByTestId } = render(<Condition {...defaultProps} />);
111
117
 
112
118
  expect(getByTestId('clinicalStatus').textContent).toEqual('resolved');
113
119
  expect(getByTestId('severity').textContent).toEqual('Mild severity');
114
- expect(getByTestId('onsetDate').textContent).toEqual('2013-04-02');
120
+ expect(getByTestId('onsetDate').textContent).toEqual('4/2/2013');
115
121
  expect(getByTestId('asserter').textContent).toEqual('Practitioner/f201');
116
- expect(getByTestId('dateRecorded').textContent).toEqual('2013-04-04');
122
+ expect(getByTestId('dateRecorded').textContent).toEqual('4/4/2013');
117
123
  });
118
124
  });
@@ -19,12 +19,10 @@ describe('should render component correctly', () => {
19
19
  expect(getByTestId('title').textContent).toContain(
20
20
  'blood count (hemogram)',
21
21
  );
22
- expect(getByTestId('effectiveDateTime').textContent).toContain(
23
- '2013-04-02',
24
- );
22
+ expect(getByTestId('effectiveDateTime').textContent).toContain('4/2/2013');
25
23
 
26
24
  expect(getByTestId('categoryCoding').textContent).toContain('Haematology');
27
- expect(getByTestId('issued').textContent).toContain('2013-05-15');
25
+ expect(getByTestId('issued').textContent).toContain('5/15/2013');
28
26
  expect(getByTestId('performer').textContent).toContain(
29
27
  'University Medical ',
30
28
  );
@@ -40,7 +38,7 @@ describe('should render component correctly', () => {
40
38
  expect(getByTestId('title').textContent).toContain(
41
39
  'blood count (hemogram)',
42
40
  );
43
- expect(getByTestId('issued').textContent).toContain('2013-05-15');
41
+ expect(getByTestId('issued').textContent).toContain('5/15/2013');
44
42
  expect(getByTestId('categoryCoding').textContent).toContain(
45
43
  'Haematology test',
46
44
  );
@@ -60,7 +58,7 @@ describe('should render component correctly', () => {
60
58
  expect(getByTestId('title').textContent).toContain(
61
59
  'blood count (hemogram)',
62
60
  );
63
- expect(getByTestId('issued').textContent).toContain('2013-05-15');
61
+ expect(getByTestId('issued').textContent).toContain('5/15/2013');
64
62
  expect(getByTestId('categoryCoding').textContent).toContain(
65
63
  'Haematology test',
66
64
  );
@@ -78,7 +76,7 @@ describe('should render component correctly', () => {
78
76
  const { getByTestId } = render(<DiagnosticReport {...defaultProps} />);
79
77
 
80
78
  expect(getByTestId('title').textContent).toContain('Culture, MRSA');
81
- expect(getByTestId('issued').textContent).toContain('2009-08-10');
79
+ expect(getByTestId('issued').textContent).toContain('8/10/2009');
82
80
  expect(getByTestId('categoryCoding').textContent).toContain('(MB)');
83
81
 
84
82
  expect(getByTestId('performer').textContent).toContain('Todd Ashby');
@@ -244,7 +244,7 @@ const DocumentReference = props => {
244
244
  return (
245
245
  <Root name="DocumentReference">
246
246
  <Header>
247
- <Title data-testid="description">{description}</Title>
247
+ <Title data-testid="title">{description}</Title>
248
248
  {status && <Badge data-testid="status">{status}</Badge>}
249
249
  {docStatus && (
250
250
  <BadgeSecondary data-testid="docStatus">{docStatus}</BadgeSecondary>
@@ -21,7 +21,7 @@ describe('should render the DocumentReference component properly', () => {
21
21
  expect(getByTestId('title').textContent).toEqual('Physical');
22
22
  expect(getByTestId('status').textContent).toEqual('current');
23
23
  expect(getByTestId('docStatus').textContent).toEqual('preliminary');
24
- expect(getByTestId('createdAt').textContent).toEqual('2005-12-24');
24
+ expect(getByTestId('createdAt').textContent).toEqual('12/24/2005');
25
25
  expect(getByTestId('type').textContent.split(nbspRegex)).toEqual([
26
26
  'Outpatient Note',
27
27
  '(34108-1)',
@@ -70,7 +70,7 @@ describe('should render the DocumentReference component properly', () => {
70
70
  expect(getByTestId('title').textContent).toEqual('Physical');
71
71
  expect(getByTestId('status').textContent).toEqual('current');
72
72
  expect(getByTestId('docStatus').textContent).toEqual('preliminary');
73
- expect(getByTestId('createdAt').textContent).toEqual('2005-12-24');
73
+ expect(getByTestId('createdAt').textContent).toEqual('12/24/2005');
74
74
  expect(getByTestId('type').textContent.split(nbspRegex)).toEqual([
75
75
  'Outpatient Note',
76
76
  '(34108-1)',
@@ -119,7 +119,7 @@ describe('should render the DocumentReference component properly', () => {
119
119
  expect(getByTestId('title').textContent).toEqual('Physical');
120
120
  expect(getByTestId('status').textContent).toEqual('current');
121
121
  expect(queryByTestId('docStatus')).toBeNull();
122
- expect(getByTestId('createdAt').textContent).toEqual('2005-12-24');
122
+ expect(getByTestId('createdAt').textContent).toEqual('12/24/2005');
123
123
  expect(getByTestId('type').textContent.split(nbspRegex)).toEqual([
124
124
  'Outpatient Note',
125
125
  '(34108-1)',
@@ -8,16 +8,9 @@ import UnhandledResourceDataStructure from '../UnhandledResourceDataStructure';
8
8
  import fhirVersions from '../fhirResourceVersions';
9
9
  import DateType from '../../datatypes/Date';
10
10
  import CodableConcept from '../../datatypes/CodeableConcept';
11
+ import Accordion from '../../containers/Accordion';
11
12
 
12
- import {
13
- Root,
14
- Header,
15
- Title,
16
- Body,
17
- Value,
18
- MissingValue,
19
- Badge,
20
- } from '../../ui';
13
+ import { Root, Header, Body, Value, MissingValue, Badge } from '../../ui';
21
14
 
22
15
  const commonDTO = fhirResource => {
23
16
  const resourceStatus = _get(fhirResource, 'status');
@@ -69,11 +62,15 @@ const dstu2DTO = fhirResource => {
69
62
 
70
63
  const stu3DTO = fhirResource => {
71
64
  let periodEnd = _get(fhirResource, 'period.end');
72
- periodEnd = periodEnd ? <DateType fhirData={periodEnd} /> : <MissingValue />;
65
+ periodEnd = periodEnd ? (
66
+ <DateType fhirData={periodEnd} isBlack />
67
+ ) : (
68
+ <MissingValue />
69
+ );
73
70
 
74
71
  let periodStart = _get(fhirResource, 'period.start');
75
72
  periodStart = periodStart ? (
76
- <DateType fhirData={periodStart} />
73
+ <DateType fhirData={periodStart} isBlack />
77
74
  ) : (
78
75
  <MissingValue />
79
76
  );
@@ -82,7 +79,7 @@ const stu3DTO = fhirResource => {
82
79
  const participant = _get(fhirResource, 'participant', []).map(item => {
83
80
  let periodStart = _get(item, 'period.start');
84
81
  if (periodStart) {
85
- periodStart = <DateType fhirData={periodStart} />;
82
+ periodStart = <DateType fhirData={periodStart} isBlack />;
86
83
  }
87
84
  const reference = _get(item, 'individual', {});
88
85
  return {
@@ -103,11 +100,15 @@ const stu3DTO = fhirResource => {
103
100
 
104
101
  const r4DTO = fhirResource => {
105
102
  let periodEnd = _get(fhirResource, 'period.end');
106
- periodEnd = periodEnd ? <DateType fhirData={periodEnd} /> : <MissingValue />;
103
+ periodEnd = periodEnd ? (
104
+ <DateType fhirData={periodEnd} isBlack />
105
+ ) : (
106
+ <MissingValue />
107
+ );
107
108
 
108
109
  let periodStart = _get(fhirResource, 'period.start');
109
110
  periodStart = periodStart ? (
110
- <DateType fhirData={periodStart} />
111
+ <DateType fhirData={periodStart} isBlack />
111
112
  ) : (
112
113
  <MissingValue />
113
114
  );
@@ -115,7 +116,7 @@ const r4DTO = fhirResource => {
115
116
  const participant = _get(fhirResource, 'participant', []).map(item => {
116
117
  let periodStart = _get(item, 'period.start');
117
118
  if (periodStart) {
118
- periodStart = <DateType fhirData={periodStart} />;
119
+ periodStart = <DateType fhirData={periodStart} isBlack />;
119
120
  }
120
121
  const reference = _get(item, 'individual', {});
121
122
  return {
@@ -176,31 +177,60 @@ const Encounter = props => {
176
177
  encounterType,
177
178
  resourceClass,
178
179
  resourceStatus,
180
+ resourceName,
179
181
  participant,
180
182
  } = fhirResourceData;
183
+
184
+ const tableData = [
185
+ {
186
+ label: 'End date',
187
+ testId: 'endDate',
188
+ data: periodEnd,
189
+ status: periodEnd,
190
+ },
191
+ {
192
+ label: 'Type',
193
+ testId: 'encounterType',
194
+ data: encounterType && <CodableConcept fhirData={encounterType} />,
195
+ status: encounterType,
196
+ },
197
+ {
198
+ label: 'Class',
199
+ testId: 'resourceClass',
200
+ data: resourceClass,
201
+ status: resourceClass,
202
+ },
203
+ ];
204
+
181
205
  return (
182
206
  <Root name="encounter">
183
- <Header>
184
- <Title data-testid="title">{locationDisplay}</Title>
185
- {resourceStatus && <Badge>{resourceStatus}</Badge>}
186
- </Header>
187
- <Body>
188
- {periodStart && <Value label="Start date">{periodStart}</Value>}
189
- {periodEnd && <Value label="End date">{periodEnd}</Value>}
190
- {encounterType && (
191
- <Value label="Type" data-testid="encounterType">
192
- <CodableConcept fhirData={encounterType} />
193
- </Value>
194
- )}
195
- {resourceClass && (
196
- <Value label="Class" data-testid="resourceClass">
197
- {resourceClass}
198
- </Value>
199
- )}
200
- {hasParticipant && (
201
- <EncounterParticipants allParticipant={participant} />
202
- )}
203
- </Body>
207
+ <Accordion
208
+ headerContent={
209
+ <Header
210
+ resourceName={resourceName}
211
+ additionalContent={
212
+ periodStart && (
213
+ <Value label="Start date" data-testid="headerStartDate">
214
+ {periodStart}
215
+ </Value>
216
+ )
217
+ }
218
+ badges={
219
+ resourceStatus && (
220
+ <Badge data-testid="status">{resourceStatus}</Badge>
221
+ )
222
+ }
223
+ title={locationDisplay}
224
+ />
225
+ }
226
+ bodyContent={
227
+ <Body tableData={tableData}>
228
+ {hasParticipant && (
229
+ <EncounterParticipants allParticipant={participant} />
230
+ )}
231
+ </Body>
232
+ }
233
+ />
204
234
  </Root>
205
235
  );
206
236
  };
@@ -9,7 +9,7 @@ const EncounterParticipants = props => {
9
9
  />
10
10
  ));
11
11
  return (
12
- <ValueSection label="Participants">
12
+ <ValueSection label="Participants" marginTop>
13
13
  <Table>
14
14
  <thead>
15
15
  <TableRow>
@@ -18,7 +18,7 @@ const EncounterParticipants = props => {
18
18
  <TableHeader>Date</TableHeader>
19
19
  </TableRow>
20
20
  </thead>
21
- <tbody>{allParticipant}</tbody>
21
+ <tbody className="border-top-0">{allParticipant}</tbody>
22
22
  </Table>
23
23
  </ValueSection>
24
24
  );
@@ -13,7 +13,7 @@ import CodeableConcept from '../../datatypes/CodeableConcept';
13
13
 
14
14
  const CareTeam = ({ fhirData: careTeam = [] }) => {
15
15
  return (
16
- <ValueSection label="Team members" data-testid="teamMembers">
16
+ <ValueSection label="Team members" data-testid="teamMembers" marginTop>
17
17
  <Table>
18
18
  <thead>
19
19
  <TableRow>
@@ -23,7 +23,7 @@ const CareTeam = ({ fhirData: careTeam = [] }) => {
23
23
  <TableHeader>Qualification</TableHeader>
24
24
  </TableRow>
25
25
  </thead>
26
- <tbody>
26
+ <tbody className="border-top-0">
27
27
  {careTeam.map((member, idx) => (
28
28
  <TeamMember
29
29
  key={idx}
@@ -18,31 +18,41 @@ const Diagnosis = ({ fhirData }) => {
18
18
  return (
19
19
  <div key={`total-${index}`}>
20
20
  <ValueSection
21
+ dirColumn
21
22
  label={`Diagnosis ${sequence}${id ? ` (id: ${id})` : ''}`}
22
23
  data-testid="diagnosis"
24
+ marginTop
23
25
  >
24
26
  {reference && (
25
- <Value label="Diagnosis" data-testid="reference">
27
+ <Value dirColumn label="Diagnosis" data-testid="reference">
26
28
  <Reference fhirData={reference} />
27
29
  </Value>
28
30
  )}
29
31
  {codeableConcept && (
30
- <Value label="Diagnosis" data-testid="codeableConcept">
32
+ <Value dirColumn label="Diagnosis" data-testid="codeableConcept">
31
33
  <CodeableConcept fhirData={codeableConcept} />
32
34
  </Value>
33
35
  )}
34
36
  {type && (
35
- <Value label="Type" data-testid="diagnosisType">
37
+ <Value dirColumn label="Type" data-testid="diagnosisType">
36
38
  <CodeableConcept fhirData={type} />
37
39
  </Value>
38
40
  )}
39
41
  {onAdmission && (
40
- <Value label="On admission" data-testid="diagnosisOnAdmission">
42
+ <Value
43
+ dirColumn
44
+ label="On admission"
45
+ data-testid="diagnosisOnAdmission"
46
+ >
41
47
  <CodeableConcept fhirData={onAdmission} />
42
48
  </Value>
43
49
  )}
44
50
  {packageCode && (
45
- <Value label="Package code" data-testid="diagnosisPackageCode">
51
+ <Value
52
+ dirColumn
53
+ label="Package code"
54
+ data-testid="diagnosisPackageCode"
55
+ >
46
56
  <CodeableConcept fhirData={packageCode} />
47
57
  </Value>
48
58
  )}