fhir-react 0.3.1 → 0.3.5

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 (83) hide show
  1. package/README.md +85 -2
  2. package/build/bootstrap-reboot.min.css +8 -2
  3. package/build/index.js +7 -14
  4. package/build/style.css +26 -239
  5. package/package.json +3 -2
  6. package/src/assets/containers/Binary/binary.svg +9 -0
  7. package/src/assets/containers/Patient/patient.svg +6 -0
  8. package/src/components/containers/Accordion/Accordion.js +17 -12
  9. package/src/components/datatypes/Annotation/Annotation.js +4 -4
  10. package/src/components/datatypes/CodeableConcept/CodeableConcept.css +4 -1
  11. package/src/components/datatypes/Coding/Coding.css +0 -1
  12. package/src/components/datatypes/HeaderIcon/HeaderIcon.js +67 -22
  13. package/src/components/datatypes/Reference/Reference.css +3 -0
  14. package/src/components/datatypes/Reference/Reference.js +2 -0
  15. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.js +87 -76
  16. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.stories.js +11 -1
  17. package/src/components/resources/Appointment/Appointment.js +3 -3
  18. package/src/components/resources/Appointment/Appointment.stories.js +28 -5
  19. package/src/components/resources/Appointment/Appointment.test.js +72 -0
  20. package/src/components/resources/Binary/Binary.js +31 -20
  21. package/src/components/resources/Binary/Binary.stories.js +6 -5
  22. package/src/components/resources/CarePlan/CarePlan.js +111 -96
  23. package/src/components/resources/CarePlan/CarePlan.test.js +2 -2
  24. package/src/components/resources/CarePlan/CarePlanActivity.js +6 -2
  25. package/src/components/resources/Condition/Condition.js +1 -2
  26. package/src/components/resources/Condition/Condition.stories.js +9 -19
  27. package/src/components/resources/Condition/Condition.test.js +71 -1
  28. package/src/components/resources/Device/Device.js +54 -34
  29. package/src/components/resources/DiagnosticReport/DiagnosticReport.js +53 -43
  30. package/src/components/resources/DiagnosticReport/DiagnosticReport.stories.js +7 -1
  31. package/src/components/resources/DocumentReference/DocumentReference.js +101 -65
  32. package/src/components/resources/DocumentReference/DocumentReference.stories.js +4 -0
  33. package/src/components/resources/Encounter/Encounter.js +3 -4
  34. package/src/components/resources/Encounter/Encounter.stories.js +27 -5
  35. package/src/components/resources/Encounter/Encounter.test.js +72 -0
  36. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +26 -10
  37. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.stories.js +8 -0
  38. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.test.js +80 -3
  39. package/src/components/resources/ExplanationOfBenefit/SupportingInfo.js +21 -6
  40. package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.js +47 -38
  41. package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.stories.js +4 -0
  42. package/src/components/resources/Goal/Goal.js +104 -85
  43. package/src/components/resources/Goal/Goal.stories.js +37 -7
  44. package/src/components/resources/Goal/Goal.test.js +1 -3
  45. package/src/components/resources/Immunization/Immunization.js +1 -2
  46. package/src/components/resources/Immunization/Immunization.stories.js +6 -9
  47. package/src/components/resources/Immunization/Immunization.test.js +71 -1
  48. package/src/components/resources/MedicationOrder/MedicationOrder.js +45 -28
  49. package/src/components/resources/MedicationOrder/MedicationOrder.stories.js +2 -1
  50. package/src/components/resources/MedicationRequest/MedicationRequest.js +65 -43
  51. package/src/components/resources/MedicationRequest/MedicationRequest.stories.js +16 -5
  52. package/src/components/resources/MedicationStatement/MedicationDetails.js +52 -0
  53. package/src/components/resources/MedicationStatement/MedicationDosage.js +46 -0
  54. package/src/components/resources/MedicationStatement/MedicationStatement.js +65 -118
  55. package/src/components/resources/MedicationStatement/MedicationStatement.stories.js +6 -0
  56. package/src/components/resources/MedicationStatement/MedicationStatement.test.js +31 -6
  57. package/src/components/resources/Observation/Observation.js +3 -3
  58. package/src/components/resources/Observation/Observation.stories.js +14 -5
  59. package/src/components/resources/Observation/Observation.test.js +67 -0
  60. package/src/components/resources/Patient/Patient.js +9 -6
  61. package/src/components/resources/Patient/Patient.stories.js +12 -5
  62. package/src/components/resources/Patient/Patient.test.js +67 -0
  63. package/src/components/resources/Practitioner/Practitioner.js +3 -13
  64. package/src/components/resources/Practitioner/Practitioner.stories.js +19 -3
  65. package/src/components/resources/Practitioner/Practitioner.test.js +72 -0
  66. package/src/components/resources/Procedure/Procedure.js +1 -2
  67. package/src/components/resources/Procedure/Procedure.stories.js +11 -5
  68. package/src/components/resources/Procedure/Procedure.test.js +71 -1
  69. package/src/components/resources/ResourceCategory/ResourceCategory.js +6 -3
  70. package/src/components/resources/ResourceCategory/ResourceCategory.test.js +1 -1
  71. package/src/components/supportedFhirResourceList.js +2 -0
  72. package/src/components/ui/bootstrap-reboot.min.css +8 -2
  73. package/src/components/ui/index.js +44 -25
  74. package/src/fixtures/example-icons.jsx +55 -10
  75. package/src/fixtures/r4/resources/explanationOfBenefit/c4bbExample.json +18 -2
  76. package/src/index.js +1 -0
  77. package/src/style.scss +1 -0
  78. package/src/utils/convertCamelCaseToSentence.js +9 -0
  79. package/src/utils/convertCamelCaseToSentence.test.js +9 -0
  80. package/src/utils/formatDate.js +6 -4
  81. package/webpack.config.js +10 -1
  82. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.css +0 -4
  83. package/src/components/resources/CarePlan/CarePlan.css +0 -7
