@openmrs/esm-laboratory-app 1.0.1-pre.106

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 (157) hide show
  1. package/.editorconfig +12 -0
  2. package/.eslintignore +2 -0
  3. package/.eslintrc +32 -0
  4. package/.husky/pre-commit +4 -0
  5. package/.husky/pre-push +6 -0
  6. package/.prettierignore +14 -0
  7. package/.turbo/turbo-build.log +30 -0
  8. package/.turbo/turbo-lint.log +12 -0
  9. package/.turbo/turbo-typescript.log +0 -0
  10. package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +541 -0
  11. package/.yarn/plugins/@yarnpkg/plugin-outdated.cjs +35 -0
  12. package/.yarn/plugins/@yarnpkg/plugin-version.cjs +550 -0
  13. package/.yarn/versions/3d4697b8.yml +0 -0
  14. package/README.md +39 -0
  15. package/__mocks__/react-i18next.js +50 -0
  16. package/assets/logo/logo.png +0 -0
  17. package/assets/logo/moh_logo_without_word.png +0 -0
  18. package/assets/screenshots/labs_enter_results.png +0 -0
  19. package/assets/screenshots/labs_general_dashboard.png +0 -0
  20. package/dist/142.js +1 -0
  21. package/dist/142.js.map +1 -0
  22. package/dist/319.js +1 -0
  23. package/dist/36.js +1 -0
  24. package/dist/36.js.map +1 -0
  25. package/dist/395.js +1 -0
  26. package/dist/395.js.map +1 -0
  27. package/dist/453.js +1 -0
  28. package/dist/453.js.map +1 -0
  29. package/dist/533.js +1 -0
  30. package/dist/533.js.map +1 -0
  31. package/dist/56.js +2 -0
  32. package/dist/56.js.LICENSE.txt +32 -0
  33. package/dist/56.js.map +1 -0
  34. package/dist/572.js +1 -0
  35. package/dist/572.js.map +1 -0
  36. package/dist/574.js +1 -0
  37. package/dist/581.js +1 -0
  38. package/dist/581.js.map +1 -0
  39. package/dist/66.js +1 -0
  40. package/dist/66.js.map +1 -0
  41. package/dist/757.js +1 -0
  42. package/dist/769.js +1 -0
  43. package/dist/769.js.map +1 -0
  44. package/dist/770.js +1 -0
  45. package/dist/770.js.map +1 -0
  46. package/dist/800.js +2 -0
  47. package/dist/800.js.LICENSE.txt +3 -0
  48. package/dist/800.js.map +1 -0
  49. package/dist/809.js +1 -0
  50. package/dist/809.js.map +1 -0
  51. package/dist/889.js +1 -0
  52. package/dist/889.js.map +1 -0
  53. package/dist/894.js +2 -0
  54. package/dist/894.js.LICENSE.txt +48 -0
  55. package/dist/894.js.map +1 -0
  56. package/dist/924.js +1 -0
  57. package/dist/924.js.map +1 -0
  58. package/dist/928.js +1 -0
  59. package/dist/928.js.map +1 -0
  60. package/dist/967b98e46b0984c4.png +0 -0
  61. package/dist/97.js +1 -0
  62. package/dist/97.js.map +1 -0
  63. package/dist/983.js +1 -0
  64. package/dist/983.js.map +1 -0
  65. package/dist/main.js +2 -0
  66. package/dist/main.js.LICENSE.txt +48 -0
  67. package/dist/main.js.map +1 -0
  68. package/dist/openmrs-esm-laboratory-app.js +1 -0
  69. package/dist/openmrs-esm-laboratory-app.js.buildmanifest.json +628 -0
  70. package/dist/openmrs-esm-laboratory-app.js.map +1 -0
  71. package/dist/routes.json +1 -0
  72. package/i18next-parser.config.js +89 -0
  73. package/jest.config.js +16 -0
  74. package/package.json +121 -0
  75. package/src/completed-list/completed-list.component.tsx +242 -0
  76. package/src/completed-list/completed-list.resource.ts +0 -0
  77. package/src/completed-list/completed-list.scss +232 -0
  78. package/src/components/create-dashboard-link.component.tsx +44 -0
  79. package/src/components/overlay/hook.ts +47 -0
  80. package/src/components/overlay/overlay.component.tsx +52 -0
  81. package/src/components/overlay/overlay.scss +93 -0
  82. package/src/config-schema.ts +36 -0
  83. package/src/constants.ts +5 -0
  84. package/src/declarations.d.ts +6 -0
  85. package/src/header/laboratory-header.component.tsx +35 -0
  86. package/src/header/laboratory-header.scss +68 -0
  87. package/src/header/laboratory-illustration.component.tsx +13 -0
  88. package/src/index.ts +92 -0
  89. package/src/laboratory.component.tsx +18 -0
  90. package/src/patient-chart/laboratory-item/view-laboratory-item.component.tsx +39 -0
  91. package/src/patient-chart/laboratory-item/view-laboratory-item.resource.ts +290 -0
  92. package/src/patient-chart/laboratory-item/view-laboratory-item.scss +0 -0
  93. package/src/patient-chart/laboratory-order.component.tsx +453 -0
  94. package/src/patient-chart/laboratory-order.resource.ts +437 -0
  95. package/src/patient-chart/laboratory-order.scss +66 -0
  96. package/src/patient-chart/results-summary/print-results-summary.component.tsx +240 -0
  97. package/src/patient-chart/results-summary/print-results-summary.scss +105 -0
  98. package/src/patient-chart/results-summary/print-results-table.component.tsx +163 -0
  99. package/src/patient-chart/results-summary/results/results.component.tsx +25 -0
  100. package/src/patient-chart/results-summary/results/results.resource.ts +50 -0
  101. package/src/patient-chart/results-summary/results/results.scss +0 -0
  102. package/src/patient-chart/results-summary/results-dialog/edit-results-dialog.component.tsx +46 -0
  103. package/src/patient-chart/results-summary/results-summary.component.tsx +98 -0
  104. package/src/patient-chart/results-summary/results-summary.resource.tsx +185 -0
  105. package/src/patient-chart/results-summary/results-summary.scss +154 -0
  106. package/src/patient-chart/results-summary/send-email-dialog.component.tsx +111 -0
  107. package/src/patient-chart/results-summary/test-children-results.component.tsx +221 -0
  108. package/src/patient-chart/results-summary/test-print-results-table.component.tsx +148 -0
  109. package/src/patient-chart/results-summary/test-results-delete-action-menu.component.tsx +27 -0
  110. package/src/patient-chart/results-summary/test-results-rescend-action-menu.component.tsx +26 -0
  111. package/src/patient-chart/results-summary/test-results-table.component.tsx +153 -0
  112. package/src/patient-chart/results-summary/tests-children-detail.component.tsx +54 -0
  113. package/src/patient-chart/results-summary/views/email.handlebars +13 -0
  114. package/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx +323 -0
  115. package/src/queue-list/lab-dialogs/add-to-worklist-dialog.resource.ts +155 -0
  116. package/src/queue-list/lab-dialogs/add-to-worklist-dialog.scss +20 -0
  117. package/src/queue-list/lab-tests/lab-tests.component.tsx +116 -0
  118. package/src/queue-list/lab-tests/lab-tests.resource.ts +17 -0
  119. package/src/queue-list/lab-tests/lab-tests.scss +12 -0
  120. package/src/queue-list/laboratory-patient-list.component.tsx +277 -0
  121. package/src/queue-list/laboratory-patient-list.resource.ts +86 -0
  122. package/src/queue-list/laboratory-queue.component.tsx +120 -0
  123. package/src/queue-list/laboratory-queue.scss +213 -0
  124. package/src/queue-list/laboratory-tabs.component.tsx +81 -0
  125. package/src/queue-list/pick-lab-request-menu.component.tsx +38 -0
  126. package/src/reject-order/reject-order-dialog.component.tsx +114 -0
  127. package/src/reject-order/reject-order-dialog.resource.ts +14 -0
  128. package/src/reject-order/reject-order-dialog.scss +14 -0
  129. package/src/results/result-form.component.tsx +223 -0
  130. package/src/results/result-form.resource.ts +328 -0
  131. package/src/results/result-form.scss +19 -0
  132. package/src/review-list/dialog/review-item.component.tsx +283 -0
  133. package/src/review-list/dialog/review-item.resource.ts +14 -0
  134. package/src/review-list/dialog/review-item.scss +0 -0
  135. package/src/review-list/review-list.component.tsx +277 -0
  136. package/src/review-list/review-list.resource.ts +0 -0
  137. package/src/review-list/review-list.scss +189 -0
  138. package/src/root.component.tsx +15 -0
  139. package/src/root.scss +50 -0
  140. package/src/routes.json +72 -0
  141. package/src/setup-tests.ts +1 -0
  142. package/src/summary-tiles/laboratory-summary-tiles.component.tsx +53 -0
  143. package/src/summary-tiles/laboratory-summary-tiles.scss +12 -0
  144. package/src/summary-tiles/laboratory-summary.resource.tsx +50 -0
  145. package/src/summary-tiles/summary-tile.component.tsx +48 -0
  146. package/src/summary-tiles/summary-tile.scss +43 -0
  147. package/src/types/index.ts +412 -0
  148. package/src/types/patient-queues.ts +189 -0
  149. package/src/utils/functions.ts +246 -0
  150. package/src/work-list/work-list.component.tsx +310 -0
  151. package/src/work-list/work-list.resource.ts +136 -0
  152. package/src/work-list/work-list.scss +215 -0
  153. package/translations/en.json +16 -0
  154. package/translations/es.json +3 -0
  155. package/translations/fr.json +3 -0
  156. package/tsconfig.json +23 -0
  157. package/webpack.config.js +29 -0
