@bahmni/clinical-app 0.0.1-dev.151 → 0.0.1-dev.153
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-B7fyRiO9-BUoC3Rut.js +423 -0
- package/dist/{LNWAZHJI-BpL8MSsb.js → LNWAZHJI-C6s7ZMip.js} +5 -5
- package/dist/{MWZ6AO7Z-B3U0oS0a.js → MWZ6AO7Z-CjhDBDOc.js} +7 -7
- package/dist/Observations-CDp0Y3q7-CLafmY39.js +170 -0
- package/dist/{YPM2AS64-BRLiQ99R.js → YPM2AS64-C3PqXSYC.js} +1 -1
- package/dist/components/consultationPad/ConsultationPad.d.ts.map +1 -1
- package/dist/{index-D9U_fT9q.js → index-F3qh_qhX.js} +20535 -20495
- package/dist/index.js +1 -1
- package/dist/utils/fhir/conceptExtractor.d.ts +9 -0
- package/dist/utils/fhir/conceptExtractor.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/FormsTable-BqSVEv0D-CJ0S1DST.js +0 -358
- package/dist/Observations-CuoD8QPi-DWd8zjnU.js +0 -162
package/dist/index.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Bundle } from 'fhir/r4';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts concept UUID and name mappings from a FHIR Bundle's Observation resources.
|
|
4
|
+
*
|
|
5
|
+
* @param bundle - The FHIR Bundle containing Observation resources
|
|
6
|
+
* @returns A Map of concept UUIDs to concept names
|
|
7
|
+
*/
|
|
8
|
+
export declare const extractConceptsFromResponseBundle: (bundle: Bundle) => Map<string, string>;
|
|
9
|
+
//# sourceMappingURL=conceptExtractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conceptExtractor.d.ts","sourceRoot":"","sources":["../../../src/utils/fhir/conceptExtractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAe,MAAM,SAAS,CAAC;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,GAC5C,QAAQ,MAAM,KACb,GAAG,CAAC,MAAM,EAAE,MAAM,CAcpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,358 +0,0 @@
|
|
|
1
|
-
import { jsx as t, jsxs as p, Fragment as W } from "react/jsx-runtime";
|
|
2
|
-
import { u as J, H as Q, w as X, a as h, i as Z, C as ee, A as G, Y as re, G as ae, b as oe, c as te, V as U, g as ne, d as v, K as se, U as de, W as me, q as ie } from "./index-D9U_fT9q.js";
|
|
3
|
-
import { useState as x, useMemo as N, useCallback as y } from "react";
|
|
4
|
-
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", Ne = "_groupLabel_1pd36_48", $e = "_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", Ce = "_commentText_1pd36_116", Le = "_nestedGroup_1pd36_125", De = "_nestedGroupLabel_1pd36_132", Oe = "_nestedGroupMembers_1pd36_141", o = {
|
|
5
|
-
formsTableBody: le,
|
|
6
|
-
customAccordianItem: ce,
|
|
7
|
-
formContent: ue,
|
|
8
|
-
formDetailsContainer: pe,
|
|
9
|
-
observation: be,
|
|
10
|
-
groupContainer: _e,
|
|
11
|
-
rowContainer: fe,
|
|
12
|
-
groupLabel: Ne,
|
|
13
|
-
rowLabel: $e,
|
|
14
|
-
rowValue: ge,
|
|
15
|
-
groupMembers: he,
|
|
16
|
-
memberRow: ye,
|
|
17
|
-
memberLabel: ve,
|
|
18
|
-
memberValue: Ae,
|
|
19
|
-
abnormalValue: Me,
|
|
20
|
-
commentSection: Te,
|
|
21
|
-
commentText: Ce,
|
|
22
|
-
nestedGroup: Le,
|
|
23
|
-
nestedGroupLabel: De,
|
|
24
|
-
nestedGroupMembers: Oe
|
|
25
|
-
}, Re = "ABNORMAL", q = (e) => {
|
|
26
|
-
const s = e.concept?.units, m = e.concept?.lowNormal, r = e.concept?.hiNormal, u = m != null, d = r != null, c = u && d ? ` (${m} - ${r})` : u ? ` (>${m})` : d ? ` (<${r})` : "", a = e.interpretation && e.interpretation.toUpperCase() === Re;
|
|
27
|
-
return { units: s, rangeString: c, isAbnormal: a };
|
|
28
|
-
}, k = ({
|
|
29
|
-
member: e,
|
|
30
|
-
depth: s = 0,
|
|
31
|
-
memberIndex: m = 0,
|
|
32
|
-
formName: r = ""
|
|
33
|
-
}) => {
|
|
34
|
-
const u = e.groupMembers && e.groupMembers.length > 0, d = e.conceptNameToDisplay ?? e.concept?.shortName ?? e.concept?.name, c = r ? `${r}-` : "";
|
|
35
|
-
if (u)
|
|
36
|
-
return /* @__PURE__ */ p(
|
|
37
|
-
"div",
|
|
38
|
-
{
|
|
39
|
-
className: o.nestedGroup,
|
|
40
|
-
"data-testid": `${c}obs-nested-group-${d}-${m}`,
|
|
41
|
-
children: [
|
|
42
|
-
/* @__PURE__ */ t(
|
|
43
|
-
"div",
|
|
44
|
-
{
|
|
45
|
-
className: o.nestedGroupLabel,
|
|
46
|
-
"data-testid": `${c}obs-nested-group-label-${d}-${m}`,
|
|
47
|
-
style: { paddingLeft: `${s * 16}px` },
|
|
48
|
-
children: d
|
|
49
|
-
}
|
|
50
|
-
),
|
|
51
|
-
/* @__PURE__ */ t(
|
|
52
|
-
"div",
|
|
53
|
-
{
|
|
54
|
-
className: o.nestedGroupMembers,
|
|
55
|
-
"data-testid": `${c}obs-nested-group-members-${d}-${m}`,
|
|
56
|
-
children: e.groupMembers?.map(($, g) => /* @__PURE__ */ t(
|
|
57
|
-
k,
|
|
58
|
-
{
|
|
59
|
-
member: $,
|
|
60
|
-
depth: s + 1,
|
|
61
|
-
memberIndex: g,
|
|
62
|
-
formName: r
|
|
63
|
-
},
|
|
64
|
-
`${$.concept.uuid}`
|
|
65
|
-
))
|
|
66
|
-
}
|
|
67
|
-
)
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
);
|
|
71
|
-
const { units: a, rangeString: b, isAbnormal: _ } = q(e);
|
|
72
|
-
return /* @__PURE__ */ p(
|
|
73
|
-
"div",
|
|
74
|
-
{
|
|
75
|
-
className: o.memberRow,
|
|
76
|
-
"data-testid": `${c}obs-member-row-${d}-${m}`,
|
|
77
|
-
style: { paddingLeft: `${s * 16}px` },
|
|
78
|
-
children: [
|
|
79
|
-
/* @__PURE__ */ p(
|
|
80
|
-
"p",
|
|
81
|
-
{
|
|
82
|
-
className: v(
|
|
83
|
-
o.memberLabel,
|
|
84
|
-
_ ? o.abnormalValue : ""
|
|
85
|
-
),
|
|
86
|
-
"data-testid": `${c}obs-member-label-${d}-${m}`,
|
|
87
|
-
children: [
|
|
88
|
-
d,
|
|
89
|
-
b
|
|
90
|
-
]
|
|
91
|
-
}
|
|
92
|
-
),
|
|
93
|
-
/* @__PURE__ */ p(
|
|
94
|
-
"p",
|
|
95
|
-
{
|
|
96
|
-
className: v(
|
|
97
|
-
o.memberValue,
|
|
98
|
-
_ ? o.abnormalValue : ""
|
|
99
|
-
),
|
|
100
|
-
"data-testid": `${c}obs-member-value-${d}-${m}`,
|
|
101
|
-
children: [
|
|
102
|
-
e.valueAsString,
|
|
103
|
-
a && ` ${a}`
|
|
104
|
-
]
|
|
105
|
-
}
|
|
106
|
-
)
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
);
|
|
110
|
-
}, Fe = ({
|
|
111
|
-
observation: e,
|
|
112
|
-
index: s,
|
|
113
|
-
formName: m = ""
|
|
114
|
-
}) => {
|
|
115
|
-
const r = e.groupMembers && e.groupMembers.length > 0, { units: u, rangeString: d, isAbnormal: c } = q(e), a = m ? `${m}-` : "";
|
|
116
|
-
return /* @__PURE__ */ p(
|
|
117
|
-
"div",
|
|
118
|
-
{
|
|
119
|
-
className: o.observation,
|
|
120
|
-
"data-testid": `${a}observation-item-${e.conceptNameToDisplay}-${s}`,
|
|
121
|
-
children: [
|
|
122
|
-
/* @__PURE__ */ p(
|
|
123
|
-
"div",
|
|
124
|
-
{
|
|
125
|
-
className: r ? o.groupContainer : o.rowContainer,
|
|
126
|
-
"data-testid": `${a}observation-container-${e.conceptNameToDisplay}-${s}`,
|
|
127
|
-
children: [
|
|
128
|
-
/* @__PURE__ */ p(
|
|
129
|
-
"p",
|
|
130
|
-
{
|
|
131
|
-
className: v(
|
|
132
|
-
r ? o.groupLabel : o.rowLabel,
|
|
133
|
-
!r && c ? o.abnormalValue : ""
|
|
134
|
-
),
|
|
135
|
-
"data-testid": `${a}observation-label-${e.conceptNameToDisplay}-${s}`,
|
|
136
|
-
children: [
|
|
137
|
-
e.conceptNameToDisplay,
|
|
138
|
-
!r && d && /* @__PURE__ */ t("span", { className: o.rangeInfo, children: d })
|
|
139
|
-
]
|
|
140
|
-
}
|
|
141
|
-
),
|
|
142
|
-
r ? /* @__PURE__ */ t(
|
|
143
|
-
"div",
|
|
144
|
-
{
|
|
145
|
-
className: o.groupMembers,
|
|
146
|
-
"data-testid": `${a}observation-group-members-${e.conceptNameToDisplay}-${s}`,
|
|
147
|
-
children: e.groupMembers?.map((b, _) => /* @__PURE__ */ t(
|
|
148
|
-
k,
|
|
149
|
-
{
|
|
150
|
-
member: b,
|
|
151
|
-
depth: 0,
|
|
152
|
-
memberIndex: _,
|
|
153
|
-
formName: m
|
|
154
|
-
},
|
|
155
|
-
`${b.concept.uuid}`
|
|
156
|
-
))
|
|
157
|
-
}
|
|
158
|
-
) : /* @__PURE__ */ p(
|
|
159
|
-
"p",
|
|
160
|
-
{
|
|
161
|
-
className: v(
|
|
162
|
-
o.rowValue,
|
|
163
|
-
c ? o.abnormalValue : ""
|
|
164
|
-
),
|
|
165
|
-
"data-testid": `${a}observation-value-${e.conceptNameToDisplay}-${s}`,
|
|
166
|
-
children: [
|
|
167
|
-
e.valueAsString,
|
|
168
|
-
u && ` ${u}`
|
|
169
|
-
]
|
|
170
|
-
}
|
|
171
|
-
)
|
|
172
|
-
]
|
|
173
|
-
}
|
|
174
|
-
),
|
|
175
|
-
e.comment && /* @__PURE__ */ t(
|
|
176
|
-
"div",
|
|
177
|
-
{
|
|
178
|
-
className: o.commentSection,
|
|
179
|
-
"data-testid": `${a}observation-comment-${e.conceptNameToDisplay}-${s}`,
|
|
180
|
-
children: /* @__PURE__ */ p("span", { className: o.commentText, children: [
|
|
181
|
-
e.comment,
|
|
182
|
-
e.providers?.[0]?.name && ` - by ${e.providers[0].name}`
|
|
183
|
-
] })
|
|
184
|
-
}
|
|
185
|
-
)
|
|
186
|
-
]
|
|
187
|
-
},
|
|
188
|
-
`${e.concept.uuid}-${s}`
|
|
189
|
-
);
|
|
190
|
-
}, Se = ({
|
|
191
|
-
episodeOfCareUuids: e,
|
|
192
|
-
encounterUuids: s,
|
|
193
|
-
config: m
|
|
194
|
-
}) => {
|
|
195
|
-
const { t: r } = J(), u = Q(), [d, c] = x(!1), [a, b] = x(null), _ = m?.numberOfVisits, $ = X(
|
|
196
|
-
e,
|
|
197
|
-
s
|
|
198
|
-
), {
|
|
199
|
-
data: g = [],
|
|
200
|
-
isLoading: C,
|
|
201
|
-
isError: L,
|
|
202
|
-
error: H
|
|
203
|
-
} = h({
|
|
204
|
-
queryKey: ["forms", u, e],
|
|
205
|
-
queryFn: () => se(u, void 0, _),
|
|
206
|
-
enabled: !!u && !$
|
|
207
|
-
}), D = N(() => !s || s.length === 0 ? g : g.filter(
|
|
208
|
-
(n) => s.includes(n.encounterUuid)
|
|
209
|
-
), [g, s]), { data: O = [] } = h({
|
|
210
|
-
queryKey: ["observationForms"],
|
|
211
|
-
queryFn: () => de()
|
|
212
|
-
}), R = y(
|
|
213
|
-
(n) => O.find((l) => l.name === n)?.uuid,
|
|
214
|
-
[O]
|
|
215
|
-
), A = N(() => {
|
|
216
|
-
if (a)
|
|
217
|
-
return R(a.formName);
|
|
218
|
-
}, [a, R]), {
|
|
219
|
-
data: we,
|
|
220
|
-
isLoading: K,
|
|
221
|
-
error: F
|
|
222
|
-
} = h({
|
|
223
|
-
queryKey: ["formMetadata", A],
|
|
224
|
-
queryFn: () => me(A),
|
|
225
|
-
enabled: !!A && d
|
|
226
|
-
}), {
|
|
227
|
-
data: M,
|
|
228
|
-
isLoading: j,
|
|
229
|
-
error: w
|
|
230
|
-
} = h({
|
|
231
|
-
queryKey: ["formsEncounter", a?.encounterUuid],
|
|
232
|
-
queryFn: () => ie(a.encounterUuid, !0),
|
|
233
|
-
enabled: !!a?.encounterUuid && d
|
|
234
|
-
}), I = N(() => !M?.observations || !a?.formName ? [] : M.observations.filter(
|
|
235
|
-
(n) => "formFieldPath" in n && typeof n.formFieldPath == "string" && n.formFieldPath.includes(a.formName)
|
|
236
|
-
), [M?.observations, a?.formName]), V = N(
|
|
237
|
-
() => [
|
|
238
|
-
{ key: "recordedOn", header: r("FORM_RECORDED_ON") },
|
|
239
|
-
{ key: "recordedBy", header: r("FORM_RECORDED_BY") }
|
|
240
|
-
],
|
|
241
|
-
[r]
|
|
242
|
-
), P = N(
|
|
243
|
-
() => [
|
|
244
|
-
{ key: "recordedOn", sortable: !0 },
|
|
245
|
-
{ key: "recordedBy", sortable: !0 }
|
|
246
|
-
],
|
|
247
|
-
[]
|
|
248
|
-
), E = N(() => {
|
|
249
|
-
const n = D.reduce(
|
|
250
|
-
(l, i) => {
|
|
251
|
-
const f = i.formName;
|
|
252
|
-
l[f] ??= [];
|
|
253
|
-
const T = i.providers.map((z) => z.providerName).filter(Boolean).join(", ");
|
|
254
|
-
return l[f].push({
|
|
255
|
-
id: i.encounterUuid,
|
|
256
|
-
formName: i.formName,
|
|
257
|
-
recordedOn: Z(i.encounterDateTime, r, ne).formattedResult,
|
|
258
|
-
recordedBy: T ?? "--",
|
|
259
|
-
encounterDateTime: i.encounterDateTime,
|
|
260
|
-
encounterUuid: i.encounterUuid
|
|
261
|
-
}), l;
|
|
262
|
-
},
|
|
263
|
-
{}
|
|
264
|
-
);
|
|
265
|
-
return Object.entries(n).map(
|
|
266
|
-
([l, i]) => ({
|
|
267
|
-
formName: l,
|
|
268
|
-
records: i.sort(
|
|
269
|
-
(f, T) => T.encounterDateTime - f.encounterDateTime
|
|
270
|
-
)
|
|
271
|
-
})
|
|
272
|
-
).sort((l, i) => l.formName.localeCompare(i.formName));
|
|
273
|
-
}, [D, r]), S = y((n) => {
|
|
274
|
-
b(n), c(!0);
|
|
275
|
-
}, []), Y = y(() => {
|
|
276
|
-
c(!1), b(null);
|
|
277
|
-
}, []), B = y(
|
|
278
|
-
(n, l) => {
|
|
279
|
-
switch (l) {
|
|
280
|
-
case "recordedOn":
|
|
281
|
-
return /* @__PURE__ */ t(ee, { onClick: () => S(n), children: n.recordedOn });
|
|
282
|
-
case "recordedBy":
|
|
283
|
-
return n.recordedBy;
|
|
284
|
-
default:
|
|
285
|
-
return null;
|
|
286
|
-
}
|
|
287
|
-
},
|
|
288
|
-
[S]
|
|
289
|
-
);
|
|
290
|
-
return /* @__PURE__ */ p(W, { children: [
|
|
291
|
-
/* @__PURE__ */ t("div", { "data-testid": "forms-table", children: C || L || E.length === 0 || $ ? /* @__PURE__ */ t(
|
|
292
|
-
G,
|
|
293
|
-
{
|
|
294
|
-
headers: V,
|
|
295
|
-
ariaLabel: r("FORMS_HEADING"),
|
|
296
|
-
rows: [],
|
|
297
|
-
loading: C,
|
|
298
|
-
errorStateMessage: L ? H?.message : void 0,
|
|
299
|
-
emptyStateMessage: r("FORMS_UNAVAILABLE"),
|
|
300
|
-
renderCell: B,
|
|
301
|
-
className: o.formsTableBody,
|
|
302
|
-
dataTestId: "forms-table"
|
|
303
|
-
}
|
|
304
|
-
) : /* @__PURE__ */ t(re, { align: "start", children: E.map((n, l) => {
|
|
305
|
-
const { formName: i, records: f } = n;
|
|
306
|
-
return /* @__PURE__ */ t(
|
|
307
|
-
ae,
|
|
308
|
-
{
|
|
309
|
-
title: i,
|
|
310
|
-
className: o.customAccordianItem,
|
|
311
|
-
testId: `accordian-title-${i}`,
|
|
312
|
-
open: l === 0,
|
|
313
|
-
children: /* @__PURE__ */ t(
|
|
314
|
-
G,
|
|
315
|
-
{
|
|
316
|
-
headers: V,
|
|
317
|
-
ariaLabel: r("FORMS_HEADING"),
|
|
318
|
-
rows: f,
|
|
319
|
-
loading: !1,
|
|
320
|
-
errorStateMessage: "",
|
|
321
|
-
sortable: P,
|
|
322
|
-
emptyStateMessage: r("FORMS_UNAVAILABLE"),
|
|
323
|
-
renderCell: B,
|
|
324
|
-
className: o.formsTableBody,
|
|
325
|
-
dataTestId: `forms-table-${i}`
|
|
326
|
-
}
|
|
327
|
-
)
|
|
328
|
-
},
|
|
329
|
-
i
|
|
330
|
-
);
|
|
331
|
-
}) }) }),
|
|
332
|
-
d && a && /* @__PURE__ */ t(
|
|
333
|
-
oe,
|
|
334
|
-
{
|
|
335
|
-
id: "modalIdForActionAreaLayout",
|
|
336
|
-
open: d,
|
|
337
|
-
onRequestClose: Y,
|
|
338
|
-
modalHeading: a.formName,
|
|
339
|
-
modalLabel: `${a.recordedOn} | ${a.recordedBy}`,
|
|
340
|
-
passiveModal: !0,
|
|
341
|
-
size: "md",
|
|
342
|
-
testId: "form-details-modal",
|
|
343
|
-
children: /* @__PURE__ */ t("div", { className: o.formContent, children: K || j ? /* @__PURE__ */ t(te, { width: "100%", lineCount: 3 }) : F ? /* @__PURE__ */ t("div", { children: U(F).message ?? r("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ t("div", { children: U(w).message ?? r("ERROR_FETCHING_FORM_DATA") }) : I.length > 0 ? /* @__PURE__ */ t("div", { className: o.formDetailsContainer, children: I.map((n, l) => /* @__PURE__ */ t(
|
|
344
|
-
Fe,
|
|
345
|
-
{
|
|
346
|
-
observation: n,
|
|
347
|
-
index: l,
|
|
348
|
-
formName: a.formName
|
|
349
|
-
},
|
|
350
|
-
`${n.concept.uuid}`
|
|
351
|
-
)) }) : /* @__PURE__ */ t("div", { children: r("NO_FORM_DATA_AVAILABLE") }) })
|
|
352
|
-
}
|
|
353
|
-
)
|
|
354
|
-
] });
|
|
355
|
-
};
|
|
356
|
-
export {
|
|
357
|
-
Se as default
|
|
358
|
-
};
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { jsxs as $, jsx as b } from "react/jsx-runtime";
|
|
2
|
-
import { H as C, h as U, u as I, e as V, j as H, a as Q, f as x, Q as K, k as M, l as j, A as w, J as G, m as N, X as P, P as X, L as J, M as Y, x as z, F as W } from "./index-D9U_fT9q.js";
|
|
3
|
-
import { useRef as Z, useEffect as _, useMemo as h } from "react";
|
|
4
|
-
const S = (e, d, o, l, t) => {
|
|
5
|
-
const a = P(e, d), r = a.value, s = X(r);
|
|
6
|
-
let n = r;
|
|
7
|
-
s === "Image" && (n = /* @__PURE__ */ b(Y, { imageSrc: r, alt: r, id: `${r}-img` })), s === "Video" && (n = /* @__PURE__ */ b(z, { id: `${r}-video`, videoSrc: r }));
|
|
8
|
-
const c = t("OBSERVATIONS_RECORDED_BY", {
|
|
9
|
-
provider: a.provider
|
|
10
|
-
}), m = e.display, p = e.observationValue?.isAbnormal ? "abnormal-obs" : "obs", u = l ? `${l}-${p}-${m}-${o}-${d}` : `${p}-${m}-${o}-${d}`;
|
|
11
|
-
return /* @__PURE__ */ b(
|
|
12
|
-
J,
|
|
13
|
-
{
|
|
14
|
-
header: a.header,
|
|
15
|
-
value: n,
|
|
16
|
-
info: c,
|
|
17
|
-
id: u,
|
|
18
|
-
testId: u,
|
|
19
|
-
ariaLabel: u
|
|
20
|
-
},
|
|
21
|
-
`obs-${e.id}`
|
|
22
|
-
);
|
|
23
|
-
}, ee = (e, d, o, l, t, a) => /* @__PURE__ */ b(
|
|
24
|
-
N,
|
|
25
|
-
{
|
|
26
|
-
title: e.display,
|
|
27
|
-
id: `grouped-obs-${e.display}-${l}`,
|
|
28
|
-
open: o,
|
|
29
|
-
children: e.members?.map(
|
|
30
|
-
(r, s) => S(r, s, t, a, d)
|
|
31
|
-
)
|
|
32
|
-
},
|
|
33
|
-
`grouped-obs-${e.id}`
|
|
34
|
-
), te = ({
|
|
35
|
-
groupedData: e,
|
|
36
|
-
title: d = ""
|
|
37
|
-
}) => {
|
|
38
|
-
const { t: o } = I(), l = (t, a, r) => {
|
|
39
|
-
const s = G(t.encounterDetails, o);
|
|
40
|
-
return /* @__PURE__ */ $(
|
|
41
|
-
N,
|
|
42
|
-
{
|
|
43
|
-
title: s,
|
|
44
|
-
id: `encounter-${t.encounterId}`,
|
|
45
|
-
open: a,
|
|
46
|
-
children: [
|
|
47
|
-
t.observations.map(
|
|
48
|
-
(n, c) => S(n, c, r, d, o)
|
|
49
|
-
),
|
|
50
|
-
t.groupedObservations.map(
|
|
51
|
-
(n, c) => ee(
|
|
52
|
-
n,
|
|
53
|
-
o,
|
|
54
|
-
a,
|
|
55
|
-
c,
|
|
56
|
-
r,
|
|
57
|
-
d
|
|
58
|
-
)
|
|
59
|
-
)
|
|
60
|
-
]
|
|
61
|
-
},
|
|
62
|
-
`encounter-${t.encounterId}`
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
return /* @__PURE__ */ b(
|
|
66
|
-
"div",
|
|
67
|
-
{
|
|
68
|
-
id: "obs-by-encounter",
|
|
69
|
-
"data-testid": "obs-by-encounter-test-id",
|
|
70
|
-
"aria-label": "obs-by-encounter-aria-label",
|
|
71
|
-
children: e.map(
|
|
72
|
-
(t, a) => l(t, a === 0, a)
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
}, ae = "_observations_kfbhq_1", re = "_title_kfbhq_12", T = {
|
|
77
|
-
observations: ae,
|
|
78
|
-
title: re
|
|
79
|
-
}, se = (e) => ["conceptUuid", e], oe = (e, d) => ["observations", e, ...d], le = ({ config: e }) => {
|
|
80
|
-
const d = e, { conceptNames: o = [], conceptUuid: l = [] } = d, t = Z(/* @__PURE__ */ new Set()), a = C(), { addNotification: r } = U(), { t: s } = I(), n = V({
|
|
81
|
-
queries: o.map((i) => ({
|
|
82
|
-
queryKey: se(i),
|
|
83
|
-
queryFn: () => H(i),
|
|
84
|
-
enabled: !!i
|
|
85
|
-
}))
|
|
86
|
-
});
|
|
87
|
-
_(() => {
|
|
88
|
-
n.forEach((i, y) => {
|
|
89
|
-
if (i.isError && !t.current.has(y)) {
|
|
90
|
-
const B = o[y];
|
|
91
|
-
r({
|
|
92
|
-
title: s("ERROR_DEFAULT_TITLE"),
|
|
93
|
-
message: s("ERROR_FETCHING_CONCEPT", { conceptName: B }),
|
|
94
|
-
type: "error"
|
|
95
|
-
}), t.current.add(y);
|
|
96
|
-
} else i.isError || t.current.delete(y);
|
|
97
|
-
});
|
|
98
|
-
}, [n, o]);
|
|
99
|
-
const c = h(() => n.map((i) => i.data?.uuid).filter((i) => !!i), [n]), m = h(() => [.../* @__PURE__ */ new Set([...c, ...l])], [c, l]), p = h(() => o.length === 0 ? !0 : n.every((i) => !i.isLoading), [n, o.length]), {
|
|
100
|
-
data: u,
|
|
101
|
-
isLoading: A,
|
|
102
|
-
isError: R
|
|
103
|
-
} = Q({
|
|
104
|
-
queryKey: oe(a, m),
|
|
105
|
-
queryFn: () => W(a, m),
|
|
106
|
-
enabled: !!a && m.length > 0 && p
|
|
107
|
-
});
|
|
108
|
-
_(() => {
|
|
109
|
-
R && r({
|
|
110
|
-
title: s("ERROR_DEFAULT_TITLE"),
|
|
111
|
-
message: s("ERROR_FETCHING_OBSERVATIONS"),
|
|
112
|
-
type: "error"
|
|
113
|
-
});
|
|
114
|
-
}, [R]);
|
|
115
|
-
const g = h(() => {
|
|
116
|
-
if (!u) return [];
|
|
117
|
-
const i = x(u), y = K(i);
|
|
118
|
-
return M(y);
|
|
119
|
-
}, [u]), F = [
|
|
120
|
-
{ key: "name", header: "name" },
|
|
121
|
-
{ key: "value", header: "value" },
|
|
122
|
-
{ key: "form", header: "form" }
|
|
123
|
-
], f = A || !p, O = R && p, L = (!u || u.entry?.length === 0 || m.length === 0) && p, D = O ? s("ERROR_FETCHING_OBSERVATIONS") : null, k = L ? s("NO_OBSERVATIONS_FOUND") : void 0, q = g.length > 0 && !f && !O, E = d.titleTranslationKey, v = E ? s(E) : "";
|
|
124
|
-
return /* @__PURE__ */ $(
|
|
125
|
-
"div",
|
|
126
|
-
{
|
|
127
|
-
id: "observations",
|
|
128
|
-
"data-testid": E ? `observations-${v}` : "observations",
|
|
129
|
-
"aria-label": "observations-aria-label",
|
|
130
|
-
className: T.observations,
|
|
131
|
-
children: [
|
|
132
|
-
/* @__PURE__ */ b(
|
|
133
|
-
j,
|
|
134
|
-
{
|
|
135
|
-
id: "observations-title",
|
|
136
|
-
testId: E ? `observations-title-${v}` : "observations-title",
|
|
137
|
-
title: v,
|
|
138
|
-
className: T.title,
|
|
139
|
-
children: /* @__PURE__ */ b("p", { children: v })
|
|
140
|
-
}
|
|
141
|
-
),
|
|
142
|
-
q ? /* @__PURE__ */ b(te, { groupedData: g, title: v }) : /* @__PURE__ */ b(
|
|
143
|
-
w,
|
|
144
|
-
{
|
|
145
|
-
headers: F,
|
|
146
|
-
rows: [],
|
|
147
|
-
ariaLabel: s("OBSERVATIONS"),
|
|
148
|
-
loading: f,
|
|
149
|
-
errorStateMessage: D,
|
|
150
|
-
emptyStateMessage: k,
|
|
151
|
-
dataTestId: "observations-table"
|
|
152
|
-
}
|
|
153
|
-
)
|
|
154
|
-
]
|
|
155
|
-
}
|
|
156
|
-
);
|
|
157
|
-
};
|
|
158
|
-
export {
|
|
159
|
-
se as conceptUuidQueryKeys,
|
|
160
|
-
le as default,
|
|
161
|
-
oe as observationsQueryKeys
|
|
162
|
-
};
|