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
@@ -95,7 +95,7 @@ describe('should render MedicationRequest component properly', () => {
95
95
  'Take one tablet',
96
96
  );
97
97
  expect(getByTestId('requester').textContent).toContain('Patrick Pump');
98
- expect(getByTestId('created').textContent).toEqual('3/1/2015');
98
+ expect(getByTestId('created').textContent).toEqual('03/01/2015');
99
99
  expect(getByTestId('intent').textContent).toEqual('order');
100
100
  });
101
101
  it('should render with STU3 source data in which medicationReference key does not exist', () => {
@@ -126,7 +126,7 @@ describe('should render MedicationRequest component properly', () => {
126
126
  'Take one tablet',
127
127
  );
128
128
  expect(getByTestId('requester').textContent).toContain('Patrick Pump');
129
- expect(getByTestId('created').textContent).toEqual('3/1/2015');
129
+ expect(getByTestId('created').textContent).toEqual('03/01/2015');
130
130
  expect(getByTestId('intent').textContent).toEqual('order');
131
131
  });
132
132
 
@@ -146,7 +146,7 @@ describe('should render MedicationRequest component properly', () => {
146
146
  'Take 4 tablets daily',
147
147
  );
148
148
  expect(getByTestId('requester').textContent).toContain('Patrick Pump');
149
- expect(getByTestId('created').textContent).toEqual('1/15/2015');
149
+ expect(getByTestId('created').textContent).toEqual('01/15/2015');
150
150
  expect(getByTestId('intent').textContent).toEqual('order');
151
151
  });
152
152
 
@@ -168,7 +168,7 @@ describe('should render MedicationRequest component properly', () => {
168
168
  '6 mg PO daily for remission',
169
169
  );
170
170
  expect(getByTestId('requester').textContent).toContain('Patrick Pump');
171
- expect(getByTestId('created').textContent).toEqual('1/15/2015');
171
+ expect(getByTestId('created').textContent).toEqual('01/15/2015');
172
172
  expect(getByTestId('intent').textContent).toEqual('order');
173
173
  });
174
174
 
