fhir-react 0.2.2 → 0.3.1

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 (138) hide show
  1. package/.github/workflows/publish_npmjs.yml +20 -0
  2. package/.storybook/config.js +9 -3
  3. package/.storybook/presets.js +1 -0
  4. package/.storybook/preview-head.html +4 -0
  5. package/README.md +41 -13
  6. package/build/bootstrap-reboot.min.css +2 -22
  7. package/build/index.js +38 -3
  8. package/build/style.css +11 -227
  9. package/package.json +13 -4
  10. package/src/assets/common/chevron-right.svg +3 -0
  11. package/src/assets/containers/AllergyIntolerance/allergy-intolerance.svg +9 -0
  12. package/src/assets/containers/Appointment/appointment.svg +14 -0
  13. package/src/assets/containers/CarePlan/care-plan.svg +10 -0
  14. package/src/assets/containers/CareTeam/care-team.svg +10 -0
  15. package/src/assets/containers/Claim/claim.svg +6 -0
  16. package/src/assets/containers/ClaimResponse/claim-response.svg +7 -0
  17. package/src/assets/containers/Condition/condition.svg +11 -0
  18. package/src/assets/containers/Device/device.svg +8 -0
  19. package/src/assets/containers/DiagnosticReport/diagnostic-report.svg +14 -0
  20. package/src/assets/containers/DocumentReference/document-reference.svg +10 -0
  21. package/src/assets/containers/Encounter/encounter.svg +10 -0
  22. package/src/assets/containers/ExplanationOfBenefit/explanation-of-benefit.svg +3 -0
  23. package/src/assets/containers/FamilyMemberHistory/family-member-history.svg +7 -0
  24. package/src/assets/containers/Goal/goal.svg +11 -0
  25. package/src/assets/containers/Immunization/immunization.svg +7 -0
  26. package/src/assets/containers/List/list.svg +3 -0
  27. package/src/assets/containers/Location/location.svg +4 -0
  28. package/src/assets/containers/Medication/medication.svg +5 -0
  29. package/src/assets/containers/MedicationAdministration/medication-administration.svg +6 -0
  30. package/src/assets/containers/MedicationKnowledge/medication-knowledge.svg +11 -0
  31. package/src/assets/containers/MedicationStatement/medication-statement.svg +5 -0
  32. package/src/assets/containers/Observation/observation.svg +12 -0
  33. package/src/assets/containers/Practitioner/practitioner.svg +5 -0
  34. package/src/assets/containers/Procedure/procedure.svg +9 -0
  35. package/src/assets/containers/Questionnaire/questionnaire.svg +6 -0
  36. package/src/assets/containers/QuestionnaireResponse/questionnaire-response.svg +6 -0
  37. package/src/assets/containers/QustionnaireResponse/questionnaire-response.svg +6 -0
  38. package/src/assets/containers/ResearchStudy/research-study.svg +9 -0
  39. package/src/assets/containers/ResourceCategory/resource-placeholder.svg +3 -0
  40. package/src/components/containers/Accordion/Accordion.js +80 -0
  41. package/src/components/containers/Accordion/Accordion.stories.js +76 -0
  42. package/src/components/containers/Accordion/index.js +3 -0
  43. package/src/components/containers/ResourceContainer/ResourceContainer.css +0 -1
  44. package/src/components/containers/ResourceContainer/ResourceContainer.js +1 -1
  45. package/src/components/datatypes/AccountBalance/AccountBalance.js +33 -0
  46. package/src/components/datatypes/AccountBalance/index.js +3 -0
  47. package/src/components/datatypes/Annotation/Annotation.js +1 -1
  48. package/src/components/datatypes/Coding/Coding.js +1 -1
  49. package/src/components/datatypes/Date/Date.js +14 -4
  50. package/src/components/datatypes/DatePeriod/DatePeriod.js +38 -0
  51. package/src/components/datatypes/DatePeriod/index.js +3 -0
  52. package/src/components/datatypes/HeaderIcon/HeaderIcon.js +31 -0
  53. package/src/components/datatypes/HeaderIcon/index.js +3 -0
  54. package/src/components/datatypes/HumanName/HumanName.js +6 -21
  55. package/src/components/datatypes/Reference/Reference.js +3 -6
  56. package/src/components/resources/AdverseEvent/AdverseEvent.test.js +2 -2
  57. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.test.js +4 -4
  58. package/src/components/resources/Appointment/Appointment.js +91 -65
  59. package/src/components/resources/Appointment/Appointment.test.js +3 -3
  60. package/src/components/resources/Bundle/Bundle.js +2 -2
  61. package/src/components/resources/Bundle/Bundle.stories.js +78 -12
  62. package/src/components/resources/Bundle/Bundle.test.js +3 -0
  63. package/src/components/resources/CarePlan/CarePlan.test.js +4 -4
  64. package/src/components/resources/CareTeam/CareTeam.js +13 -14
  65. package/src/components/resources/CareTeam/CareTeam.test.js +4 -4
  66. package/src/components/resources/Claim/Claim.test.js +6 -6
  67. package/src/components/resources/ClaimResponse/ClaimResponse.test.js +6 -6
  68. package/src/components/resources/Condition/Condition.js +63 -47
  69. package/src/components/resources/Condition/Condition.stories.js +41 -8
  70. package/src/components/resources/Condition/Condition.test.js +20 -14
  71. package/src/components/resources/DiagnosticReport/DiagnosticReport.test.js +5 -7
  72. package/src/components/resources/DocumentReference/DocumentReference.js +1 -1
  73. package/src/components/resources/DocumentReference/DocumentReference.test.js +3 -3
  74. package/src/components/resources/Encounter/Encounter.js +66 -36
  75. package/src/components/resources/Encounter/EncounterParticipants.js +2 -2
  76. package/src/components/resources/ExplanationOfBenefit/CareTeam.js +2 -2
  77. package/src/components/resources/ExplanationOfBenefit/Diagnosis.js +31 -5
  78. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +272 -201
  79. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.stories.js +12 -0
  80. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.test.js +96 -62
  81. package/src/components/resources/ExplanationOfBenefit/Items.js +2 -2
  82. package/src/components/resources/ExplanationOfBenefit/PriceLabel.js +20 -0
  83. package/src/components/resources/ExplanationOfBenefit/Related.js +3 -3
  84. package/src/components/resources/ExplanationOfBenefit/SupportingInfo.js +14 -3
  85. package/src/components/resources/ExplanationOfBenefit/TotalGraph.js +68 -0
  86. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.js +89 -0
  87. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.stories.js +78 -0
  88. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.test.js +51 -0
  89. package/src/components/resources/ExplanationOfBenefitGraph/index.js +3 -0
  90. package/src/components/resources/Goal/Goal.test.js +1 -1
  91. package/src/components/resources/Immunization/Immunization.js +125 -94
  92. package/src/components/resources/Immunization/Immunization.stories.js +23 -4
  93. package/src/components/resources/Immunization/Immunization.test.js +17 -12
  94. package/src/components/resources/List/List.test.js +3 -3
  95. package/src/components/resources/MedicationAdministration/MedicationAdministration.test.js +7 -7
  96. package/src/components/resources/MedicationDispense/MedicationDispense.test.js +2 -2
  97. package/src/components/resources/MedicationRequest/MedicationRequest.test.js +4 -4
  98. package/src/components/resources/Observation/Observation.js +72 -54
  99. package/src/components/resources/Observation/Observation.test.js +6 -18
  100. package/src/components/resources/Observation/ObservationGraph.js +159 -55
  101. package/src/components/resources/Observation/ObservationGraph.test.js +47 -26
  102. package/src/components/resources/Patient/Patient.js +79 -97
  103. package/src/components/resources/Patient/Patient.test.js +10 -10
  104. package/src/components/resources/Practitioner/Practitioner.js +80 -60
  105. package/src/components/resources/Practitioner/Practitioner.test.js +4 -4
  106. package/src/components/resources/Procedure/Procedure.js +99 -87
  107. package/src/components/resources/Procedure/Procedure.stories.js +8 -6
  108. package/src/components/resources/Procedure/Procedure.test.js +11 -8
  109. package/src/components/resources/Questionnaire/Questionnaire.test.js +3 -3
  110. package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.test.js +5 -5
  111. package/src/components/resources/ReferralRequest/ReferralRequest.test.js +2 -2
  112. package/src/components/resources/ResearchStudy/ResearchStudy.test.js +1 -1
  113. package/src/components/resources/ResourceCategory/ResourceCategory.js +56 -0
  114. package/src/components/resources/ResourceCategory/ResourceCategory.stories.js +29 -0
  115. package/src/components/resources/ResourceCategory/ResourceCategory.test.js +101 -0
  116. package/src/components/resources/ResourceCategory/index.js +3 -0
  117. package/src/components/ui/_header.scss +3 -0
  118. package/src/components/ui/bootstrap-reboot.min.css +2 -22
  119. package/src/components/ui/index.js +191 -29
  120. package/src/constants/badge-status.jsx +98 -0
  121. package/src/fixtures/dstu2/resources/condition/condition.svg +35 -0
  122. package/src/fixtures/dstu2/resources/immunization/immunization.svg +10 -0
  123. package/src/fixtures/example-icons.jsx +169 -0
  124. package/src/fixtures/r4/resources/explanationOfBenefit/c4bbExtendedDiagnosis.json +446 -0
  125. package/src/index.js +6 -1
  126. package/src/style.scss +176 -0
  127. package/src/utils/formatDate.js +21 -0
  128. package/src/utils/formatDate.test.js +22 -0
  129. package/src/utils/getBadgeColor.js +6 -0
  130. package/src/utils/getBadgeColor.test.js +14 -0
  131. package/src/utils/isUrl.js +9 -0
  132. package/src/utils/isUrl.test.js +12 -0
  133. package/src/utils.js +7 -0
  134. package/src/components/datatypes/HumanName/HumanName.css +0 -15
  135. package/src/components/datatypes/Reference/Reference.css +0 -8
  136. package/src/components/resources/Observation/ObservationGraph.css +0 -51
  137. package/src/components/resources/Patient/Patient.css +0 -19
  138. package/src/components/ui/index.css +0 -123