@@ -11,13 +11,12 @@ import UnhandledResourceDataStructure from '../UnhandledResourceDataStructure';
11
11
  import {
12
12
  Root,
13
13
  Header,
14
- Title,
15
14
  Badge,
16
- BadgeSecondary,
17
15
  Body,
18
- Value,
19
16
  MissingValue,
17
+ ValueSectionItem,
20
18
  } from '../../ui';
19
+ import Accordion from '../../containers/Accordion';
21
20
 
22
21
  const commonDTO = fhirResource => {
23
22
  const model = _get(fhirResource, 'model', 'Device');
@@ -103,8 +102,7 @@ const resourceDTO = (fhirVersion, fhirResource) => {
103
102
  }
104
103
  };
105
104
 
106
- const Device = props => {
107
- const { fhirResource, fhirVersion } = props;
105
+ const Device = ({ fhirResource, fhirVersion, fhirIcons }) => {
108
106
  let fhirResourceData = {};
109
107
  try {
110
108
  fhirResourceData = resourceDTO(fhirVersion, fhirResource);
@@ -130,35 +128,57 @@ const Device = props => {
130
128
  const safetyArr = hasSafety && !Array.isArray(safety) ? [safety] : safety;
131
129
  return (
132
130
  <Root name="Device">
133
- <Header>
134
- {model && <Title>{model}</Title>}
135
- {status && <Badge data-testid="status">{status}</Badge>}
136
- {hasExpiry && (
137
- <BadgeSecondary data-testid="expiry">
138
- expires on <Date fhirData={getExpiry} />
139
- </BadgeSecondary>
140
- )}
141
- </Header>
142
- <Body>
143
- {hasTypeCoding && (
144
- <Value data-testid="typeCoding" label="Type">
145
- {getTypeCoding.map((coding, i) => (
146
- <Coding key={`item-${i}`} fhirData={coding} />
147
- ))}
148
- </Value>
149
- )}
150
- <Value label="Unique device identifier" data-testid="uniqueId">
151
- {getUdi ? getUdi : <MissingValue />}
152
- </Value>
153
- {udiCarrierAIDC && <Value label="AIDC barcode">{udiCarrierAIDC}</Value>}
154
- {udiCarrierHRF && <Value label="HRF barcode">{udiCarrierHRF}</Value>}
155
- {hasSafety &&
156
- safetyArr.map((item, i) => (
157
- <Value label="HRF barcode" key={`safety-${i}`}>
158
- <CodeableConcept fhirData={item} />
159
- </Value>
160
- ))}
161
- </Body>
131
+ <Accordion
132
+ headerContent={
133
+ <Header
134
+ icon={fhirIcons}
135
+ resourceName="Device"
136
+ badges={status && <Badge data-testid="status">{status}</Badge>}
137
+ title={model}
138
+ additionalContent={
139
+ hasExpiry && (
140
+ <div data-testid="expiry">
141
+ <span className="text-secondary">expires on</span>{' '}
142
+ <Date fhirData={getExpiry} isBlack />
143
+ </div>
144
+ )
145
+ }
146
+ />
147
+ }
148
+ bodyContent={
149
+ <Body>
150
+ {hasTypeCoding && (
151
+ <ValueSectionItem data-testid="typeCoding" label="Type">
152
+ {getTypeCoding.map((coding, i) => (
153
+ <Coding key={`item-${i}`} fhirData={coding} />
154
+ ))}
155
+ </ValueSectionItem>
156
+ )}
157
+ <ValueSectionItem
158
+ label="Unique device identifier"
159
+ data-testid="uniqueId"
160
+ >
161
+ {getUdi ? getUdi : <MissingValue />}
162
+ </ValueSectionItem>
163
+ {udiCarrierAIDC && (
164
+ <ValueSectionItem label="AIDC barcode">
165
+ {udiCarrierAIDC}
166
+ </ValueSectionItem>
167
+ )}
168
+ {udiCarrierHRF && (
169
+ <ValueSectionItem label="HRF barcode">
170
+ {udiCarrierHRF}
171
+ </ValueSectionItem>
172
+ )}
173
+ {hasSafety &&
174
+ safetyArr.map((item, i) => (
175
+ <ValueSectionItem label="HRF barcode" key={`safety-${i}`}>
176
+ <CodeableConcept fhirData={item} />
177
+ </ValueSectionItem>
178
+ ))}
179
+ </Body>
180
+ }
181
+ />
162
182
  </Root>
163
183
  );
164
184
  };
@@ -7,16 +7,9 @@ import _get from 'lodash/get';
7
7
  import _has from 'lodash/has';
8
8
  import fhirVersions from '../fhirResourceVersions';
9
9
  import UnhandledResourceDataStructure from '../UnhandledResourceDataStructure';
10
+ import Accordion from '../../containers/Accordion';
10
11
 
11
- import {
12
- Root,
13
- Header,
14
- Title,
15
- Badge,
16
- BadgeSecondary,
17
- Body,
18
- Value,
19
- } from '../../ui';
12
+ import { Root, Header, Badge, Body, Value } from '../../ui';
20
13
 
21
14
  const commonDTO = fhirResource => {
22
15
  const title =
@@ -101,7 +94,7 @@ const resourceDTO = (fhirVersion, fhirResource) => {
101
94
  };
102
95
 
103
96
  const DiagnosticReport = props => {
104
- const { fhirResource, fhirVersion } = props;
97
+ const { fhirResource, fhirVersion, fhirIcons } = props;
105
98
  let fhirResourceData = {};
106
99
  try {
107
100
  fhirResourceData = resourceDTO(fhirVersion, fhirResource);
@@ -121,41 +114,58 @@ const DiagnosticReport = props => {
121
114
  performer,
122
115
  issued,
123
116
  } = fhirResourceData;
117
+
118
+ const tableData = [
119
+ {
120
+ label: 'Issued',
121
+ testId: 'issued',
122
+ data: <Date fhirData={issued} isBlack />,
123
+ status: issued,
124
+ },
125
+ {
126
+ label: 'Category',
127
+ testId: 'categoryCoding',
128
+ data:
129
+ categoryCoding &&
130
+ categoryCoding.map((coding, i) => (
131
+ <Coding key={`item-${i}`} fhirData={coding} />
132
+ )),
133
+ status: hasCategoryCoding,
134
+ },
135
+ {
136
+ label: 'Performer',
137
+ testId: 'performer',
138
+ data: <Reference fhirData={performer} />,
139
+ status: hasPerformer,
140
+ },
141
+ {
142
+ label: 'Conclusion',
143
+ testId: 'conclusion',
144
+ data: conclusion,
145
+ status: conclusion,
146
+ },
147
+ ];
148
+
124
149
  return (
125
150
  <Root name="DiagnosticReport">
126
- <Header>
127
- <Title data-testid="title">{title}</Title>
128
- {status && <Badge data-testid="status">{status}</Badge>}
129
- {effectiveDateTime && (
130
- <BadgeSecondary data-testid="effectiveDateTime">
131
- <Date fhirData={effectiveDateTime} />
132
- </BadgeSecondary>
133
- )}
134
- </Header>
135
- <Body>
136
- {issued && (
137
- <Value label="Issued" data-testid="issued">
138
- <Date fhirData={issued} />
139
- </Value>
140
- )}
141
- {hasCategoryCoding && (
142
- <Value label="Category" data-testid="categoryCoding">
143
- {categoryCoding.map((coding, i) => (
144
- <Coding key={`item-${i}`} fhirData={coding} />
145
- ))}
146
- </Value>
147
- )}
148
- {hasPerformer && (
149
- <Value label="Performer" data-testid="performer">
150
- <Reference fhirData={performer} />
151
- </Value>
152
- )}
153
- {conclusion && (
154
- <Value label="Conclusion" data-testid="conclusion">
155
- {conclusion}
156
- </Value>
157
- )}
158
- </Body>
151
+ <Accordion
152
+ headerContent={
153
+ <Header
154
+ icon={fhirIcons}
155
+ resourceName="DiagnosticReport"
156
+ badges={status && <Badge data-testid="status">{status}</Badge>}
157
+ title={title}
158
+ additionalContent={
159
+ effectiveDateTime && (
160
+ <Value label="On" data-testid="effectiveDateTime">
161
+ <Date fhirData={effectiveDateTime} isBlack />
162
+ </Value>
163
+ )
164
+ }
165
+ />
166
+ }
167
+ bodyContent={<Body tableData={tableData} />}
168
+ />
159
169
  </Root>
160
170
  );
161
171
  };
@@ -9,6 +9,7 @@ import exampleDiagnosticReportSTU3 from '../../../fixtures/stu3/resources/diagno
9
9
  import exampleDiagnosticReportR4 from '../../../fixtures/r4/resources/diagnosticReport/example1.json';
10
10
  import example2DiagnosticReportR4 from '../../../fixtures/r4/resources/diagnosticReport/example2.json';
11
11
  import example3DiagnosticReportR4 from '../../../fixtures/r4/resources/diagnosticReport/example3.json';
12
+ import fhirIcons from '../../../fixtures/example-icons';
12
13
 
13
14
  export default { title: 'DiagnosticReport' };
14
15
 
@@ -18,6 +19,7 @@ export const DefaultVisualizationDSTU2 = () => {
18
19
  <DiagnosticReport
19
20
  fhirVersion={fhirVersions.DSTU2}
20
21
  fhirResource={fhirResource}
22
+ fhirIcons={fhirIcons}
21
23
  />
22
24
  );
23
25
  };
@@ -28,6 +30,7 @@ export const ExampleDiagnosticReportSTU3 = () => {
28
30
  <DiagnosticReport
29
31
  fhirVersion={fhirVersions.STU3}
30
32
  fhirResource={fhirResource}
33
+ fhirIcons={fhirIcons}
31
34
  />
32
35
  );
33
36
  };
@@ -38,6 +41,7 @@ export const ExampleDiagnosticReportR4 = () => {
38
41
  <DiagnosticReport
39
42
  fhirVersion={fhirVersions.R4}
40
43
  fhirResource={fhirResource}
44
+ fhirIcons={fhirIcons}
41
45
  />
42
46
  );
43
47
  };
@@ -48,6 +52,7 @@ export const Example2DiagnosticReportR4 = () => {
48
52
  <DiagnosticReport
49
53
  fhirVersion={fhirVersions.R4}
50
54
  fhirResource={fhirResource}
55
+ fhirIcons={fhirIcons}
51
56
  />
52
57
  );
53
58
  };
@@ -58,11 +63,12 @@ export const Example3DiagnosticReportR4 = () => {
58
63
  <DiagnosticReport
59
64
  fhirVersion={fhirVersions.R4}
60
65
  fhirResource={fhirResource}
66
+ fhirIcons={fhirIcons}
61
67
  />
62
68
  );
63
69
  };