@@ -0,0 +1,189 @@
1
+ export interface PatientQueue {
2
+ uuid: string;
3
+ creator: {
4
+ uuid: string;
5
+ display: string;
6
+ username: string;
7
+ systemId: string;
8
+ person: UuidDisplay;
9
+ privileges: [];
10
+ roles: Array<UuidDisplay>;
11
+ retired: boolean;
12
+ };
13
+ dateCreated: string;
14
+ changedBy?: string;
15
+ dateChanged?: string;
16
+ voided: boolean;
17
+ dateVoided: string;
18
+ voidedBy: string;
19
+ patient: {
20
+ uuid: string;
21
+ display: string;
22
+ identifiers: Array<UuidDisplay>;
23
+ person: {
24
+ uuid: string;
25
+ display: string;
26
+ gender: string;
27
+ age: number;
28
+ birthdate: string;
29
+ birthdateEstimated: boolean;
30
+ dead: boolean;
31
+ deathDate?: string;
32
+ causeOfDeath?: string;
33
+ preferredName: UuidDisplay;
34
+ preferredAddress: UuidDisplay;
35
+ attributes: [];
36
+ voided: boolean;
37
+ birthtime?: string;
38
+ deathdateEstimated: boolean;
39
+ };
40
+ voided: boolean;
41
+ };
42
+ encounter: Encounter;
43
+ provider: {
44
+ uuid: string;
45
+ display: string;
46
+ person: UuidDisplay;
47
+ identifier: string;
48
+ attributes: [];
49
+ retired: boolean;
50
+ };
51
+ locationFrom: QueueLocation;
52
+ locationTo: QueueLocation;
53
+ // encounter: string; // TODO add encounter type
54
+ status: string; // TODO add status enum
55
+ priority: number; // TODO add priority enum
56
+ priorityComment: string;
57
+ visitNumber: string;
58
+ comment: string;
59
+ queueRoom: QueueRoom;
60
+ datePicked: string;
61
+ dateCompleted: string;
62
+ }
63
+
64
+ export interface QueueLocation {
65
+ uuid: string;
66
+ display: string;
67
+ name: string;
68
+ description: string;
69
+ address1?: string;
70
+ address2?: string;
71
+ cityVillage?: string;
72
+ stateProvince?: string;
73
+ country: string;
74
+ postalCode?: string;
75
+ latitude?: string;
76
+ longitude?: string;
77
+ countyDistrict?: string;
78
+ address3?: string;
79
+ address4?: string;
80
+ address5?: string;
81
+ address6?: string;
82
+ tags: Array<UuidDisplay>;
83
+ parentLocation: UuidDisplay;
84
+ childLocations: Array<UuidDisplay>;
85
+ retired: boolean;
86
+ attributes: [];
87
+ }
88
+
89
+ export interface QueueRoom {
90
+ uuid: string;
91
+ display: string;
92
+ name: string;
93
+ description: string;
94
+ address1?: string;
95
+ address2?: string;
96
+ cityVillage?: string;
97
+ stateProvince?: string;
98
+ country?: string;
99
+ postalCode?: string;
100
+ latitude?: string;
101
+ longitude?: string;
102
+ countyDistrict?: string;
103
+ address3?: string;
104
+ address4?: string;
105
+ address5?: string;
106
+ address6?: string;
107
+ tags: Array<UuidDisplay>;
108
+ parentLocation: UuidDisplay;
109
+ childLocations: Array<QueueLocation>;
110
+ retired: boolean;
111
+ }
112
+
113
+ export interface UuidDisplay {
114
+ uuid: string;
115
+ display: string;
116
+ }
117
+
118
+ export interface Encounter {
119
+ uuid: string;
120
+ display: string;
121
+ encounterDatetime: string;
122
+ patient: Patient;
123
+ location: Location;
124
+ form: Form;
125
+ encounterType: EncounterType;
126
+ obs: Ob[];
127
+ orders: Order[];
128
+ voided: boolean;
129
+ visit: Visit;
130
+ encounterProviders: EncounterProvider[];
131
+ diagnoses: any[];
132
+ links: Link[];
133
+ resourceVersion: string;
134
+ }
135
+
136
+ export interface Patient {
137
+ uuid: string;
138
+ display: string;
139
+ links: Link[];
140
+ }
141
+
142
+ export interface Link {
143
+ rel: string;
144
+ uri: string;
145
+ resourceAlias: string;
146
+ }
147
+
148
+ export interface Location {
149
+ uuid: string;
150
+ display: string;
151
+ links: Link[];
152
+ }
153
+
154
+ export interface Form {
155
+ uuid: string;
156
+ display: string;
157
+ links: Link[];
158
+ }
159
+
160
+ export interface EncounterType {
161
+ uuid: string;
162
+ display: string;
163
+ links: Link[];
164
+ }
165
+
166
+ export interface Ob {
167
+ uuid: string;
168
+ display: string;
169
+ links: Link[];
170
+ }
171
+
172
+ export interface Order {
173
+ uuid: string;
174
+ display: string;
175
+ links: Link[];
176
+ type: string;
177
+ }
178
+
179
+ export interface Visit {
180
+ uuid: string;
181
+ display: string;
182
+ links: Link[];
183
+ }
184
+
185
+ export interface EncounterProvider {
186
+ uuid: string;
187
+ display: string;
188
+ links: Link[];
189
+ }
@@ -0,0 +1,246 @@
1
+ import { openmrsFetch } from "@openmrs/esm-framework";
2
+ import useSWR from "swr";
3
+
4
+ export const trimVisitNumber = (visitNumber: string) => {
5
+ if (!visitNumber) {
6
+ return;
7
+ }
8
+ return visitNumber.substring(15);
9
+ };
10
+
11
+ export const formatWaitTime = (waitTime: string, t) => {
12
+ const num = parseInt(waitTime);
13
+ const hours = num / 60;
14
+ const rhours = Math.floor(hours);
15
+ const minutes = (hours - rhours) * 60;
16
+ const rminutes = Math.round(minutes);
17
+ if (rhours > 0) {
18
+ return (
19
+ rhours +
20
+ " " +
21
+ `${t("hoursAnd", "hours and ")}` +
22
+ rminutes +
23
+ " " +
24
+ `${t("minutes", "minutes")}`
25
+ );
26
+ } else {
27
+ return rminutes + " " + `${t("minutes", "minutes")}`;
28
+ }
29
+ };
30
+
31
+ export const getTagColor = (waitTime: string) => {
32
+ const num = parseInt(waitTime);
33
+ if (num <= 30) {
34
+ return "green";
35
+ } else if (num > 30 && num <= 45) {
36
+ return "orange";
37
+ } else {
38
+ return "red";
39
+ }
40
+ };
41
+
42
+ export const getStatusColor = (fulfillerStatus: string) => {
43
+ if (fulfillerStatus === "COMPLETED") {
44
+ return "green";
45
+ } else if (fulfillerStatus === "IN_PROGRESS") {
46
+ return "orange";
47
+ } else {
48
+ return "red";
49
+ }
50
+ };
51
+ export interface PatientResource {
52
+ uuid: string;
53
+ display: string;
54
+ identifiers: Identifier[];
55
+ person: Person;
56
+ voided: boolean;
57
+ auditInfo: AuditInfo;
58
+ links: Link[];
59
+ resourceVersion: string;
60
+ }
61
+
62
+ export interface Identifier {
63
+ display: string;
64
+ uuid: string;
65
+ identifier: string;
66
+ identifierType: IdentifierType;
67
+ location: Location;
68
+ preferred: boolean;
69
+ voided: boolean;
70
+ links: Link[];
71
+ resourceVersion: string;
72
+ }
73
+
74
+ export interface IdentifierType {
75
+ uuid: string;
76
+ display: string;
77
+ links: Link[];
78
+ }
79
+
80
+ export interface Link {
81
+ rel: string;
82
+ uri: string;
83
+ resourceAlias: string;
84
+ }
85
+
86
+ export interface Location {
87
+ uuid: string;
88
+ display: string;
89
+ links: Link[];
90
+ }
91
+
92
+ export interface Person {
93
+ uuid: string;
94
+ display: string;
95
+ gender: string;
96
+ age: number;
97
+ birthdate: string;
98
+ birthdateEstimated: boolean;
99
+ dead: boolean;
100
+ deathDate: any;
101
+ causeOfDeath: any;
102
+ preferredName: PreferredName;
103
+ preferredAddress: PreferredAddress;
104
+ names: Name[];
105
+ addresses: Address[];
106
+ attributes: Attribute[];
107
+ voided: boolean;
108
+ auditInfo: AuditInfo;
109
+ birthtime: any;
110
+ deathdateEstimated: boolean;
111
+ causeOfDeathNonCoded: any;
112
+ links: Link[];
113
+ resourceVersion: string;
114
+ }
115
+
116
+ export interface PreferredName {
117
+ display: string;
118
+ uuid: string;
119
+ givenName: string;
120
+ middleName: string;
121
+ familyName: string;
122
+ familyName2: any;
123
+ voided: boolean;
124
+ links: Link[];
125
+ resourceVersion: string;
126
+ }
127
+
128
+ export interface PreferredAddress {
129
+ display: any;
130
+ uuid: string;
131
+ preferred: boolean;
132
+ address1: any;
133
+ address2: any;
134
+ cityVillage: any;
135
+ stateProvince: string;
136
+ country: string;
137
+ postalCode: any;
138
+ countyDistrict: string;
139
+ address3: string;
140
+ address4: string;
141
+ address5: string;
142
+ address6: any;
143
+ startDate: any;
144
+ endDate: any;
145
+ latitude: any;
146
+ longitude: any;
147
+ voided: boolean;
148
+ address7: any;
149
+ address8: any;
150
+ address9: any;
151
+ address10: any;
152
+ address11: any;
153
+ address12: any;
154
+ address13: any;
155
+ address14: any;
156
+ address15: any;
157
+ links: Link[];
158
+ resourceVersion: string;
159
+ }
160
+
161
+ export interface Name {
162
+ display: string;
163
+ uuid: string;
164
+ givenName: string;
165
+ middleName: string;
166
+ familyName: string;
167
+ familyName2: any;
168
+ voided: boolean;
169
+ links: Link[];
170
+ resourceVersion: string;
171
+ }
172
+
173
+ export interface Address {
174
+ display: any;
175
+ uuid: string;
176
+ preferred: boolean;
177
+ address1: any;
178
+ address2: any;
179
+ cityVillage: any;
180
+ stateProvince: string;
181
+ country: string;
182
+ postalCode: any;
183
+ countyDistrict: string;
184
+ address3: string;
185
+ address4: string;
186
+ address5: string;
187
+ address6: any;
188
+ startDate: any;
189
+ endDate: any;
190
+ latitude: any;
191
+ longitude: any;
192
+ voided: boolean;
193
+ address7: any;
194
+ address8: any;
195
+ address9: any;
196
+ address10: any;
197
+ address11: any;
198
+ address12: any;
199
+ address13: any;
200
+ address14: any;
201
+ address15: any;
202
+ links: Link[];
203
+ resourceVersion: string;
204
+ }
205
+
206
+ export interface Attribute {
207
+ display: string;
208
+ uuid: string;
209
+ value: string;
210
+ attributeType: AttributeType;
211
+ voided: boolean;
212
+ links: Link[];
213
+ resourceVersion: string;
214
+ }
215
+
216
+ export interface AttributeType {
217
+ uuid: string;
218
+ display: string;
219
+ links: Link[];
220
+ }
221
+
222
+ export interface AuditInfo {
223
+ creator: Creator;
224
+ dateCreated: string;
225
+ changedBy: any;
226
+ dateChanged: any;
227
+ }
228
+
229
+ export interface Creator {
230
+ uuid: string;
231
+ display: string;
232
+ links: Link[];
233
+ }
234
+
235
+ export function useGetPatientByUuid(uuid: string) {
236
+ const apiUrl = `/ws/rest/v1/patient/${uuid}?v=full`;
237
+ const { data, error, isLoading } = useSWR<{ data: PatientResource }, Error>(
238
+ apiUrl,
239
+ openmrsFetch
240
+ );
241
+ return {
242
+ patient: data?.data,
243
+ isLoading,
244
+ isError: error,
245
+ };
246
+ }