fhir-react 0.3.0 → 0.3.4

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 (47) hide show
  1. package/.github/workflows/publish_npmjs.yml +2 -0
  2. package/README.md +88 -5
  3. package/build/bootstrap-reboot.min.css +394 -0
  4. package/build/index.js +43 -0
  5. package/build/style.css +31 -0
  6. package/package.json +3 -2
  7. package/src/assets/containers/Patient/patient.svg +6 -0
  8. package/src/components/containers/Accordion/Accordion.js +7 -3
  9. package/src/components/datatypes/HeaderIcon/HeaderIcon.js +67 -22
  10. package/src/components/resources/Appointment/Appointment.js +3 -3
  11. package/src/components/resources/Appointment/Appointment.stories.js +28 -5
  12. package/src/components/resources/Appointment/Appointment.test.js +72 -0
  13. package/src/components/resources/Condition/Condition.js +1 -2
  14. package/src/components/resources/Condition/Condition.stories.js +9 -19
  15. package/src/components/resources/Condition/Condition.test.js +71 -1
  16. package/src/components/resources/Encounter/Encounter.js +3 -4
  17. package/src/components/resources/Encounter/Encounter.stories.js +27 -5
  18. package/src/components/resources/Encounter/Encounter.test.js +72 -0
  19. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +26 -10
  20. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.stories.js +8 -0
  21. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.test.js +80 -3
  22. package/src/components/resources/ExplanationOfBenefit/SupportingInfo.js +21 -6
  23. package/src/components/resources/Immunization/Immunization.js +1 -2
  24. package/src/components/resources/Immunization/Immunization.stories.js +6 -9
  25. package/src/components/resources/Immunization/Immunization.test.js +71 -1
  26. package/src/components/resources/Observation/Observation.js +3 -3
  27. package/src/components/resources/Observation/Observation.stories.js +14 -5
  28. package/src/components/resources/Observation/Observation.test.js +67 -0
  29. package/src/components/resources/Patient/Patient.js +9 -6
  30. package/src/components/resources/Patient/Patient.stories.js +12 -5
  31. package/src/components/resources/Patient/Patient.test.js +67 -0
  32. package/src/components/resources/Practitioner/Practitioner.js +3 -13
  33. package/src/components/resources/Practitioner/Practitioner.stories.js +19 -3
  34. package/src/components/resources/Practitioner/Practitioner.test.js +72 -0
  35. package/src/components/resources/Procedure/Procedure.js +1 -2
  36. package/src/components/resources/Procedure/Procedure.stories.js +11 -5
  37. package/src/components/resources/Procedure/Procedure.test.js +71 -1
  38. package/src/components/resources/ResourceCategory/ResourceCategory.js +6 -3
  39. package/src/components/resources/ResourceCategory/ResourceCategory.test.js +1 -1
  40. package/src/components/supportedFhirResourceList.js +2 -0
  41. package/src/components/ui/index.js +33 -25
  42. package/src/fixtures/example-icons.jsx +48 -10
  43. package/src/fixtures/r4/resources/explanationOfBenefit/c4bbExample.json +18 -2
  44. package/src/index.js +1 -0
  45. package/src/utils/convertCamelCaseToSentence.js +9 -0
  46. package/src/utils/convertCamelCaseToSentence.test.js +9 -0
  47. package/webpack.config.js +10 -1
@@ -3,62 +3,70 @@ import React from 'react';
3
3
  import { getBadgeColor } from '../../utils/getBadgeColor';
4
4
  import HeaderIcon from '../datatypes/HeaderIcon';
5
5
 
