@bahmni/widgets 0.0.1-dev.152 → 0.0.1-dev.155

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.
@@ -0,0 +1,425 @@
1
+ import { jsxs as b, jsx as d, Fragment as k } from "react/jsx-runtime";
2
+ import { c as C, D as te, N as re, $ as ae, e as oe, R as se, u as ne, o as de, h as ie, f as le, p as ce, a as me, A as ue, g as pe, m as be, t as x, H as fe, C as _e, b as $e, d as ge, i as H, l as he } from "./index-veQFQARd.js";
3
+ import { useQueryClient as ye, useQuery as L } from "@tanstack/react-query";
4
+ import { useState as P, useMemo as y, useCallback as F } from "react";
5
+ import { useTranslation as ve } from "react-i18next";
6
+ const Ne = "_formsTableBody_1pd36_1", Oe = "_customAccordianItem_1pd36_6", Le = "_formContent_1pd36_18", Fe = "_formDetailsContainer_1pd36_25", Ce = "_observation_1pd36_30", Re = "_groupContainer_1pd36_39", Me = "_rowContainer_1pd36_43", De = "_groupLabel_1pd36_48", we = "_rowLabel_1pd36_58", Te = "_rowValue_1pd36_67", Ve = "_groupMembers_1pd36_75", Ae = "_memberRow_1pd36_81", Ee = "_memberLabel_1pd36_86", Be = "_memberValue_1pd36_94", Ie = "_abnormalValue_1pd36_102", Se = "_commentSection_1pd36_110", Ge = "_commentText_1pd36_116", qe = "_nestedGroup_1pd36_125", Ue = "_nestedGroupLabel_1pd36_132", xe = "_nestedGroupMembers_1pd36_141", o = {
7
+ formsTableBody: Ne,
8
+ customAccordianItem: Oe,
9
+ formContent: Le,
10
+ formDetailsContainer: Fe,
11
+ observation: Ce,
12
+ groupContainer: Re,
13
+ rowContainer: Me,
14
+ groupLabel: De,
15
+ rowLabel: we,
16
+ rowValue: Te,
17
+ groupMembers: Ve,
18
+ memberRow: Ae,
19
+ memberLabel: Ee,
20
+ memberValue: Be,
21
+ abnormalValue: Ie,
22
+ commentSection: Se,
23
+ commentText: Ge,
24
+ nestedGroup: qe,
25
+ nestedGroupLabel: Ue,
26
+ nestedGroupMembers: xe
27
+ }, K = (e) => {
28
+ const t = te(e);
29
+ return t === "Image" ? /* @__PURE__ */ d(
30
+ re,
31
+ {
32
+ imageSrc: e,
33
+ alt: e,
34
+ id: `${e}-img`
35
+ }
36
+ ) : t === "Video" ? /* @__PURE__ */ d(ae, { id: `${e}-video`, videoSrc: e }) : e;
37
+ }, j = (e) => {
38
+ const t = e.observationValue?.unit, a = e.observationValue?.referenceRange?.low?.value, n = e.observationValue?.referenceRange?.high?.value, s = a != null, c = n != null, i = s && c ? ` (${a} - ${n})` : s ? ` (>${a})` : c ? ` (<${n})` : "", r = e.observationValue?.isAbnormal === !0;
39
+ return { units: t, rangeString: i, isAbnormal: r };
40
+ }, Q = ({
41
+ member: e,
42
+ depth: t = 0,
43
+ memberIndex: a = 0,
44
+ formName: n = "",
45
+ comment: s
46
+ }) => {
47
+ const c = e.members && e.members.length > 0, i = e.display, r = n ? `${n}-` : "";
48
+ if (c)
49
+ return /* @__PURE__ */ b(
50
+ "div",
51
+ {
52
+ className: o.nestedGroup,
53
+ "data-testid": `${r}obs-nested-group-${i}-${a}`,
54
+ children: [
55
+ /* @__PURE__ */ d(
56
+ "div",
57
+ {
58
+ className: o.nestedGroupLabel,
59
+ "data-testid": `${r}obs-nested-group-label-${i}-${a}`,
60
+ style: { paddingLeft: `${t * 16}px` },
61
+ children: i
62
+ }
63
+ ),
64
+ /* @__PURE__ */ d(
65
+ "div",
66
+ {
67
+ className: o.nestedGroupMembers,
68
+ "data-testid": `${r}obs-nested-group-members-${i}-${a}`,
69
+ children: e.members?.map((v, N) => /* @__PURE__ */ d(
70
+ Q,
71
+ {
72
+ member: v,
73
+ depth: t + 1,
74
+ memberIndex: N,
75
+ formName: n
76
+ },
77
+ `${v.id}`
78
+ ))
79
+ }
80
+ )
81
+ ]
82
+ }
83
+ );
84
+ const { units: p, rangeString: h, isAbnormal: f } = j(e), _ = e.observationValue?.value?.toString(), $ = _ ? K(_) : null;
85
+ return /* @__PURE__ */ b(k, { children: [
86
+ /* @__PURE__ */ b(
87
+ "div",
88
+ {
89
+ className: o.memberRow,
90
+ "data-testid": `${r}obs-member-row-${i}-${a}`,
91
+ style: { paddingLeft: `${t * 16}px` },
92
+ children: [
93
+ /* @__PURE__ */ b(
94
+ "p",
95
+ {
96
+ className: C(
97
+ o.memberLabel,
98
+ f ? o.abnormalValue : ""
99
+ ),
100
+ "data-testid": `${r}obs-member-label-${i}-${a}`,
101
+ children: [
102
+ i,
103
+ h
104
+ ]
105
+ }
106
+ ),
107
+ /* @__PURE__ */ b(
108
+ "div",
109
+ {
110
+ className: C(
111
+ o.memberValue,
112
+ f ? o.abnormalValue : ""
113
+ ),
114
+ "data-testid": `${r}obs-member-value-${i}-${a}`,
115
+ children: [
116
+ $,
117
+ p && ` ${p}`
118
+ ]
119
+ }
120
+ )
121
+ ]
122
+ }
123
+ ),
124
+ s && /* @__PURE__ */ d(
125
+ "div",
126
+ {
127
+ className: o.commentSection,
128
+ "data-testid": `${r}obs-member-comment-${i}-${a}`,
129
+ style: { paddingLeft: `${t * 16}px` },
130
+ children: /* @__PURE__ */ b("span", { className: o.commentText, children: [
131
+ s,
132
+ e.encounter?.provider && ` - by ${e.encounter.provider}`
133
+ ] })
134
+ }
135
+ )
136
+ ] });
137
+ }, He = ({
138
+ observation: e,
139
+ index: t,
140
+ formName: a = "",
141
+ comment: n
142
+ }) => {
143
+ const s = e.members && e.members.length > 0, { units: c, rangeString: i, isAbnormal: r } = j(e), p = a ? `${a}-` : "", h = e.observationValue?.value?.toString(), f = h ? K(h) : null;
144
+ return /* @__PURE__ */ b(
145
+ "div",
146
+ {
147
+ className: o.observation,
148
+ "data-testid": `${p}observation-item-${e.display}-${t}`,
149
+ children: [
150
+ /* @__PURE__ */ b(
151
+ "div",
152
+ {
153
+ className: s ? o.groupContainer : o.rowContainer,
154
+ "data-testid": `${p}observation-container-${e.display}-${t}`,
155
+ children: [
156
+ /* @__PURE__ */ b(
157
+ "p",
158
+ {
159
+ className: C(
160
+ s ? o.groupLabel : o.rowLabel,
161
+ !s && r ? o.abnormalValue : ""
162
+ ),
163
+ "data-testid": `${p}observation-label-${e.display}-${t}`,
164
+ children: [
165
+ e.display,
166
+ !s && i && /* @__PURE__ */ d("span", { className: o.rangeInfo, children: i })
167
+ ]
168
+ }
169
+ ),
170
+ s ? /* @__PURE__ */ d(
171
+ "div",
172
+ {
173
+ className: o.groupMembers,
174
+ "data-testid": `${p}observation-group-members-${e.display}-${t}`,
175
+ children: e.members?.map((_, $) => /* @__PURE__ */ d(
176
+ Q,
177
+ {
178
+ member: _,
179
+ depth: 0,
180
+ memberIndex: $,
181
+ formName: a
182
+ },
183
+ `${_.id}`
184
+ ))
185
+ }
186
+ ) : /* @__PURE__ */ b(
187
+ "div",
188
+ {
189
+ className: C(
190
+ o.rowValue,
191
+ r ? o.abnormalValue : ""
192
+ ),
193
+ "data-testid": `${p}observation-value-${e.display}-${t}`,
194
+ children: [
195
+ f,
196
+ c && ` ${c}`
197
+ ]
198
+ }
199
+ )
200
+ ]
201
+ }
202
+ ),
203
+ n && /* @__PURE__ */ d(
204
+ "div",
205
+ {
206
+ className: o.commentSection,
207
+ "data-testid": `${p}observation-comment-${e.display}-${t}`,
208
+ children: /* @__PURE__ */ b("span", { className: o.commentText, children: [
209
+ n,
210
+ e.encounter?.provider && ` - by ${e.encounter.provider}`
211
+ ] })
212
+ }
213
+ )
214
+ ]
215
+ },
216
+ `${e.id}-${t}`
217
+ );
218
+ }, Pe = (e) => e ? e.extension?.find(
219
+ (a) => a.url === se
220
+ )?.valueString : void 0, ke = (e) => {
221
+ if (e)
222
+ return e.note?.[0]?.text;
223
+ }, Ke = (e, t) => e.entry?.find((a) => a.resource?.id === t)?.resource, w = (e, t) => {
224
+ const a = Ke(e, t);
225
+ return a ? {
226
+ formFieldPath: Pe(a),
227
+ comment: ke(a)
228
+ } : {};
229
+ }, je = (e, t) => {
230
+ if (!e?.entry || !t)
231
+ return [];
232
+ const a = oe(e);
233
+ return [
234
+ ...a.observations.map((s) => {
235
+ const { formFieldPath: c, comment: i } = w(
236
+ e,
237
+ s.id
238
+ );
239
+ return { obs: s, formFieldPath: c, comment: i };
240
+ }),
241
+ ...a.groupedObservations.flatMap((s) => {
242
+ const { formFieldPath: c } = w(e, s.id);
243
+ return (s.members ?? []).map((i) => {
244
+ const { comment: r } = w(e, i.id);
245
+ return { obs: i, formFieldPath: c, comment: r };
246
+ });
247
+ })
248
+ ].filter(
249
+ ({ formFieldPath: s }) => !s || s.includes(t)
250
+ );
251
+ }, Xe = ({
252
+ episodeOfCareUuids: e,
253
+ encounterUuids: t,
254
+ config: a
255
+ }) => {
256
+ const { t: n } = ve(), s = ne(), [c, i] = P(!1), [r, p] = P(null), h = a?.numberOfVisits, f = de(
257
+ e,
258
+ t
259
+ ), _ = ye(), {
260
+ data: $ = [],
261
+ isLoading: v,
262
+ isError: N,
263
+ error: z,
264
+ refetch: W
265
+ } = L({
266
+ queryKey: ["forms", s, e],
267
+ queryFn: () => ie(s, void 0, h),
268
+ enabled: !!s && !f
269
+ }), T = y(() => !t || t.length === 0 ? $ : $.filter(
270
+ (l) => t.includes(l.encounterUuid)
271
+ ), [$, t]), { data: V = [] } = L({
272
+ queryKey: ["observationForms"],
273
+ queryFn: () => le()
274
+ }), A = F(
275
+ (l) => V.find((m) => m.name === l)?.uuid,
276
+ [V]
277
+ ), R = y(() => {
278
+ if (r)
279
+ return A(r.formName);
280
+ }, [r, A]), { isLoading: Y, error: E } = L({
281
+ queryKey: ["formMetadata", R],
282
+ queryFn: () => ce(R),
283
+ enabled: !!R && c
284
+ }), {
285
+ data: M,
286
+ isLoading: J,
287
+ error: B
288
+ } = L({
289
+ queryKey: ["formsEncounterFHIR", r?.encounterUuid],
290
+ queryFn: () => me(r.encounterUuid),
291
+ enabled: !!r?.encounterUuid && c
292
+ });
293
+ ue(
294
+ (l) => {
295
+ l.patientUUID === s && l.updatedConcepts.size > 0 && (W(), _.invalidateQueries({ queryKey: ["formsEncounter"] }));
296
+ },
297
+ [s]
298
+ );
299
+ const I = y(() => !M || !r?.formName ? [] : je(
300
+ M,
301
+ r.formName
302
+ ), [M, r?.formName]), S = y(
303
+ () => [
304
+ { key: "recordedOn", header: n("FORM_RECORDED_ON") },
305
+ { key: "recordedBy", header: n("FORM_RECORDED_BY") }
306
+ ],
307
+ [n]
308
+ ), X = y(
309
+ () => [
310
+ { key: "recordedOn", sortable: !0 },
311
+ { key: "recordedBy", sortable: !0 }
312
+ ],
313
+ []
314
+ ), G = y(() => {
315
+ const l = T.reduce(
316
+ (m, u) => {
317
+ const O = u.formName;
318
+ m[O] ??= [];
319
+ const D = u.providers.map((ee) => ee.providerName).filter(Boolean).join(", ");
320
+ return m[O].push({
321
+ id: u.encounterUuid,
322
+ formName: u.formName,
323
+ recordedOn: pe(u.encounterDateTime, n, he).formattedResult,
324
+ recordedBy: D ?? "--",
325
+ encounterDateTime: u.encounterDateTime,
326
+ encounterUuid: u.encounterUuid
327
+ }), m;
328
+ },
329
+ {}
330
+ );
331
+ return Object.entries(l).map(
332
+ ([m, u]) => ({
333
+ formName: m,
334
+ records: u.sort(
335
+ (O, D) => D.encounterDateTime - O.encounterDateTime
336
+ )
337
+ })
338
+ ).sort((m, u) => m.formName.localeCompare(u.formName));
339
+ }, [T, n]), q = F((l) => {
340
+ p(l), i(!0);
341
+ }, []), Z = F(() => {
342
+ i(!1), p(null);
343
+ }, []), U = F(
344
+ (l, g) => {
345
+ switch (g) {
346
+ case "recordedOn":
347
+ return /* @__PURE__ */ d(be, { onClick: () => q(l), children: l.recordedOn });
348
+ case "recordedBy":
349
+ return l.recordedBy;
350
+ default:
351
+ return null;
352
+ }
353
+ },
354
+ [q]
355
+ );
356
+ return /* @__PURE__ */ b(k, { children: [
357
+ /* @__PURE__ */ d("div", { "data-testid": "forms-table", children: v || N || G.length === 0 || f ? /* @__PURE__ */ d(
358
+ x,
359
+ {
360
+ headers: S,
361
+ ariaLabel: n("FORMS_HEADING"),
362
+ rows: [],
363
+ loading: v,
364
+ errorStateMessage: N ? z?.message : void 0,
365
+ emptyStateMessage: n("FORMS_UNAVAILABLE"),
366
+ renderCell: U,
367
+ className: o.formsTableBody,
368
+ dataTestId: "forms-table"
369
+ }
370
+ ) : /* @__PURE__ */ d(fe, { align: "start", children: G.map((l, g) => {
371
+ const { formName: m, records: u } = l;
372
+ return /* @__PURE__ */ d(
373
+ _e,
374
+ {
375
+ title: m,
376
+ className: o.customAccordianItem,
377
+ testId: `accordian-title-${m}`,
378
+ open: g === 0,
379
+ children: /* @__PURE__ */ d(
380
+ x,
381
+ {
382
+ headers: S,
383
+ ariaLabel: n("FORMS_HEADING"),
384
+ rows: u,
385
+ loading: !1,
386
+ errorStateMessage: "",
387
+ sortable: X,
388
+ emptyStateMessage: n("FORMS_UNAVAILABLE"),
389
+ renderCell: U,
390
+ className: o.formsTableBody,
391
+ dataTestId: `forms-table-${m}`
392
+ }
393
+ )
394
+ },
395
+ m
396
+ );
397
+ }) }) }),
398
+ c && r && /* @__PURE__ */ d(
399
+ $e,
400
+ {
401
+ id: "modalIdForActionAreaLayout",
402
+ open: c,
403
+ onRequestClose: Z,
404
+ modalHeading: r.formName,
405
+ modalLabel: `${r.recordedOn} | ${r.recordedBy}`,
406
+ passiveModal: !0,
407
+ size: "md",
408
+ testId: "form-details-modal",
409
+ children: /* @__PURE__ */ d("div", { className: o.formContent, children: Y || J ? /* @__PURE__ */ d(ge, { width: "100%", lineCount: 3 }) : E ? /* @__PURE__ */ d("div", { children: H(E).message ?? n("ERROR_FETCHING_FORM_METADATA") }) : B ? /* @__PURE__ */ d("div", { children: H(B).message ?? n("ERROR_FETCHING_FORM_DATA") }) : I.length > 0 ? /* @__PURE__ */ d("div", { className: o.formDetailsContainer, children: I.map(({ obs: l, comment: g }, m) => /* @__PURE__ */ d(
410
+ He,
411
+ {
412
+ observation: l,
413
+ index: m,
414
+ formName: r.formName,
415
+ comment: g
416
+ },
417
+ `${l.id}`
418
+ )) }) : /* @__PURE__ */ d("div", { children: n("NO_FORM_DATA_AVAILABLE") }) })
419
+ }
420
+ )
421
+ ] });
422
+ };
423
+ export {
424
+ Xe as default
425
+ };
@@ -1,17 +1,17 @@
1
- import { jsx as d, jsxs as N } from "react/jsx-runtime";
2
- import { i as k, V as S, j as q, D as w, _ as M, x as K, k as Q, u as G, m as j, n as H, r as P, A as J, q as z, s as Y, v as x, O as W, J as X } from "./index-CImzN7Zl.js";
3
- import { useQueries as Z, useQuery as ee } from "@tanstack/react-query";
4
- import { useRef as te, useEffect as $, useMemo as h } from "react";
1
+ import { jsx as d, jsxs as D } from "react/jsx-runtime";
2
+ import { j as k, _ as S, k as q, D as M, n as V, N as K, $ as Q, u as G, q as j, r as H, s as P, A as z, e as Y, v as J, w as W, B as X, t as Z } from "./index-veQFQARd.js";
3
+ import { useQueries as x, useQuery as ee } from "@tanstack/react-query";
4
+ import { useRef as te, useEffect as I, useMemo as h } from "react";
5
5
  import { useTranslation as C } from "react-i18next";
