@bahmni/registration-app 0.0.1-dev.144 → 0.0.1-dev.147
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/{FormsTable-Dpfi4Dm7-B9pm60Xy.js → FormsTable-BUsrgnPF-sWoDE9uw.js} +29 -29
- package/dist/LNWAZHJI-D91uDIZn.js +33 -0
- package/dist/{MWZ6AO7Z-BjiW6ajX.js → MWZ6AO7Z-k08y64Rf.js} +7 -7
- package/dist/{Observations-DQ6cetK6-D7MHAj7T.js → Observations-Dj12rVar-DV0PqkKW.js} +84 -84
- package/dist/{YPM2AS64-D4xTpfPd.js → YPM2AS64-CBxUINrF.js} +563 -563
- package/dist/{index-Ba1qJwVW.js → index-DbgtnTLR.js} +32473 -32136
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/LNWAZHJI-BheggQkO.js +0 -33
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as t, jsxs as p, Fragment as
|
|
2
|
-
import { u as
|
|
1
|
+
import { jsx as t, jsxs as p, Fragment as Z } from "react/jsx-runtime";
|
|
2
|
+
import { u as J, b as Q, m as Y, p as X, a as ee, h as re, d as ae, c as oe, y as te, $ as U, U as ne, W as se, e as me, Z as de, f as x, K as ie, H as v } from "./index-DbgtnTLR.js";
|
|
3
3
|
import { useQuery as h } from "@tanstack/react-query";
|
|
4
|
-
import { useState as
|
|
4
|
+
import { useState as G, useMemo as $, useCallback as y } from "react";
|
|
5
5
|
const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue = "_formContent_1pd36_18", pe = "_formDetailsContainer_1pd36_25", be = "_observation_1pd36_30", _e = "_groupContainer_1pd36_39", fe = "_rowContainer_1pd36_43", $e = "_groupLabel_1pd36_48", Ne = "_rowLabel_1pd36_58", ge = "_rowValue_1pd36_67", he = "_groupMembers_1pd36_75", ye = "_memberRow_1pd36_81", ve = "_memberLabel_1pd36_86", Ae = "_memberValue_1pd36_94", Me = "_abnormalValue_1pd36_102", Te = "_commentSection_1pd36_110", Le = "_commentText_1pd36_116", Ce = "_nestedGroup_1pd36_125", De = "_nestedGroupLabel_1pd36_132", Oe = "_nestedGroupMembers_1pd36_141", o = {
|
|
6
6
|
formsTableBody: le,
|
|
7
7
|
customAccordianItem: ce,
|
|
@@ -188,12 +188,12 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
|
|
|
188
188
|
},
|
|
189
189
|
`${e.concept.uuid}-${s}`
|
|
190
190
|
);
|
|
191
|
-
},
|
|
191
|
+
}, Ve = ({
|
|
192
192
|
episodeOfCareUuids: e,
|
|
193
193
|
encounterUuids: s,
|
|
194
194
|
config: d
|
|
195
195
|
}) => {
|
|
196
|
-
const { t: r } =
|
|
196
|
+
const { t: r } = J(), u = Q(), [m, c] = G(!1), [a, b] = G(null), _ = d?.numberOfVisits, N = Y(
|
|
197
197
|
e,
|
|
198
198
|
s
|
|
199
199
|
), {
|
|
@@ -203,7 +203,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
|
|
|
203
203
|
error: H
|
|
204
204
|
} = h({
|
|
205
205
|
queryKey: ["forms", u, e],
|
|
206
|
-
queryFn: () =>
|
|
206
|
+
queryFn: () => X(u, void 0, _),
|
|
207
207
|
enabled: !!u && !N
|
|
208
208
|
}), D = $(() => !s || s.length === 0 ? g : g.filter(
|
|
209
209
|
(n) => s.includes(n.encounterUuid)
|
|
@@ -218,7 +218,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
|
|
|
218
218
|
return R(a.formName);
|
|
219
219
|
}, [a, R]), {
|
|
220
220
|
data: we,
|
|
221
|
-
isLoading:
|
|
221
|
+
isLoading: K,
|
|
222
222
|
error: F
|
|
223
223
|
} = h({
|
|
224
224
|
queryKey: ["formMetadata", A],
|
|
@@ -226,15 +226,15 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
|
|
|
226
226
|
enabled: !!A && m
|
|
227
227
|
}), {
|
|
228
228
|
data: M,
|
|
229
|
-
isLoading:
|
|
229
|
+
isLoading: j,
|
|
230
230
|
error: w
|
|
231
231
|
} = h({
|
|
232
232
|
queryKey: ["formsEncounter", a?.encounterUuid],
|
|
233
233
|
queryFn: () => ae(a.encounterUuid, !0),
|
|
234
234
|
enabled: !!a?.encounterUuid && m
|
|
235
|
-
}),
|
|
235
|
+
}), I = $(() => !M?.observations || !a?.formName ? [] : M.observations.filter(
|
|
236
236
|
(n) => "formFieldPath" in n && typeof n.formFieldPath == "string" && n.formFieldPath.includes(a.formName)
|
|
237
|
-
), [M?.observations, a?.formName]),
|
|
237
|
+
), [M?.observations, a?.formName]), E = $(
|
|
238
238
|
() => [
|
|
239
239
|
{ key: "recordedOn", header: r("FORM_RECORDED_ON") },
|
|
240
240
|
{ key: "recordedBy", header: r("FORM_RECORDED_BY") }
|
|
@@ -246,12 +246,12 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
|
|
|
246
246
|
{ key: "recordedBy", sortable: !0 }
|
|
247
247
|
],
|
|
248
248
|
[]
|
|
249
|
-
),
|
|
249
|
+
), S = $(() => {
|
|
250
250
|
const n = D.reduce(
|
|
251
251
|
(l, i) => {
|
|
252
252
|
const f = i.formName;
|
|
253
253
|
l[f] ??= [];
|
|
254
|
-
const T = i.providers.map((
|
|
254
|
+
const T = i.providers.map((W) => W.providerName).filter(Boolean).join(", ");
|
|
255
255
|
return l[f].push({
|
|
256
256
|
id: i.encounterUuid,
|
|
257
257
|
formName: i.formName,
|
|
@@ -271,38 +271,38 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
|
|
|
271
271
|
)
|
|
272
272
|
})
|
|
273
273
|
).sort((l, i) => l.formName.localeCompare(i.formName));
|
|
274
|
-
}, [D, r]),
|
|
274
|
+
}, [D, r]), B = y((n) => {
|
|
275
275
|
b(n), c(!0);
|
|
276
|
-
}, []),
|
|
276
|
+
}, []), z = y(() => {
|
|
277
277
|
c(!1), b(null);
|
|
278
|
-
}, []),
|
|
278
|
+
}, []), V = y(
|
|
279
279
|
(n, l) => {
|
|
280
280
|
switch (l) {
|
|
281
281
|
case "recordedOn":
|
|
282
|
-
return /* @__PURE__ */ t(te, { onClick: () =>
|
|
282
|
+
return /* @__PURE__ */ t(te, { onClick: () => B(n), children: n.recordedOn });
|
|
283
283
|
case "recordedBy":
|
|
284
284
|
return n.recordedBy;
|
|
285
285
|
default:
|
|
286
286
|
return null;
|
|
287
287
|
}
|
|
288
288
|
},
|
|
289
|
-
[
|
|
289
|
+
[B]
|
|
290
290
|
);
|
|
291
|
-
return /* @__PURE__ */ p(
|
|
292
|
-
/* @__PURE__ */ t("div", { "data-testid": "forms-table", children: L || C ||
|
|
293
|
-
|
|
291
|
+
return /* @__PURE__ */ p(Z, { children: [
|
|
292
|
+
/* @__PURE__ */ t("div", { "data-testid": "forms-table", children: L || C || S.length === 0 || N ? /* @__PURE__ */ t(
|
|
293
|
+
U,
|
|
294
294
|
{
|
|
295
|
-
headers:
|
|
295
|
+
headers: E,
|
|
296
296
|
ariaLabel: r("FORMS_HEADING"),
|
|
297
297
|
rows: [],
|
|
298
298
|
loading: L,
|
|
299
299
|
errorStateMessage: C ? H?.message : void 0,
|
|
300
300
|
emptyStateMessage: r("FORMS_UNAVAILABLE"),
|
|
301
|
-
renderCell:
|
|
301
|
+
renderCell: V,
|
|
302
302
|
className: o.formsTableBody,
|
|
303
303
|
dataTestId: "forms-table"
|
|
304
304
|
}
|
|
305
|
-
) : /* @__PURE__ */ t(ne, { align: "start", children:
|
|
305
|
+
) : /* @__PURE__ */ t(ne, { align: "start", children: S.map((n, l) => {
|
|
306
306
|
const { formName: i, records: f } = n;
|
|
307
307
|
return /* @__PURE__ */ t(
|
|
308
308
|
se,
|
|
@@ -312,16 +312,16 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
|
|
|
312
312
|
testId: `accordian-title-${i}`,
|
|
313
313
|
open: l === 0,
|
|
314
314
|
children: /* @__PURE__ */ t(
|
|
315
|
-
|
|
315
|
+
U,
|
|
316
316
|
{
|
|
317
|
-
headers:
|
|
317
|
+
headers: E,
|
|
318
318
|
ariaLabel: r("FORMS_HEADING"),
|
|
319
319
|
rows: f,
|
|
320
320
|
loading: !1,
|
|
321
321
|
errorStateMessage: "",
|
|
322
322
|
sortable: P,
|
|
323
323
|
emptyStateMessage: r("FORMS_UNAVAILABLE"),
|
|
324
|
-
renderCell:
|
|
324
|
+
renderCell: V,
|
|
325
325
|
className: o.formsTableBody,
|
|
326
326
|
dataTestId: `forms-table-${i}`
|
|
327
327
|
}
|
|
@@ -335,13 +335,13 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
|
|
|
335
335
|
{
|
|
336
336
|
id: "modalIdForActionAreaLayout",
|
|
337
337
|
open: m,
|
|
338
|
-
onRequestClose:
|
|
338
|
+
onRequestClose: z,
|
|
339
339
|
modalHeading: a.formName,
|
|
340
340
|
modalLabel: `${a.recordedOn} | ${a.recordedBy}`,
|
|
341
341
|
passiveModal: !0,
|
|
342
342
|
size: "md",
|
|
343
343
|
testId: "form-details-modal",
|
|
344
|
-
children: /* @__PURE__ */ t("div", { className: o.formContent, children:
|
|
344
|
+
children: /* @__PURE__ */ t("div", { className: o.formContent, children: K || j ? /* @__PURE__ */ t(de, { width: "100%", lineCount: 3 }) : F ? /* @__PURE__ */ t("div", { children: x(F).message ?? r("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ t("div", { children: x(w).message ?? r("ERROR_FETCHING_FORM_DATA") }) : I.length > 0 ? /* @__PURE__ */ t("div", { className: o.formDetailsContainer, children: I.map((n, l) => /* @__PURE__ */ t(
|
|
345
345
|
Fe,
|
|
346
346
|
{
|
|
347
347
|
observation: n,
|
|
@@ -355,5 +355,5 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
|
|
|
355
355
|
] });
|
|
356
356
|
};
|
|
357
357
|
export {
|
|
358
|
-
|
|
358
|
+
Ve as default
|
|
359
359
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-CBxUINrF.js";
|
|
2
|
+
import { o as d, q as f, r as e } from "./index-DbgtnTLR.js";
|
|
3
|
+
var p = (a) => {
|
|
4
|
+
const [r, o] = c({
|
|
5
|
+
prefix: "TanstackQueryDevtools"
|
|
6
|
+
}), n = d(), s = f(() => {
|
|
7
|
+
const t = r.theme_preference || l;
|
|
8
|
+
return t !== "system" ? t : n();
|
|
9
|
+
});
|
|
10
|
+
return e(i.Provider, {
|
|
11
|
+
value: a,
|
|
12
|
+
get children() {
|
|
13
|
+
return e(m, {
|
|
14
|
+
localStore: r,
|
|
15
|
+
setLocalStore: o,
|
|
16
|
+
get children() {
|
|
17
|
+
return e(u.Provider, {
|
|
18
|
+
value: s,
|
|
19
|
+
get children() {
|
|
20
|
+
return e(v, {
|
|
21
|
+
localStore: r,
|
|
22
|
+
setLocalStore: o
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}, C = p;
|
|
31
|
+
export {
|
|
32
|
+
C as default
|
|
33
|
+
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { c as s, T as c, P as
|
|
2
|
-
import {
|
|
3
|
-
var
|
|
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-CBxUINrF.js";
|
|
2
|
+
import { o as v, q as C, r as e } from "./index-DbgtnTLR.js";
|
|
3
|
+
var h = (t) => {
|
|
4
4
|
const [r, o] = s({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
6
|
-
}), a =
|
|
6
|
+
}), a = v(), l = C(() => {
|
|
7
7
|
const n = r.theme_preference || c;
|
|
8
8
|
return n !== "system" ? n : a();
|
|
9
9
|
});
|
|
10
10
|
return e(d.Provider, {
|
|
11
11
|
value: t,
|
|
12
12
|
get children() {
|
|
13
|
-
return e(
|
|
13
|
+
return e(u, {
|
|
14
14
|
disabled: !0,
|
|
15
15
|
localStore: r,
|
|
16
16
|
setLocalStore: o,
|
|
17
17
|
get children() {
|
|
18
|
-
return e(
|
|
18
|
+
return e(i.Provider, {
|
|
19
19
|
value: l,
|
|
20
20
|
get children() {
|
|
21
21
|
return e(m, {
|
|
@@ -36,7 +36,7 @@ var C = (t) => {
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
|
-
}, p =
|
|
39
|
+
}, p = h;
|
|
40
40
|
export {
|
|
41
41
|
p as default
|
|
42
42
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as _, jsx as b } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { useQueries as
|
|
4
|
-
import { useRef as
|
|
5
|
-
const
|
|
2
|
+
import { b as q, g as L, u as I, l as U, i as x, M as K, $ as Q, j, B as A, s as P, k as G, P as H, n as X } from "./index-DbgtnTLR.js";
|
|
3
|
+
import { useQueries as Y, useQuery as Z } from "@tanstack/react-query";
|
|
4
|
+
import { useRef as z, useEffect as S, useMemo as h } from "react";
|
|
5
|
+
const J = "normal", W = "http://terminology.hl7.org/CodeSystem/referencerange-meaning", ee = "A", te = "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation", ne = (e, n) => e?.date ? j(e.date, n).formattedResult : n("DATE_ERROR_PARSE"), re = (e) => {
|
|
6
6
|
if (!e.observationValue?.value)
|
|
7
7
|
return "";
|
|
8
8
|
const { value: n, unit: t } = e.observationValue;
|
|
@@ -11,30 +11,30 @@ const Z = "normal", J = "http://terminology.hl7.org/CodeSystem/referencerange-me
|
|
|
11
11
|
const n = e.display;
|
|
12
12
|
if (!e.observationValue)
|
|
13
13
|
return String(n);
|
|
14
|
-
const { unit: t, referenceRange:
|
|
15
|
-
if (!
|
|
14
|
+
const { unit: t, referenceRange: i } = e.observationValue;
|
|
15
|
+
if (!i)
|
|
16
16
|
return String(n);
|
|
17
|
-
const { low: r, high: o } =
|
|
17
|
+
const { low: r, high: o } = i;
|
|
18
18
|
if (r && o) {
|
|
19
|
-
const
|
|
20
|
-
return `${n} (${
|
|
19
|
+
const a = r.unit ? `${r.value} ${r.unit}` : t ? `${r.value} ${t}` : String(r.value), s = o.unit ? `${o.value} ${o.unit}` : t ? `${o.value} ${t}` : String(o.value);
|
|
20
|
+
return `${n} (${a} - ${s})`;
|
|
21
21
|
}
|
|
22
22
|
if (r) {
|
|
23
|
-
const
|
|
24
|
-
return `${n} (>${
|
|
23
|
+
const a = r.unit ? `${r.value} ${r.unit}` : t ? `${r.value} ${t}` : String(r.value);
|
|
24
|
+
return `${n} (>${a})`;
|
|
25
25
|
}
|
|
26
26
|
if (o) {
|
|
27
|
-
const
|
|
28
|
-
return `${n} (<${
|
|
27
|
+
const a = o.unit ? `${o.value} ${o.unit}` : t ? `${o.value} ${t}` : String(o.value);
|
|
28
|
+
return `${n} (<${a})`;
|
|
29
29
|
}
|
|
30
30
|
return n;
|
|
31
|
-
},
|
|
31
|
+
}, ie = (e, n) => ({
|
|
32
32
|
index: n,
|
|
33
33
|
header: oe(e),
|
|
34
34
|
value: re(e),
|
|
35
35
|
provider: e.encounter?.provider
|
|
36
36
|
}), $ = (e) => (typeof e == "string" ? e : e?.reference)?.split("/")?.pop();
|
|
37
|
-
function
|
|
37
|
+
function ae(e) {
|
|
38
38
|
return !e.interpretation || e.interpretation.length === 0 ? !1 : e.interpretation.some(
|
|
39
39
|
(n) => n.coding?.some(
|
|
40
40
|
(t) => t.system === te && t.code === ee
|
|
@@ -45,11 +45,11 @@ function se(e) {
|
|
|
45
45
|
const {
|
|
46
46
|
valueQuantity: n,
|
|
47
47
|
valueCodeableConcept: t,
|
|
48
|
-
valueString:
|
|
48
|
+
valueString: i,
|
|
49
49
|
valueBoolean: r,
|
|
50
50
|
valueInteger: o,
|
|
51
|
-
referenceRange:
|
|
52
|
-
} = e, s =
|
|
51
|
+
referenceRange: a
|
|
52
|
+
} = e, s = ae(e);
|
|
53
53
|
if (n) {
|
|
54
54
|
const u = {
|
|
55
55
|
value: n.value ?? "",
|
|
@@ -57,10 +57,10 @@ function se(e) {
|
|
|
57
57
|
type: "quantity",
|
|
58
58
|
isAbnormal: s
|
|
59
59
|
};
|
|
60
|
-
if (
|
|
61
|
-
const l =
|
|
60
|
+
if (a && a.length > 0) {
|
|
61
|
+
const l = a.find(
|
|
62
62
|
(v) => v.type?.coding?.some(
|
|
63
|
-
(c) => c.system ===
|
|
63
|
+
(c) => c.system === W && c.code === J
|
|
64
64
|
)
|
|
65
65
|
);
|
|
66
66
|
l && (l.low || l.high) && (u.referenceRange = {
|
|
@@ -82,9 +82,9 @@ function se(e) {
|
|
|
82
82
|
type: "codeable",
|
|
83
83
|
isAbnormal: s
|
|
84
84
|
};
|
|
85
|
-
if (
|
|
85
|
+
if (i)
|
|
86
86
|
return {
|
|
87
|
-
value:
|
|
87
|
+
value: i,
|
|
88
88
|
type: "string",
|
|
89
89
|
isAbnormal: s
|
|
90
90
|
};
|
|
@@ -112,9 +112,9 @@ function ue(e, n) {
|
|
|
112
112
|
location: t.location?.[0]?.location?.display
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
const
|
|
117
|
-
(o) =>
|
|
115
|
+
function w(e, n, t) {
|
|
116
|
+
const i = $(e.encounter), r = (e.hasMember ?? []).map((o) => $(o)).map((o) => o ? t.get(o) : void 0).filter((o) => !!o).map(
|
|
117
|
+
(o) => w(o, n, t)
|
|
118
118
|
);
|
|
119
119
|
return {
|
|
120
120
|
id: e.id,
|
|
@@ -122,23 +122,23 @@ function N(e, n, t) {
|
|
|
122
122
|
observationValue: se(e),
|
|
123
123
|
effectiveDateTime: e.effectiveDateTime,
|
|
124
124
|
issued: e.issued,
|
|
125
|
-
encounter:
|
|
125
|
+
encounter: i ? ue(i, n) : void 0,
|
|
126
126
|
members: r.length > 0 ? r : void 0
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
129
|
function le(e) {
|
|
130
|
-
const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(),
|
|
131
|
-
e.entry?.forEach(({ resource:
|
|
132
|
-
|
|
130
|
+
const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
|
|
131
|
+
e.entry?.forEach(({ resource: a }) => {
|
|
132
|
+
a?.id && (a.resourceType === "Encounter" ? n.set(a.id, a) : a.resourceType === "Observation" && (t.set(a.id, a), a.hasMember?.forEach((s) => {
|
|
133
133
|
const u = $(s);
|
|
134
|
-
u &&
|
|
134
|
+
u && i.add(u);
|
|
135
135
|
})));
|
|
136
136
|
});
|
|
137
137
|
const r = [], o = [];
|
|
138
|
-
return t.forEach((
|
|
139
|
-
if (
|
|
140
|
-
const u =
|
|
141
|
-
|
|
138
|
+
return t.forEach((a, s) => {
|
|
139
|
+
if (i.has(s)) return;
|
|
140
|
+
const u = w(
|
|
141
|
+
a,
|
|
142
142
|
n,
|
|
143
143
|
t
|
|
144
144
|
);
|
|
@@ -149,43 +149,43 @@ function de(e) {
|
|
|
149
149
|
const n = /* @__PURE__ */ new Map();
|
|
150
150
|
return e.observations.forEach((t) => {
|
|
151
151
|
if (!t.encounter?.id) return;
|
|
152
|
-
const
|
|
153
|
-
n.has(
|
|
152
|
+
const i = t.encounter.id;
|
|
153
|
+
n.has(i) || n.set(i, {
|
|
154
154
|
observations: [],
|
|
155
155
|
groupedObservations: []
|
|
156
|
-
}), n.get(
|
|
156
|
+
}), n.get(i).observations.push(t);
|
|
157
157
|
}), e.groupedObservations.forEach((t) => {
|
|
158
158
|
if (!t.encounter?.id) return;
|
|
159
|
-
const
|
|
160
|
-
n.has(
|
|
159
|
+
const i = t.encounter.id;
|
|
160
|
+
n.has(i) || n.set(i, {
|
|
161
161
|
observations: [],
|
|
162
162
|
groupedObservations: []
|
|
163
|
-
}), n.get(
|
|
164
|
-
}), Array.from(n.entries()).map(([t,
|
|
165
|
-
const r =
|
|
163
|
+
}), n.get(i).groupedObservations.push(t);
|
|
164
|
+
}), Array.from(n.entries()).map(([t, i]) => {
|
|
165
|
+
const r = i.observations[0]?.encounter ?? i.groupedObservations[0]?.encounter;
|
|
166
166
|
return {
|
|
167
167
|
encounterId: t,
|
|
168
168
|
encounterDetails: r,
|
|
169
|
-
observations:
|
|
170
|
-
groupedObservations:
|
|
169
|
+
observations: i.observations,
|
|
170
|
+
groupedObservations: i.groupedObservations
|
|
171
171
|
};
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
function ce(e) {
|
|
175
175
|
return [...e].sort((n, t) => {
|
|
176
|
-
const
|
|
177
|
-
return !
|
|
176
|
+
const i = n.encounterDetails?.date, r = t.encounterDetails?.date;
|
|
177
|
+
return !i && !r ? 0 : i ? r ? new Date(r).getTime() - new Date(i).getTime() : -1 : 1;
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
|
-
const
|
|
181
|
-
const o =
|
|
182
|
-
let u =
|
|
183
|
-
s === "Image" && (u = /* @__PURE__ */ b(
|
|
180
|
+
const D = (e, n, t, i, r) => {
|
|
181
|
+
const o = ie(e, n), a = o.value, s = P(a);
|
|
182
|
+
let u = a;
|
|
183
|
+
s === "Image" && (u = /* @__PURE__ */ b(H, { imageSrc: a, alt: a, id: `${a}-img` })), s === "Video" && (u = /* @__PURE__ */ b(X, { id: `${a}-video`, videoSrc: a }));
|
|
184
184
|
const l = r("OBSERVATIONS_RECORDED_BY", {
|
|
185
185
|
provider: o.provider
|
|
186
|
-
}), v = e.display, c = e.observationValue?.isAbnormal ? "abnormal-obs" : "obs", p =
|
|
186
|
+
}), v = e.display, c = e.observationValue?.isAbnormal ? "abnormal-obs" : "obs", p = i ? `${i}-${c}-${v}-${t}-${n}` : `${c}-${v}-${t}-${n}`;
|
|
187
187
|
return /* @__PURE__ */ b(
|
|
188
|
-
|
|
188
|
+
G,
|
|
189
189
|
{
|
|
190
190
|
header: o.header,
|
|
191
191
|
value: u,
|
|
@@ -196,14 +196,14 @@ const w = (e, n, t, a, r) => {
|
|
|
196
196
|
},
|
|
197
197
|
`obs-${e.id}`
|
|
198
198
|
);
|
|
199
|
-
}, ve = (e, n, t,
|
|
199
|
+
}, ve = (e, n, t, i, r, o) => /* @__PURE__ */ b(
|
|
200
200
|
A,
|
|
201
201
|
{
|
|
202
202
|
title: e.display,
|
|
203
|
-
id: `grouped-obs-${e.display}-${
|
|
203
|
+
id: `grouped-obs-${e.display}-${i}`,
|
|
204
204
|
open: t,
|
|
205
205
|
children: e.children.map(
|
|
206
|
-
(
|
|
206
|
+
(a, s) => D(a, s, r, o, n)
|
|
207
207
|
)
|
|
208
208
|
},
|
|
209
209
|
`grouped-obs-${e.id}`
|
|
@@ -211,7 +211,7 @@ const w = (e, n, t, a, r) => {
|
|
|
211
211
|
groupedData: e,
|
|
212
212
|
title: n = ""
|
|
213
213
|
}) => {
|
|
214
|
-
const { t } = I(),
|
|
214
|
+
const { t } = I(), i = (r, o, a) => {
|
|
215
215
|
const s = ne(r.encounterDetails, t);
|
|
216
216
|
return /* @__PURE__ */ _(
|
|
217
217
|
A,
|
|
@@ -221,7 +221,7 @@ const w = (e, n, t, a, r) => {
|
|
|
221
221
|
open: o,
|
|
222
222
|
children: [
|
|
223
223
|
r.observations.map(
|
|
224
|
-
(u, l) =>
|
|
224
|
+
(u, l) => D(u, l, a, n, t)
|
|
225
225
|
),
|
|
226
226
|
r.groupedObservations.map(
|
|
227
227
|
(u, l) => ve(
|
|
@@ -229,7 +229,7 @@ const w = (e, n, t, a, r) => {
|
|
|
229
229
|
t,
|
|
230
230
|
o,
|
|
231
231
|
l,
|
|
232
|
-
|
|
232
|
+
a,
|
|
233
233
|
n
|
|
234
234
|
)
|
|
235
235
|
)
|
|
@@ -245,44 +245,44 @@ const w = (e, n, t, a, r) => {
|
|
|
245
245
|
"data-testid": "obs-by-encounter-test-id",
|
|
246
246
|
"aria-label": "obs-by-encounter-aria-label",
|
|
247
247
|
children: e.map(
|
|
248
|
-
(r, o) =>
|
|
248
|
+
(r, o) => i(r, o === 0, o)
|
|
249
249
|
)
|
|
250
250
|
}
|
|
251
251
|
);
|
|
252
252
|
}, be = "_observations_kfbhq_1", ge = "_title_kfbhq_12", T = {
|
|
253
253
|
observations: be,
|
|
254
254
|
title: ge
|
|
255
|
-
},
|
|
256
|
-
const n = e, { conceptNames: t = [], conceptUuid:
|
|
255
|
+
}, fe = (e) => ["conceptUuid", e], me = (e, n) => ["observations", e, ...n], Oe = ({ config: e }) => {
|
|
256
|
+
const n = e, { conceptNames: t = [], conceptUuid: i = [] } = n, r = z(/* @__PURE__ */ new Set()), o = q(), { addNotification: a } = L(), { t: s } = I(), u = Y({
|
|
257
257
|
queries: t.map((d) => ({
|
|
258
|
-
queryKey:
|
|
259
|
-
queryFn: () =>
|
|
258
|
+
queryKey: fe(d),
|
|
259
|
+
queryFn: () => U(d),
|
|
260
260
|
enabled: !!d
|
|
261
261
|
}))
|
|
262
262
|
});
|
|
263
263
|
S(() => {
|
|
264
264
|
u.forEach((d, g) => {
|
|
265
265
|
if (d.isError && !r.current.has(g)) {
|
|
266
|
-
const
|
|
267
|
-
|
|
266
|
+
const k = t[g];
|
|
267
|
+
a({
|
|
268
268
|
title: s("ERROR_DEFAULT_TITLE"),
|
|
269
|
-
message: s("ERROR_FETCHING_CONCEPT", { conceptName:
|
|
269
|
+
message: s("ERROR_FETCHING_CONCEPT", { conceptName: k }),
|
|
270
270
|
type: "error"
|
|
271
271
|
}), r.current.add(g);
|
|
272
272
|
} else d.isError || r.current.delete(g);
|
|
273
273
|
});
|
|
274
274
|
}, [u, t]);
|
|
275
|
-
const l = h(() => u.map((d) => d.data?.uuid).filter((d) => !!d), [u]), v = h(() => [.../* @__PURE__ */ new Set([...l, ...
|
|
275
|
+
const l = h(() => u.map((d) => d.data?.uuid).filter((d) => !!d), [u]), v = h(() => [.../* @__PURE__ */ new Set([...l, ...i])], [l, i]), c = h(() => t.length === 0 ? !0 : u.every((d) => !d.isLoading), [u, t.length]), {
|
|
276
276
|
data: p,
|
|
277
|
-
isLoading:
|
|
277
|
+
isLoading: N,
|
|
278
278
|
isError: y
|
|
279
|
-
} =
|
|
280
|
-
queryKey:
|
|
281
|
-
queryFn: () =>
|
|
279
|
+
} = Z({
|
|
280
|
+
queryKey: me(o, v),
|
|
281
|
+
queryFn: () => x(o, v),
|
|
282
282
|
enabled: !!o && v.length > 0 && c
|
|
283
283
|
});
|
|
284
284
|
S(() => {
|
|
285
|
-
y &&
|
|
285
|
+
y && a({
|
|
286
286
|
title: s("ERROR_DEFAULT_TITLE"),
|
|
287
287
|
message: s("ERROR_FETCHING_OBSERVATIONS"),
|
|
288
288
|
type: "error"
|
|
@@ -296,34 +296,34 @@ const w = (e, n, t, a, r) => {
|
|
|
296
296
|
{ key: "name", header: "name" },
|
|
297
297
|
{ key: "value", header: "value" },
|
|
298
298
|
{ key: "form", header: "form" }
|
|
299
|
-
], O =
|
|
299
|
+
], O = N || !c, R = y && c, C = (!p || p.entry?.length === 0 || v.length === 0) && c, M = R ? s("ERROR_FETCHING_OBSERVATIONS") : null, B = C ? s("NO_OBSERVATIONS_FOUND") : void 0, F = E.length > 0 && !O && !R, m = n.titleTranslationKey, f = m ? s(m) : "";
|
|
300
300
|
return /* @__PURE__ */ _(
|
|
301
301
|
"div",
|
|
302
302
|
{
|
|
303
303
|
id: "observations",
|
|
304
|
-
"data-testid":
|
|
304
|
+
"data-testid": m ? `observations-${f}` : "observations",
|
|
305
305
|
"aria-label": "observations-aria-label",
|
|
306
306
|
className: T.observations,
|
|
307
307
|
children: [
|
|
308
308
|
/* @__PURE__ */ b(
|
|
309
|
-
|
|
309
|
+
K,
|
|
310
310
|
{
|
|
311
311
|
id: "observations-title",
|
|
312
|
-
testId:
|
|
313
|
-
title:
|
|
312
|
+
testId: m ? `observations-title-${f}` : "observations-title",
|
|
313
|
+
title: f,
|
|
314
314
|
className: T.title,
|
|
315
|
-
children: /* @__PURE__ */ b("p", { children:
|
|
315
|
+
children: /* @__PURE__ */ b("p", { children: f })
|
|
316
316
|
}
|
|
317
317
|
),
|
|
318
|
-
|
|
318
|
+
F ? /* @__PURE__ */ b(pe, { groupedData: E, title: f }) : /* @__PURE__ */ b(
|
|
319
319
|
Q,
|
|
320
320
|
{
|
|
321
321
|
headers: V,
|
|
322
322
|
rows: [],
|
|
323
323
|
ariaLabel: s("OBSERVATIONS"),
|
|
324
324
|
loading: O,
|
|
325
|
-
errorStateMessage:
|
|
326
|
-
emptyStateMessage:
|
|
325
|
+
errorStateMessage: M,
|
|
326
|
+
emptyStateMessage: B,
|
|
327
327
|
dataTestId: "observations-table"
|
|
328
328
|
}
|
|
329
329
|
)
|
|
@@ -332,7 +332,7 @@ const w = (e, n, t, a, r) => {
|
|
|
332
332
|
);
|
|
333
333
|
};
|
|
334
334
|
export {
|
|
335
|
-
|
|
335
|
+
fe as conceptUuidQueryKeys,
|
|
336
336
|
Oe as default,
|
|
337
|
-
|
|
337
|
+
me as observationsQueryKeys
|
|
338
338
|
};
|