@bahmni/reports-app 0.0.1-dev.422
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/README.md +9 -0
- package/dist/App.d.ts +3 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/DocumentsTable-Cik3MQZO-BEOP3gXe.js +227 -0
- package/dist/FormsTable-BdcB_G8V-Bv8kdRrU.js +272 -0
- package/dist/LNWAZHJI-B83w9zem.js +33 -0
- package/dist/MWZ6AO7Z-D07k4ozG.js +42 -0
- package/dist/Observations-f5ZvMmFn-_Fn9yyIz.js +246 -0
- package/dist/ReportsPage-DEhk2rFR.js +109 -0
- package/dist/YPM2AS64-C0pi-hgq.js +8975 -0
- package/dist/components/PrivilegeGuard/PrivilegeGuard.d.ts +15 -0
- package/dist/components/PrivilegeGuard/PrivilegeGuard.d.ts.map +1 -0
- package/dist/config/tanstackQuery.d.ts +3 -0
- package/dist/config/tanstackQuery.d.ts.map +1 -0
- package/dist/constants/app.d.ts +5 -0
- package/dist/constants/app.d.ts.map +1 -0
- package/dist/index-BMa5QlCF.js +198807 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/locales/locale_en.json +17 -0
- package/dist/locales/locale_es.json +17 -0
- package/dist/pages/ReportsPage.d.ts +4 -0
- package/dist/pages/ReportsPage.d.ts.map +1 -0
- package/dist/routes/index.d.ts +4 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/model.d.ts +8 -0
- package/dist/routes/model.d.ts.map +1 -0
- package/package.json +30 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { jsxs as I, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { v as Q, z as M, u as w, j as Y, a as j, k as G, l as H, m as J, n as P, o as W, _ as X, C as Z, r as ee, Y as ae, x as se, s as B, t as re, B as te, w as ie, R as oe, T as ne, L as de, O as le } from "./index-BMa5QlCF.js";
|
|
3
|
+
import { useQueries as ue, useQuery as ce } from "@tanstack/react-query";
|
|
4
|
+
import { useRef as me, useEffect as D, useMemo as E } from "react";
|
|
5
|
+
const pe = "Observations-module_observations__RKSyo", be = "Observations-module_title__TJL3z", ve = "Observations-module_wrapper__muk2L", he = "Observations-module_secondary__14nuS", O = {
|
|
6
|
+
observations: pe,
|
|
7
|
+
title: be,
|
|
8
|
+
wrapper: ve,
|
|
9
|
+
secondary: he
|
|
10
|
+
}, U = (s, l, o, d, c, r) => {
|
|
11
|
+
const t = re(s, l, c), e = t.value, m = te(e);
|
|
12
|
+
let i = e;
|
|
13
|
+
m === "Image" && (i = /* @__PURE__ */ n(
|
|
14
|
+
ne,
|
|
15
|
+
{
|
|
16
|
+
imageSrc: e,
|
|
17
|
+
alt: e,
|
|
18
|
+
id: `${e}-img`,
|
|
19
|
+
hideThumbnail: r
|
|
20
|
+
}
|
|
21
|
+
)), m === "Video" && (i = /* @__PURE__ */ n(
|
|
22
|
+
de,
|
|
23
|
+
{
|
|
24
|
+
id: `${e}-video`,
|
|
25
|
+
videoSrc: e,
|
|
26
|
+
hideThumbnail: r
|
|
27
|
+
}
|
|
28
|
+
)), m === "PDF" && (i = /* @__PURE__ */ n(le, { id: `${e}-pdf`, src: e }));
|
|
29
|
+
const p = /* @__PURE__ */ I("div", { className: O.wrapper, children: [
|
|
30
|
+
/* @__PURE__ */ n("span", { children: t.header.display }),
|
|
31
|
+
t.header.referenceRange && /* @__PURE__ */ n("span", { className: O.secondary, children: t.header.referenceRange })
|
|
32
|
+
] }), u = c("OBSERVATIONS_RECORDED_BY", {
|
|
33
|
+
provider: t.provider
|
|
34
|
+
}), b = s.effectiveDateTime ? ie(s.effectiveDateTime, c, !0).formattedResult : void 0, f = /* @__PURE__ */ I("div", { className: O.wrapper, children: [
|
|
35
|
+
/* @__PURE__ */ n("span", { children: u }),
|
|
36
|
+
b && /* @__PURE__ */ n("span", { className: O.secondary, children: b })
|
|
37
|
+
] }), v = s.display, h = s.observationValue?.isAbnormal ? "abnormal-obs" : "obs", R = d ? `${d}-${h}-${v}-${o}-${l}` : `${h}-${v}-${o}-${l}`;
|
|
38
|
+
return /* @__PURE__ */ n(
|
|
39
|
+
oe,
|
|
40
|
+
{
|
|
41
|
+
header: p,
|
|
42
|
+
value: i,
|
|
43
|
+
info: f,
|
|
44
|
+
id: R,
|
|
45
|
+
testId: R,
|
|
46
|
+
ariaLabel: R
|
|
47
|
+
},
|
|
48
|
+
`obs-${s.id}`
|
|
49
|
+
);
|
|
50
|
+
}, ye = (s, l, o, d, c, r, t) => /* @__PURE__ */ n(
|
|
51
|
+
B,
|
|
52
|
+
{
|
|
53
|
+
title: s.display,
|
|
54
|
+
id: `grouped-obs-${s.display}-${d}`,
|
|
55
|
+
open: o,
|
|
56
|
+
children: s.members?.map(
|
|
57
|
+
(e, m) => U(
|
|
58
|
+
e,
|
|
59
|
+
m,
|
|
60
|
+
c,
|
|
61
|
+
r,
|
|
62
|
+
l,
|
|
63
|
+
t
|
|
64
|
+
)
|
|
65
|
+
)
|
|
66
|
+
},
|
|
67
|
+
`grouped-obs-${s.id}`
|
|
68
|
+
), Oe = ({
|
|
69
|
+
groupedData: s,
|
|
70
|
+
title: l = "",
|
|
71
|
+
hideThumbnail: o
|
|
72
|
+
}) => {
|
|
73
|
+
const { t: d } = w(), c = (r, t, e) => {
|
|
74
|
+
const m = se(r.encounterDetails, d);
|
|
75
|
+
return /* @__PURE__ */ I(
|
|
76
|
+
B,
|
|
77
|
+
{
|
|
78
|
+
title: m,
|
|
79
|
+
id: `encounter-${r.encounterId}`,
|
|
80
|
+
open: t,
|
|
81
|
+
children: [
|
|
82
|
+
r.observations.map(
|
|
83
|
+
(i, p) => U(
|
|
84
|
+
i,
|
|
85
|
+
p,
|
|
86
|
+
e,
|
|
87
|
+
l,
|
|
88
|
+
d,
|
|
89
|
+
o
|
|
90
|
+
)
|
|
91
|
+
),
|
|
92
|
+
r.groupedObservations.map(
|
|
93
|
+
(i, p) => ye(
|
|
94
|
+
i,
|
|
95
|
+
d,
|
|
96
|
+
t,
|
|
97
|
+
p,
|
|
98
|
+
e,
|
|
99
|
+
l,
|
|
100
|
+
o
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
`encounter-${r.encounterId}`
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
return /* @__PURE__ */ n(
|
|
109
|
+
"div",
|
|
110
|
+
{
|
|
111
|
+
id: "obs-by-encounter",
|
|
112
|
+
"data-testid": "obs-by-encounter-test-id",
|
|
113
|
+
"aria-label": "obs-by-encounter-aria-label",
|
|
114
|
+
children: s.map(
|
|
115
|
+
(r, t) => c(r, t === 0, t)
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
}, Re = (s) => ["conceptUuid", s], _e = (s, l, o, d) => [
|
|
120
|
+
"observations",
|
|
121
|
+
s,
|
|
122
|
+
...l,
|
|
123
|
+
o,
|
|
124
|
+
d
|
|
125
|
+
], Ie = ({
|
|
126
|
+
config: s,
|
|
127
|
+
episodeOfCareUuids: l,
|
|
128
|
+
encounterUuids: o
|
|
129
|
+
}) => {
|
|
130
|
+
const d = s, {
|
|
131
|
+
conceptNames: c = [],
|
|
132
|
+
conceptUuid: r = [],
|
|
133
|
+
hideThumbnail: t = !1,
|
|
134
|
+
scope: e = "all"
|
|
135
|
+
} = d, m = me(/* @__PURE__ */ new Set()), i = Q(), { addNotification: p } = M(), { t: u } = w(), b = ue({
|
|
136
|
+
queries: c.map((a) => ({
|
|
137
|
+
queryKey: Re(a),
|
|
138
|
+
queryFn: () => Y(a),
|
|
139
|
+
enabled: !!a
|
|
140
|
+
}))
|
|
141
|
+
});
|
|
142
|
+
D(() => {
|
|
143
|
+
const a = b.some((x) => x.isError), y = m.current.size > 0;
|
|
144
|
+
a && !y ? (p({
|
|
145
|
+
title: u("ERROR_DEFAULT_TITLE"),
|
|
146
|
+
message: u("ERROR_FETCHING_OBSERVATIONS"),
|
|
147
|
+
type: "error"
|
|
148
|
+
}), m.current.add(0)) : !a && y && m.current.clear();
|
|
149
|
+
}, [b, p, u]);
|
|
150
|
+
const f = E(() => b.map((a) => a.data?.uuid).filter((a) => !!a), [b]), v = E(() => [.../* @__PURE__ */ new Set([...f, ...r])], [f, r]), h = E(() => c.length === 0 ? !0 : b.every((a) => !a.isLoading), [b, c.length]), R = e === "latest" || e === "latest-encounter", V = j(
|
|
151
|
+
l,
|
|
152
|
+
o
|
|
153
|
+
), {
|
|
154
|
+
data: _,
|
|
155
|
+
isLoading: C,
|
|
156
|
+
isError: N,
|
|
157
|
+
refetch: S
|
|
158
|
+
} = ce({
|
|
159
|
+
queryKey: _e(
|
|
160
|
+
i,
|
|
161
|
+
v,
|
|
162
|
+
o,
|
|
163
|
+
e
|
|
164
|
+
),
|
|
165
|
+
queryFn: () => R ? G(
|
|
166
|
+
i,
|
|
167
|
+
v,
|
|
168
|
+
o
|
|
169
|
+
) : H(
|
|
170
|
+
i,
|
|
171
|
+
v,
|
|
172
|
+
o
|
|
173
|
+
),
|
|
174
|
+
enabled: !!i && v.length > 0 && h && !V
|
|
175
|
+
});
|
|
176
|
+
J(
|
|
177
|
+
(a) => {
|
|
178
|
+
a.patientUUID === i && a.updatedConcepts.size > 0 && [...a.updatedConcepts.keys()].some(
|
|
179
|
+
(y) => v.includes(y)
|
|
180
|
+
) && S();
|
|
181
|
+
},
|
|
182
|
+
[i, S]
|
|
183
|
+
), D(() => {
|
|
184
|
+
N && p({
|
|
185
|
+
title: u("ERROR_DEFAULT_TITLE"),
|
|
186
|
+
message: u("ERROR_FETCHING_OBSERVATIONS"),
|
|
187
|
+
type: "error"
|
|
188
|
+
});
|
|
189
|
+
}, [N]);
|
|
190
|
+
const $ = E(() => {
|
|
191
|
+
if (!_) return [];
|
|
192
|
+
let a = P(_);
|
|
193
|
+
e === "latest-encounter" && (a = W(a));
|
|
194
|
+
const y = X(a);
|
|
195
|
+
return Z(y);
|
|
196
|
+
}, [_, e]), F = [
|
|
197
|
+
{ key: "name", header: "name" },
|
|
198
|
+
{ key: "value", header: "value" },
|
|
199
|
+
{ key: "form", header: "form" }
|
|
200
|
+
], A = C || !h, L = N && h, k = (!_ || _.entry?.length === 0 || v.length === 0) && h, K = L ? u("ERROR_FETCHING_OBSERVATIONS") : null, q = k ? u("NO_OBSERVATIONS_FOUND") : void 0, z = $.length > 0 && !A && !L, g = d.titleTranslationKey, T = g ? u(g) : "";
|
|
201
|
+
return /* @__PURE__ */ I(
|
|
202
|
+
"div",
|
|
203
|
+
{
|
|
204
|
+
id: "observations",
|
|
205
|
+
"data-testid": g ? `observations-${T}` : "observations",
|
|
206
|
+
"aria-label": "observations-aria-label",
|
|
207
|
+
className: O.observations,
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ n(
|
|
210
|
+
ee,
|
|
211
|
+
{
|
|
212
|
+
id: "observations-title",
|
|
213
|
+
testId: g ? `observations-title-${T}` : "observations-title",
|
|
214
|
+
title: T,
|
|
215
|
+
className: O.title,
|
|
216
|
+
children: /* @__PURE__ */ n("p", { children: T })
|
|
217
|
+
}
|
|
218
|
+
),
|
|
219
|
+
z ? /* @__PURE__ */ n(
|
|
220
|
+
Oe,
|
|
221
|
+
{
|
|
222
|
+
groupedData: $,
|
|
223
|
+
title: T,
|
|
224
|
+
hideThumbnail: t
|
|
225
|
+
}
|
|
226
|
+
) : /* @__PURE__ */ n(
|
|
227
|
+
ae,
|
|
228
|
+
{
|
|
229
|
+
headers: F,
|
|
230
|
+
rows: [],
|
|
231
|
+
ariaLabel: u("OBSERVATIONS"),
|
|
232
|
+
loading: A,
|
|
233
|
+
errorStateMessage: K,
|
|
234
|
+
emptyStateMessage: q ?? u("NO_OBSERVATIONS_AVAILABLE"),
|
|
235
|
+
dataTestId: "observations-table"
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
};
|
|
242
|
+
export {
|
|
243
|
+
Re as conceptUuidQueryKeys,
|
|
244
|
+
Ie as default,
|
|
245
|
+
_e as observationsQueryKeys
|
|
246
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { jsx as a, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { u as E, $ as c, M as i, D as P, G as A, H as b, I as m, X as d, Q as L, K as l, U as B, W as O } from "./index-BMa5QlCF.js";
|
|
3
|
+
import { useMemo as h, useCallback as S } from "react";
|
|
4
|
+
import "@tanstack/react-query";
|
|
5
|
+
import { useLocation as g, useNavigate as u } from "react-router-dom";
|
|
6
|
+
const M = "ReportsPage-module_page__ewRXe", y = "ReportsPage-module_panel__HFBCt", s = {
|
|
7
|
+
page: M,
|
|
8
|
+
panel: y
|
|
9
|
+
}, o = 1, H = 0, N = () => {
|
|
10
|
+
const { t: e } = E(), n = g(), r = u(), R = h(
|
|
11
|
+
() => [
|
|
12
|
+
{ id: "home", label: e("REPORTS_HOME_LABEL"), href: c },
|
|
13
|
+
{ id: "reports", label: e("REPORTS_LABEL"), isCurrentPage: !0 }
|
|
14
|
+
],
|
|
15
|
+
[e]
|
|
16
|
+
), _ = n.pathname === i ? o : H, p = S(
|
|
17
|
+
({ selectedIndex: T }) => {
|
|
18
|
+
r(
|
|
19
|
+
T === o ? i : P
|
|
20
|
+
);
|
|
21
|
+
},
|
|
22
|
+
[r]
|
|
23
|
+
);
|
|
24
|
+
return /* @__PURE__ */ a(
|
|
25
|
+
A,
|
|
26
|
+
{
|
|
27
|
+
header: /* @__PURE__ */ a(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
id: "reports-page-header",
|
|
31
|
+
"data-testid": "reports-page-header-test-id",
|
|
32
|
+
"aria-label": "Reports Page Header",
|
|
33
|
+
children: /* @__PURE__ */ a(
|
|
34
|
+
B,
|
|
35
|
+
{
|
|
36
|
+
breadcrumbItems: R,
|
|
37
|
+
userMenu: /* @__PURE__ */ a(O, {})
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
main: /* @__PURE__ */ a(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
id: "reports-page",
|
|
46
|
+
"data-testid": "reports-page-test-id",
|
|
47
|
+
"aria-label": "Reports Page",
|
|
48
|
+
className: s.page,
|
|
49
|
+
children: /* @__PURE__ */ t(b, { selectedIndex: _, onChange: p, children: [
|
|
50
|
+
/* @__PURE__ */ t(
|
|
51
|
+
m,
|
|
52
|
+
{
|
|
53
|
+
id: "reports-tab-list",
|
|
54
|
+
"data-testid": "reports-tab-list-test-id",
|
|
55
|
+
"aria-label": e("REPORTS_TAB_LIST_ARIA_LABEL"),
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ a(
|
|
58
|
+
d,
|
|
59
|
+
{
|
|
60
|
+
id: "reports-tab",
|
|
61
|
+
"data-testid": "reports-tab-test-id",
|
|
62
|
+
"aria-label": e("REPORTS_TAB_LABEL"),
|
|
63
|
+
children: e("REPORTS_TAB_LABEL")
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
/* @__PURE__ */ a(
|
|
67
|
+
d,
|
|
68
|
+
{
|
|
69
|
+
id: "my-reports-tab",
|
|
70
|
+
"data-testid": "my-reports-tab-test-id",
|
|
71
|
+
"aria-label": e("REPORTS_MY_REPORTS_TAB_LABEL"),
|
|
72
|
+
children: e("REPORTS_MY_REPORTS_TAB_LABEL")
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ t(L, { children: [
|
|
79
|
+
/* @__PURE__ */ a(
|
|
80
|
+
l,
|
|
81
|
+
{
|
|
82
|
+
id: "reports-tab-panel",
|
|
83
|
+
"data-testid": "reports-tab-panel-test-id",
|
|
84
|
+
"aria-label": e("REPORTS_TAB_LABEL"),
|
|
85
|
+
className: s.panel,
|
|
86
|
+
children: /* @__PURE__ */ a("p", { children: e("REPORTS_TAB_PLACEHOLDER") })
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ a(
|
|
90
|
+
l,
|
|
91
|
+
{
|
|
92
|
+
id: "my-reports-tab-panel",
|
|
93
|
+
"data-testid": "my-reports-tab-panel-test-id",
|
|
94
|
+
"aria-label": e("REPORTS_MY_REPORTS_TAB_LABEL"),
|
|
95
|
+
className: s.panel,
|
|
96
|
+
children: /* @__PURE__ */ a("p", { children: e("REPORTS_MY_REPORTS_TAB_PLACEHOLDER") })
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] })
|
|
100
|
+
] })
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
export {
|
|
107
|
+
N as ReportsPage,
|
|
108
|
+
N as default
|
|
109
|
+
};
|