6
6
  const U = (t, c, n, l, o) => {
7
- const s = q(t, c), r = s.value, a = w(r);
7
+ const s = q(t, c), r = s.value, a = M(r);
8
8
  let i = r;
9
9
  a === "Image" && (i = /* @__PURE__ */ d(K, { imageSrc: r, alt: r, id: `${r}-img` })), a === "Video" && (i = /* @__PURE__ */ d(Q, { id: `${r}-video`, videoSrc: r }));
10
10
  const u = o("OBSERVATIONS_RECORDED_BY", {
11
11
  provider: s.provider
12
- }), b = t.display, m = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", f = l ? `${l}-${m}-${b}-${n}-${c}` : `${m}-${b}-${n}-${c}`;
12
+ }), b = t.display, p = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", f = l ? `${l}-${p}-${b}-${n}-${c}` : `${p}-${b}-${n}-${c}`;
13
13
  return /* @__PURE__ */ d(
14
- M,
14
+ V,
15
15
  {
16
16
  header: s.header,
17
17
  value: i,
@@ -39,7 +39,7 @@ const U = (t, c, n, l, o) => {
39
39
  }) => {
40
40
  const { t: n } = C(), l = (o, s, r) => {
41
41
  const a = k(o.encounterDetails, n);
42
- return /* @__PURE__ */ N(
42
+ return /* @__PURE__ */ D(
43
43
  S,
44
44
  {
45
45
  title: a,
@@ -75,31 +75,31 @@ const U = (t, c, n, l, o) => {
75
75
  )
76
76
  }
77
77
  );
78
- }, re = "_observations_kfbhq_1", ae = "_title_kfbhq_12", D = {
78
+ }, re = "_observations_kfbhq_1", ae = "_title_kfbhq_12", N = {
79
79
  observations: re,
80
80
  title: ae
81
- }, ne = (t) => ["conceptUuid", t], ie = (t, c) => ["observations", t, ...c], me = ({ config: t }) => {
82
- const c = t, { conceptNames: n = [], conceptUuid: l = [] } = c, o = te(/* @__PURE__ */ new Set()), s = G(), { addNotification: r } = j(), { t: a } = C(), i = Z({
81
+ }, ne = (t) => ["conceptUuid", t], ie = (t, c) => ["observations", t, ...c], pe = ({ config: t }) => {
82
+ const c = t, { conceptNames: n = [], conceptUuid: l = [] } = c, o = te(/* @__PURE__ */ new Set()), s = G(), { addNotification: r } = j(), { t: a } = C(), i = x({
83
83
  queries: n.map((e) => ({
84
84
  queryKey: ne(e),
85
85
  queryFn: () => H(e),
86
86
  enabled: !!e
87
87
  }))
88
88
  });
89
- $(() => {
90
- i.forEach((e, p) => {
91
- if (e.isError && !o.current.has(p)) {
92
- const g = n[p];
89
+ I(() => {
90
+ i.forEach((e, m) => {
91
+ if (e.isError && !o.current.has(m)) {
92
+ const g = n[m];
93
93
  r({
94
94
  title: a("ERROR_DEFAULT_TITLE"),
95
95
  message: a("ERROR_FETCHING_CONCEPT", { conceptName: g }),
96
96
  type: "error"
97
- }), o.current.add(p);
98
- } else e.isError || o.current.delete(p);
97
+ }), o.current.add(m);
98
+ } else e.isError || o.current.delete(m);
99
99
  });
100
100
  }, [i, n]);
101
101
  const u = h(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), b = h(() => [.../* @__PURE__ */ new Set([...u, ...l])], [u, l]), v = h(() => n.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, n.length]), {
102
- data: m,
102
+ data: p,
103
103
  isLoading: f,
104
104
  isError: O,
105
105
  refetch: R
@@ -108,14 +108,14 @@ const U = (t, c, n, l, o) => {
108
108
  queryFn: () => P(s, b),
109
109
  enabled: !!s && b.length > 0 && v
110
110
  });
111
- J(
111
+ z(
112
112
  (e) => {
113
113
  e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
114
114
  (g) => b.includes(g)
115
115
  ) && R();
116
116
  },
117
117
  [s, R]
118
- ), $(() => {
118
+ ), I(() => {
119
119
  O && r({
120
120
  title: a("ERROR_DEFAULT_TITLE"),
121
121
  message: a("ERROR_FETCHING_OBSERVATIONS"),
@@ -123,36 +123,36 @@ const U = (t, c, n, l, o) => {
123
123
  });
124
124
  }, [O]);
125
125
  const T = h(() => {
126
- if (!m) return [];
127
- const e = z(m), p = Y(e);
128
- return x(p);
129
- }, [m]), A = [
126
+ if (!p) return [];
127
+ const e = Y(p), m = J(e);
128
+ return W(m);
129
+ }, [p]), B = [
130
130
  { key: "name", header: "name" },
131
131
  { key: "value", header: "value" },
132
132
  { key: "form", header: "form" }
133
- ], _ = f || !v, I = O && v, B = (!m || m.entry?.length === 0 || b.length === 0) && v, F = I ? a("ERROR_FETCHING_OBSERVATIONS") : null, L = B ? a("NO_OBSERVATIONS_FOUND") : void 0, V = T.length > 0 && !_ && !I, E = c.titleTranslationKey, y = E ? a(E) : "";
134
- return /* @__PURE__ */ N(
133
+ ], _ = f || !v, $ = O && v, A = (!p || p.entry?.length === 0 || b.length === 0) && v, F = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, L = A ? a("NO_OBSERVATIONS_FOUND") : void 0, w = T.length > 0 && !_ && !$, E = c.titleTranslationKey, y = E ? a(E) : "";
134
+ return /* @__PURE__ */ D(
135
135
  "div",
136
136
  {
137
137
  id: "observations",
138
138
  "data-testid": E ? `observations-${y}` : "observations",
139
139
  "aria-label": "observations-aria-label",
140
- className: D.observations,
140
+ className: N.observations,
141
141
  children: [
142
142
  /* @__PURE__ */ d(
143
- W,
143
+ X,
144
144
  {
145
145
  id: "observations-title",
146
146
  testId: E ? `observations-title-${y}` : "observations-title",
147
147
  title: y,
148
- className: D.title,
148
+ className: N.title,
149
149
  children: /* @__PURE__ */ d("p", { children: y })
150
150
  }
151
151
  ),
152
- V ? /* @__PURE__ */ d(oe, { groupedData: T, title: y }) : /* @__PURE__ */ d(
153
- X,
152
+ w ? /* @__PURE__ */ d(oe, { groupedData: T, title: y }) : /* @__PURE__ */ d(
153
+ Z,
154
154
  {
155
- headers: A,
155
+ headers: B,
156
156
  rows: [],
157
157
  ariaLabel: a("OBSERVATIONS"),
158
158
  loading: _,
@@ -167,6 +167,6 @@ const U = (t, c, n, l, o) => {
167
167
  };
168
168
  export {
169
169
  ne as conceptUuidQueryKeys,
170
- me as default,
170
+ pe as default,
171
171
  ie as observationsQueryKeys
172
172
  };
@@ -1 +1 @@
1
- {"version":3,"file":"FormsTable.d.ts","sourceRoot":"","sources":["../../src/forms/FormsTable.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAShD;;;GAGG;AACH,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAqSrC,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"FormsTable.d.ts","sourceRoot":"","sources":["../../src/forms/FormsTable.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMhD;;;GAGG;AACH,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA8RrC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import { default as React } from 'react';
2
- import { ObservationData } from './models';
2
+ import { ExtractedObservation } from '../observations/models';
3
3
  interface ObservationItemProps {
4
- observation: ObservationData;
4
+ observation: ExtractedObservation;
5
5
  index: number;
6
6
  formName?: string;
7
+ comment?: string;
7
8
  }
8
9
  export declare const ObservationItem: React.FC<ObservationItemProps>;
9
10
  export default ObservationItem;
@@ -1 +1 @@
1
- {"version":3,"file":"ObservationItem.d.ts","sourceRoot":"","sources":["../../src/forms/ObservationItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,UAAU,oBAAoB;IAC5B,WAAW,EAAE,eAAe,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAwHD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA+E1D,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"ObservationItem.d.ts","sourceRoot":"","sources":["../../src/forms/ObservationItem.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,UAAU,oBAAoB;IAC5B,WAAW,EAAE,oBAAoB,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAgKD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAmF1D,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,24 +1,3 @@
1
- export interface ObservationData {
2
- concept: {
3
- name: string;
4
- uuid: string;
5
- shortName?: string;
6
- units?: string;
7
- hiNormal?: number;
8
- lowNormal?: number;
9
- };
10
- value?: unknown;
11
- valueAsString?: string;
12
- conceptNameToDisplay?: string;
13
- groupMembers?: ObservationData[];
14
- formFieldPath?: string;
15
- comment?: string;
16
- providers?: Array<{
17
- uuid: string;
18
- name: string;
19
- }>;
20
- interpretation?: string;
21
- }
22
1
  export interface FormRecordViewModel {
23
2
  id: string;
24
3
  formName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/forms/models.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,KAAK,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,mBAAmB,EAAE,CAAC;CAChC"}
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/forms/models.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,mBAAmB,EAAE,CAAC;CAChC"}
@@ -0,0 +1,38 @@
1
+ import { Bundle, Observation } from 'fhir/r4';
2
+ import { ExtractedObservation } from '../observations/models';
3
+ export interface FormFieldData {
4
+ obs: ExtractedObservation;
5
+ comment?: string;
6
+ formFieldPath?: string;
7
+ }
8
+ /**
9
+ * Extract formFieldPath from FHIR Observation extension
10
+ * @param observation - FHIR Observation resource
11
+ * @returns formFieldPath string or undefined
12
+ */
13
+ export declare const extractFormFieldPath: (observation: Observation | undefined) => string | undefined;
14
+ /**
15
+ * Extract comment from FHIR Observation note field
16
+ * @param observation - FHIR Observation resource
17
+ * @returns comment string or undefined
18
+ */
19
+ export declare const extractComment: (observation: Observation | undefined) => string | undefined;
20
+ /**
21
+ * Extract form field data (formFieldPath and comment) from a FHIR Observation
22
+ * @param bundle - FHIR Bundle containing Observations
23
+ * @param obsId - Observation ID to extract data for
24
+ * @returns Object with formFieldPath and comment
25
+ */
26
+ export declare const getFormFieldPathAndComment: (bundle: Bundle<Observation>, obsId: string) => {
27
+ formFieldPath?: string;
28
+ comment?: string;
29
+ };
30
+ /**
31
+ * Filter observations by form name using formFieldPath
32
+ * Observations without formFieldPath are included (assumed to belong to the form)
33
+ * @param bundle - FHIR Bundle containing Observations
34
+ * @param formName - Name of the form to filter by
35
+ * @returns Array of FormFieldData with observations filtered by form name
36
+ */
37
+ export declare const filterObservationsByFormName: (bundle: Bundle<Observation>, formName: string) => FormFieldData[];
38
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/forms/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,oBAAoB,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,aAAa,WAAW,GAAG,SAAS,KACnC,MAAM,GAAG,SAQX,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,aAAa,WAAW,GAAG,SAAS,KACnC,MAAM,GAAG,SAGX,CAAC;AAgBF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GACrC,QAAQ,MAAM,CAAC,WAAW,CAAC,EAC3B,OAAO,MAAM,KACZ;IAAE,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAS5C,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GACvC,QAAQ,MAAM,CAAC,WAAW,CAAC,EAC3B,UAAU,MAAM,KACf,aAAa,EA6Bf,CAAC"}