fhir-react 0.3.4 → 0.3.7

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 (84) hide show
  1. package/README.md +1 -1
  2. package/build/bootstrap-reboot.min.css +8 -2
  3. package/build/index.js +7 -7
  4. package/build/style.css +6 -6
  5. package/package.json +1 -1
  6. package/src/assets/containers/Binary/binary.svg +9 -0
  7. package/src/assets/containers/Coverage/coverage.svg +4 -0
  8. package/src/assets/containers/MedicationOrder/medication-order.svg +5 -0
  9. package/src/assets/containers/MedicationRequest/medication-request.svg +5 -0
  10. package/src/assets/containers/Organization/organization.svg +5 -0
  11. package/src/assets/containers/ResourceCategory/{resource-placeholder.svg → resource-category.svg} +0 -0
  12. package/src/components/containers/Accordion/Accordion.js +10 -9
  13. package/src/components/datatypes/Annotation/Annotation.js +4 -4
  14. package/src/components/datatypes/Attachment/Attachment.css +5 -0
  15. package/src/components/datatypes/Attachment/Attachment.js +7 -2
  16. package/src/components/datatypes/CodeableConcept/CodeableConcept.css +4 -1
  17. package/src/components/datatypes/Coding/Coding.css +0 -1
  18. package/src/components/datatypes/Identifier/Identifier.js +7 -3
  19. package/src/components/datatypes/Reference/Reference.css +3 -0
  20. package/src/components/datatypes/Reference/Reference.js +7 -1
  21. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.js +86 -77
  22. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.stories.js +12 -1
  23. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.test.js +71 -0
  24. package/src/components/resources/Binary/Binary.js +30 -20
  25. package/src/components/resources/Binary/Binary.stories.js +12 -5
  26. package/src/components/resources/Binary/Binary.test.js +67 -0
  27. package/src/components/resources/CarePlan/CarePlan.js +111 -96
  28. package/src/components/resources/CarePlan/CarePlan.stories.js +31 -5
  29. package/src/components/resources/CarePlan/CarePlan.test.js +74 -2
  30. package/src/components/resources/CarePlan/CarePlanActivity.js +6 -2
  31. package/src/components/resources/Claim/CareTeam.js +55 -0
  32. package/src/components/resources/Claim/Claim.css +2 -11
  33. package/src/components/resources/Claim/Claim.js +157 -309
  34. package/src/components/resources/Claim/Claim.stories.js +37 -5
  35. package/src/components/resources/Claim/Claim.test.js +72 -0
  36. package/src/components/resources/Claim/Diagnosis.js +61 -0
  37. package/src/components/resources/Claim/Insurance.js +58 -0
  38. package/src/components/resources/Claim/Item.js +79 -0
  39. package/src/components/resources/Claim/Items.js +29 -0
  40. package/src/components/resources/Coverage/Coverage.js +96 -69
  41. package/src/components/resources/Coverage/Coverage.stories.js +31 -5
  42. package/src/components/resources/Coverage/Coverage.test.js +75 -3
  43. package/src/components/resources/Device/Device.js +54 -34
  44. package/src/components/resources/Device/Device.stories.js +33 -5
  45. package/src/components/resources/Device/Device.test.js +72 -0
  46. package/src/components/resources/DiagnosticReport/DiagnosticReport.js +53 -43
  47. package/src/components/resources/DiagnosticReport/DiagnosticReport.stories.js +8 -1
  48. package/src/components/resources/DiagnosticReport/DiagnosticReport.test.js +71 -0
  49. package/src/components/resources/DocumentReference/DocumentReference.js +101 -65
  50. package/src/components/resources/DocumentReference/DocumentReference.stories.js +5 -0
  51. package/src/components/resources/DocumentReference/DocumentReference.test.js +71 -0
  52. package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.js +47 -38
  53. package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.stories.js +5 -0
  54. package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.test.js +72 -0
  55. package/src/components/resources/Goal/Goal.js +103 -85
  56. package/src/components/resources/Goal/Goal.stories.js +38 -7
  57. package/src/components/resources/Goal/Goal.test.js +70 -3
  58. package/src/components/resources/Medication/Medication.js +90 -51
  59. package/src/components/resources/Medication/Medication.stories.js +37 -7
  60. package/src/components/resources/Medication/Medication.test.js +77 -3
  61. package/src/components/resources/MedicationKnowledge/MedicationKnowledge.js +1 -1
  62. package/src/components/resources/MedicationOrder/MedicationOrder.js +45 -28
  63. package/src/components/resources/MedicationOrder/MedicationOrder.test.js +67 -0
  64. package/src/components/resources/MedicationRequest/MedicationRequest.js +64 -44
  65. package/src/components/resources/MedicationRequest/MedicationRequest.stories.js +21 -5
  66. package/src/components/resources/MedicationRequest/MedicationRequest.test.js +67 -0
  67. package/src/components/resources/MedicationStatement/MedicationDetails.js +52 -0
  68. package/src/components/resources/MedicationStatement/MedicationDosage.js +46 -0
  69. package/src/components/resources/MedicationStatement/MedicationStatement.js +66 -118
  70. package/src/components/resources/MedicationStatement/MedicationStatement.stories.js +7 -0
  71. package/src/components/resources/MedicationStatement/MedicationStatement.test.js +103 -6
  72. package/src/components/resources/Organization/Organization.js +55 -37
  73. package/src/components/resources/Organization/Organization.stories.js +15 -2
  74. package/src/components/resources/Organization/Organization.test.js +73 -0
  75. package/src/components/resources/ResourceCategory/ResourceCategory.js +7 -12
  76. package/src/components/resources/ResourceCategory/ResourceCategory.stories.js +13 -2
  77. package/src/components/resources/ResourceCategory/ResourceCategory.test.js +77 -18
  78. package/src/components/ui/bootstrap-reboot.min.css +8 -2
  79. package/src/components/ui/index.js +22 -4
  80. package/src/fixtures/example-icons.jsx +46 -11
  81. package/src/style.scss +1 -0
  82. package/src/utils/formatDate.js +6 -4
  83. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.css +0 -4
  84. package/src/components/resources/CarePlan/CarePlan.css +0 -7
