fhir-react 0.3.10 → 0.3.13

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 (77) hide show
  1. package/.storybook/preview.js +49 -0
  2. package/README.md +17 -1
  3. package/build/index.js +9 -9
  4. package/build/style.css +1 -1
  5. package/package.json +1 -1
  6. package/src/components/containers/Accordion/Accordion.js +13 -8
  7. package/src/components/containers/ResourceContainer/ResourceContainer.css +1 -3
  8. package/src/components/datatypes/Date/Date.js +1 -0
  9. package/src/components/datatypes/DatePeriod/DatePeriod.js +2 -2
  10. package/src/components/resources/AdverseEvent/AdverseEvent.js +2 -0
  11. package/src/components/resources/AdverseEvent/AdverseEvent.test.js +2 -2
  12. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.js +21 -2
  13. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.test.js +8 -4
  14. package/src/components/resources/Appointment/Appointment.js +2 -0
  15. package/src/components/resources/Binary/Binary.js +2 -1
  16. package/src/components/resources/CarePlan/CarePlan.js +3 -0
  17. package/src/components/resources/CarePlan/CarePlan.test.js +4 -4
  18. package/src/components/resources/CareTeam/CareTeam.js +2 -0
  19. package/src/components/resources/CareTeam/CareTeam.test.js +4 -4
  20. package/src/components/resources/Claim/Claim.js +3 -0
  21. package/src/components/resources/Claim/Claim.stories.js +1 -1
  22. package/src/components/resources/Claim/Claim.test.js +6 -6
  23. package/src/components/resources/ClaimResponse/ClaimResponse.js +2 -0
  24. package/src/components/resources/ClaimResponse/ClaimResponse.stories.js +1 -1
  25. package/src/components/resources/ClaimResponse/ClaimResponse.test.js +6 -6
  26. package/src/components/resources/Condition/Condition.js +27 -3
  27. package/src/components/resources/Condition/Condition.test.js +5 -5
  28. package/src/components/resources/Coverage/Coverage.js +3 -0
  29. package/src/components/resources/Device/Device.js +3 -0
  30. package/src/components/resources/DiagnosticReport/DiagnosticReport.js +2 -0
  31. package/src/components/resources/DiagnosticReport/DiagnosticReport.test.js +4 -2
  32. package/src/components/resources/DocumentReference/DocumentReference.js +2 -0
  33. package/src/components/resources/Encounter/Encounter.js +2 -0
  34. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +21 -4
  35. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.test.js +7 -7
  36. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.stories.js +1 -1
  37. package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.js +2 -0
  38. package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.stories.js +1 -1
  39. package/src/components/resources/Generic/Generic.js +8 -1
  40. package/src/components/resources/Goal/Goal.js +2 -0
  41. package/src/components/resources/Goal/Goal.test.js +2 -2
  42. package/src/components/resources/Immunization/Immunization.js +10 -2
  43. package/src/components/resources/List/List.js +2 -0
  44. package/src/components/resources/Location/Location.js +8 -1
  45. package/src/components/resources/Medication/Medication.js +2 -0
  46. package/src/components/resources/MedicationAdministration/MedicationAdministration.js +4 -2
  47. package/src/components/resources/MedicationAdministration/MedicationAdministration.test.js +7 -7
  48. package/src/components/resources/MedicationDispense/MedicationDispense.js +2 -0
  49. package/src/components/resources/MedicationDispense/MedicationDispense.test.js +2 -2
  50. package/src/components/resources/MedicationKnowledge/MedicationKnowledge.js +2 -0
  51. package/src/components/resources/MedicationOrder/MedicationOrder.js +8 -1
  52. package/src/components/resources/MedicationRequest/MedicationRequest.js +2 -0
  53. package/src/components/resources/MedicationRequest/MedicationRequest.test.js +4 -4
  54. package/src/components/resources/MedicationStatement/MedicationStatement.js +2 -0
  55. package/src/components/resources/Observation/Observation.js +23 -4
  56. package/src/components/resources/Observation/Observation.test.js +1 -1
  57. package/src/components/resources/Organization/Organization.js +2 -0
  58. package/src/components/resources/Patient/Patient.js +3 -1
  59. package/src/components/resources/Patient/Patient.test.js +6 -6
  60. package/src/components/resources/Practitioner/Practitioner.js +4 -0
  61. package/src/components/resources/PractitionerRole/PractitionerRole.js +2 -0
  62. package/src/components/resources/PractitionerRole/PractitionerRole.stories.js +1 -1
  63. package/src/components/resources/Procedure/Procedure.js +8 -1
  64. package/src/components/resources/Procedure/Procedure.test.js +1 -1
  65. package/src/components/resources/Questionnaire/Questionnaire.js +2 -0
  66. package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.js +2 -0
  67. package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.test.js +4 -4
  68. package/src/components/resources/ReferralRequest/ReferralRequest.js +2 -0
  69. package/src/components/resources/RelatedPerson/RelatedPerson.js +2 -0
  70. package/src/components/resources/RelatedPerson/RelatedPerson.stories.js +1 -1
  71. package/src/components/resources/ResearchStudy/ResearchStudy.js +2 -0
  72. package/src/components/resources/ResearchStudy/ResearchStudy.test.js +1 -1
  73. package/src/components/supportedFhirResourceList.js +2 -0
  74. package/src/components/ui/index.js +5 -1
  75. package/src/utils/formatDate.js +3 -0
  76. package/src/utils/formatDate.test.js +2 -2
  77. package/src/utils/getResourceDate.js +9 -0
