@bahmni/clinical-app 0.0.1-dev.151 → 0.0.1-dev.152

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.
@@ -1,29 +1,29 @@
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;
1
+ import { jsx as n, jsxs as p, Fragment as J } from "react/jsx-runtime";
2
+ import { u as X, h as Z, w as ee, a as re, b as g, e as ae, i as oe, C as te, A as U, Y as ne, G as se, c as de, d as me, V as x, g as ie, f as y, K as le, U as ce, W as ue, q as pe } from "./index-BPwSmRKH.js";
3
+ import { useState as q, useMemo as N, useCallback as h } from "react";
4
+ const be = "_formsTableBody_1pd36_1", _e = "_customAccordianItem_1pd36_6", fe = "_formContent_1pd36_18", Ne = "_formDetailsContainer_1pd36_25", $e = "_observation_1pd36_30", ge = "_groupContainer_1pd36_39", he = "_rowContainer_1pd36_43", ye = "_groupLabel_1pd36_48", ve = "_rowLabel_1pd36_58", Ae = "_rowValue_1pd36_67", Ce = "_groupMembers_1pd36_75", Me = "_memberRow_1pd36_81", Te = "_memberLabel_1pd36_86", Le = "_memberValue_1pd36_94", De = "_abnormalValue_1pd36_102", Oe = "_commentSection_1pd36_110", Re = "_commentText_1pd36_116", Fe = "_nestedGroup_1pd36_125", we = "_nestedGroupLabel_1pd36_132", Ie = "_nestedGroupMembers_1pd36_141", o = {
5
+ formsTableBody: be,
6
+ customAccordianItem: _e,
7
+ formContent: fe,
8
+ formDetailsContainer: Ne,
9
+ observation: $e,
10
+ groupContainer: ge,
11
+ rowContainer: he,
12
+ groupLabel: ye,
13
+ rowLabel: ve,
14
+ rowValue: Ae,
15
+ groupMembers: Ce,
16
+ memberRow: Me,
17
+ memberLabel: Te,
18
+ memberValue: Le,
19
+ abnormalValue: De,
20
+ commentSection: Oe,
21
+ commentText: Re,
22
+ nestedGroup: Fe,
23
+ nestedGroupLabel: we,
24
+ nestedGroupMembers: Ie
25
+ }, Ve = "ABNORMAL", K = (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() === Ve;
27
27
  return { units: s, rangeString: c, isAbnormal: a };
28
28
  }, k = ({
29
29
  member: e,
@@ -39,7 +39,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
39
39
  className: o.nestedGroup,
40
40
  "data-testid": `${c}obs-nested-group-${d}-${m}`,
41
41
  children: [
42
- /* @__PURE__ */ t(
42
+ /* @__PURE__ */ n(
43
43
  "div",
44
44
  {
45
45
  className: o.nestedGroupLabel,
@@ -48,17 +48,17 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
48
48
  children: d
49
49
  }
50
50
  ),
51
- /* @__PURE__ */ t(
51
+ /* @__PURE__ */ n(
52
52
  "div",
53
53
  {
54
54
  className: o.nestedGroupMembers,
55
55
  "data-testid": `${c}obs-nested-group-members-${d}-${m}`,
56
- children: e.groupMembers?.map(($, g) => /* @__PURE__ */ t(
56
+ children: e.groupMembers?.map(($, v) => /* @__PURE__ */ n(
57
57
  k,
58
58
  {
59
59
  member: $,
60
60
  depth: s + 1,
61
- memberIndex: g,
61
+ memberIndex: v,
62
62
  formName: r
63
63
  },
64
64
  `${$.concept.uuid}`
@@ -68,7 +68,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
68
68
  ]
69
69
  }
70
70
  );
71
- const { units: a, rangeString: b, isAbnormal: _ } = q(e);
71
+ const { units: a, rangeString: b, isAbnormal: _ } = K(e);
72
72
  return /* @__PURE__ */ p(
73
73
  "div",
74
74
  {
@@ -79,7 +79,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
79
79
  /* @__PURE__ */ p(
80
80
  "p",
81
81
  {
82
- className: v(
82
+ className: y(
83
83
  o.memberLabel,
84
84
  _ ? o.abnormalValue : ""
85
85
  ),
@@ -93,7 +93,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
93
93
  /* @__PURE__ */ p(
94
94
  "p",
95
95
  {
96
- className: v(
96
+ className: y(
97
97
  o.memberValue,
98
98
  _ ? o.abnormalValue : ""
99
99
  ),
@@ -107,12 +107,12 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
107
107
  ]
108
108
  }
109
109
  );
110
- }, Fe = ({
110
+ }, Ee = ({
111
111
  observation: e,
112
112
  index: s,
113
113
  formName: m = ""
114
114
  }) => {
115
- const r = e.groupMembers && e.groupMembers.length > 0, { units: u, rangeString: d, isAbnormal: c } = q(e), a = m ? `${m}-` : "";
115
+ const r = e.groupMembers && e.groupMembers.length > 0, { units: u, rangeString: d, isAbnormal: c } = K(e), a = m ? `${m}-` : "";
116
116
  return /* @__PURE__ */ p(
117
117
  "div",
118
118
  {
@@ -128,23 +128,23 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
128
128
  /* @__PURE__ */ p(
129
129
  "p",
130
130
  {
131
- className: v(
131
+ className: y(
132
132
  r ? o.groupLabel : o.rowLabel,
133
133
  !r && c ? o.abnormalValue : ""
134
134
  ),
135
135
  "data-testid": `${a}observation-label-${e.conceptNameToDisplay}-${s}`,
136
136
  children: [
137
137
  e.conceptNameToDisplay,
138
- !r && d && /* @__PURE__ */ t("span", { className: o.rangeInfo, children: d })
138
+ !r && d && /* @__PURE__ */ n("span", { className: o.rangeInfo, children: d })
139
139
  ]
140
140
  }
141
141
  ),
142
- r ? /* @__PURE__ */ t(
142
+ r ? /* @__PURE__ */ n(
143
143
  "div",
144
144
  {
145
145
  className: o.groupMembers,
146
146
  "data-testid": `${a}observation-group-members-${e.conceptNameToDisplay}-${s}`,
147
- children: e.groupMembers?.map((b, _) => /* @__PURE__ */ t(
147
+ children: e.groupMembers?.map((b, _) => /* @__PURE__ */ n(
148
148
  k,
149
149
  {
150
150
  member: b,
@@ -158,7 +158,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
158
158
  ) : /* @__PURE__ */ p(
159
159
  "p",
160
160
  {
161
- className: v(
161
+ className: y(
162
162
  o.rowValue,
163
163
  c ? o.abnormalValue : ""
164
164
  ),
@@ -172,7 +172,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
172
172
  ]
173
173
  }
174
174
  ),
175
- e.comment && /* @__PURE__ */ t(
175
+ e.comment && /* @__PURE__ */ n(
176
176
  "div",
177
177
  {
178
178
  className: o.commentSection,
@@ -187,74 +187,82 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
187
187
  },
188
188
  `${e.concept.uuid}-${s}`
189
189
  );
190
- }, Se = ({
190
+ }, xe = ({
191
191
  episodeOfCareUuids: e,
192
192
  encounterUuids: s,
193
193
  config: m
194
194
  }) => {
195
- const { t: r } = J(), u = Q(), [d, c] = x(!1), [a, b] = x(null), _ = m?.numberOfVisits, $ = X(
195
+ const { t: r } = X(), u = Z(), [d, c] = q(!1), [a, b] = q(null), _ = m?.numberOfVisits, $ = ee(
196
196
  e,
197
197
  s
198
- ), {
199
- data: g = [],
200
- isLoading: C,
201
- isError: L,
202
- error: H
203
- } = h({
198
+ ), v = re(), {
199
+ data: A = [],
200
+ isLoading: L,
201
+ isError: D,
202
+ error: j,
203
+ refetch: H
204
+ } = g({
204
205
  queryKey: ["forms", u, e],
205
- queryFn: () => se(u, void 0, _),
206
+ queryFn: () => le(u, void 0, _),
206
207
  enabled: !!u && !$
207
- }), D = N(() => !s || s.length === 0 ? g : g.filter(
208
- (n) => s.includes(n.encounterUuid)
209
- ), [g, s]), { data: O = [] } = h({
208
+ }), O = N(() => !s || s.length === 0 ? A : A.filter(
209
+ (t) => s.includes(t.encounterUuid)
210
+ ), [A, s]), { data: R = [] } = g({
210
211
  queryKey: ["observationForms"],
211
- queryFn: () => de()
212
- }), R = y(
213
- (n) => O.find((l) => l.name === n)?.uuid,
214
- [O]
215
- ), A = N(() => {
212
+ queryFn: () => ce()
213
+ }), F = h(
214
+ (t) => R.find((l) => l.name === t)?.uuid,
215
+ [R]
216
+ ), C = N(() => {
216
217
  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
218
+ return F(a.formName);
219
+ }, [a, F]), {
220
+ data: Se,
221
+ isLoading: P,
222
+ error: w
223
+ } = g({
224
+ queryKey: ["formMetadata", C],
225
+ queryFn: () => ue(C),
226
+ enabled: !!C && d
226
227
  }), {
227
228
  data: M,
228
- isLoading: j,
229
- error: w
230
- } = h({
229
+ isLoading: Q,
230
+ error: I
231
+ } = g({
231
232
  queryKey: ["formsEncounter", a?.encounterUuid],
232
- queryFn: () => ie(a.encounterUuid, !0),
233
+ queryFn: () => pe(a.encounterUuid, !0),
233
234
  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(
235
+ });
236
+ ae(
237
+ (t) => {
238
+ t.patientUUID === u && t.updatedConcepts.size > 0 && (H(), v.invalidateQueries({ queryKey: ["formsEncounter"] }));
239
+ },
240
+ [u]
241
+ );
242
+ const V = N(() => !M?.observations || !a?.formName ? [] : M.observations.filter(
243
+ (t) => "formFieldPath" in t && typeof t.formFieldPath == "string" && t.formFieldPath.includes(a.formName)
244
+ ), [M?.observations, a?.formName]), E = N(
237
245
  () => [
238
246
  { key: "recordedOn", header: r("FORM_RECORDED_ON") },
239
247
  { key: "recordedBy", header: r("FORM_RECORDED_BY") }
240
248
  ],
241
249
  [r]
242
- ), P = N(
250
+ ), Y = N(
243
251
  () => [
244
252
  { key: "recordedOn", sortable: !0 },
245
253
  { key: "recordedBy", sortable: !0 }
246
254
  ],
247
255
  []
248
- ), E = N(() => {
249
- const n = D.reduce(
256
+ ), S = N(() => {
257
+ const t = O.reduce(
250
258
  (l, i) => {
251
259
  const f = i.formName;
252
260
  l[f] ??= [];
253
- const T = i.providers.map((z) => z.providerName).filter(Boolean).join(", ");
261
+ const T = i.providers.map((W) => W.providerName).filter(Boolean).join(", ");
254
262
  return l[f].push({
255
263
  id: i.encounterUuid,
256
264
  formName: i.formName,
257
- recordedOn: Z(i.encounterDateTime, r, ne).formattedResult,
265
+ recordedOn: oe(i.encounterDateTime, r, ie).formattedResult,
258
266
  recordedBy: T ?? "--",
259
267
  encounterDateTime: i.encounterDateTime,
260
268
  encounterUuid: i.encounterUuid
@@ -262,7 +270,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
262
270
  },
263
271
  {}
264
272
  );
265
- return Object.entries(n).map(
273
+ return Object.entries(t).map(
266
274
  ([l, i]) => ({
267
275
  formName: l,
268
276
  records: i.sort(
@@ -270,57 +278,57 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
270
278
  )
271
279
  })
272
280
  ).sort((l, i) => l.formName.localeCompare(i.formName));
273
- }, [D, r]), S = y((n) => {
274
- b(n), c(!0);
275
- }, []), Y = y(() => {
281
+ }, [O, r]), B = h((t) => {
282
+ b(t), c(!0);
283
+ }, []), z = h(() => {
276
284
  c(!1), b(null);
277
- }, []), B = y(
278
- (n, l) => {
285
+ }, []), G = h(
286
+ (t, l) => {
279
287
  switch (l) {
280
288
  case "recordedOn":
281
- return /* @__PURE__ */ t(ee, { onClick: () => S(n), children: n.recordedOn });
289
+ return /* @__PURE__ */ n(te, { onClick: () => B(t), children: t.recordedOn });
282
290
  case "recordedBy":
283
- return n.recordedBy;
291
+ return t.recordedBy;
284
292
  default:
285
293
  return null;
286
294
  }
287
295
  },
288
- [S]
296
+ [B]
289
297
  );
290
- return /* @__PURE__ */ p(W, { children: [
291
- /* @__PURE__ */ t("div", { "data-testid": "forms-table", children: C || L || E.length === 0 || $ ? /* @__PURE__ */ t(
292
- G,
298
+ return /* @__PURE__ */ p(J, { children: [
299
+ /* @__PURE__ */ n("div", { "data-testid": "forms-table", children: L || D || S.length === 0 || $ ? /* @__PURE__ */ n(
300
+ U,
293
301
  {
294
- headers: V,
302
+ headers: E,
295
303
  ariaLabel: r("FORMS_HEADING"),
296
304
  rows: [],
297
- loading: C,
298
- errorStateMessage: L ? H?.message : void 0,
305
+ loading: L,
306
+ errorStateMessage: D ? j?.message : void 0,
299
307
  emptyStateMessage: r("FORMS_UNAVAILABLE"),
300
- renderCell: B,
308
+ renderCell: G,
301
309
  className: o.formsTableBody,
302
310
  dataTestId: "forms-table"
303
311
  }
304
- ) : /* @__PURE__ */ t(re, { align: "start", children: E.map((n, l) => {
305
- const { formName: i, records: f } = n;
306
- return /* @__PURE__ */ t(
307
- ae,
312
+ ) : /* @__PURE__ */ n(ne, { align: "start", children: S.map((t, l) => {
313
+ const { formName: i, records: f } = t;
314
+ return /* @__PURE__ */ n(
315
+ se,
308
316
  {
309
317
  title: i,
310
318
  className: o.customAccordianItem,
311
319
  testId: `accordian-title-${i}`,
312
320
  open: l === 0,
313
- children: /* @__PURE__ */ t(
314
- G,
321
+ children: /* @__PURE__ */ n(
322
+ U,
315
323
  {
316
- headers: V,
324
+ headers: E,
317
325
  ariaLabel: r("FORMS_HEADING"),
318
326
  rows: f,
319
327
  loading: !1,
320
328
  errorStateMessage: "",
321
- sortable: P,
329
+ sortable: Y,
322
330
  emptyStateMessage: r("FORMS_UNAVAILABLE"),
323
- renderCell: B,
331
+ renderCell: G,
324
332
  className: o.formsTableBody,
325
333
  dataTestId: `forms-table-${i}`
326
334
  }
@@ -329,30 +337,30 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
329
337
  i
330
338
  );
331
339
  }) }) }),
332
- d && a && /* @__PURE__ */ t(
333
- oe,
340
+ d && a && /* @__PURE__ */ n(
341
+ de,
334
342
  {
335
343
  id: "modalIdForActionAreaLayout",
336
344
  open: d,
337
- onRequestClose: Y,
345
+ onRequestClose: z,
338
346
  modalHeading: a.formName,
339
347
  modalLabel: `${a.recordedOn} | ${a.recordedBy}`,
340
348
  passiveModal: !0,
341
349
  size: "md",
342
350
  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,
351
+ children: /* @__PURE__ */ n("div", { className: o.formContent, children: P || Q ? /* @__PURE__ */ n(me, { width: "100%", lineCount: 3 }) : w ? /* @__PURE__ */ n("div", { children: x(w).message ?? r("ERROR_FETCHING_FORM_METADATA") }) : I ? /* @__PURE__ */ n("div", { children: x(I).message ?? r("ERROR_FETCHING_FORM_DATA") }) : V.length > 0 ? /* @__PURE__ */ n("div", { className: o.formDetailsContainer, children: V.map((t, l) => /* @__PURE__ */ n(
352
+ Ee,
345
353
  {
346
- observation: n,
354
+ observation: t,
347
355
  index: l,
348
356
  formName: a.formName
349
357
  },
350
- `${n.concept.uuid}`
351
- )) }) : /* @__PURE__ */ t("div", { children: r("NO_FORM_DATA_AVAILABLE") }) })
358
+ `${t.concept.uuid}`
359
+ )) }) : /* @__PURE__ */ n("div", { children: r("NO_FORM_DATA_AVAILABLE") }) })
352
360
  }
353
361
  )
354
362
  ] });
355
363
  };
356
364
  export {
357
- Se as default
365
+ xe as default
358
366
  };
@@ -1,9 +1,9 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-BRLiQ99R.js";
2
- import { n as p, o as d, p as e } from "./index-D9U_fT9q.js";
3
- var f = (a) => {
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-DM4vxIO7.js";
2
+ import { o as d, r as f, s as e } from "./index-BPwSmRKH.js";
3
+ var p = (a) => {
4
4
  const [r, o] = c({
5
5
  prefix: "TanstackQueryDevtools"
6
- }), n = p(), s = d(() => {
6
+ }), n = d(), s = f(() => {
7
7
  const t = r.theme_preference || l;
8
8
  return t !== "system" ? t : n();
9
9
  });
@@ -27,7 +27,7 @@ var f = (a) => {
27
27
  });
28
28
  }
29
29
  });
30
- }, C = f;
30
+ }, C = p;
31
31
  export {
32
32
  C as default
33
33
  };
@@ -1,9 +1,9 @@
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-BRLiQ99R.js";
2
- import { n as v, o as C, p as e } from "./index-D9U_fT9q.js";
1
+ import { c as l, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-DM4vxIO7.js";
2
+ import { o as v, r as C, s as e } from "./index-BPwSmRKH.js";
3
3
  var h = (t) => {
4
- const [r, o] = s({
4
+ const [r, o] = l({
5
5
  prefix: "TanstackQueryDevtools"
6
- }), a = v(), l = C(() => {
6
+ }), a = v(), s = C(() => {
7
7
  const n = r.theme_preference || c;
8
8
  return n !== "system" ? n : a();
9
9
  });
@@ -16,7 +16,7 @@ var h = (t) => {
16
16
  setLocalStore: o,
17
17
  get children() {
18
18
  return e(i.Provider, {
19
- value: l,
19
+ value: s,
20
20
  get children() {
21
21
  return e(m, {
22
22
  get children() {
@@ -36,7 +36,7 @@ var h = (t) => {
36
36
  });
37
37
  }
38
38
  });
39
- }, g = h;
39
+ }, p = h;
40
40
  export {
41
- g as default
41
+ p as default
42
42
  };
@@ -0,0 +1,170 @@
1
+ import { jsxs as I, jsx as c } from "react/jsx-runtime";
2
+ import { h as q, p as B, u as N, j as Q, k as x, b as H, e as K, l as M, Q as j, m as w, n as G, A as P, J as X, H as S, X as J, P as Y, L as z, M as W, x as Z, F as ee } from "./index-BPwSmRKH.js";
3
+ import { useRef as te, useEffect as T, useMemo as h } from "react";
4
+ const A = (t, d, i, l, s) => {
5
+ const a = J(t, d), r = a.value, o = Y(r);
6
+ let n = r;
7
+ o === "Image" && (n = /* @__PURE__ */ c(W, { imageSrc: r, alt: r, id: `${r}-img` })), o === "Video" && (n = /* @__PURE__ */ c(Z, { id: `${r}-video`, videoSrc: r }));
8
+ const b = s("OBSERVATIONS_RECORDED_BY", {
9
+ provider: a.provider
10
+ }), m = t.display, v = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", u = l ? `${l}-${v}-${m}-${i}-${d}` : `${v}-${m}-${i}-${d}`;
11
+ return /* @__PURE__ */ c(
12
+ z,
13
+ {
14
+ header: a.header,
15
+ value: n,
16
+ info: b,
17
+ id: u,
18
+ testId: u,
19
+ ariaLabel: u
20
+ },
21
+ `obs-${t.id}`
22
+ );
23
+ }, ae = (t, d, i, l, s, a) => /* @__PURE__ */ c(
24
+ S,
25
+ {
26
+ title: t.display,
27
+ id: `grouped-obs-${t.display}-${l}`,
28
+ open: i,
29
+ children: t.members?.map(
30
+ (r, o) => A(r, o, s, a, d)
31
+ )
32
+ },
33
+ `grouped-obs-${t.id}`
34
+ ), se = ({
35
+ groupedData: t,
36
+ title: d = ""
37
+ }) => {
38
+ const { t: i } = N(), l = (s, a, r) => {
39
+ const o = X(s.encounterDetails, i);
40
+ return /* @__PURE__ */ I(
41
+ S,
42
+ {
43
+ title: o,
44
+ id: `encounter-${s.encounterId}`,
45
+ open: a,
46
+ children: [
47
+ s.observations.map(
48
+ (n, b) => A(n, b, r, d, i)
49
+ ),
50
+ s.groupedObservations.map(
51
+ (n, b) => ae(
52
+ n,
53
+ i,
54
+ a,
55
+ b,
56
+ r,
57
+ d
58
+ )
59
+ )
60
+ ]
61
+ },
62
+ `encounter-${s.encounterId}`
63
+ );
64
+ };
65
+ return /* @__PURE__ */ c(
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: t.map(
72
+ (s, a) => l(s, a === 0, a)
73
+ )
74
+ }
75
+ );
76
+ }, re = "_observations_kfbhq_1", oe = "_title_kfbhq_12", $ = {
77
+ observations: re,
78
+ title: oe
79
+ }, ie = (t) => ["conceptUuid", t], ne = (t, d) => ["observations", t, ...d], ce = ({ config: t }) => {
80
+ const d = t, { conceptNames: i = [], conceptUuid: l = [] } = d, s = te(/* @__PURE__ */ new Set()), a = q(), { addNotification: r } = B(), { t: o } = N(), n = Q({
81
+ queries: i.map((e) => ({
82
+ queryKey: ie(e),
83
+ queryFn: () => x(e),
84
+ enabled: !!e
85
+ }))
86
+ });
87
+ T(() => {
88
+ n.forEach((e, p) => {
89
+ if (e.isError && !s.current.has(p)) {
90
+ const V = i[p];
91
+ r({
92
+ title: o("ERROR_DEFAULT_TITLE"),
93
+ message: o("ERROR_FETCHING_CONCEPT", { conceptName: V }),
94
+ type: "error"
95
+ }), s.current.add(p);
96
+ } else e.isError || s.current.delete(p);
97
+ });
98
+ }, [n, i]);
99
+ const b = h(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), m = h(() => [.../* @__PURE__ */ new Set([...b, ...l])], [b, l]), v = h(() => i.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, i.length]), {
100
+ data: u,
101
+ isLoading: F,
102
+ isError: R,
103
+ refetch: g
104
+ } = H({
105
+ queryKey: ne(a, m),
106
+ queryFn: () => ee(a, m),
107
+ enabled: !!a && m.length > 0 && v
108
+ });
109
+ K(
110
+ (e) => {
111
+ e.patientUUID === a && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
112
+ (p) => m.includes(p)
113
+ ) && g();
114
+ },
115
+ [a, g]
116
+ ), T(() => {
117
+ R && r({
118
+ title: o("ERROR_DEFAULT_TITLE"),
119
+ message: o("ERROR_FETCHING_OBSERVATIONS"),
120
+ type: "error"
121
+ });
122
+ }, [R]);
123
+ const f = h(() => {
124
+ if (!u) return [];
125
+ const e = M(u), p = j(e);
126
+ return w(p);
127
+ }, [u]), L = [
128
+ { key: "name", header: "name" },
129
+ { key: "value", header: "value" },
130
+ { key: "form", header: "form" }
131
+ ], O = F || !v, _ = R && v, D = (!u || u.entry?.length === 0 || m.length === 0) && v, U = _ ? o("ERROR_FETCHING_OBSERVATIONS") : null, k = D ? o("NO_OBSERVATIONS_FOUND") : void 0, C = f.length > 0 && !O && !_, E = d.titleTranslationKey, y = E ? o(E) : "";
132
+ return /* @__PURE__ */ I(
133
+ "div",
134
+ {
135
+ id: "observations",
136
+ "data-testid": E ? `observations-${y}` : "observations",
137
+ "aria-label": "observations-aria-label",
138
+ className: $.observations,
139
+ children: [
140
+ /* @__PURE__ */ c(
141
+ G,
142
+ {
143
+ id: "observations-title",
144
+ testId: E ? `observations-title-${y}` : "observations-title",
145
+ title: y,
146
+ className: $.title,
147
+ children: /* @__PURE__ */ c("p", { children: y })
148
+ }
149
+ ),
150
+ C ? /* @__PURE__ */ c(se, { groupedData: f, title: y }) : /* @__PURE__ */ c(
151
+ P,
152
+ {
153
+ headers: L,
154
+ rows: [],
155
+ ariaLabel: o("OBSERVATIONS"),
156
+ loading: O,
157
+ errorStateMessage: U,
158
+ emptyStateMessage: k,
159
+ dataTestId: "observations-table"
160
+ }
161
+ )
162
+ ]
163
+ }
164
+ );
165
+ };
166
+ export {
167
+ ie as conceptUuidQueryKeys,
168
+ ce as default,
169
+ ne as observationsQueryKeys
170
+ };
@@ -1,4 +1,4 @@
1
- import { r as we, s as z, t as xt, v as B, o as q, p as y, y as Ro, z as ye, S as R, B as _, D as k, E as N, I as A, N as bs, O as ir, R as $e, T as U, Z as Hn, _ as Vn, $ as dt, a0 as D, a1 as xs, a2 as cn, a3 as Be, a4 as ws, a5 as qt, a6 as zt, a7 as $s, a8 as Cs, a9 as $n, aa as Ss, ab as Nr, ac as Bt, ad as zo, ae as ks, af as Es, ag as j, ah as Ur, ai as Ms, aj as Ds, ak as sr, al as As, am as Ts, an as zn, ao as Fs, ap as Is, aq as Z, ar as Ps, as as Os } from "./index-D9U_fT9q.js";
1
+ import { t as we, v as z, y as xt, z as B, r as q, s as y, B as Ro, D as ye, S as R, E as _, I as k, N, O as A, R as bs, T as ir, Z as $e, _ as U, $ as Hn, a0 as Vn, a1 as dt, a2 as D, a3 as xs, a4 as cn, a5 as Be, a6 as ws, a7 as qt, a8 as zt, a9 as $s, aa as Cs, ab as $n, ac as Ss, ad as Nr, ae as Bt, af as zo, ag as ks, ah as Es, ai as j, aj as Ur, ak as Ms, al as Ds, am as sr, an as As, ao as Ts, ap as zn, aq as Fs, ar as Is, as as Z, at as Ps, au as Os } from "./index-BPwSmRKH.js";
2
2
  var Ls = (e) => e != null, qs = (e) => e.filter(Ls);
3
3
  function _s(e) {
4
4
  return (...t) => {
@@ -1 +1 @@
1
- {"version":3,"file":"ConsultationPad.d.ts","sourceRoot":"","sources":["../../../src/components/consultationPad/ConsultationPad.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAoB,MAAM,OAAO,CAAC;AA2CzC,UAAU,oBAAoB;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA+anD,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"ConsultationPad.d.ts","sourceRoot":"","sources":["../../../src/components/consultationPad/ConsultationPad.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAoB,MAAM,OAAO,CAAC;AA2CzC,UAAU,oBAAoB;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAobnD,CAAC;AAEF,eAAe,eAAe,CAAC"}