@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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { at as i } from "./index-D9U_fT9q.js";
1
+ import { av as i } from "./index-BPwSmRKH.js";
2
2
  export {
3
3
  i as ClinicalApp
4
4
  };
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/clinical-app",
3
- "version": "0.0.1-dev.151",
3
+ "version": "0.0.1-dev.152",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -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
- };