@@ -0,0 +1,20 @@
1
+ name: Publish Package to npmjs
2
+ on:
3
+ release:
4
+ types: [created]
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ # Setup .npmrc file to publish to npm
11
+ - uses: actions/setup-node@v2
12
+ with:
13
+ node-version: '16.x'
14
+ registry-url: 'https://registry.npmjs.org'
15
+ - run: npm ci
16
+ - run: npm run build
17
+ - run: npm run test
18
+ - run: npm publish
19
+ env:
20
+ NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
@@ -1,8 +1,14 @@
1
- import { configure, addParameters, addDecorator } from '@storybook/react';
2
- import { withKnobs } from '@storybook/addon-knobs';
3
-
4
1
  import '../src/components/ui/bootstrap-reboot.min.css';
5
2
  import '../src/style.css';
3
+ import '../src/style.scss';
4
+
5
+ import { addDecorator, addParameters, configure } from '@storybook/react';
6
+
7
+ import { withKnobs } from '@storybook/addon-knobs';
8
+
9
+ if (typeof document !== 'undefined') {
10
+ require('bootstrap/dist/js/bootstrap.min.js');
11
+ }
6
12
 
7
13
  addParameters({
8
14
  options: {
@@ -0,0 +1 @@
1
+ module.exports = ['@storybook/preset-scss'];
@@ -8,5 +8,9 @@
8
8
  <style>
9
9
  .sb-show-main {
10
10
  padding: 16px;
11
+ background-color: #f4f8fd;
12
+ }
13
+ html {
14
+ background-color: #f4f8fd;
11
15
  }
12
16
  </style>
package/README.md CHANGED
@@ -28,12 +28,34 @@ const MyComponent = () => {
28
28
  <FhirResource
29
29
  fhirResource={fhirResource}
30
30
  fhirVersion={fhirVersions.R4}
31
+ fhirIcons={fhirIcons}
31
32
  withCarinBBProfile
32
33
  />
33
34
  );
34
35
  };
35
36
  ```
36
37
 
38
+ Optionally custom header icons could be passed as `fhirIcons` props. The shape of the passed object should be as in example below with resource type as the key and image url or DOM node as the value:
39
+
40
+ ```jsx
41
+ import React from 'react';
42
+
43
+ export default {
44
+ Condition: (
45
+ <img
46
+ src={require('./dstu2/resources/condition/condition.svg')}
47
+ alt="header icon"
48
+ />
49
+ ),
50
+ Immunization: (
51
+ <img
52
+ src={require('./dstu2/resources/immunization/immunization.svg')}
53
+ alt="header icon"
54
+ />
55
+ ),
56
+ };
57
+ ```
58
+
37
59
  ### `FhirResource` component props
38
60
 
39
61
  | Prop | Type | Default | Description |
@@ -94,21 +116,29 @@ const MyComponent = () => {
94
116
  | `ReferralRequest` | ✅ | ✅ | _N/A_ |
95
117
  | `ResearchStudy` | _N/A_ | ✅ | ✅ |
96
118
 
97
- ### Styles
119
+ ### Styles update `v0.3`
98
120
 
99
- Optional CSS styles are provided with this library. They are split into two files:
121
+ The 0.3 version of the FHIR React Component library introduces the bootstrap Accordion component as the base of each available resource which provides any data. The RWD support is provided for each component.
100
122
 
101
- - `style.css` with basic styling of the components
102
- - `bootstrap-reboot.min.css` further enhancing those styles
123
+ All of the changes can be tracked by viewing the current version of the [storybook](https://fhir-react-lib-test-storybook.s3.amazonaws.com/branch/fhir-react-next/index.html?path=/story/condition--default-visualization-dstu-2).
103
124
 
104
- To use provided styles include them in the React component:
125
+ ### Available resources `v0.3`
105
126
 
106
- ```js
107
- import 'fhir-react/build/style.css';
108
- import 'fhir-react/build/bootstrap-reboot.min.css';
109
- ```
110
127
 
111
- The working demo example with styles included can be viewed [here](https://codesandbox.io/s/infallible-diffie-r6ln5).
128
+ | Resource | DSTU2 | STU3 | R4 | Carin BB Profile | DaVinci PDex |
129
+ | -------------------------- | :---: | :---: | :---: | :--------------: | ------------ |
130
+ | `Appointment` | ✅ | ✅ | ✅ |
131
+ | `Condition` | ✅ | ✅ | ✅ |
132
+ | `Encounter` | ✅ | ✅ | ✅ |
133
+ | `ExplanationOfBenefit` | ✅ | ✅ | ✅ | ✅ |
134
+ | `Immunization` | ✅ | ✅ | ✅ |
135
+ | `Observation` | ✅ | ✅ | ✅ |
136
+ | `Patient` | ✅ | ✅ | ✅ |
137
+ | `Practitioner` | ✅ | ✅ | ✅ |
138
+ | `Procedure` | ✅ | ✅ | ✅ |
139
+
140
+ The update does not change the datasets which components are able to handle. It means that user can display the same particulars as in the previous version of the specific component.
141
+
112
142
 
113
143
  ### Styles
114
144
 
@@ -166,9 +196,7 @@ npm run build
166
196
 
167
197
  ### Publish to NPM Registry
168
198
 
169
- ```
170
- npm publish
171
- ```
199
+ To publish, [create a new release in GitHub](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository).
172
200
 
173
201
  ### Storybook for the changes
174
202
 
@@ -14,23 +14,9 @@
14
14
  }
15
15
 
16
16
  .fhir-resource {
17
- font-family:
18
- -apple-system,
19
- BlinkMacSystemFont,
20
- 'Segoe UI',
21
- Roboto,
22
- 'Helvetica Neue',
23
- Arial,
24
- 'Noto Sans',
25
- sans-serif,
26
- 'Apple Color Emoji',
27
- 'Segoe UI Emoji',
28
- 'Segoe UI Symbol',
29
- 'Noto Color Emoji';
30
17
  font-size: 1rem;
31
18
  font-weight: 400;
32
19
  line-height: 1.5;
33
- color: #212529;
34
20
  background-color: #fff;
35
21
  -webkit-text-size-adjust: 100%;
36
22
  -webkit-tap-highlight-color: transparent;
@@ -187,14 +173,8 @@ sup {
187
173
  .fhir-resource kbd,
188
174
  .fhir-resource pre,
189
175
  .fhir-resource samp {
190
- font-family:
191
- SFMono-Regular,
192
- Menlo,
193
- Monaco,
194
- Consolas,
195
- 'Liberation Mono',
196
- 'Courier New',
197
- monospace;
176
+ font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono',
177
+ 'Courier New', monospace;
198
178
  font-size: 1em;
199
179
  }
200
180