@bahmni/home-app 0.0.1-dev.466 → 0.0.1-dev.472
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.
- package/dist/{DocumentsTable-Cdjrw4yW-Bvm9v6KO.js → DocumentsTable-D05Z8kWb-DzQ5bm6e.js} +93 -93
- package/dist/{FormsTable-hfP2wv7g-DaziNRV1.js → FormsTable-DS8v_y5q-BRmywf2r.js} +91 -91
- package/dist/{LNWAZHJI-UvSDfL7G.js → LNWAZHJI-DdY39os1.js} +2 -2
- package/dist/{MWZ6AO7Z-Dce_RT_N.js → MWZ6AO7Z-BUJGOmip.js} +5 -5
- package/dist/Observations-UeuPSqCU-CwJXcB-L.js +246 -0
- package/dist/{YPM2AS64-CTijv4oG.js → YPM2AS64-C8dmMwSG.js} +138 -138
- package/dist/{index-sSTaq7Q4.js → index-BZHrIUJp.js} +11 -11
- package/dist/{index-BXrO9hti.js → index-Cee5-kEn.js} +107158 -85211
- package/dist/index-Dyt17CgX-XFw_K91S.js +6900 -0
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/Observations-B-dxdRlx-BF_q1_kq.js +0 -246
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as n, jsxs as H, Fragment as ne } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { useQueryClient as ve, useQuery as
|
|
4
|
-
import { useState as
|
|
5
|
-
const
|
|
6
|
-
formsTableBody:
|
|
7
|
-
modalHeading:
|
|
2
|
+
import { u as ie, Q as de, f as le, p as me, g as ue, h as ce, E as fe, q as ye, $ as pe, i as Ne, X as ge, j as he, H as be, z as Oe, C as $, l as z, t as Te, M as V, O as Ie, S as Ae, R as _e, m as Ee, n as Re } from "./index-Cee5-kEn.js";
|
|
3
|
+
import { useQueryClient as ve, useQuery as A } from "@tanstack/react-query";
|
|
4
|
+
import { useState as Q, useMemo as i, useCallback as d } from "react";
|
|
5
|
+
const Ce = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_modalHeading__wnTmA", Be = "FormsTable-module_customAccordianItem__isszs", g = {
|
|
6
|
+
formsTableBody: Ce,
|
|
7
|
+
modalHeading: Le,
|
|
8
8
|
customAccordianItem: Be
|
|
9
9
|
}, De = ({
|
|
10
10
|
episodeOfCareUuids: _,
|
|
@@ -13,71 +13,71 @@ const Le = "FormsTable-module_formsTableBody__SvGha", Re = "FormsTable-module_mo
|
|
|
13
13
|
disableActions: x = !1,
|
|
14
14
|
activeEncounterUuid: y = null
|
|
15
15
|
}) => {
|
|
16
|
-
const { t: o } = ie(), m = de(), [
|
|
17
|
-
numberOfVisits:
|
|
18
|
-
hideThumbnail:
|
|
19
|
-
forms:
|
|
20
|
-
} = j ?? {},
|
|
21
|
-
|
|
22
|
-
), { userPrivileges:
|
|
16
|
+
const { t: o } = ie(), m = de(), [h, E] = Q(!1), [s, R] = Q(null), {
|
|
17
|
+
numberOfVisits: K,
|
|
18
|
+
hideThumbnail: G = !1,
|
|
19
|
+
forms: p
|
|
20
|
+
} = j ?? {}, P = le(
|
|
21
|
+
Re.EDIT_OBSERVATIONS
|
|
22
|
+
), { userPrivileges: N } = me(), b = P && !x && !!y, v = ue(
|
|
23
23
|
_,
|
|
24
24
|
l
|
|
25
|
-
),
|
|
26
|
-
data:
|
|
27
|
-
isLoading:
|
|
25
|
+
), X = ve(), {
|
|
26
|
+
data: C = [],
|
|
27
|
+
isLoading: L,
|
|
28
28
|
isError: B,
|
|
29
|
-
error:
|
|
30
|
-
refetch:
|
|
31
|
-
} =
|
|
29
|
+
error: W,
|
|
30
|
+
refetch: Y
|
|
31
|
+
} = A({
|
|
32
32
|
queryKey: ["forms", m, _],
|
|
33
|
-
queryFn: () => ce(m, void 0,
|
|
33
|
+
queryFn: () => ce(m, void 0, K),
|
|
34
34
|
enabled: !!m && !v
|
|
35
35
|
}), F = i(() => {
|
|
36
|
-
let e =
|
|
36
|
+
let e = C;
|
|
37
37
|
return l && l.length > 0 && (e = e.filter(
|
|
38
38
|
(r) => l.includes(r.encounterUuid)
|
|
39
|
-
)), Array.isArray(
|
|
40
|
-
(r) =>
|
|
39
|
+
)), Array.isArray(p) && p.length > 0 && (e = e.filter(
|
|
40
|
+
(r) => p.some((a) => a.toLowerCase() === r.formName.toLowerCase())
|
|
41
41
|
)), e;
|
|
42
|
-
}, [
|
|
42
|
+
}, [C, l, p]), { data: S = [] } = A({
|
|
43
43
|
queryKey: ["observationForms"],
|
|
44
44
|
queryFn: () => fe()
|
|
45
|
-
}),
|
|
45
|
+
}), M = d(
|
|
46
46
|
(e) => {
|
|
47
|
-
const r =
|
|
48
|
-
(
|
|
47
|
+
const r = S.find(
|
|
48
|
+
(t) => t.name.toLowerCase() === e.toLowerCase()
|
|
49
49
|
);
|
|
50
50
|
if (!r?.privileges || r.privileges.length === 0) return !0;
|
|
51
|
-
if (!
|
|
52
|
-
const a = new Set(
|
|
51
|
+
if (!N || N.length === 0) return !1;
|
|
52
|
+
const a = new Set(N.map((t) => t.name));
|
|
53
53
|
return r.privileges.some(
|
|
54
|
-
(
|
|
54
|
+
(t) => a.has(t.privilegeName) && t.editable
|
|
55
55
|
);
|
|
56
56
|
},
|
|
57
|
-
[
|
|
57
|
+
[S, N]
|
|
58
58
|
), u = d(
|
|
59
|
-
(e) => !y || e.encounterUuid !== y ? !1 :
|
|
60
|
-
[y,
|
|
59
|
+
(e) => !y || e.encounterUuid !== y ? !1 : M(e.formName),
|
|
60
|
+
[y, M]
|
|
61
61
|
), {
|
|
62
|
-
data:
|
|
63
|
-
isLoading:
|
|
64
|
-
isError:
|
|
65
|
-
error:
|
|
66
|
-
} =
|
|
67
|
-
queryKey: ["formsEncounterFHIR",
|
|
68
|
-
queryFn: () => ye(
|
|
69
|
-
enabled: !!
|
|
62
|
+
data: O,
|
|
63
|
+
isLoading: J,
|
|
64
|
+
isError: Z,
|
|
65
|
+
error: T
|
|
66
|
+
} = A({
|
|
67
|
+
queryKey: ["formsEncounterFHIR", s?.encounterUuid],
|
|
68
|
+
queryFn: () => ye(s.encounterUuid),
|
|
69
|
+
enabled: !!s?.encounterUuid && h
|
|
70
70
|
});
|
|
71
|
-
|
|
71
|
+
pe(
|
|
72
72
|
(e) => {
|
|
73
|
-
e.patientUUID === m && (
|
|
73
|
+
e.patientUUID === m && (Y(), X.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
|
|
74
74
|
},
|
|
75
75
|
[m]
|
|
76
76
|
);
|
|
77
|
-
const ee = i(() => !
|
|
78
|
-
if (
|
|
79
|
-
return
|
|
80
|
-
}, [
|
|
77
|
+
const ee = i(() => !O?.entry || !s?.formName ? [] : O.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => Ne(e) ? ge(e)?.toLowerCase() === s.formName.toLowerCase() : !0), [O, s?.formName]), re = i(() => {
|
|
78
|
+
if (T)
|
|
79
|
+
return he(T).message;
|
|
80
|
+
}, [T]), c = i(
|
|
81
81
|
() => [
|
|
82
82
|
{ key: "recordedOn", header: o("RECORDED_ON") },
|
|
83
83
|
{ key: "recordedBy", header: o("RECORDED_BY") }
|
|
@@ -87,9 +87,9 @@ const Le = "FormsTable-module_formsTableBody__SvGha", Re = "FormsTable-module_mo
|
|
|
87
87
|
() => [...c, { key: "actions", header: o("ACTIONS") }],
|
|
88
88
|
[c, o]
|
|
89
89
|
), ae = d(
|
|
90
|
-
(e) =>
|
|
91
|
-
[
|
|
92
|
-
), oe = c,
|
|
90
|
+
(e) => b && e.some((r) => u(r)) ? U : c,
|
|
91
|
+
[b, u, U, c]
|
|
92
|
+
), oe = c, se = i(
|
|
93
93
|
() => [
|
|
94
94
|
{ key: "recordedOn", sortable: !0 },
|
|
95
95
|
{ key: "recordedBy", sortable: !0 }
|
|
@@ -98,13 +98,13 @@ const Le = "FormsTable-module_formsTableBody__SvGha", Re = "FormsTable-module_mo
|
|
|
98
98
|
), D = i(() => {
|
|
99
99
|
const e = F.reduce(
|
|
100
100
|
(r, a) => {
|
|
101
|
-
const
|
|
102
|
-
r[
|
|
103
|
-
const f = a.providers.map((
|
|
104
|
-
return r[
|
|
101
|
+
const t = a.formName;
|
|
102
|
+
r[t] ??= [];
|
|
103
|
+
const f = a.providers.map((te) => te.providerName).filter(Boolean).join(", ");
|
|
104
|
+
return r[t].push({
|
|
105
105
|
id: a.encounterUuid,
|
|
106
106
|
formName: a.formName,
|
|
107
|
-
recordedOn:
|
|
107
|
+
recordedOn: be(a.encounterDateTime, o, !0).formattedResult,
|
|
108
108
|
recordedBy: f ?? "--",
|
|
109
109
|
encounterDateTime: a.encounterDateTime,
|
|
110
110
|
encounterUuid: a.encounterUuid
|
|
@@ -116,16 +116,16 @@ const Le = "FormsTable-module_formsTableBody__SvGha", Re = "FormsTable-module_mo
|
|
|
116
116
|
([r, a]) => ({
|
|
117
117
|
formName: r,
|
|
118
118
|
records: a.sort(
|
|
119
|
-
(
|
|
119
|
+
(t, f) => f.encounterDateTime - t.encounterDateTime
|
|
120
120
|
)
|
|
121
121
|
})
|
|
122
122
|
).sort((r, a) => r.formName.localeCompare(a.formName));
|
|
123
123
|
}, [F, o]), k = d((e) => {
|
|
124
|
-
|
|
124
|
+
R(e), E(!0);
|
|
125
125
|
}, []), w = d(() => {
|
|
126
|
-
E(!1),
|
|
127
|
-
}, []),
|
|
128
|
-
|
|
126
|
+
E(!1), R(null);
|
|
127
|
+
}, []), I = d((e) => {
|
|
128
|
+
Oe({
|
|
129
129
|
context: {
|
|
130
130
|
encounter: { resourceType: "Encounter", id: e.encounterUuid },
|
|
131
131
|
formName: e.formName,
|
|
@@ -137,48 +137,48 @@ const Le = "FormsTable-module_formsTableBody__SvGha", Re = "FormsTable-module_mo
|
|
|
137
137
|
(e, r) => {
|
|
138
138
|
switch (r) {
|
|
139
139
|
case "recordedOn":
|
|
140
|
-
return /* @__PURE__ */ n(
|
|
140
|
+
return /* @__PURE__ */ n(Te, { onClick: () => k(e), children: e.recordedOn });
|
|
141
141
|
case "recordedBy":
|
|
142
142
|
return e.recordedBy;
|
|
143
143
|
case "actions":
|
|
144
144
|
return u(e) ? /* @__PURE__ */ n(
|
|
145
|
-
|
|
145
|
+
$,
|
|
146
146
|
{
|
|
147
147
|
label: o("EDIT_OBSERVATION_FORM"),
|
|
148
148
|
kind: "ghost",
|
|
149
149
|
size: "sm",
|
|
150
150
|
testId: `edit-form-${e.encounterUuid}`,
|
|
151
|
-
onClick: () =>
|
|
152
|
-
children: /* @__PURE__ */ n(
|
|
151
|
+
onClick: () => I(e),
|
|
152
|
+
children: /* @__PURE__ */ n(z, {})
|
|
153
153
|
}
|
|
154
154
|
) : null;
|
|
155
155
|
default:
|
|
156
156
|
return null;
|
|
157
157
|
}
|
|
158
158
|
},
|
|
159
|
-
[k,
|
|
159
|
+
[k, I, u, o]
|
|
160
160
|
);
|
|
161
161
|
return /* @__PURE__ */ H(ne, { children: [
|
|
162
|
-
/* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children:
|
|
162
|
+
/* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: L || B || D.length === 0 || v ? /* @__PURE__ */ n(
|
|
163
163
|
V,
|
|
164
164
|
{
|
|
165
165
|
headers: oe,
|
|
166
166
|
ariaLabel: o("FORMS_HEADING"),
|
|
167
167
|
rows: [],
|
|
168
|
-
loading:
|
|
169
|
-
errorStateMessage: B ?
|
|
168
|
+
loading: L,
|
|
169
|
+
errorStateMessage: B ? W?.message : void 0,
|
|
170
170
|
emptyStateMessage: o("FORMS_UNAVAILABLE"),
|
|
171
171
|
renderCell: q,
|
|
172
|
-
className:
|
|
172
|
+
className: g.formsTableBody,
|
|
173
173
|
dataTestId: "forms-table"
|
|
174
174
|
}
|
|
175
|
-
) : /* @__PURE__ */ n(
|
|
176
|
-
const { formName: a, records:
|
|
175
|
+
) : /* @__PURE__ */ n(Ie, { align: "start", children: D.map((e, r) => {
|
|
176
|
+
const { formName: a, records: t } = e, f = ae(t);
|
|
177
177
|
return /* @__PURE__ */ n(
|
|
178
|
-
|
|
178
|
+
Ae,
|
|
179
179
|
{
|
|
180
180
|
title: a,
|
|
181
|
-
className:
|
|
181
|
+
className: g.customAccordianItem,
|
|
182
182
|
testId: `accordian-title-${a}`,
|
|
183
183
|
open: r === 0,
|
|
184
184
|
children: /* @__PURE__ */ n(
|
|
@@ -186,13 +186,13 @@ const Le = "FormsTable-module_formsTableBody__SvGha", Re = "FormsTable-module_mo
|
|
|
186
186
|
{
|
|
187
187
|
headers: f,
|
|
188
188
|
ariaLabel: o("FORMS_HEADING"),
|
|
189
|
-
rows:
|
|
189
|
+
rows: t,
|
|
190
190
|
loading: !1,
|
|
191
191
|
errorStateMessage: "",
|
|
192
|
-
sortable:
|
|
192
|
+
sortable: se,
|
|
193
193
|
emptyStateMessage: o("FORMS_UNAVAILABLE"),
|
|
194
194
|
renderCell: q,
|
|
195
|
-
className:
|
|
195
|
+
className: g.formsTableBody,
|
|
196
196
|
dataTestId: `forms-table-${a}`
|
|
197
197
|
}
|
|
198
198
|
)
|
|
@@ -200,30 +200,30 @@ const Le = "FormsTable-module_formsTableBody__SvGha", Re = "FormsTable-module_mo
|
|
|
200
200
|
a
|
|
201
201
|
);
|
|
202
202
|
}) }) }),
|
|
203
|
-
|
|
203
|
+
h && s && /* @__PURE__ */ n(
|
|
204
204
|
_e,
|
|
205
205
|
{
|
|
206
206
|
id: "modalIdForActionAreaLayout",
|
|
207
207
|
portalId: "main-display-area",
|
|
208
|
-
open:
|
|
208
|
+
open: h,
|
|
209
209
|
onRequestClose: w,
|
|
210
|
-
modalHeading: /* @__PURE__ */ H("div", { className:
|
|
211
|
-
/* @__PURE__ */ n("span", { children:
|
|
212
|
-
|
|
213
|
-
|
|
210
|
+
modalHeading: /* @__PURE__ */ H("div", { className: g.modalHeading, children: [
|
|
211
|
+
/* @__PURE__ */ n("span", { children: s.formName }),
|
|
212
|
+
b && u(s) && /* @__PURE__ */ n(
|
|
213
|
+
$,
|
|
214
214
|
{
|
|
215
215
|
label: o("EDIT_OBSERVATION_FORM"),
|
|
216
216
|
kind: "ghost",
|
|
217
217
|
size: "sm",
|
|
218
|
-
testId: `edit-form-modal-${
|
|
218
|
+
testId: `edit-form-modal-${s.encounterUuid}`,
|
|
219
219
|
onClick: () => {
|
|
220
|
-
w(),
|
|
220
|
+
w(), I(s);
|
|
221
221
|
},
|
|
222
|
-
children: /* @__PURE__ */ n(
|
|
222
|
+
children: /* @__PURE__ */ n(z, {})
|
|
223
223
|
}
|
|
224
224
|
)
|
|
225
225
|
] }),
|
|
226
|
-
modalLabel: `${
|
|
226
|
+
modalLabel: `${s.recordedOn} | ${s.recordedBy}`,
|
|
227
227
|
passiveModal: !0,
|
|
228
228
|
size: "md",
|
|
229
229
|
testId: "form-details-modal",
|
|
@@ -231,13 +231,13 @@ const Le = "FormsTable-module_formsTableBody__SvGha", Re = "FormsTable-module_mo
|
|
|
231
231
|
Ee,
|
|
232
232
|
{
|
|
233
233
|
observations: ee,
|
|
234
|
-
isLoading:
|
|
235
|
-
isError:
|
|
234
|
+
isLoading: J,
|
|
235
|
+
isError: Z,
|
|
236
236
|
errorMessage: re,
|
|
237
237
|
emptyStateMessage: o("NO_FORM_DATA_AVAILABLE"),
|
|
238
|
-
testIdPrefix:
|
|
239
|
-
hideThumbnail:
|
|
240
|
-
formName:
|
|
238
|
+
testIdPrefix: s.formName,
|
|
239
|
+
hideThumbnail: G,
|
|
240
|
+
formName: s.formName
|
|
241
241
|
}
|
|
242
242
|
)
|
|
243
243
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-
|
|
2
|
-
import {
|
|
1
|
+
import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-C8dmMwSG.js";
|
|
2
|
+
import { aa as d, ab as f, ac as e } from "./index-Cee5-kEn.js";
|
|
3
3
|
var p = (a) => {
|
|
4
4
|
const [r, t] = c({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-
|
|
2
|
-
import {
|
|
1
|
+
import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-C8dmMwSG.js";
|
|
2
|
+
import { aa as v, ab as C, ac as e } from "./index-Cee5-kEn.js";
|
|
3
3
|
var h = (t) => {
|
|
4
4
|
const [r, o] = s({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
6
|
-
}),
|
|
7
|
-
const
|
|
8
|
-
return
|
|
6
|
+
}), n = v(), l = C(() => {
|
|
7
|
+
const a = r.theme_preference || c;
|
|
8
|
+
return a !== "system" ? a : n();
|
|
9
9
|
});
|
|
10
10
|
return e(d.Provider, {
|
|
11
11
|
value: t,
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { jsxs as S, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { Q as z, a as G, u as U, y as H, g as x, r as J, s as Y, $ as j, G as W, J as P, K as X, Y as Z, c as ee, M as ae, v as se, w as V, W as re, A as te, H as ie, F as oe, I as ne, L as de, N as le } from "./index-Cee5-kEn.js";
|
|
3
|
+
import { useQueries as ce, useQuery as ue } from "@tanstack/react-query";
|
|
4
|
+
import { useRef as pe, useEffect as L, useMemo as E } from "react";
|
|
5
|
+
const me = "Observations-module_observations__RKSyo", be = "Observations-module_title__TJL3z", he = "Observations-module_wrapper__muk2L", ve = "Observations-module_secondary__14nuS", R = {
|
|
6
|
+
observations: me,
|
|
7
|
+
title: be,
|
|
8
|
+
wrapper: he,
|
|
9
|
+
secondary: ve
|
|
10
|
+
}, B = (s, l, o, d, u, r) => {
|
|
11
|
+
const t = re(s, l, u), e = t.value, p = te(e);
|
|
12
|
+
let i = e;
|
|
13
|
+
p === "Image" && (i = /* @__PURE__ */ n(
|
|
14
|
+
ne,
|
|
15
|
+
{
|
|
16
|
+
imageSrc: e,
|
|
17
|
+
alt: e,
|
|
18
|
+
id: `${e}-img`,
|
|
19
|
+
hideThumbnail: r
|
|
20
|
+
}
|
|
21
|
+
)), p === "Video" && (i = /* @__PURE__ */ n(
|
|
22
|
+
de,
|
|
23
|
+
{
|
|
24
|
+
id: `${e}-video`,
|
|
25
|
+
videoSrc: e,
|
|
26
|
+
hideThumbnail: r
|
|
27
|
+
}
|
|
28
|
+
)), p === "PDF" && (i = /* @__PURE__ */ n(le, { id: `${e}-pdf`, src: e }));
|
|
29
|
+
const m = /* @__PURE__ */ S("div", { className: R.wrapper, children: [
|
|
30
|
+
/* @__PURE__ */ n("span", { children: t.header.display }),
|
|
31
|
+
t.header.referenceRange && /* @__PURE__ */ n("span", { className: R.secondary, children: t.header.referenceRange })
|
|
32
|
+
] }), c = u("OBSERVATIONS_RECORDED_BY", {
|
|
33
|
+
provider: t.provider
|
|
34
|
+
}), b = s.effectiveDateTime ? ie(s.effectiveDateTime, u, !0).formattedResult : void 0, T = /* @__PURE__ */ S("div", { className: R.wrapper, children: [
|
|
35
|
+
/* @__PURE__ */ n("span", { children: c }),
|
|
36
|
+
b && /* @__PURE__ */ n("span", { className: R.secondary, children: b })
|
|
37
|
+
] }), h = s.display, v = s.observationValue?.isAbnormal ? "abnormal-obs" : "obs", O = d ? `${d}-${v}-${h}-${o}-${l}` : `${v}-${h}-${o}-${l}`;
|
|
38
|
+
return /* @__PURE__ */ n(
|
|
39
|
+
oe,
|
|
40
|
+
{
|
|
41
|
+
header: m,
|
|
42
|
+
value: i,
|
|
43
|
+
info: T,
|
|
44
|
+
id: O,
|
|
45
|
+
testId: O,
|
|
46
|
+
ariaLabel: O
|
|
47
|
+
},
|
|
48
|
+
`obs-${s.id}`
|
|
49
|
+
);
|
|
50
|
+
}, ye = (s, l, o, d, u, r, t) => /* @__PURE__ */ n(
|
|
51
|
+
V,
|
|
52
|
+
{
|
|
53
|
+
title: s.display,
|
|
54
|
+
id: `grouped-obs-${s.display}-${d}`,
|
|
55
|
+
open: o,
|
|
56
|
+
children: s.members?.map(
|
|
57
|
+
(e, p) => B(
|
|
58
|
+
e,
|
|
59
|
+
p,
|
|
60
|
+
u,
|
|
61
|
+
r,
|
|
62
|
+
l,
|
|
63
|
+
t
|
|
64
|
+
)
|
|
65
|
+
)
|
|
66
|
+
},
|
|
67
|
+
`grouped-obs-${s.id}`
|
|
68
|
+
), Re = ({
|
|
69
|
+
groupedData: s,
|
|
70
|
+
title: l = "",
|
|
71
|
+
hideThumbnail: o
|
|
72
|
+
}) => {
|
|
73
|
+
const { t: d } = U(), u = (r, t, e) => {
|
|
74
|
+
const p = se(r.encounterDetails, d);
|
|
75
|
+
return /* @__PURE__ */ S(
|
|
76
|
+
V,
|
|
77
|
+
{
|
|
78
|
+
title: p,
|
|
79
|
+
id: `encounter-${r.encounterId}`,
|
|
80
|
+
open: t,
|
|
81
|
+
children: [
|
|
82
|
+
r.observations.map(
|
|
83
|
+
(i, m) => B(
|
|
84
|
+
i,
|
|
85
|
+
m,
|
|
86
|
+
e,
|
|
87
|
+
l,
|
|
88
|
+
d,
|
|
89
|
+
o
|
|
90
|
+
)
|
|
91
|
+
),
|
|
92
|
+
r.groupedObservations.map(
|
|
93
|
+
(i, m) => ye(
|
|
94
|
+
i,
|
|
95
|
+
d,
|
|
96
|
+
t,
|
|
97
|
+
m,
|
|
98
|
+
e,
|
|
99
|
+
l,
|
|
100
|
+
o
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
`encounter-${r.encounterId}`
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
return /* @__PURE__ */ n(
|
|
109
|
+
"div",
|
|
110
|
+
{
|
|
111
|
+
id: "obs-by-encounter",
|
|
112
|
+
"data-testid": "obs-by-encounter-test-id",
|
|
113
|
+
"aria-label": "obs-by-encounter-aria-label",
|
|
114
|
+
children: s.map(
|
|
115
|
+
(r, t) => u(r, t === 0, t)
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
}, Oe = (s) => ["conceptUuid", s], _e = (s, l, o, d) => [
|
|
120
|
+
"observations",
|
|
121
|
+
s,
|
|
122
|
+
...l,
|
|
123
|
+
o,
|
|
124
|
+
d
|
|
125
|
+
], Se = ({
|
|
126
|
+
config: s,
|
|
127
|
+
episodeOfCareUuids: l,
|
|
128
|
+
encounterUuids: o
|
|
129
|
+
}) => {
|
|
130
|
+
const d = s, {
|
|
131
|
+
conceptNames: u = [],
|
|
132
|
+
conceptUuid: r = [],
|
|
133
|
+
hideThumbnail: t = !1,
|
|
134
|
+
scope: e = "all"
|
|
135
|
+
} = d, p = pe(/* @__PURE__ */ new Set()), i = z(), { addNotification: m } = G(), { t: c } = U(), b = ce({
|
|
136
|
+
queries: u.map((a) => ({
|
|
137
|
+
queryKey: Oe(a),
|
|
138
|
+
queryFn: () => H(a),
|
|
139
|
+
enabled: !!a
|
|
140
|
+
}))
|
|
141
|
+
});
|
|
142
|
+
L(() => {
|
|
143
|
+
const a = b.some((k) => k.isError), y = p.current.size > 0;
|
|
144
|
+
a && !y ? (m({
|
|
145
|
+
title: c("ERROR_DEFAULT_TITLE"),
|
|
146
|
+
message: c("ERROR_FETCHING_OBSERVATIONS"),
|
|
147
|
+
type: "error"
|
|
148
|
+
}), p.current.add(0)) : !a && y && p.current.clear();
|
|
149
|
+
}, [b, m, c]);
|
|
150
|
+
const T = E(() => b.map((a) => a.data?.uuid).filter((a) => !!a), [b]), h = E(() => [.../* @__PURE__ */ new Set([...T, ...r])], [T, r]), v = E(() => u.length === 0 ? !0 : b.every((a) => !a.isLoading), [b, u.length]), O = e === "latest" || e === "latest-encounter", F = x(
|
|
151
|
+
l,
|
|
152
|
+
o
|
|
153
|
+
), {
|
|
154
|
+
data: _,
|
|
155
|
+
isLoading: w,
|
|
156
|
+
isError: N,
|
|
157
|
+
refetch: $
|
|
158
|
+
} = ue({
|
|
159
|
+
queryKey: _e(
|
|
160
|
+
i,
|
|
161
|
+
h,
|
|
162
|
+
o,
|
|
163
|
+
e
|
|
164
|
+
),
|
|
165
|
+
queryFn: () => O ? J(
|
|
166
|
+
i,
|
|
167
|
+
h,
|
|
168
|
+
o
|
|
169
|
+
) : Y(
|
|
170
|
+
i,
|
|
171
|
+
h,
|
|
172
|
+
o
|
|
173
|
+
),
|
|
174
|
+
enabled: !!i && h.length > 0 && v && !F
|
|
175
|
+
});
|
|
176
|
+
j(
|
|
177
|
+
(a) => {
|
|
178
|
+
a.patientUUID === i && a.updatedConcepts.size > 0 && [...a.updatedConcepts.keys()].some(
|
|
179
|
+
(y) => h.includes(y)
|
|
180
|
+
) && $();
|
|
181
|
+
},
|
|
182
|
+
[i, $]
|
|
183
|
+
), L(() => {
|
|
184
|
+
N && m({
|
|
185
|
+
title: c("ERROR_DEFAULT_TITLE"),
|
|
186
|
+
message: c("ERROR_FETCHING_OBSERVATIONS"),
|
|
187
|
+
type: "error"
|
|
188
|
+
});
|
|
189
|
+
}, [N]);
|
|
190
|
+
const I = E(() => {
|
|
191
|
+
if (!_) return [];
|
|
192
|
+
let a = W(_);
|
|
193
|
+
e === "latest-encounter" && (a = P(a));
|
|
194
|
+
const y = X(a);
|
|
195
|
+
return Z(y);
|
|
196
|
+
}, [_, e]), K = [
|
|
197
|
+
{ key: "name", header: "name" },
|
|
198
|
+
{ key: "value", header: "value" },
|
|
199
|
+
{ key: "form", header: "form" }
|
|
200
|
+
], A = w || !v, D = N && v, Q = (!_ || _.entry?.length === 0 || h.length === 0) && v, q = D ? c("ERROR_FETCHING_OBSERVATIONS") : null, C = Q ? c("NO_OBSERVATIONS_FOUND") : void 0, M = I.length > 0 && !A && !D, g = d.titleTranslationKey, f = g ? c(g) : "";
|
|
201
|
+
return /* @__PURE__ */ S(
|
|
202
|
+
"div",
|
|
203
|
+
{
|
|
204
|
+
id: "observations",
|
|
205
|
+
"data-testid": g ? `observations-${f}` : "observations",
|
|
206
|
+
"aria-label": "observations-aria-label",
|
|
207
|
+
className: R.observations,
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ n(
|
|
210
|
+
ee,
|
|
211
|
+
{
|
|
212
|
+
id: "observations-title",
|
|
213
|
+
testId: g ? `observations-title-${f}` : "observations-title",
|
|
214
|
+
title: f,
|
|
215
|
+
className: R.title,
|
|
216
|
+
children: /* @__PURE__ */ n("p", { children: f })
|
|
217
|
+
}
|
|
218
|
+
),
|
|
219
|
+
M ? /* @__PURE__ */ n(
|
|
220
|
+
Re,
|
|
221
|
+
{
|
|
222
|
+
groupedData: I,
|
|
223
|
+
title: f,
|
|
224
|
+
hideThumbnail: t
|
|
225
|
+
}
|
|
226
|
+
) : /* @__PURE__ */ n(
|
|
227
|
+
ae,
|
|
228
|
+
{
|
|
229
|
+
headers: K,
|
|
230
|
+
rows: [],
|
|
231
|
+
ariaLabel: c("OBSERVATIONS"),
|
|
232
|
+
loading: A,
|
|
233
|
+
errorStateMessage: q,
|
|
234
|
+
emptyStateMessage: C ?? c("NO_OBSERVATIONS_AVAILABLE"),
|
|
235
|
+
dataTestId: "observations-table"
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
};
|
|
242
|
+
export {
|
|
243
|
+
Oe as conceptUuidQueryKeys,
|
|
244
|
+
Se as default,
|
|
245
|
+
_e as observationsQueryKeys
|
|
246
|
+
};
|