64
70
 
65
71
  export const ExampleWithoutFhirVersionProperty = () => {
66
72
  const fhirResource = object('Resource', exampleDiagnosticReportSTU3);
67
- return <DiagnosticReport fhirResource={fhirResource} />;
73
+ return <DiagnosticReport fhirResource={fhirResource} fhirIcons={fhirIcons} />;
68
74
  };
@@ -5,17 +5,16 @@ import prettyBytes from 'pretty-bytes';
5
5
 
6
6
  import fhirVersions from '../fhirResourceVersions';
7
7
  import Coding from '../../datatypes/Coding';
8
- import DateType from '../../datatypes/Date';
9
8
  import UnhandledResourceDataStructure from '../UnhandledResourceDataStructure';
9
+ import Accordion from '../../containers/Accordion';
10
+ import Date from '../../datatypes/Date';
10
11
 
11
12
  import {
12
13
  Root,
13
14
  Body,
14
15
  Header,
15
- Title,
16
16
  Badge,
17
- BadgeSecondary,
18
- Value,
17
+ ValueSectionItem,
19
18
  ValueSection,
20
19
  Table,
21
20
  TableRow,
@@ -202,7 +201,7 @@ const Content = props => {
202
201
  <ContentItem key={i} item={item} />
203
202
  ));