@@ -113,6 +113,7 @@ const MedicationStatement = ({
113
113
  fhirIcons,
114
114
  onClick,
115
115
  rawOnClick,
116
+ customId,
116
117
  }) => {
117
118
  let fhirResourceData = {};
118
119
  try {
@@ -207,6 +208,7 @@ const MedicationStatement = ({
207
208
  }
208
209
  onClick={onClick}
209
210
  rawOnClick={rawOnClick}
211
+ customId={customId}
210
212
  />
211
213
  </Root>
212
214
  );
@@ -17,13 +17,20 @@ import {
17
17
  Value,
18
18
  } from '../../ui';
19
19
  import Reference from '../../datatypes/Reference';
20
+ import { getResourceDate } from '../../../utils/getResourceDate';
20
21
 
21
- const Observation = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
22
+ const Observation = ({
23
+ fhirResource,
24
+ fhirIcons,
25
+ onClick,
26
+ rawOnClick,
27
+ customId,
28
+ }) => {
22
29
  const effectiveDate = _get(fhirResource, 'effectiveDateTime');
23
30
  const codeCodingDisplay = _get(fhirResource, 'code.coding.0.display');
24
31
  const codeText = _get(fhirResource, 'code.text', '');
25
32
  const valueQuantityValue = _get(fhirResource, 'valueQuantity.value', '');
26
- const issued = _get(fhirResource, 'issued', '');
33
+ // const issued = _get(fhirResource, 'issued', '');
27
34
  const valueQuantityUnit = _get(fhirResource, 'valueQuantity.unit', '');
28
35
  const status = _get(fhirResource, 'status', '');
29
36
  const valueCodeableConceptText = _get(
@@ -66,6 +73,17 @@ const Observation = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
66
73
  },
67
74
  ];
68
75
 
76
+ const observationDatesPaths = [
77
+ 'effectiveDateTime',
78
+ 'effectivePeriod.start',
79
+ 'effectiveDateTime',
80
+ 'issued',
81
+ 'valuePeriod.start',
82
+ 'valueDateTime',
83
+ ];
84
+
85
+ const headerDate = getResourceDate(fhirResource, observationDatesPaths);
86
+
69
87
  return (
70
88
  <Root name="Observation">
71
89
  <Accordion
@@ -73,9 +91,9 @@ const Observation = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
73
91
  <Header
74
92
  resourceName="Observation"
75
93
  additionalContent={
76
- issued && (
94
+ headerDate && (
77
95
  <Value label="Start date" data-testid="headerStartDate">
78
- <Date fhirData={issued} isBlack />
96
+ <Date fhirData={headerDate} isBlack />
79
97
  </Value>
80
98
  )
81
99
  }
@@ -116,6 +134,7 @@ const Observation = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
116
134
  }
117
135
  onClick={onClick}
118
136
  rawOnClick={rawOnClick}
137
+ customId={customId}
119
138
  />
120
139
  </Root>
121
140
  );
@@ -129,7 +129,7 @@ describe('should render component correctly', () => {
129
129
  );
130
130
  expect(getByTestId('status').textContent).toEqual('final');
131
131
  expect(getByTestId('secondaryStatus').textContent).toEqual('YES');
132
- expect(getByTestId('issuedOn').textContent).toEqual('5/18/2016');
132
+ expect(getByTestId('issuedOn').textContent).toEqual('05/18/2016');
133
133
  expect(getByTestId('subject').textContent).toContain('Patient/infant');
134
134
  expect(queryByText(/373066001/g)).not.toBeNull();
135
135
  });
@@ -61,6 +61,7 @@ const Organization = ({
61
61
  fhirIcons,
62
62
  onClick,
63
63
  rawOnClick,
64
+ customId,
64
65
  }) => {
65
66
  let fhirResourceData = {};
66
67
  try {
@@ -135,6 +136,7 @@ const Organization = ({
135
136
  bodyContent={<Body tableData={tableData} />}
136
137
  onClick={onClick}
137
138
  rawOnClick={rawOnClick}
139
+ customId={customId}
138
140
  />
139
141
  </Root>
140
142
  );
@@ -48,6 +48,7 @@ function Patient(props) {
48
48
  fhirIcons,
49
49
  onClick,
50
50
  rawOnClick,
51
+ customId,
51
52
  } = props;
52
53
 
53
54
  const id = getId(fhirResource);
@@ -131,7 +132,7 @@ function Patient(props) {
131
132
  {patientGender || 'unknown'}
132
133
  </span>
133
134
  {', '}
134
- <span data-testid="patientBirthDate">{patientBirthDate}</span>
135
+ <Date testId="patientBirthDate" fhirData={patientBirthDate} />
135
136
  </span>
136
137
  )
137
138
  }
@@ -150,6 +151,7 @@ function Patient(props) {
150
151
  bodyContent={<Body tableData={tableData} />}
151
152
  onClick={onClick}
152
153
  rawOnClick={rawOnClick}
154
+ customId={customId}
153
155
  />
154
156
  </Root>
155
157
  );
@@ -88,7 +88,7 @@ describe('should render component correctly', () => {
88
88
  'Jason Argonaut (usual)',
89
89
  );
90
90
  expect(getByTestId('patientGender').textContent).toEqual('male');
91
- expect(getByTestId('patientBirthDate').textContent).toEqual('1985-08-01');
91
+ expect(getByTestId('patientBirthDate').textContent).toEqual('08/01/1985');
92
92
  expect(getByTestId('patientAddress').textContent).toEqual(
93
93
  '1979 Milky Way Dr.Verona, WI 53593 US',
94
94
  );
@@ -99,7 +99,7 @@ describe('should render component correctly', () => {
99
99
  expect(queryByTestId('deceasedInfo')).toBeNull();
100
100
  });
101
101
 
102
- test('DSTU3', () => {
102
+ test('STU3', () => {
103
103
  const defaultProps = {
104
104
  fhirResource: examplePatientSTU3,
105
105
  };
@@ -111,14 +111,14 @@ describe('should render component correctly', () => {
111
111
  'John, X Doe (usual)',
112
112
  );
113
113
  expect(getByTestId('patientGender').textContent).toEqual('male');
114
- expect(getByTestId('patientBirthDate').textContent).toEqual('2014-06-01');
114
+ expect(getByTestId('patientBirthDate').textContent).toEqual('06/01/2014');
115
115
  expect(getByTestId('patientAddress').textContent).toEqual(' 05 99999 ');
116
116
  expect(getByTestId('patientPhones').textContent).toEqual('-');
117
117
  expect(queryByTestId('activeStatus')).toBeNull();
118
118
  expect(queryByTestId('deceasedInfo')).toBeNull();
119
119
  });
120
120
 
121
- test('DSTU3 resource which contains communication key data', () => {
121
+ test('STU3 resource which contains communication key data', () => {
122
122
  const defaultProps = {
123
123
  fhirResource: example2PatientSTU3,
124
124
  };
@@ -138,7 +138,7 @@ describe('should render component correctly', () => {
138
138
  'Peter, James Chalmers (official)',
139
139
  );
140
140
  expect(getByTestId('patientGender').textContent).toEqual('male');
141
- expect(getByTestId('patientBirthDate').textContent).toEqual('1974-12-25');
141
+ expect(getByTestId('patientBirthDate').textContent).toEqual('12/25/1974');
142
142
  expect(getByTestId('patientAddress').textContent).toContain(
143
143
  'PleasantVille, Vic 3999',
144
144
  );
@@ -154,7 +154,7 @@ describe('should render component correctly', () => {
154
154
  fhirResource: example3PatientR4,
155
155
  };
156
156
  const { getByTestId } = render(<Patient {...defaultProps} />);
157
- expect(getByTestId('deceasedInfo').textContent).toEqual('2/14/2015');
157
+ expect(getByTestId('deceasedInfo').textContent).toEqual('02/14/2015');
158
158
  });
159
159
 
160
160
  it('should fire custom onClick function', () => {
@@ -38,12 +38,14 @@ const commonDTO = fhirResource => {
38
38
  birthDate,
39
39
  };
40
40
  };
41
+
41
42
  const dstu2DTO = fhirResource => {
42
43
  const name = _get(fhirResource, 'name');
43
44
  return {
44
45
  name,
45
46
  };
46
47
  };
48
+
47
49
  const stu3DTO = fhirResource => {
48
50
  const name = _get(fhirResource, 'name.0');
49
51
  const address = _get(fhirResource, 'address.0');
@@ -88,6 +90,7 @@ const Practitioner = ({
88
90
  fhirIcons,
89
91
  onClick,
90
92
  rawOnClick,
93
+ customId,
91
94
  }) => {
92
95
  let fhirResourceData = {};
93
96
  try {
@@ -168,6 +171,7 @@ const Practitioner = ({
168
171
  bodyContent={<Body tableData={tableData} />}
169
172
  onClick={onClick}
170
173
  rawOnClick={rawOnClick}
174
+ customId={customId}
171
175
  />
172
176
  </Root>
173
177
  );
@@ -49,6 +49,7 @@ const PractitionerRole = ({
49
49
  fhirIcons,
50
50
  onClick,
51
51
  rawOnClick,
52
+ customId,
52
53
  }) => {
53
54
  let fhirResourceData = {};
54
55
  try {
@@ -108,6 +109,7 @@ const PractitionerRole = ({
108
109
  bodyContent={<Body tableData={tableData} />}
109
110
  onClick={onClick}
110
111
  rawOnClick={rawOnClick}
112
+ customId={customId}
111
113
  />
112
114
  </Root>
113
115
  );
@@ -16,7 +16,7 @@ import fhirIcons from '../../../fixtures/example-icons';
16
16
  import PractitionerRoleIcon from '../../../assets/containers/PractitionerRole/practitioner-role.svg';
17
17
 
18
18
  export default {
19
- title: 'PractitionerRole',
19
+ title: 'Practitioner/PractitionerRole',
20
20
  component: PractitionerRole,
21
21
  argTypes: {
22
22
  ...defaultArgTypes,
@@ -14,7 +14,13 @@ import _has from 'lodash/has';
14
14
  import { isNotEmptyArray } from '../../../utils';
15
15
  import { Value } from '../../ui';
16
16
 
17
- const Procedure = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
17
+ const Procedure = ({
18
+ fhirResource,
19
+ fhirIcons,
20
+ onClick,
21
+ rawOnClick,
22
+ customId,
23
+ }) => {
18
24
  const display =
19
25
  _get(fhirResource, 'code.coding[0].display') ||
20
26
  _get(fhirResource, 'code.text');
@@ -126,6 +132,7 @@ const Procedure = ({ fhirResource, fhirIcons, onClick, rawOnClick }) => {
126
132
  bodyContent={<Body tableData={tableData} />}
127
133
  onClick={onClick}
128
134
  rawOnClick={rawOnClick}
135
+ customId={customId}
129
136
  />
130
137
  </Root>
131
138
  );
@@ -131,7 +131,7 @@ describe('Procedure should render component correctly', () => {
131
131
  'Insertion of intracardiac pacemaker (procedure)',
132
132
  );
133
133
  expect(getByTestId('status').textContent).toEqual('completed');
134
- expect(getByTestId('providedDate').textContent).toEqual('4/5/2015');
134
+ expect(getByTestId('providedDate').textContent).toEqual('04/05/2015');
135
135
  expect(getByTestId('hasCoding').textContent).toContain(
136
136
  'Insertion of intracardiac',
137
137
  );
@@ -81,6 +81,7 @@ const Questionnaire = ({
81
81
  fhirIcons,
82
82
  onClick,
83
83
  rawOnClick,
84
+ customId,
84
85
  }) => {
85
86
  let fhirResourceData = {};
86
87
 
@@ -121,6 +122,7 @@ const Questionnaire = ({
121
122
  }
122
123
  onClick={onClick}
123
124
  rawOnClick={rawOnClick}
125
+ customId={customId}
124
126
  />
125
127
  </Root>
126
128
  );
@@ -77,6 +77,7 @@ const QuestionnaireResponse = ({
77
77
  fhirIcons,
78
78
  onClick,
79
79
  rawOnClick,
80
+ customId,
80
81
  }) => {
81
82
  let fhirResourceData = {};
82
83
 
@@ -141,6 +142,7 @@ const QuestionnaireResponse = ({
141
142
  }
142
143
  onClick={onClick}
143
144
  rawOnClick={rawOnClick}
145
+ customId={customId}
144
146
  />
145
147
  </Root>
146
148
  );
@@ -23,7 +23,7 @@ describe('QuestionnaireResponse should render component correctly', () => {
23
23
  'Questionnaire Response',
24
24
  );
25
25
  expect(getByTestId('status').textContent).toEqual('completed');
26
- expect(getByTestId('dateTime').textContent).toEqual('6/18/2013');
26
+ expect(getByTestId('dateTime').textContent).toEqual('06/18/2013');
27
27
  expect(getByTestId('subject').textContent).toEqual('Roel');
28
28
  expect(getByTestId('author').textContent).toEqual('Practitioner/f201');
29
29
 
@@ -34,7 +34,7 @@ describe('QuestionnaireResponse should render component correctly', () => {
34
34
  'What is your gender?Male ',
35
35
  );
36
36
  expect(getByTestId('linkId-2.2').textContent).toEqual(
37
- 'What is your date of birth?3/13/1960 ',
37
+ 'What is your date of birth?03/13/1960 ',
38
38
  );
39
39
  expect(getByTestId('linkId-2.3').textContent).toEqual(
40
40
  'What is your country of birth?The Netherlands ',
@@ -72,7 +72,7 @@ describe('QuestionnaireResponse should render component correctly', () => {
72
72
  'Questionnaire Response',
73
73
  );
74
74
  expect(getByTestId('status').textContent).toEqual('completed');
75
- expect(getByTestId('dateTime').textContent).toEqual('2/19/2013');
75
+ expect(getByTestId('dateTime').textContent).toEqual('02/19/2013');
76
76
 
77
77
  expect(getByTestId('answer-nameOfChild-0').textContent).toContain(
78
78
  'Cathy Jones',
@@ -90,7 +90,7 @@ describe('QuestionnaireResponse should render component correctly', () => {
90
90
  'Questionnaire Response',
91
91
  );
92
92
  expect(getByTestId('status').textContent).toEqual('completed');
93
- expect(getByTestId('dateTime').textContent).toEqual('6/18/2013');
93
+ expect(getByTestId('dateTime').textContent).toEqual('06/18/2013');
94
94
  expect(getByTestId('subject').textContent).toEqual('Roel');
95
95
  expect(getByTestId('author').textContent).toEqual('Practitioner/f201');
96
96
 
@@ -76,6 +76,7 @@ const ReferralRequest = ({
76
76
  fhirIcons,
77
77
  onClick,
78
78
  rawOnClick,
79
+ customId,
79
80
  }) => {
80
81
  let fhirResourceData = {};
81
82
  try {
@@ -157,6 +158,7 @@ const ReferralRequest = ({
157
158
  }
158
159
  onClick={onClick}
159
160
  rawOnClick={rawOnClick}
161
+ customId={customId}
160
162
  />
161
163
  </Root>
162
164
  );
@@ -73,6 +73,7 @@ const RelatedPerson = ({
73
73
  fhirIcons,
74
74
  onClick,
75
75
  rawOnClick,
76
+ customId,
76
77
  }) => {
77
78
  let fhirResourceData = {};
78
79
  try {
@@ -146,6 +147,7 @@ const RelatedPerson = ({
146
147
  bodyContent={<Body tableData={tableData} />}
147
148
  onClick={onClick}
148
149
  rawOnClick={rawOnClick}
150
+ customId={customId}
149
151
  />
150
152
  </Root>
151
153
  );
@@ -11,7 +11,7 @@ import exampleR4 from '../../../fixtures/r4/resources/relatedPerson/example1.jso
11
11
  import fhirIcons from '../../../fixtures/example-icons';
12
12
 
13
13
  export default {
14
- title: 'RelatedPerson',
14
+ title: 'Coverage/RelatedPerson',
15
15
  component: RelatedPerson,
16
16
  argTypes: {
17
17
  ...defaultArgTypes,
@@ -100,6 +100,7 @@ const ResearchStudy = ({
100
100
  fhirIcons,
101
101
  onClick,
102
102
  rawOnClick,
103
+ customId,
103
104
  }) => {
104
105
  let fhirResourceData = {};
105
106
  try {
@@ -296,6 +297,7 @@ const ResearchStudy = ({
296
297
  bodyContent={<Body tableData={tableData} />}
297
298
  onClick={onClick}
298
299
  rawOnClick={rawOnClick}
300
+ customId={customId}
299
301
  />
300
302
  </Root>
301
303
  );
@@ -120,7 +120,7 @@ describe('should render ResearchStudy component properly', () => {
120
120
 
121
121
  expect(title).toEqual('Example study');
122
122
  expect(status).toEqual('completed');
123
- expect(period).toEqual('2/1/2015 - 2/21/2015');
123
+ expect(period).toEqual('02/01/2015 - 02/21/2015');
124
124
  expect(category).toEqual('Gene expression (GENE)');
125
125
  expect(focus).toEqual('Prostate cancer (PRC)');
126
126
  expect(protocol).toEqual('PlanDefinition/pdf1');
@@ -36,6 +36,7 @@ import MedicationAdministration from './resources/MedicationAdministration';
36
36
  import Questionnaire from './resources/Questionnaire';
37
37
  import QuestionnaireResponse from './resources/QuestionnaireResponse';
38
38
  import ReferralRequest from './resources/ReferralRequest';
39
+ import RelatedPerson from './resources/RelatedPerson';
39
40
  import ResearchStudy from './resources/ResearchStudy';
40
41
  import ResourceCategory from './resources/ResourceCategory';
41
42
 
@@ -78,6 +79,7 @@ export {
78
79
  Questionnaire,
79
80
  QuestionnaireResponse,
80
81
  ReferralRequest,
82
+ RelatedPerson,
81
83
  ResearchStudy,
82
84
  ResourceCategory,
83
85
  };
@@ -17,6 +17,7 @@ export const Header = ({
17
17
  children,
18
18
  capitalize = false,
19
19
  isNoIcon = false,
20
+ rawButton,
20
21
  }) => {
21
22
  const rightItemsClass = 'align-items-center flex-fill d-flex';
22
23
 
@@ -66,7 +67,7 @@ export const Header = ({
66
67
  </div>
67
68
  )}
68
69
  </div>
69
- {(additionalContent || rightAdditionalContent) && (
70
+ {additionalContent || rightAdditionalContent ? (
70
71
  <div
71
72
  className={`fhir-ui__${resourceName}-Header__additional-content w-100 justify-content-start d-flex ${
72
73
  additionalContent ? ' pt-2' : ''
@@ -77,8 +78,11 @@ export const Header = ({
77
78
  className={`fhir-ui__${resourceName}-Header__rightAdditionalContent justify-content-md-end mx-0 ${rightItemsClass}`}
78
79
  >
79
80
  {rightAdditionalContent}
81
+ {rawButton}
80
82
  </div>
81
83
  </div>
84
+ ) : (
85
+ <div className="d-flex justify-content-end">{rawButton}</div>
82
86
  )}
83
87
  </div>
84
88
  )}
@@ -18,6 +18,9 @@ const whichOptions = date => {
18
18
  };
19
19
  }
20
20
  return {
21
+ day: '2-digit',
22
+ month: '2-digit',
23
+ year: 'numeric',
21
24
  timeZone: 'UTC',
22
25
  };
23
26
  };
@@ -13,10 +13,10 @@ describe('Date format function', () => {
13
13
  });
14
14
  it('should return US date format', () => {
15
15
  const date = '2021-03-14';
16
- expect(formatDate(date, locale)).toEqual('3/14/2021');
16
+ expect(formatDate(date, locale)).toEqual('03/14/2021');
17
17
  });
18
18
  it('should return US date format given full timestamp', () => {
19
19
  const date = '2021-03-14T13:28:17-05:00';
20
- expect(formatDate(date, locale)).toEqual('3/14/2021');
20
+ expect(formatDate(date, locale)).toEqual('03/14/2021');
21
21
  });
22
22
  });
@@ -0,0 +1,9 @@
1
+ import _get from 'lodash/get';
2
+
3
+ export const getResourceDate = (resource, paths) => {
4
+ return paths?.reduce((acc, path) => {
5
+ const dataTemp = _get(resource, path);
6
+ if (dataTemp && !acc) acc = dataTemp;
7
+ return acc;
8
+ }, null);
9
+ };