@@ -5,8 +5,75 @@ import Binary from './Binary';
5
5
  import stu3ExamplePdf from '../../../fixtures/stu3/resources/binary/example-pdf.json';
6
6
  import stu3ExampleJpeg from '../../../fixtures/stu3/resources/binary/example-jpeg.json';
7
7
  import stu3ExampleJson from '../../../fixtures/stu3/resources/binary/example-json.json';
8
+ import fhirIcons from '../../../fixtures/example-icons';
8
9
 
9
10
  describe('should render component correctly', () => {
11
+ it('component without a fhirIcons props should render a default icon', () => {
12
+ const defaultProps = {
13
+ fhirResource: stu3ExamplePdf,
14
+ };
15
+
16
+ const { getByAltText } = render(<Binary {...defaultProps} />);
17
+ const headerIcon = getByAltText('binary');
18
+
19
+ expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
20
+ });
21
+
22
+ it('component with a false as a fhirIcons props should render a placeholder', () => {
23
+ const defaultProps = {
24
+ fhirResource: stu3ExamplePdf,
25
+ fhirIcons: false,
26
+ };
27
+
28
+ const { getByTestId } = render(<Binary {...defaultProps} />);
29
+ const headerIcon = getByTestId('placeholder');
30
+
31
+ expect(headerIcon).toBeTruthy();
32
+ });
33
+
34
+ it('component with the img as a fhirIcons props should render an img', () => {
35
+ const defaultProps = {
36
+ fhirResource: stu3ExamplePdf,
37
+ fhirIcons: (
38
+ <img
39
+ src={require('../assets/containers/Binary/binary.svg')}
40
+ alt="binary"
41
+ />
42
+ ),
43
+ };
44
+
45
+ const { getByAltText } = render(<Binary {...defaultProps} />);
46
+ const headerIcon = getByAltText('binary');
47
+
48
+ expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
49
+ });
50
+
51
+ it('component with the resources object as a fhirIcons props should render an img', () => {
52
+ const defaultProps = {
53
+ fhirResource: stu3ExamplePdf,
54
+ fhirIcons: fhirIcons,
55
+ };
56
+
57
+ const { getByAltText } = render(<Binary {...defaultProps} />);
58
+ const headerIcon = getByAltText('binary');
59
+
60
+ expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
61
+ });
62
+
63
+ it('component with the url as a fhirIcons props should render an img', () => {
64
+ const avatarSrc =
65
+ 'https://www.gravatar.com/avatar/?s=50&r=any&default=identicon&forcedefault=1';
66
+ const defaultProps = {
67
+ fhirResource: stu3ExamplePdf,
68
+ fhirIcons: avatarSrc,
69
+ };
70
+
71
+ const { getByAltText } = render(<Binary {...defaultProps} />);
72
+ const headerIcon = getByAltText('header icon');
73
+
74
+ expect(headerIcon.getAttribute('src')).toContain(avatarSrc);
75
+ });
76
+
10
77
  it('PDF binary file', () => {
11
78
  const { container } = render(<Binary fhirResource={stu3ExamplePdf} />);
12
79
  expect(container).not.toBe(null);
@@ -10,18 +10,17 @@ import { isNotEmptyArray } from '../../../utils';
10
10
  import fhirVersions from '../fhirResourceVersions';
11
11
  import UnhandledResourceDataStructure from '../UnhandledResourceDataStructure';
12
12
  import CarePlanActivity from './CarePlanActivity';
13
- import './CarePlan.css';
14
13
 
15
14
  import {
16
15
  Root,
17
16
  Header,
18
- Title,
19
17
  Badge,
20
18
  BadgeSecondary,
21
19
  Body,
22
- Value,
23
20
  MissingValue,
21
+ ValueSectionItem,
24
22
  } from '../../ui';
23
+ import Accordion from '../../containers/Accordion';
25
24
 
26
25
  const commonDTO = fhirResource => {
27
26
  const status = _get(fhirResource, 'status', '');
@@ -163,8 +162,7 @@ const resourceDTO = (fhirVersion, fhirResource) => {
163
162
  }
164
163
  };
165
164
 
166
- const CarePlan = props => {
167
- const { fhirResource, fhirVersion } = props;
165
+ const CarePlan = ({ fhirResource, fhirVersion, fhirIcons }) => {
168
166
  let fhirResourceData = {};
169
167
  try {
170
168
  fhirResourceData = resourceDTO(fhirVersion, fhirResource);
@@ -197,99 +195,116 @@ const CarePlan = props => {
197
195
  const authorArr = Array.isArray(author) ? author : [author];
198
196
  return (
199
197
  <Root name="CarePlan">
200
- <Header>
201
- <Title>Care Plan</Title>
202
- {status && <Badge data-testid="status">{status}</Badge>}
203
- {expiry && <BadgeSecondary>expires on ${expiry}</BadgeSecondary>}
204
- </Header>
205
- <Body>
206
- {hasCategory && (
207
- <Value label="Category" data-testid="category">
208
- {category.map((category, i) =>
209
- (category.coding || []).map((coding, j) => (
210
- <Coding key={`item-${i}${j}`} fhirData={coding} />
211
- )),
198
+ <Accordion
199
+ headerContent={
200
+ <Header
201
+ icon={fhirIcons}
202
+ resourceName="CarePlan"
203
+ badges={status && <Badge data-testid="status">{status}</Badge>}
204
+ title={'Care Plan'}
205
+ additionalContent={
206
+ expiry && <BadgeSecondary>expires on ${expiry}</BadgeSecondary>
207
+ }
208
+ />
209
+ }
210
+ bodyContent={
211
+ <Body>
212
+ {hasCategory && (
213
+ <ValueSectionItem label="Category" data-testid="category">
214
+ {category.map((category, i) =>
215
+ (category.coding || []).map((coding, j) => (
216
+ <Coding key={`item-${i}${j}`} fhirData={coding} />
217
+ )),
218
+ )}
219
+ </ValueSectionItem>
212
220
  )}
213
- </Value>
214
- )}
215
- {intent && (
216
- <Value label="Intent" data-testid="intent">
217
- {intent}
218
- </Value>
219
- )}
220
- {hasGoals && (
221
- <Value label="Goals" data-testid="goals">
222
- {goals.map((goal, i) => (
223
- <div key={`goal-${i}`}>
224
- <Reference fhirData={goal} />
225
- </div>
226
- ))}
227
- </Value>
228
- )}
229
- {description && (
230
- <Value label="Description" data-testid="description">
231
- {description}
232
- </Value>
233
- )}
234
- {subject && (
235
- <Value label="Subject" data-testid="subject">
236
- <Reference fhirData={subject} />
237
- </Value>
238
- )}
239
- {hasValue(author) && (
240
- <Value label="Author" data-testid="author">
241
- {authorArr.map((item, i) => (
242
- <Reference key={`author-${i}`} fhirData={item} />
243
- ))}
244
- </Value>
245
- )}
246
- {periodStart && (
247
- <Value label="Plan Period Start" data-testid="periodStart">
248
- {periodStart ? (
249
- <DateType fhirData={periodStart} />
250
- ) : (
251
- <MissingValue />
221
+ {intent && (
222
+ <ValueSectionItem label="Intent" data-testid="intent">
223
+ {intent}
224
+ </ValueSectionItem>
252
225
  )}
253
- </Value>
254
- )}
255
- {periodEnd && (
256
- <Value label="Plan Period End" data-testid="periodEnd">
257
- {periodEnd ? <DateType fhirData={periodEnd} /> : <MissingValue />}
258
- </Value>
259
- )}
260
- {hasAddresses && (
261
- <Value label="Addresses" data-testid="addresses">
262
- {addresses.map((address, i) => (
263
- <div key={`item-${i}`}>
264
- <Reference fhirData={address} />
265
- </div>
266
- ))}
267
- </Value>
268
- )}
269
- {isNotEmptyArray(basedOn) && (
270
- <Value label="Based on" data-testid="basedOn">
271
- {basedOn.map((item, i) => (
272
- <Reference key={`based-on-${i}`} fhirData={item} />
273
- ))}
274
- </Value>
275
- )}
276
- {isNotEmptyArray(partOf) && (
277
- <Value label="Part of" data-testid="partOf">
278
- {partOf.map((item, i) => (
279
- <Reference key={`part-of-${i}`} fhirData={item} />
280
- ))}
281
- </Value>
282
- )}
283
- {hasActivity && (
284
- <Value label="Activity" data-testid="activity">
285
- {activity.map((activity, i) => (
286
- <div key={`item-${i}`}>
287
- <CarePlanActivity fhirData={activity} />
288
- </div>
289
- ))}
290
- </Value>
291
- )}
292
- </Body>
226
+ {hasGoals && (
227
+ <ValueSectionItem label="Goals" data-testid="goals">
228
+ {goals.map((goal, i) => (
229
+ <div key={`goal-${i}`}>
230
+ <Reference fhirData={goal} />
231
+ </div>
232
+ ))}
233
+ </ValueSectionItem>
234
+ )}
235
+ {description && (
236
+ <ValueSectionItem label="Description" data-testid="description">
237
+ {description}
238
+ </ValueSectionItem>
239
+ )}
240
+ {subject && (
241
+ <ValueSectionItem label="Subject" data-testid="subject">
242
+ <Reference fhirData={subject} />
243
+ </ValueSectionItem>
244
+ )}
245
+ {hasValue(author) && (
246
+ <ValueSectionItem label="Author" data-testid="author">
247
+ {authorArr.map((item, i) => (
248
+ <Reference key={`author-${i}`} fhirData={item} />
249
+ ))}
250
+ </ValueSectionItem>
251
+ )}
252
+ {periodStart && (
253
+ <ValueSectionItem
254
+ label="Plan Period Start"
255
+ data-testid="periodStart"
256
+ >
257
+ {periodStart ? (
258
+ <DateType fhirData={periodStart} isBlack />
259
+ ) : (
260
+ <MissingValue />
261
+ )}
262
+ </ValueSectionItem>
263
+ )}
264
+ {periodEnd && (
265
+ <ValueSectionItem label="Plan Period End" data-testid="periodEnd">
266
+ {periodEnd ? (
267
+ <DateType fhirData={periodEnd} isBlack />
268
+ ) : (
269
+ <MissingValue />
270
+ )}
271
+ </ValueSectionItem>
272
+ )}
273
+ {hasAddresses && (
274
+ <ValueSectionItem label="Addresses" data-testid="addresses">
275
+ {addresses.map((address, i) => (
276
+ <div key={`item-${i}`}>
277
+ <Reference fhirData={address} />
278
+ </div>
279
+ ))}
280
+ </ValueSectionItem>
281
+ )}
282
+ {isNotEmptyArray(basedOn) && (
283
+ <ValueSectionItem label="Based on" data-testid="basedOn">
284
+ {basedOn.map((item, i) => (
285
+ <Reference key={`based-on-${i}`} fhirData={item} />
286
+ ))}
287
+ </ValueSectionItem>
288
+ )}
289
+ {isNotEmptyArray(partOf) && (
290
+ <ValueSectionItem label="Part of" data-testid="partOf">
291
+ {partOf.map((item, i) => (
292
+ <Reference key={`part-of-${i}`} fhirData={item} />
293
+ ))}
294
+ </ValueSectionItem>
295
+ )}
296
+ {hasActivity && (
297
+ <ValueSectionItem label="Activity" data-testid="activity">
298
+ {activity.map((activity, i) => (
299
+ <div key={`item-${i}`}>
300
+ <CarePlanActivity fhirData={activity} />
301
+ </div>
302
+ ))}
303
+ </ValueSectionItem>
304
+ )}
305
+ </Body>
306
+ }
307
+ />
293
308
  </Root>
294
309
  );
295
310
  };
@@ -10,38 +10,64 @@ import weightLossCarePlanR4 from '../../../fixtures/r4/resources/carePlan/weight
10
10
  import pregnancyCarePlanR4 from '../../../fixtures/r4/resources/carePlan/pregnancyPlan.json';
11
11
  import heartOperationCarePlanR4 from '../../../fixtures/r4/resources/carePlan/heartOperationPlan.json';
12
12
  import fhirVersions from '../fhirResourceVersions';
13
+ import CarePlanIcon from '../../../assets/containers/CarePlan/care-plan.svg';
14
+ import fhirIcons from '../../../fixtures/example-icons';
13
15
 
14
16
  export default { title: 'CarePlan' };
15
17
 
16
18
  export const DefaultVisualizationDSTU2 = () => {
17
19
  const fhirResource = object('Resource', exampleCarePlanDSTU2);
18
20
  return (
19
- <CarePlan fhirVersion={fhirVersions.DSTU2} fhirResource={fhirResource} />
21
+ <CarePlan
22
+ fhirVersion={fhirVersions.DSTU2}
23
+ fhirResource={fhirResource}
24
+ fhirIcons={require('../../../assets/containers/CarePlan/care-plan.svg')}
25
+ />
20
26
  );
21
27
  };
22
28
 
23
29
  export const ExampleCarePlanSTU3 = () => {
24
30
  const fhirResource = object('Resource', exampleCarePlanSTU3);
25
31
  return (
26
- <CarePlan fhirVersion={fhirVersions.STU3} fhirResource={fhirResource} />
32
+ <CarePlan
33
+ fhirVersion={fhirVersions.STU3}
34
+ fhirResource={fhirResource}
35
+ fhirIcons={CarePlanIcon}
36
+ />
27
37
  );
28
38
  };
29
39
 
30
40
  export const Example2CarePlanSTU3 = () => {
31
41
  const fhirResource = object('Resource', example2CarePlanSTU3);
32
42
  return (
33
- <CarePlan fhirVersion={fhirVersions.STU3} fhirResource={fhirResource} />
43
+ <CarePlan
44
+ fhirVersion={fhirVersions.STU3}
45
+ fhirResource={fhirResource}
46
+ fhirIcons={fhirIcons}
47
+ />
34
48
  );
35
49
  };
36
50
 
37
51
  export const WeightLossCarePlanR4 = () => {
38
52
  const fhirResource = object('Resource', weightLossCarePlanR4);
39
- return <CarePlan fhirVersion={fhirVersions.R4} fhirResource={fhirResource} />;
53
+ return (
54
+ <CarePlan
55
+ fhirVersion={fhirVersions.R4}
56
+ fhirResource={fhirResource}
57
+ fhirIcons={false}
58
+ />
59
+ );
40
60
  };
41
61
 
42
62
  export const PregnancyCarePlanR4 = () => {
43
63
  const fhirResource = object('Resource', pregnancyCarePlanR4);
44
- return <CarePlan fhirVersion={fhirVersions.R4} fhirResource={fhirResource} />;
64
+ return (
65
+ <CarePlan
66
+ fhirVersion={fhirVersions.R4}
67
+ fhirResource={fhirResource}
68
+ fhirIcons={'random text'}
69
+ />
70
+ );
45
71
  };
46
72
 
47
73
  export const HeartOperatioCarePlanR4 = () => {
@@ -7,8 +7,80 @@ import examplecarePlanDSTU2 from '../../../fixtures/dstu2/resources/carePlan/exa
7
7
  import exampleCarePlanSTU3 from '../../../fixtures/stu3/resources/carePlan/example1.json';
8
8
  import example1CarePlanR4 from '../../../fixtures/r4/resources/carePlan/weightLossPlan.json';
9
9
  import example2CarePlanR4 from '../../../fixtures/r4/resources/carePlan/pregnancyPlan.json';
10
+ import fhirIcons from '../../../fixtures/example-icons';
10
11
 
11
12
  describe('should render component correctly', () => {
13
+ it('component without a fhirIcons props should render a default icon', () => {
14
+ const defaultProps = {
15
+ fhirResource: examplecarePlanDSTU2,
16
+ fhirVersion: fhirVersions.DSTU2,
17
+ };
18
+
19
+ const { getByAltText } = render(<CarePlan {...defaultProps} />);
20
+ const headerIcon = getByAltText('care plan');
21
+
22
+ expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
23
+ });
24
+
25
+ it('component with a false as a fhirIcons props should render a placeholder', () => {
26
+ const defaultProps = {
27
+ fhirResource: examplecarePlanDSTU2,
28
+ fhirVersion: fhirVersions.DSTU2,
29
+ fhirIcons: false,
30
+ };
31
+
32
+ const { getByTestId } = render(<CarePlan {...defaultProps} />);
33
+ const headerIcon = getByTestId('placeholder');
34
+
35
+ expect(headerIcon).toBeTruthy();
36
+ });
37
+
38
+ it('component with the img as a fhirIcons props should render an img', () => {
39
+ const defaultProps = {
40
+ fhirResource: examplecarePlanDSTU2,
41
+ fhirVersion: fhirVersions.DSTU2,
42
+ fhirIcons: (
43
+ <img
44
+ src={require('../assets/containers/CarePlan/care-plan.svg')}
45
+ alt="care plan"
46
+ />
47
+ ),
48
+ };
49
+
50
+ const { getByAltText } = render(<CarePlan {...defaultProps} />);
51
+ const headerIcon = getByAltText('care plan');
52
+
53
+ expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
54
+ });
55
+
56
+ it('component with the resources object as a fhirIcons props should render an img', () => {
57
+ const defaultProps = {
58
+ fhirResource: examplecarePlanDSTU2,
59
+ fhirVersion: fhirVersions.DSTU2,
60
+ fhirIcons: fhirIcons,
61
+ };
62
+
63
+ const { getByAltText } = render(<CarePlan {...defaultProps} />);
64
+ const headerIcon = getByAltText('care plan');
65
+
66
+ expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
67
+ });
68
+
69
+ it('component with the url as a fhirIcons props should render an img', () => {
70
+ const avatarSrc =
71
+ 'https://www.gravatar.com/avatar/?s=50&r=any&default=identicon&forcedefault=1';
72
+ const defaultProps = {
73
+ fhirResource: examplecarePlanDSTU2,
74
+ fhirVersion: fhirVersions.DSTU2,
75
+ fhirIcons: avatarSrc,
76
+ };
77
+
78
+ const { getByAltText } = render(<CarePlan {...defaultProps} />);
79
+ const headerIcon = getByAltText('header icon');
80
+
81
+ expect(headerIcon.getAttribute('src')).toContain(avatarSrc);
82
+ });
83
+
12
84
  it('should render with DSTU2 source data', () => {
13
85
  const defaultProps = {
14
86
  fhirResource: examplecarePlanDSTU2,
@@ -21,7 +93,7 @@ describe('should render component correctly', () => {
21
93
  expect(getByTestId('status').textContent).toContain('active');
22
94
  expect(getByTestId('category').textContent).toContain('Longitudinal');
23
95
  expect(getByTestId('addresses').textContent).toContain('Dog bite');
24
- expect(getByTestId('activity').textContent).toContain('ADULT DIET');
96
+ expect(getByTestId('activity').textContent).toContain('Adult diet');
25
97
  expect(getByTestId('subject').textContent).toEqual('Patient/d47f763e7c7f');
26
98
  });
27
99
 
@@ -84,7 +156,7 @@ describe('should render component correctly', () => {
84
156
  expect(container).not.toBeNull();
85
157
 
86
158
  expect(getByTestId('addresses').textContent).toContain('pregnancy');
87
- expect(getByTestId('activity').textContent).toContain('First Antenatal');
159
+ expect(getByTestId('activity').textContent).toContain('First antenatal');
88
160
  expect(getByTestId('intent').textContent).toEqual('plan');
89
161
  expect(getByTestId('goals').textContent).toEqual('#goal');
90
162
  expect(getByTestId('subject').textContent).toContain('Eve Everywoman');
@@ -5,8 +5,12 @@ import Coding from '../../datatypes/Coding';
5
5
  const CarePlanActivity = props => {
6
6
  const { title = '', hasCategories, categories } = props.fhirData;
7
7
  return (
8
- <div className="fhir-resource__CarePlan__activity">
9
- <div className="fhir-resource__CarePlan__activity-title">{title}</div>
8
+ <div className="fhir-resource__CarePlan__activity mb-2">
9
+ <div className="fhir-resource__CarePlan__activity-title fw-bold">
10
+ {title
11
+ .toLowerCase()
12
+ .replace(/./, firstLetter => firstLetter.toUpperCase())}
13
+ </div>
10
14
  {hasCategories &&
11
15
  categories.map((coding, i) => (
12
16
  <Coding key={`item-${i}`} fhirData={coding} />
@@ -0,0 +1,55 @@
1
+ import {
2
+ MissingValue,
3
+ Table,
4
+ TableCell,
5
+ TableHeader,
6
+ TableRow,
7
+ ValueSection,
8
+ } from '../../ui';
9
+ import Reference from '../../datatypes/Reference';
10
+ import Coding from '../../datatypes/Coding';
11
+ import React from 'react';
12
+
13
+ const CareTeam = ({ careTeam }) => {
14
+ return (
15
+ <ValueSection label="Care Team" data-testid="careTeam" marginTop>
16
+ <Table>
17
+ <thead>
18
+ <TableRow>
19
+ <TableHeader>Provider</TableHeader>
20
+ <TableHeader>Role</TableHeader>
21
+ <TableHeader>Qualification</TableHeader>
22
+ </TableRow>
23
+ </thead>
24
+ <tbody className="border-top-0">
25
+ {careTeam.map((member, idx) => (
26
+ <TableRow key={idx}>
27
+ <TableCell data-testid="careTeam.provider" className="col-md-4">
28
+ <Reference fhirData={member.provider} />
29
+ </TableCell>
30
+ <TableCell data-testid="careTeam.role" className="col-md-4">
31
+ {member.role ? (
32
+ <Coding fhirData={member.role} />
33
+ ) : (
34
+ <MissingValue />
35
+ )}
36
+ </TableCell>
37
+ <TableCell
38
+ data-testid="careTeam.qualification"
39
+ className="col-md-4"
40
+ >
41
+ {careTeam.qualification ? (
42
+ <Coding fhirData={member.qualification} />
43
+ ) : (
44
+ <MissingValue />
45
+ )}
46
+ </TableCell>
47
+ </TableRow>
48
+ ))}
49
+ </tbody>
50
+ </Table>
51
+ </ValueSection>
52
+ );
53
+ };
54
+
55
+ export default CareTeam;
@@ -1,12 +1,3 @@
1
- .fhir-resource__Claim__item-level {
2
- height: 100%;
3
- height: 50px;
4
- margin: -12px;
5
- display: flex;
6
- }
7
-
8
- .fhir-resource__Claim__item-level-fill {
9
- width: 10px;
10
- height: 100%;
11
- background: #dee2e6;
1
+ .table-expandable-row {
2
+ --bs-table-striped-bg: #eef1f3;
12
3
  }