@@ -107,7 +107,7 @@ describe('should render component correctly', () => {
107
107
 
108
108
  expect(getByTestId('clinicalStatus').textContent).toEqual('active');
109
109
  expect(getByTestId('severity').textContent).toEqual('Medium severity');
110
- expect(getByTestId('onsetDate').textContent).toEqual('8/24/2015');
110
+ expect(getByTestId('onsetDate').textContent).toEqual('12/02/2019');
111
111
  expect(getByTestId('asserter').textContent).toEqual('MOORE, NICK');
112
112
  });
113
113
 
@@ -137,7 +137,7 @@ describe('should render component correctly', () => {
137
137
  expect(getByTestId('severity').textContent).toEqual(
138
138
  'Moderate to severe severity',
139
139
  );
140
- expect(getByTestId('onsetDate').textContent).toEqual('3/8/2013');
140
+ expect(getByTestId('onsetDate').textContent).toEqual('03/08/2013');
141
141
  expect(getByTestId('asserter').textContent).toEqual('Practitioner/f201');
142
142
  });
143
143
 
@@ -153,7 +153,7 @@ describe('should render component correctly', () => {
153
153
 
154
154
  expect(getByTestId('clinicalStatus').textContent).toEqual('active');
155
155
  expect(getByTestId('severity').textContent).toEqual('Severe severity');
156
- expect(getByTestId('onsetDate').textContent).toEqual('5/24/2012');
156
+ expect(getByTestId('onsetDate').textContent).toEqual('05/24/2012');
157
157
  expect(queryAllByTestId('asserter').length).toEqual(0);
158
158
  expect(queryAllByTestId('dateRecorded').length).toEqual(0);
159
159
  });
@@ -185,9 +185,9 @@ describe('should render component correctly', () => {
185
185
 
186
186
  expect(getByTestId('clinicalStatus').textContent).toEqual('resolved');
187
187
  expect(getByTestId('severity').textContent).toEqual('Mild severity');
188
- expect(getByTestId('onsetDate').textContent).toEqual('4/2/2013');
188
+ expect(getByTestId('onsetDate').textContent).toEqual('04/02/2013');
189
189
  expect(getByTestId('asserter').textContent).toEqual('Practitioner/f201');
190
- expect(getByTestId('dateRecorded').textContent).toEqual('4/4/2013');
190
+ expect(getByTestId('dateRecorded').textContent).toEqual('04/04/2013');
191
191
  });
192
192
 