204
203
  return (
205
- <ValueSection label="Content">
204
+ <ValueSection label="Content" marginTop>
206
205
  <Table>
207
206
  <thead>
208
207
  <TableRow>
@@ -211,14 +210,14 @@ const Content = props => {
211
210
  <TableHeader>Resource</TableHeader>
212
211
  </TableRow>
213
212
  </thead>
214
- <tbody>{allContent}</tbody>
213
+ <tbody className="border-top-0">{allContent}</tbody>
215
214
  </Table>
216
215
  </ValueSection>
217
216
  );
218
217
  };
219
218
 
220
219
  const DocumentReference = props => {
221
- const { fhirVersion, fhirResource } = props;
220
+ const { fhirVersion, fhirResource, fhirIcons } = props;
222
221
  let fhirResourceData = {};
223
222
  try {
224
223
  fhirResourceData = resourceDTO(fhirVersion, fhirResource);
@@ -241,67 +240,104 @@ const DocumentReference = props => {
241
240
  const hasContent = content.length > 0;
242
241
  const hasPeriod = context.periodStart || context.periodEnd;
243
242
 
243
+ const tableData = [
244
+ {
245
+ label: 'Document type',
246
+ testId: 'type',
247
+ data: <Coding fhirData={typeCoding} />,
248
+ status: typeCoding,
249
+ },
250
+ {
251
+ label: 'Document categorization',
252
+ testId: 'class',
253
+ data: <Coding fhirData={classCoding} />,
254
+ status: classCoding,
255
+ },
256
+ {
257
+ label: 'Security Label',
258
+ testId: 'securityLabel',
259
+ data: <Coding fhirData={securityLabelCoding} />,
260
+ status: securityLabelCoding,
261
+ },
262
+ {
263
+ label: 'Created At',
264
+ testId: 'createdAt',
265
+ data: <Date fhirData={createdAt} isBlack />,
266
+ status: createdAt,
267
+ },
268
+ ];
269
+
270
+ const contextTable = [
271
+ {
272
+ label: 'Event',
273
+ testId: 'context.event',
274
+ data: <Coding fhirData={context.eventCoding} />,
275
+ status: context.eventCoding,
276
+ },
277
+ {
278
+ label: 'Facility',
279
+ testId: 'context.facilityType',
280
+ data: <Coding fhirData={context.facilityTypeCoding} />,
281
+ status: context.facilityTypeCoding,
282
+ },
283
+ {
284
+ label: 'Practice Setting',
285
+ testId: 'context.practiceSetting',
286
+ data: <Coding fhirData={context.practiceSettingCoding} />,
287
+ status: context.practiceSettingCoding,
288
+ },
289
+ {
290
+ label: 'Period',
291
+ testId: 'context.period',
292
+ data: (
293
+ <>
294
+ {context.periodStart && (
295
+ <Date fhirData={context.periodStart} isBlack />
296
+ )}
297
+ {' - '}
298
+ {context.periodEnd && <Date fhirData={context.periodEnd} isBlack />}
299
+ </>
300
+ ),
301
+ status: hasPeriod,
302
+ },
303
+ ];
304
+
305
+ const getValueSectionItem = (item, index) =>
306
+ item.status && (
307
+ <ValueSectionItem
308
+ key={`context-item-${index}`}
309
+ label={item.label}
310
+ data-testid={item.testId}
311
+ >
312
+ {item.data}
313
+ </ValueSectionItem>
314
+ );
315
+
244
316
  return (
245
317
  <Root name="DocumentReference">
246
- <Header>
247
- <Title data-testid="title">{description}</Title>
248
- {status && <Badge data-testid="status">{status}</Badge>}
249
- {docStatus && (
250
- <BadgeSecondary data-testid="docStatus">{docStatus}</BadgeSecondary>
251
- )}
252
- </Header>
253
- <Body>
254
- {typeCoding && (
255
- <Value label="Document type" data-testid="type">
256
- <Coding fhirData={typeCoding} />
257
- </Value>
258
- )}
259
- {classCoding && (
260
- <Value label="Document categorization" data-testid="class">
261
- <Coding fhirData={classCoding} />
262
- </Value>
263
- )}
264
- {securityLabelCoding && (
265
- <Value label="Security Label" data-testid="securityLabel">
266
- <Coding fhirData={securityLabelCoding} />
267
- </Value>
268
- )}
269
- {createdAt && (
270
- <Value label="Created At" data-testid="createdAt">
271
- <DateType fhirData={createdAt} />
272
- </Value>
273
- )}
274
- <ValueSection label="Context">
275
- {context.eventCoding && (
276
- <Value label="Event" data-testid="context.event">
277
- <Coding fhirData={context.eventCoding} />
278
- </Value>
279
- )}
280
- {context.facilityTypeCoding && (
281
- <Value label="Facility" data-testid="context.facilityType">
282
- <Coding fhirData={context.facilityTypeCoding} />
283
- </Value>
284
- )}
285
- {context.practiceSettingCoding && (
286
- <Value
287
- label="Practice Setting"
288
- data-testid="context.practiceSetting"
289
- >
290
- <Coding fhirData={context.practiceSettingCoding} />
291
- </Value>
292
- )}
293
- {hasPeriod && (
294
- <Value label="Period" data-testid="context.period">
295
- {context.periodStart && (
296
- <DateType fhirData={context.periodStart} />
318
+ <Accordion
319
+ headerContent={
320
+ <Header
321
+ icon={fhirIcons}
322
+ resourceName="DocumentReference"
323
+ title={description}
324
+ badges={status && <Badge data-testid="status">{status}</Badge>}
325
+ additionalBadge={
326
+ docStatus && <Badge data-testid="docStatus">{docStatus}</Badge>
327
+ }
328
+ />
329
+ }
330
+ bodyContent={
331
+ <Body tableData={tableData}>
332
+ <ValueSection label="Context" marginTop>
333
+ {contextTable.map((item, index) =>
334
+ getValueSectionItem(item, index),
297
335
  )}
298
- {' - '}
299
- {context.periodEnd && <DateType fhirData={context.periodEnd} />}
300
- </Value>
301
- )}
302
- </ValueSection>
303
- {hasContent && <Content content={content} />}
304
- </Body>
336
+ </ValueSection>
337
+ {hasContent && <Content content={content} />}
338
+ </Body>
339
+ }
340
+ />
305
341
  </Root>
306
342
  );
307
343
  };
@@ -7,6 +7,7 @@ import DocumentReference from './DocumentReference';
7
7
  import exampleDocumentReference from '../../../fixtures/dstu2/resources/documentReference/example1.json';
8
8
  import exampleDocumentReferenceSTU3 from '../../../fixtures/stu3/resources/documentReference/example1.json';
9
9
  import example1DocumentReferenceR4 from '../../../fixtures/r4/resources/documentReference/example1.json';
10
+ import fhirIcons from '../../../fixtures/example-icons';
10
11
 
11
12
  export default { title: 'Document Reference' };
12
13
 
@@ -16,6 +17,7 @@ export const DefaultVisualizationDSTU2 = () => {
16
17
  <DocumentReference
17
18
  fhirResource={fhirResource}
18
19
  fhirVersion={fhirVersions.DSTU2}
20
+ fhirIcons={fhirIcons}
19
21
  />
20
22
  );
21
23
  };
@@ -26,6 +28,7 @@ export const ExampleSTU3 = () => {
26
28
  <DocumentReference
27
29
  fhirResource={fhirResource}
28
30
  fhirVersion={fhirVersions.STU3}
31
+ fhirIcons={fhirIcons}
29
32
  />
30
33
  );
31
34
  };
@@ -36,6 +39,7 @@ export const ExampleR4 = () => {
36
39
  <DocumentReference
37
40
  fhirResource={fhirResource}
38
41
  fhirVersion={fhirVersions.R4}
42
+ fhirIcons={fhirIcons}
39
43
  />
40
44
  );
41
45
  };
@@ -160,8 +160,7 @@ const resourceDTO = (fhirVersion, fhirResource) => {
160
160
  }
161
161
  };