6
- export const Header = props => {
6
+ export const Header = ({
7
+ resourceName,
8
+ isAccordionOpenable,
9
+ icon,
10
+ titleTestID,
11
+ title,
12
+ prefixBadge,
13
+ badges,
14
+ additionalBadge,
15
+ additionalContent,
16
+ rightAdditionalContent,
17
+ children,
18
+ }) => {
7
19
  const rightItemsClass = 'align-items-center flex-fill d-flex';
8
20
 
9
21
  return (
10
22
  <>
11
23
  {// This condition was left due to fact, that to much changes in Header will generate many errors in tests. This condition will be removed after all changes have been made.
12
- props.children || (
24
+ children || (
13
25
  <div
14
- className={`fhir-ui__${props.resourceName}-Header w-100 p-4 position-relative`}
26
+ className={`fhir-ui__${resourceName}-Header w-100 p-4 position-relative`}
15
27
  >
16
28
  <div
17
- className={`fhir-ui__${props.resourceName}-Header__title-data ${
18
- props.isAccordionOpenable ? 'header__title-row' : ''
29
+ className={`fhir-ui__${resourceName}-Header__title-data ${
30
+ isAccordionOpenable ? 'header__title-row' : ''
19
31
  } d-flex w-100 flex-column flex-sm-row`}
20
32
  >
21
33
  <div className="d-flex">
22
34
  <div
23
- className={`fhir-ui__${props.resourceName}-Header__icon flex-shrink-1 m-half me-2`}
35
+ className={`fhir-ui__${resourceName}-Header__icon d-flex align-items-center flex-shrink-1 m-half me-2`}
24
36
  >
25
- <HeaderIcon headerIcon={props.icon} />
37
+ <HeaderIcon headerIcon={icon} resourceName={resourceName} />
26
38
  </div>
27
39
  <div
28
- className={`fhir-ui__${props.resourceName}-Header__title flex-fill text-start`}
40
+ className={`fhir-ui__${resourceName}-Header__title flex-fill text-start`}
29
41
  >
30
- <Title data-testid={props.titleTestID || 'title'}>
31
- {props.title || ''}
42
+ <Title data-testid={titleTestID || 'title'}>
43
+ {title || ''}
32
44
  </Title>
33
45
  </div>
34
46
  </div>
35
47
 
36
48
  <div
37
- className={`fhir-ui__${props.resourceName}-Header__badges ps-1 ps-sm-2 mt-3 mt-sm-0 badges-max-width-sm flex-wrap flex-sm-nowrap justify-content-between justify-content-sm-end ${rightItemsClass}`}
49
+ className={`fhir-ui__${resourceName}-Header__badges ps-1 ps-sm-2 mt-3 mt-sm-0 badges-max-width-sm flex-wrap flex-sm-nowrap justify-content-between justify-content-sm-end ${rightItemsClass}`}
38
50
  >
39
- {props.prefixBadge && (
40
- <div className="me-3">{props.prefixBadge}</div>
41
- )}
51
+ {prefixBadge && <div className="me-3">{prefixBadge}</div>}
42
52
  <div className="d-flex">
43
- {props.badges}
44
- {props.additionalBadge && (
45
- <div className="ms-3">{props.additionalBadge}</div>
53
+ {badges}
54
+ {additionalBadge && (
55
+ <div className="ms-3">{additionalBadge}</div>
46
56
  )}
47
57
  </div>
48
58
  </div>
49
59
  </div>
50
60
  <div
51
- className={`fhir-ui__${
52
- props.resourceName
53
- }-Header__additional-content w-100 justify-content-start d-flex ${
54
- props.additionalContent ? ' pt-2' : ''
61
+ className={`fhir-ui__${resourceName}-Header__additional-content w-100 justify-content-start d-flex ${
62
+ additionalContent ? ' pt-2' : ''
55
63
  }`}
56
64
  >
57
- {props.additionalContent}
65
+ {additionalContent}
58
66
  <div
59
- className={`fhir-ui__${props.resourceName}-Header__rightAdditionalContent justify-content-end ${rightItemsClass}`}
67
+ className={`fhir-ui__${resourceName}-Header__rightAdditionalContent justify-content-end ${rightItemsClass}`}
60
68
  >
61
- {props.rightAdditionalContent}
69
+ {rightAdditionalContent}
62
70
  </div>
63
71
  </div>
64
72
  </div>
@@ -213,7 +221,7 @@ export const ValueSection = props => (
213
221
  </div>
214
222
  );
215
223
 
216
- export const MissingValue = props => (
224
+ export const MissingValue = () => (
217
225
  <span className="fhir-ui__MissingValue">-</span>
218
226
  );
219
227
 
@@ -3,167 +3,205 @@ import React from 'react';
3
3
  export default {
4
4
  Condition: (
5
5
  <img
6
+ className="header-icon__image"
6
7
  src={require('../assets/containers/Condition/condition.svg')}
7
- alt="germ"
8
+ alt="condition"
8
9
  />
9
10
  ),
10
11
  Immunization: (
11
12
  <img
13
+ className="header-icon__image"
12
14
  src={require('../assets/containers/Immunization/immunization.svg')}
13
- alt="syringe"
15
+ alt="immunization"
14
16
  />
15
17
  ),
16
18
  Procedure: (
17
19
  <img
20
+ className="header-icon__image"
18
21
  src={require('../assets/containers/Procedure/procedure.svg')}
19
- alt="block diagram"
22
+ alt="procedure"
20
23
  />
21
24
  ),
22
25
  Practitioner: (
23
26
  <img
27
+ className="header-icon__image"
24
28
  src={require('../assets/containers/Practitioner/practitioner.svg')}
25
- alt="doctor avatar"
29
+ alt="practitioner"
26
30
  />
27
31
  ),
28
32
  AllergyIntolerance: (
29
33
  <img
34
+ className="header-icon__image"
30
35
  src={require('../assets/containers/AllergyIntolerance/allergy-intolerance.svg')}
31
36
  alt="sneezing emoji"
32
37
  />
33
38
  ),
34
39
  Appointment: (
35
40
  <img
41
+ className="header-icon__image"
36
42
  src={require('../assets/containers/Appointment/appointment.svg')}
37
- alt="calendar"
43
+ alt="appointment"
38
44
  />
39
45
  ),
40
46
  CarePlan: (
41
47
  <img
48
+ className="header-icon__image"
42
49
  src={require('../assets/containers/CarePlan/care-plan.svg')}
43
50
  alt="note with a heart"
44
51
  />
45
52
  ),
46
53
  CareTeam: (
47
54
  <img
55
+ className="header-icon__image"
48
56
  src={require('../assets/containers/CareTeam/care-team.svg')}
49
57
  alt="group of people"
50
58
  />
51
59
  ),
52
60
  Claim: (
53
61
  <img
62
+ className="header-icon__image"
54
63
  src={require('../assets/containers/Claim/claim.svg')}
55
64
  alt="clipboard with a symmetrical cross"
56
65
  />
57
66
  ),
58
67
  ClaimResponse: (
59
68
  <img
69
+ className="header-icon__image"
60
70
  src={require('../assets/containers/ClaimResponse/claim-response.svg')}
61
71
  alt="clipboard with a symmetrical cross and a return arrow"
62
72
  />
63
73
  ),
64
74
  Device: (
65
75
  <img
76
+ className="header-icon__image"
66
77
  src={require('../assets/containers/Device/device.svg')}
67
78
  alt="computer rack"
68
79
  />
69
80
  ),
70
81
  DiagnosticReport: (
71
82
  <img
83
+ className="header-icon__image"
72
84
  src={require('../assets/containers/DiagnosticReport/diagnostic-report.svg')}
73
85
  alt="note with shapes"
74
86
  />
75
87
  ),
76
88
  DocumentReference: (
77
89
  <img
90
+ className="header-icon__image"
78
91
  src={require('../assets/containers/DocumentReference/document-reference.svg')}
79
92
  alt="hand holding a note"
80
93
  />
81
94
  ),
82
95
  Encounter: (
83
96
  <img
97
+ className="header-icon__image"
84
98
  src={require('../assets/containers/Encounter/encounter.svg')}
85
- alt="conversation between two individuals"
99
+ alt="encounter"
86
100
  />
87
101
  ),
88
102
  ExplanationOfBenefit: (
89
103
  <img
104
+ className="header-icon__image"
90
105
  src={require('../assets/containers/ExplanationOfBenefit/explanation-of-benefit.svg')}
91
- alt="percentage sign"
106
+ alt="explanation of benefit"
92
107
  />
93
108
  ),
94
109
  FamilyMemberHistory: (
95
110
  <img
111
+ className="header-icon__image"
96
112
  src={require('../assets/containers/FamilyMemberHistory/family-member-history.svg')}
97
113
  alt="parent and child"
98
114
  />
99
115
  ),
100
116
  Goal: (
101
117
  <img
118
+ className="header-icon__image"
102
119
  src={require('../assets/containers/Goal/goal.svg')}
103
120
  alt="arrow hits bullseye"
104
121
  />
105
122
  ),
106
123
  List: (
107
- <img src={require('../assets/containers/List/list.svg')} alt="checklist" />
124
+ <img
125
+ className="header-icon__image"
126
+ src={require('../assets/containers/List/list.svg')}
127
+ alt="checklist"
128
+ />
108
129
  ),
109
130
  Location: (
110
131
  <img
132
+ className="header-icon__image"
111
133
  src={require('../assets/containers/Location/location.svg')}
112
134
  alt="location marker"
113
135
  />
114
136
  ),
115
137
  Medication: (
116
138
  <img
139
+ className="header-icon__image"
117
140
  src={require('../assets/containers/Medication/medication.svg')}
118
141
  alt="some pills"
119
142
  />
120
143
  ),
121
144
  MedicationAdministration: (
122
145
  <img
146
+ className="header-icon__image"
123
147
  src={require('../assets/containers/MedicationAdministration/medication-administration.svg')}
124
148
  alt="pill gets swallowed"
125
149
  />
126
150
  ),
127
151
  MedicationKnowledge: (
128
152
  <img
153
+ className="header-icon__image"
129
154
  src={require('../assets/containers/MedicationKnowledge/medication-knowledge.svg')}
130
155
  alt="pill database"
131
156
  />
132
157
  ),
133
158
  MedicationStatement: (
134
159
  <img
160
+ className="header-icon__image"
135
161
  src={require('../assets/containers/MedicationStatement/medication-statement.svg')}
136
162
  alt="note with symmetrical cross"
137
163
  />
138
164
  ),
139
165
  Observation: (
140
166
  <img
167
+ className="header-icon__image"
141
168
  src={require('../assets/containers/Observation/observation.svg')}
142
- alt="hospital bed"
169
+ alt="observation"
143
170
  />
144
171
  ),
145
172
  Questionnaire: (
146
173
  <img
174
+ className="header-icon__image"
147
175
  src={require('../assets/containers/Questionnaire/questionnaire.svg')}
148
176
  alt="clipboard and pen"
149
177
  />
150
178
  ),
151
179
  QuestionnaireResponse: (
152
180
  <img
181
+ className="header-icon__image"
153
182
  src={require('../assets/containers/QuestionnaireResponse/questionnaire-response.svg')}
154
183
  alt="clipboard and return arrow"
155
184
  />
156
185
  ),
157
186
  ResearchStudy: (
158
187
  <img
188
+ className="header-icon__image"
159
189
  src={require('../assets/containers/ResearchStudy/research-study.svg')}
160
190
  alt="finger pointing something in a book"
161
191
  />
162
192
  ),
163
- ResourceCategoryPlaceholder: (
193
+ ResourceCategory: (
164
194
  <img
195
+ className="header-icon__image"
165
196
  src={require('../assets/containers/ResourceCategory/resource-placeholder.svg')}
166
197
  alt="header icon"
167
198
  />
168
199
  ),
200
+ Patient: (
201
+ <img
202
+ className="header-icon__image"
203
+ src={require('../assets/containers/Patient/patient.svg')}
204
+ alt="patient"
205
+ />
206
+ ),
169
207
  };
@@ -148,13 +148,29 @@
148
148
  "category": {
149
149
  "coding": [
150
150
  {
151
+ "code": "clmrecvddate",
151
152
  "system": "http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType",
152
- "code": "clmrecvddate"
153
+ "display": "Claim Received Date"
153
154
  }
154
155
  ]
155
156
  },
156
157
  "timingDate": "2017-01-05"
157
- }
158
+ },
159
+ {
160
+ "sequence": 2,
161
+ "category": {
162
+ "coding": [
163
+ {
164
+ "code": "dayssupply",
165
+ "system": "http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType",
166
+ "display": "Days Supply"
167
+ }
168
+ ]
169
+ },
170
+ "valueQuantity": {
171
+ "value": 30
172
+ }
173
+ }
158
174
  ],
159
175
  "diagnosis": [
160
176
  {
package/src/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import 'bootstrap/dist/css/bootstrap.min.css';
2
2
  import './style.css';
3
+ import './style.scss';
3
4
 
4
5
  import FhirResource from './components/containers/FhirResource';
5
6
  import fhirVersions from './components/resources/fhirResourceVersions';
@@ -0,0 +1,9 @@
1
+ import _trim from 'lodash/trim';
2
+
3
+ export const convertCamelCaseToSentence = word => {
4
+ const result = word && word.replace(/([A-Z])/g, ' $1');
5
+ return (
6
+ result &&
7
+ _trim(result.charAt(0).toUpperCase() + result.slice(1)).toLowerCase()
8
+ );
9
+ };
@@ -0,0 +1,9 @@
1
+ import { convertCamelCaseToSentence } from './convertCamelCaseToSentence';
2
+
3
+ describe('convertCamelCaseToSentence function ', () => {
4
+ it('should return sentence', () => {
5
+ expect(convertCamelCaseToSentence('CamelCaseToSentence')).toEqual(
6
+ 'camel case to sentence',
7
+ );
8
+ });
9
+ });
package/webpack.config.js CHANGED
@@ -25,7 +25,7 @@ module.exports = {
25
25
  },
26
26
  },
27
27
  {
28
- test: /\.css$/,
28
+ test: /\.(css|scss)$/,
29
29
  exclude: path.resolve(
30
30
  __dirname,
31
31
  'src/components/ui/bootstrap-reboot.min.css',
@@ -35,6 +35,15 @@ module.exports = {
35
35
  loader: MiniCssExtractPlugin.loader,
36
36
  },
37
37
  'css-loader',
38
+ 'sass-loader',
39
+ ],
40
+ },
41
+ {
42
+ test: /\.svg$/,
43
+ use: [
44
+ {
45
+ loader: 'svg-url-loader',
46
+ },
38
47
  ],
39
48
  },
40
49
  ],