193
193
  it('should fire custom onClick function', () => {
@@ -60,6 +60,7 @@ const stu3DTO = fhirResource => {
60
60
  hasExtension,
61
61
  };
62
62
  };
63
+
63
64
  const r4DTO = fhirResource => {
64
65
  const issuer = _get(fhirResource, 'payor.0');
65
66
  const planId = _get(fhirResource, 'class.plan');
@@ -120,6 +121,7 @@ const Coverage = ({
120
121
  fhirIcons,
121
122
  onClick,
122
123
  rawOnClick,
124
+ customId,
123
125
  }) => {
124
126
  let fhirResourceData = {};
125
127
  try {
@@ -240,6 +242,7 @@ const Coverage = ({
240
242
  bodyContent={<Body tableData={tableData} />}
241
243
  onClick={onClick}
242
244
  rawOnClick={rawOnClick}
245
+ customId={customId}
243
246
  />
244
247
  </Root>
245
248
  );
@@ -42,6 +42,7 @@ const dstu2DTO = fhirResource => {
42
42
  getExpiry,
43
43
  };
44
44
  };
45
+
45
46
  const stu3DTO = fhirResource => {
46
47
  const getUdi = _get(fhirResource, 'udi.name');
47
48
  const hasExpiry = _has(fhirResource, 'expirationDate');
@@ -108,6 +109,7 @@ const Device = ({
108
109
  fhirIcons,
109
110
  onClick,
110
111
  rawOnClick,
112
+ customId,
111
113
  }) => {
112
114
  let fhirResourceData = {};
113
115
  try {
@@ -186,6 +188,7 @@ const Device = ({
186
188
  }
187
189
  onClick={onClick}
188
190
  rawOnClick={rawOnClick}
191
+ customId={customId}
189
192
  />
190
193
  </Root>
191
194
  );
@@ -99,6 +99,7 @@ const DiagnosticReport = ({
99
99
  fhirIcons,
100
100
  onClick,
101
101
  rawOnClick,
102
+ customId,
102
103
  }) => {
103
104
  let fhirResourceData = {};
104
105
  try {
@@ -172,6 +173,7 @@ const DiagnosticReport = ({
172
173
  bodyContent={<Body tableData={tableData} />}
173
174
  onClick={onClick}
174
175
  rawOnClick={rawOnClick}
176
+ customId={customId}
175
177
  />
176
178
  </Root>
177
179
  );
@@ -90,10 +90,12 @@ describe('should render component correctly', () => {
90
90
  expect(getByTestId('title').textContent).toContain(
91
91
  'blood count (hemogram)',
92
92
  );
93
- expect(getByTestId('effectiveDateTime').textContent).toContain('4/2/2013');
93
+ expect(getByTestId('effectiveDateTime').textContent).toContain(
94
+ '04/02/2013',
95
+ );
94
96
 
95
97
  expect(getByTestId('categoryCoding').textContent).toContain('Haematology');
96
- expect(getByTestId('issued').textContent).toContain('5/15/2013');
98
+ expect(getByTestId('issued').textContent).toContain('05/15/2013');
97
99
  expect(getByTestId('performer').textContent).toContain(
98
100
  'University Medical ',
99
101
  );
@@ -222,6 +222,7 @@ const DocumentReference = ({
222
222
  fhirIcons,
223
223
  onClick,
224
224
  rawOnClick,
225
+ customId,
225
226
  }) => {
226
227
  let fhirResourceData = {};
227
228
  try {
@@ -344,6 +345,7 @@ const DocumentReference = ({
344
345
  }
345
346
  onClick={onClick}
346
347
  rawOnClick={rawOnClick}
348
+ customId={customId}
347
349
  />
348
350
  </Root>
349
351
  );
@@ -166,6 +166,7 @@ const Encounter = ({
166
166
  fhirIcons,
167
167
  onClick,
168
168
  rawOnClick,
169
+ customId,
169
170
  }) => {
170
171
  let fhirResourceData = {};
171
172
  try {
@@ -237,6 +238,7 @@ const Encounter = ({
237
238
  }
238
239
  onClick={onClick}
239
240
  rawOnClick={rawOnClick}
241
+ customId={customId}
240
242
  />
241
243
  </Root>
242
244
  );
@@ -126,7 +126,9 @@ const r4DTO = fhirResource => {
126
126
  */
127
127
  const prepareServiceItem = services =>
128
128
  services.map(serviceItem => {
129
- const coding = _get(serviceItem, 'productOrService.coding.0');
129
+ const coding =
130
+ _get(serviceItem, 'revenue.coding.0') ||
131
+ _get(serviceItem, 'productOrService.coding.0');
130
132
  const servicedDate = _get(serviceItem, 'servicedDate');
131
133
  const servicedPeriod = _get(serviceItem, 'servicedPeriod');
132
134
  const quantity = _get(serviceItem, 'quantity.value');
@@ -235,6 +237,7 @@ const ExplanationOfBenefit = ({
235
237
  fhirIcons,
236
238
  onClick,
237
239
  rawOnClick,
240
+ customId,
238
241
  }) => {
239
242
  let fhirResourceData = {};
240
243
  try {
@@ -517,9 +520,22 @@ const ExplanationOfBenefit = ({
517
520
  return key !== 'sequence' && key !== 'category';
518
521
  },
519
522
  );
520
- const infoStatus = _get(informationItem, infoKey);
521
- const StatusComponent =
522
- infoKey.toString() === 'timingDate' ? Date : Quantity;
523
+ let infoStatus = _get(informationItem, infoKey);
524
+ let StatusComponent;
525
+ switch (infoKey.toString()) {
526
+ case 'timingDate':
527
+ StatusComponent = Date;
528
+ break;
529
+ case 'timingPeriod':
530
+ StatusComponent = Period;
531
+ break;
532
+ case 'valueQuantity':
533
+ StatusComponent = Quantity;
534
+ break;
535
+ default:
536
+ StatusComponent = Coding;
537
+ infoStatus = _get(infoStatus, 'coding', '')[0];
538
+ }
523
539
 
524
540
  return (
525
541
  <TableRow key={`serviceItem-${i}`}>
@@ -550,6 +566,7 @@ const ExplanationOfBenefit = ({
550
566
  }
551
567
  onClick={onClick}
552
568
  rawOnClick={rawOnClick}
569
+ customId={customId}
553
570
  />
554
571
  </Root>
555
572
  );
@@ -95,7 +95,7 @@ describe('should render ExplanationOfBenefit component properly', () => {
95
95
  expect(container).not.toBeNull();
96
96
 
97
97
  expect(getByTestId('title').textContent).toContain('Claim settled as ');
98
- expect(getByTestId('created').textContent).toContain('8/16/2014');
98
+ expect(getByTestId('created').textContent).toContain('08/16/2014');
99
99
  expect(getByTestId('insurer').textContent).toContain('Organization/2');
100
100
  });
101
101
 
@@ -111,7 +111,7 @@ describe('should render ExplanationOfBenefit component properly', () => {
111
111
  expect(container).not.toBeNull();
112
112
 
113
113
  expect(getByTestId('title').textContent).toContain('Claim settled as ');
114
- expect(getByTestId('created').textContent).toContain('8/16/2014');
114
+ expect(getByTestId('created').textContent).toContain('08/16/2014');
115
115
  expect(getByTestId('metricAmount').textContent).toContain('$135.57');
116
116
  expect(
117
117
  getByTestId('planDiscount').textContent.replace(nbspRegex, ' '),
@@ -153,7 +153,7 @@ describe('should render ExplanationOfBenefit component properly', () => {
153
153
  expect(getByTestId('title').textContent).toEqual(
154
154
  'Claim settled as per contract.',
155
155
  );
156
- expect(getByTestId('created').textContent).toEqual('8/16/2014');
156
+ expect(getByTestId('created').textContent).toEqual('08/16/2014');
157
157
  expect(getByTestId('insurer').textContent).toEqual('Organization/3');
158
158
  expect(getByTestId('provider').textContent).toEqual('Practitioner/1');
159
159
  expect(getByTestId('totalSum').textContent).toContain('135.57');
@@ -184,7 +184,7 @@ describe('should render ExplanationOfBenefit component properly', () => {
184
184
  const explanationServicedDate = getAllByTestId(
185
185
  'explanation.servicedDate',
186
186
  ).map(n => n.textContent);
187
- expect(explanationServicedDate).toEqual(['8/16/2014', '8/16/2014']);
187
+ expect(explanationServicedDate).toEqual(['08/16/2014', '08/16/2014']);
188
188
 
189
189
  const explanationQuantity = getAllByTestId('explanation.quantity').map(
190
190
  n => n.textContent,
@@ -244,7 +244,7 @@ describe('should render ExplanationOfBenefit component properly', () => {
244
244
  } = render(<ExplanationOfBenefit {...defaultProps} />);
245
245
  expect(container).not.toBeNull();
246
246
 
247
- expect(getByTestId('created').textContent).toEqual('1/5/2017');
247
+ expect(getByTestId('created').textContent).toEqual('01/05/2017');
248
248
  expect(getByTestId('identifier').textContent).toContain(
249
249
  'c145d3fe-d56e-dc26-75e9-01e90672f506',
250
250
  );
@@ -259,7 +259,7 @@ describe('should render ExplanationOfBenefit component properly', () => {
259
259
  'Organization/iAxXvHiphwGGAL48m3B7XXtKlLZg6yXnC1ch84x1up',
260
260
  );
261
261
  expect(getByTestId('billablePeriod').textContent).toEqual(
262
- 'From: 1/5/2017; To: 1/5/2018',
262
+ 'From: 01/05/2017; To: 01/05/2018',
263
263
  );
264
264
  expect(getByTestId('patient').textContent).toEqual(
265
265
  'Patient/f56391c2-dd54-b378-46ef-87c1643a2ba0',
@@ -276,7 +276,7 @@ describe('should render ExplanationOfBenefit component properly', () => {
276
276
  'clmrecvddate',
277
277
  );
278
278
  expect(getByTestId('supportingInfo.0.timingDate').textContent).toEqual(
279
- '1/5/2017',
279
+ '01/05/2017',
280
280
  );
281
281
  expect(getByTestId('supportingInfo.1.category').textContent).toContain(
282
282
  'dayssupply',
@@ -30,7 +30,7 @@ const CHART_DATA = [
30
30
  ];
31
31
 
32
32
  export default {
33
- title: 'ExplanationOfBenefitGraph',
33
+ title: 'ExplanationOfBenefit/ExplanationOfBenefitGraph',
34
34
  component: ExplanationOfBenefitGraph,
35
35
  argTypes: {
36
36
  data: {
@@ -76,6 +76,7 @@ const FamilyMemberHistory = ({
76
76
  fhirIcons,
77
77
  onClick,
78
78
  rawOnClick,
79
+ customId,
79
80
  }) => {
80
81
  let fhirResourceData = {};
81
82
  try {
@@ -142,6 +143,7 @@ const FamilyMemberHistory = ({
142
143
  bodyContent={<Body tableData={tableData} />}
143
144
  onClick={onClick}
144
145
  rawOnClick={rawOnClick}
146
+ customId={customId}
145
147
  />
146
148
  </Root>
147
149
  );
@@ -12,7 +12,7 @@ import fhirIcons from '../../../fixtures/example-icons';
12
12
  import FamilyMemberHistoryIcon from '../../../assets/containers/FamilyMemberHistory/family-member-history.svg';
13
13
 
14
14
  export default {
15
- title: 'FamilyMemberHistory',
15
+ title: 'Coverage/FamilyMemberHistory',
16
16
  component: FamilyMemberHistory,
17
17
  argTypes: {
18
18
  ...defaultArgTypes,
@@ -4,7 +4,13 @@ import _get from 'lodash/get';
4
4
  import { Root, Header } from '../../ui';
5
5
  import Accordion from '../../containers/Accordion';
6
6
 
7
- const Generic = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
7
+ const Generic = ({
8
+ fhirResource,
9
+ fhirIcons,
10
+ onClick,
11
+ rawOnClick,
12
+ customId,
13
+ }) => {
8
14
  const title = fhirResource
9
15
  ? `${fhirResource.resourceType}/${fhirResource.id}`
10
16
  : `Unknown Resource`;
@@ -31,6 +37,7 @@ const Generic = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
31
37
  }
32
38
  onClick={onClick}
33
39
  rawOnClick={rawOnClick}
40
+ customId={customId}
34
41
  />
35
42
  </Root>
36
43
  );
@@ -105,6 +105,7 @@ const Goal = ({
105
105
  fhirIcons,
106
106
  onClick,
107
107
  rawOnClick,
108
+ customId,
108
109
  }) => {
109
110
  let fhirResourceData = {};
110
111
  try {
@@ -235,6 +236,7 @@ const Goal = ({
235
236
  bodyContent={<Body tableData={tableData} />}
236
237
  onClick={onClick}
237
238
  rawOnClick={rawOnClick}
239
+ customId={customId}
238
240
  />
239
241
  </Root>
240
242
  );
@@ -139,7 +139,7 @@ describe('should render Goal component properly', () => {
139
139
  'Peter James Chalmers',
140
140
  );
141
141
 
142
- expect(getByTestId('statusDate').textContent).toEqual('2/14/2016');
142
+ expect(getByTestId('statusDate').textContent).toEqual('02/14/2016');
143
143
 
144
144
  expect(getByTestId('description').textContent).toEqual(
145
145
  'Target weight is 160 to 180 lbs.',
@@ -169,7 +169,7 @@ describe('should render Goal component properly', () => {
169
169
 
170
170
  expect(getByTestId('status').textContent).toEqual('completed');
171
171
 
172
- expect(getByTestId('headerStartDate').textContent).toEqual('4/5/2015');
172
+ expect(getByTestId('headerStartDate').textContent).toEqual('04/05/2015');
173
173
 
174
174
  expect(getByTestId('subject').textContent).toContain(
175
175
  'Peter James Chalmers',
@@ -11,6 +11,7 @@ import _get from 'lodash/get';
11
11
  import _has from 'lodash/has';
12
12
  import fhirVersions from '../fhirResourceVersions';
13
13
  import { Value } from '../../ui';
14
+ import { getResourceDate } from '../../../utils/getResourceDate';
14
15
 
15
16
  const commonDTO = fhirResource => {
16
17
  const title =
@@ -109,6 +110,7 @@ const Immunization = ({
109
110
  fhirIcons,
110
111
  onClick,
111
112
  rawOnClick,
113
+ customId,
112
114
  }) => {
113
115
  const {
114
116
  title,
@@ -227,6 +229,11 @@ const Immunization = ({
227
229
  },
228
230
  ];
229
231
 
232
+ const immunizationDatesPaths = ['occurrenceDateTime'];
233
+
234
+ const headerDate =
235
+ getResourceDate(fhirResource, immunizationDatesPaths) || providedDate;
236
+
230
237
  return (
231
238
  <Root name="Immunization">
232
239
  <Accordion
@@ -234,9 +241,9 @@ const Immunization = ({
234
241
  <Header
235
242
  resourceName="Immunization"
236
243
  additionalContent={
237
- providedDate && (
244
+ headerDate && (
238
245
  <Value label="Start date" data-testid="headerStartDate">
239
- <Date fhirData={providedDate} isBlack />
246
+ <Date fhirData={headerDate} isBlack />
240
247
  </Value>
241
248
  )
242
249
  }
@@ -248,6 +255,7 @@ const Immunization = ({
248
255
  bodyContent={<Body tableData={tableData} />}
249
256
  onClick={onClick}
250
257
  rawOnClick={rawOnClick}
258
+ customId={customId}
251
259
  />
252
260
  </Root>
253
261
  );
@@ -132,6 +132,7 @@ const List = ({
132
132
  fhirIcons,
133
133
  onClick,
134
134
  rawOnClick,
135
+ customId,
135
136
  }) => {
136
137
  let fhirResourceData = {};
137
138
  try {
@@ -293,6 +294,7 @@ const List = ({
293
294
  }
294
295
  onClick={onClick}
295
296
  rawOnClick={rawOnClick}
297
+ customId={customId}
296
298
  />
297
299
  </Root>
298
300
  );
@@ -9,7 +9,13 @@ import CodeableConcept from '../../datatypes/CodeableConcept';
9
9
  import Reference from '../../datatypes/Reference';
10
10
  import Accordion from '../../containers/Accordion';
11
11
 
12
- const Location = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
12
+ const Location = ({
13
+ fhirResource,
14
+ fhirIcons,
15
+ onClick,
16
+ rawOnClick,
17
+ customId,
18
+ }) => {
13
19
  const name = _get(fhirResource, 'name');
14
20
  const status = _get(fhirResource, 'status');
15
21
  const description = _get(fhirResource, 'description');
@@ -83,6 +89,7 @@ const Location = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
83
89
  bodyContent={<Body tableData={tableData} />}
84
90
  onClick={onClick}
85
91
  rawOnClick={rawOnClick}
92
+ customId={customId}
86
93
  />
87
94
  </Root>
88
95
  );
@@ -168,6 +168,7 @@ const Medication = ({
168
168
  fhirIcons,
169
169
  onClick,
170
170
  rawOnClick,
171
+ customId,
171
172
  }) => {
172
173
  let fhirResourceData = {};
173
174
  try {
@@ -281,6 +282,7 @@ const Medication = ({
281
282
  }
282
283
  onClick={onClick}
283
284
  rawOnClick={rawOnClick}
285
+ customId={customId}
284
286
  />
285
287
  </Root>
286
288
  );
@@ -28,12 +28,11 @@ const commonDTO = fhirResource => {
28
28
 
29
29
  return {
30
30
  medicationReference,
31
-
32
31
  dosageRoute,
33
-
34
32
  status,
35
33
  };
36
34
  };
35
+
37
36
  const dstu2DTO = fhirResource => {
38
37
  const periodTimeStart = _get(fhirResource, 'effectiveTimePeriod.start');
39
38
  const periodTimeEnd = _get(fhirResource, 'effectiveTimePeriod.end');
@@ -50,6 +49,7 @@ const dstu2DTO = fhirResource => {
50
49
  dosageQuantity,
51
50
  };
52
51
  };
52
+
53
53
  const stu3DTO = fhirResource => {
54
54
  const periodTimeStart = _get(fhirResource, 'effectivePeriod.start');
55
55
  const periodTimeEnd = _get(fhirResource, 'effectivePeriod.end');
@@ -116,6 +116,7 @@ const MedicationAdministration = ({
116
116
  fhirIcons,
117
117
  onClick,
118
118
  rawOnClick,
119
+ customId,
119
120
  }) => {
120
121
  let fhirResourceData = {};
121
122
  try {
@@ -215,6 +216,7 @@ const MedicationAdministration = ({
215
216
  }
216
217
  onClick={onClick}
217
218
  rawOnClick={rawOnClick}
219
+ customId={customId}
218
220
  />
219
221
  </Root>
220
222
  );
@@ -111,9 +111,9 @@ describe('should render MedicationAdministration component properly', () => {
111
111
  'Practitioner/example',
112
112
  );
113
113
 
114
- expect(getByTestId('periodTimeStart').textContent).toEqual('1/15/2015');
114
+ expect(getByTestId('periodTimeStart').textContent).toEqual('01/15/2015');
115
115
 
116
- expect(getByTestId('periodTimeEnd').textContent).toEqual('1/15/2015');
116
+ expect(getByTestId('periodTimeEnd').textContent).toEqual('01/15/2015');
117
117
 
118
118
  expect(getByTestId('dosageRoute').textContent).toContain(
119
119
  'Intravenous route',
@@ -139,7 +139,7 @@ describe('should render MedicationAdministration component properly', () => {
139
139
 
140
140
  expect(getByTestId('practitioner').textContent).toContain('Patrick Pump');
141
141
 
142
- expect(getByTestId('periodTimeStart').textContent).toEqual('1/15/2015');
142
+ expect(getByTestId('periodTimeStart').textContent).toEqual('01/15/2015');
143
143
 
144
144
  expect(getByTestId('periodTimeEnd').textContent).toEqual('-');
145
145
 
@@ -164,8 +164,8 @@ describe('should render MedicationAdministration component properly', () => {
164
164
  expect(getByTestId('status').textContent).toContain('on-hold');
165
165
  expect(getByTestId('patient').textContent).toContain('Donald Duck');
166
166
  expect(queryByTestId('practitioner')).toBeNull();
167
- expect(getByTestId('periodTimeStart').textContent).toEqual('1/15/2015');
168
- expect(getByTestId('periodTimeEnd').textContent).toEqual('1/15/2015');
167
+ expect(getByTestId('periodTimeStart').textContent).toEqual('01/15/2015');
168
+ expect(getByTestId('periodTimeEnd').textContent).toEqual('01/15/2015');
169
169
  expect(getByTestId('dosageRoute').textContent).toContain('-');
170
170
  expect(getByTestId('dosageQuantity').textContent).toEqual('-');
171
171
  });
@@ -184,8 +184,8 @@ describe('should render MedicationAdministration component properly', () => {
184
184
  expect(getByTestId('status').textContent).toContain('completed');
185
185
  expect(getByTestId('patient').textContent).toContain('Donald Duck');
186
186
  expect(getByTestId('practitioner').textContent).toContain('Patrick Pump');
187
- expect(getByTestId('periodTimeStart').textContent).toEqual('1/15/2015');
188
- expect(getByTestId('periodTimeEnd').textContent).toEqual('1/15/2015');
187
+ expect(getByTestId('periodTimeStart').textContent).toEqual('01/15/2015');
188
+ expect(getByTestId('periodTimeEnd').textContent).toEqual('01/15/2015');
189
189
  expect(getByTestId('dosageRoute').textContent).toContain('Oral Route');
190
190
  expect(getByTestId('dosageQuantity').textContent).toEqual('2 TAB');
191
191
  });
@@ -165,6 +165,7 @@ const MedicationDispense = ({
165
165
  fhirIcons,
166
166
  onClick,
167
167
  rawOnClick,
168
+ customId,
168
169
  }) => {
169
170
  let fhirResourceData = {};
170
171
  try {
@@ -245,6 +246,7 @@ const MedicationDispense = ({
245
246
  }
246
247
  onClick={onClick}
247
248
  rawOnClick={rawOnClick}
249
+ customId={customId}
248
250
  />
249
251
  </Root>
250
252
  );
@@ -93,7 +93,7 @@ describe('should render Device component properly', () => {
93
93
 
94
94
  expect(getByTestId('title').textContent).toEqual('prescribed medication');
95
95
  expect(getByTestId('typeCoding').textContent).toContain('Part Fill');
96
- expect(getByTestId('whenPrepared').textContent).toContain('3/1/2015');
96
+ expect(getByTestId('whenPrepared').textContent).toContain('03/01/2015');
97
97
  expect(getByTestId('hasDosageInstruction').textContent).toContain(
98
98
  'or after food',
99
99
  );
@@ -132,7 +132,7 @@ describe('should render Device component properly', () => {
132
132
  expect(container).not.toBeNull();
133
133
 
134
134
  expect(getByTestId('title').textContent).toContain('Novolog 100u/ml');
135
- expect(getByTestId('whenPrepared').textContent).toEqual('1/15/2015');
135
+ expect(getByTestId('whenPrepared').textContent).toEqual('01/15/2015');
136
136
  expect(
137
137
  within(getByTestId('hasDosageInstruction'))
138
138
  .queryAllByTestId('dosageTiming')
@@ -110,6 +110,7 @@ const MedicationKnowledge = ({
110
110
  fhirIcons,
111
111
  onClick,
112
112
  rawOnClick,
113
+ customId,
113
114
  }) => {
114
115
  let fhirResourceData = {};
115
116
  try {
@@ -254,6 +255,7 @@ const MedicationKnowledge = ({
254
255
  }
255
256
  onClick={onClick}
256
257
  rawOnClick={rawOnClick}
258
+ customId={customId}
257
259
  />
258
260
  </Root>
259
261
  );
@@ -8,7 +8,13 @@ import Coding from '../../datatypes/Coding';
8
8
 
9
9
  import { Root, Header, Body } from '../../ui';
10
10
 
11
- const MedicationOrder = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
11
+ const MedicationOrder = ({
12
+ fhirResource,
13
+ fhirIcons,
14
+ onClick,
15
+ rawOnClick,
16
+ customId,
17
+ }) => {
12
18
  const medicationReference = _get(fhirResource, 'medicationReference');
13
19
  const medicationCodeableConcept = _get(
14
20
  fhirResource,
@@ -66,6 +72,7 @@ const MedicationOrder = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
66
72
  bodyContent={<Body tableData={tableData} />}
67
73
  onClick={onClick}
68
74
  rawOnClick={rawOnClick}
75
+ customId={customId}
69
76
  />
70
77
  </Root>
71
78
  );
@@ -14,6 +14,7 @@ const MedicationRequest = ({
14
14
  fhirIcons,
15
15
  onClick,
16
16
  rawOnClick,
17
+ customId,
17
18
  }) => {
18
19
  const medicationReference = _get(fhirResource, 'medicationReference');
19
20
  const medicationCodeableConcept = _get(
@@ -94,6 +95,7 @@ const MedicationRequest = ({
94
95
  bodyContent={<Body tableData={tableData} />}
95
96
  onClick={onClick}
96
97
  rawOnClick={rawOnClick}
98
+ customId={customId}
97
99
  />
98
100
  </Root>
99
101
  );