@bahmni/widgets 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.
@@ -0,0 +1,425 @@
1
+ import { jsxs as b, jsx as d, Fragment as k } from "react/jsx-runtime";
2
+ import { c as R, D as te, x as re, b 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, d as be, J as U, L as fe, H as _e, i as $e, t as ge, j as H, l as he } from "./index-D3Mgdxfk.js";
3
+ import { useQueryClient as ye, useQuery as O } 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", Le = "_customAccordianItem_1pd36_6", Oe = "_formContent_1pd36_18", Fe = "_formDetailsContainer_1pd36_25", Re = "_observation_1pd36_30", Me = "_groupContainer_1pd36_39", Ce = "_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", xe = "_nestedGroup_1pd36_125", qe = "_nestedGroupLabel_1pd36_132", Ue = "_nestedGroupMembers_1pd36_141", o = {
7
+ formsTableBody: Ne,
8
+ customAccordianItem: Le,
9
+ formContent: Oe,
10
+ formDetailsContainer: Fe,
11
+ observation: Re,
12
+ groupContainer: Me,
13
+ rowContainer: Ce,
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: xe,
25
+ nestedGroupLabel: qe,
26
+ nestedGroupMembers: Ue
27
+ }, j = (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
+ }, K = (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 } = K(e), _ = e.observationValue?.value?.toString(), $ = _ ? j(_) : 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: R(
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: R(
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 } = K(e), p = a ? `${a}-` : "", h = e.observationValue?.value?.toString(), f = h ? j(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: R(
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: R(
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
+ }, je = (e, t) => e.entry?.find((a) => a.resource?.id === t)?.resource, w = (e, t) => {
224
+ const a = je(e, t);
225
+ return a ? {
226
+ formFieldPath: Pe(a),
227
+ comment: ke(a)
228
+ } : {};
229
+ }, Ke = (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: J
265
+ } = O({
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 = [] } = O({
272
+ queryKey: ["observationForms"],
273
+ queryFn: () => le()
274
+ }), A = F(
275
+ (l) => V.find((m) => m.name === l)?.uuid,
276
+ [V]
277
+ ), M = y(() => {
278
+ if (r)
279
+ return A(r.formName);
280
+ }, [r, A]), { isLoading: W, error: E } = O({
281
+ queryKey: ["formMetadata", M],
282
+ queryFn: () => ce(M),
283
+ enabled: !!M && c
284
+ }), {
285
+ data: C,
286
+ isLoading: Y,
287
+ error: B
288
+ } = O({
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 && (J(), _.invalidateQueries({ queryKey: ["formsEncounter"] }));
296
+ },
297
+ [s]
298
+ );
299
+ const I = y(() => !C || !r?.formName ? [] : Ke(
300
+ C,
301
+ r.formName
302
+ ), [C, 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 L = u.formName;
318
+ m[L] ??= [];
319
+ const D = u.providers.map((ee) => ee.providerName).filter(Boolean).join(", ");
320
+ return m[L].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
+ (L, D) => D.encounterDateTime - L.encounterDateTime
336
+ )
337
+ })
338
+ ).sort((m, u) => m.formName.localeCompare(u.formName));
339
+ }, [T, n]), x = F((l) => {
340
+ p(l), i(!0);
341
+ }, []), Z = F(() => {
342
+ i(!1), p(null);
343
+ }, []), q = F(
344
+ (l, g) => {
345
+ switch (g) {
346
+ case "recordedOn":
347
+ return /* @__PURE__ */ d(be, { onClick: () => x(l), children: l.recordedOn });
348
+ case "recordedBy":
349
+ return l.recordedBy;
350
+ default:
351
+ return null;
352
+ }
353
+ },
354
+ [x]
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
+ U,
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: q,
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
+ U,
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: q,
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: W || Y ? /* @__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
+ };
@@ -0,0 +1,172 @@
1
+ import { jsx as d, jsxs as N } from "react/jsx-runtime";
2
+ import { k, V as S, m as q, D as w, _ as M, x as K, b as Q, u as G, n as H, q as P, r as j, A as J, e as z, s as Y, v as x, O as W, J as X } from "./index-D3Mgdxfk.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";
5
+ import { useTranslation as C } from "react-i18next";
6
+ const U = (t, c, n, l, o) => {
7
+ const s = q(t, c), r = s.value, a = w(r);
8
+ let i = r;
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
+ const u = o("OBSERVATIONS_RECORDED_BY", {
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}`;
13
+ return /* @__PURE__ */ d(
14
+ M,
15
+ {
16
+ header: s.header,
17
+ value: i,
18
+ info: u,
19
+ id: f,
20
+ testId: f,
21
+ ariaLabel: f
22
+ },
23
+ `obs-${t.id}`
24
+ );
25
+ }, se = (t, c, n, l, o, s) => /* @__PURE__ */ d(
26
+ S,
27
+ {
28
+ title: t.display,
29
+ id: `grouped-obs-${t.display}-${l}`,
30
+ open: n,
31
+ children: t.members?.map(
32
+ (r, a) => U(r, a, o, s, c)
33
+ )
34
+ },
35
+ `grouped-obs-${t.id}`
36
+ ), oe = ({
37
+ groupedData: t,
38
+ title: c = ""
39
+ }) => {
40
+ const { t: n } = C(), l = (o, s, r) => {
41
+ const a = k(o.encounterDetails, n);
42
+ return /* @__PURE__ */ N(
43
+ S,
44
+ {
45
+ title: a,
46
+ id: `encounter-${o.encounterId}`,
47
+ open: s,
48
+ children: [
49
+ o.observations.map(
50
+ (i, u) => U(i, u, r, c, n)
51
+ ),
52
+ o.groupedObservations.map(
53
+ (i, u) => se(
54
+ i,
55
+ n,
56
+ s,
57
+ u,
58
+ r,
59
+ c
60
+ )
61
+ )
62
+ ]
63
+ },
64
+ `encounter-${o.encounterId}`
65
+ );
66
+ };
67
+ return /* @__PURE__ */ d(
68
+ "div",
69
+ {
70
+ id: "obs-by-encounter",
71
+ "data-testid": "obs-by-encounter-test-id",
72
+ "aria-label": "obs-by-encounter-aria-label",
73
+ children: t.map(
74
+ (o, s) => l(o, s === 0, s)
75
+ )
76
+ }
77
+ );
78
+ }, re = "_observations_kfbhq_1", ae = "_title_kfbhq_12", D = {
79
+ observations: re,
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 } = H(), { t: a } = C(), i = Z({
83
+ queries: n.map((e) => ({
84
+ queryKey: ne(e),
85
+ queryFn: () => P(e),
86
+ enabled: !!e
87
+ }))
88
+ });
89
+ $(() => {
90
+ i.forEach((e, p) => {
91
+ if (e.isError && !o.current.has(p)) {
92
+ const g = n[p];
93
+ r({
94
+ title: a("ERROR_DEFAULT_TITLE"),
95
+ message: a("ERROR_FETCHING_CONCEPT", { conceptName: g }),
96
+ type: "error"
97
+ }), o.current.add(p);
98
+ } else e.isError || o.current.delete(p);
99
+ });
100
+ }, [i, n]);
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,
103
+ isLoading: f,
104
+ isError: O,
105
+ refetch: R
106
+ } = ee({
107
+ queryKey: ie(s, b),
108
+ queryFn: () => j(s, b),
109
+ enabled: !!s && b.length > 0 && v
110
+ });
111
+ J(
112
+ (e) => {
113
+ e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
114
+ (g) => b.includes(g)
115
+ ) && R();
116
+ },
117
+ [s, R]
118
+ ), $(() => {
119
+ O && r({
120
+ title: a("ERROR_DEFAULT_TITLE"),
121
+ message: a("ERROR_FETCHING_OBSERVATIONS"),
122
+ type: "error"
123
+ });
124
+ }, [O]);
125
+ const T = h(() => {
126
+ if (!m) return [];
127
+ const e = z(m), p = Y(e);
128
+ return x(p);
129
+ }, [m]), A = [
130
+ { key: "name", header: "name" },
131
+ { key: "value", header: "value" },
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(
135
+ "div",
136
+ {
137
+ id: "observations",
138
+ "data-testid": E ? `observations-${y}` : "observations",
139
+ "aria-label": "observations-aria-label",
140
+ className: D.observations,
141
+ children: [
142
+ /* @__PURE__ */ d(
143
+ W,
144
+ {
145
+ id: "observations-title",
146
+ testId: E ? `observations-title-${y}` : "observations-title",
147
+ title: y,
148
+ className: D.title,
149
+ children: /* @__PURE__ */ d("p", { children: y })
150
+ }
151
+ ),
152
+ V ? /* @__PURE__ */ d(oe, { groupedData: T, title: y }) : /* @__PURE__ */ d(
153
+ X,
154
+ {
155
+ headers: A,
156
+ rows: [],
157
+ ariaLabel: a("OBSERVATIONS"),
158
+ loading: _,
159
+ errorStateMessage: F,
160
+ emptyStateMessage: L,
161
+ dataTestId: "observations-table"
162
+ }
163
+ )
164
+ ]
165
+ }
166
+ );
167
+ };
168
+ export {
169
+ ne as conceptUuidQueryKeys,
170
+ me as default,
171
+ ie as observationsQueryKeys
172
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"FormsTable.d.ts","sourceRoot":"","sources":["../../src/forms/FormsTable.tsx"],"names":[],"mappings":"AAwBA,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,CAoRrC,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"}