162
162
 
163
- const Encounter = props => {
164
- const { fhirResource, fhirVersion } = props;
163
+ const Encounter = ({ fhirResource, fhirVersion, fhirIcons }) => {
165
164
  let fhirResourceData = {};
166
165
  try {
167
166
  fhirResourceData = resourceDTO(fhirVersion, fhirResource);
@@ -177,7 +176,6 @@ const Encounter = props => {
177
176
  encounterType,
178
177
  resourceClass,
179
178
  resourceStatus,
180
- resourceName,
181
179
  participant,
182
180
  } = fhirResourceData;
183
181
 
@@ -207,7 +205,7 @@ const Encounter = props => {
207
205
  <Accordion
208
206
  headerContent={
209
207
  <Header
210
- resourceName={resourceName}
208
+ resourceName={'Encounter'}
211
209
  additionalContent={
212
210
  periodStart && (
213
211
  <Value label="Start date" data-testid="headerStartDate">
@@ -221,6 +219,7 @@ const Encounter = props => {
221
219
  )
222
220
  }
223
221
  title={locationDisplay}
222
+ icon={fhirIcons}
224
223
  />
225
224
  }
226
225
  bodyContent={
@@ -11,6 +11,8 @@ import example1_R4 from '../../../fixtures/r4/resources/encounter/example1.json'
11
11
  import example2_R4 from '../../../fixtures/r4/resources/encounter/example2.json';
12
12
  import example3_R4 from '../../../fixtures/r4/resources/encounter/example3.json';
13
13
  import fhirVersions from '../fhirResourceVersions';
14
+ import fhirIcons from '../../../fixtures/example-icons';
15
+ import EncounterIcon from '../../../assets/containers/Encounter/encounter.svg';
14
16
 
15
17
  export default {
16
18
  title: 'Encounter',
@@ -19,35 +21,55 @@ export default {
19
21
  export const DefaultVisualizationDSTU2 = () => {
20
22
  const fhirResource = object('Resource', example1);
21
23
  return (
22
- <Encounter fhirVersion={fhirVersions.DSTU2} fhirResource={fhirResource} />
24
+ <Encounter
25
+ fhirVersion={fhirVersions.DSTU2}
26
+ fhirResource={fhirResource}
27
+ fhirIcons={require('../../../assets/containers/Encounter/encounter.svg')}
28
+ />
23
29
  );
24
30
  };
25
31
 
26
32
  export const ExampleWithoutParticipantsDSTU2 = () => {
27
33
  const fhirResource = object('Resource', example2);
28
34
  return (
29
- <Encounter fhirVersion={fhirVersions.DSTU2} fhirResource={fhirResource} />
35
+ <Encounter
36
+ fhirVersion={fhirVersions.DSTU2}
37
+ fhirResource={fhirResource}
38
+ fhirIcons={EncounterIcon}
39
+ />
30
40
  );
31
41
  };
32
42
 
33
43
  export const ExampleSTU3 = () => {
34
44
  const fhirResource = object('Resource', example_STU3);
35
45
  return (
36
- <Encounter fhirVersion={fhirVersions.STU3} fhirResource={fhirResource} />
46
+ <Encounter
47
+ fhirVersion={fhirVersions.STU3}
48
+ fhirResource={fhirResource}
49
+ fhirIcons={fhirIcons}
50
+ />
37
51
  );
38
52
  };
39
53
 
40
54
  export const ExampleWithoutParticipantSTU3 = () => {
41
55
  const fhirResource = object('Resource', example2_STU3);
42
56
  return (
43
- <Encounter fhirVersion={fhirVersions.STU3} fhirResource={fhirResource} />
57
+ <Encounter
58
+ fhirVersion={fhirVersions.STU3}
59
+ fhirResource={fhirResource}
60
+ fhirIcons={false}
61
+ />
44
62
  );
45
63
  };
46
64
 
47
65
  export const ExampleWithoutParticipantR4 = () => {
48
66
  const fhirResource = object('Resource', example1_R4);
49
67
  return (
50
- <Encounter fhirVersion={fhirVersions.R4} fhirResource={fhirResource} />
68
+ <Encounter
69
+ fhirVersion={fhirVersions.R4}
70
+ fhirResource={fhirResource}
71
+ fhirIcons={'random text'}
72
+ />
51
73
  );
52
74
  };
53
75