@bahmni/clinical-app 0.0.1-dev.146 → 0.0.1-dev.148

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 { ap as i } from "./index-BJ3OpmgT.js";
1
+ import { aH as i } from "./index-BkD8km-2.js";
2
2
  export {
3
3
  i as ClinicalApp
4
4
  };
@@ -283,6 +283,10 @@
283
283
  "PATIENT_HEADER_LABEL": "Patient Header",
284
284
  "PINNED_FORMS_INVALID_DATA": "Invalid pinned forms data",
285
285
  "PINNED_FORMS_USER_NOT_FOUND": "User not found",
286
+ "PROGRAM_DETAILS_ERROR_UPDATING_STATE": "Error updating program state",
287
+ "PROGRAM_DETAILS_STATE_CHANGE_ERROR_TITLE": "Error",
288
+ "PROGRAM_STATE_UPDATED_SUCCESSFULLY_MESSAGE": "Program state updated successfully",
289
+ "PROGRAM_STATE_UPDATED_SUCCESSFULLY_TITLE": "Success",
286
290
  "PROGRAMS_TABLE_ARIA_LABEL": "Programs table",
287
291
  "PROGRAMS_TABLE_HEADER_END_DATE": "End Date",
288
292
  "PROGRAMS_TABLE_HEADER_OUTCOME": "Outcome",
@@ -296,6 +300,7 @@
296
300
  "RADIOLOGY_RESULTS": "Results",
297
301
  "RADIOLOGY_INVESTIGATION_NAME": "Procedure Name",
298
302
  "RADIOLOGY_VIEW_IMAGES": "View Images",
303
+ "RADIOLOGY_VIEW_REPORT": "View Report",
299
304
  "REACTIONS": "Reaction(s)",
300
305
  "REVOKED_STATUS": "Canceled",
301
306
  "SELECT_ENCOUNTER_TYPE": "Select encounter type",
@@ -314,6 +319,7 @@
314
319
  "SIDE_NAVIGATION": "Side navigation",
315
320
  "UNEXPECTED_ERROR": "An unexpected error occurred",
316
321
  "UNKNOWN_STATUS": "Canceled",
322
+ "UPDATE_PROGRAM_STATE_BUTTON": "Update State",
317
323
  "VACCINATION_ADD_NOTE": "Add Note",
318
324
  "VACCINATION_ADD_NOTE_PLACEHOLDER": "Add notes for the vaccination",
319
325
  "VACCINATION_ADDED_VACCINATIONS": "Added vaccinations",
@@ -280,6 +280,10 @@
280
280
  "PATIENT_HEADER_LABEL": "Cabecera del Paciente",
281
281
  "PINNED_FORMS_INVALID_DATA": "Datos de formularios anclados no válidos",
282
282
  "PINNED_FORMS_USER_NOT_FOUND": "Usuario no encontrado",
283
+ "PROGRAM_DETAILS_STATE_CHANGE_ERROR_TITLE": "Error",
284
+ "PROGRAM_DETAILS_ERROR_UPDATING_STATE": "Error al actualizar el estado del programa",
285
+ "PROGRAM_STATE_UPDATED_SUCCESSFULLY_MESSAGE": "Estado del programa actualizado correctamente",
286
+ "PROGRAM_STATE_UPDATED_SUCCESSFULLY_TITLE": "Éxito",
283
287
  "PROGRAMS_TABLE_ARIA_LABEL": "Tabla de programas",
284
288
  "PROGRAMS_TABLE_HEADER_END_DATE": "Fecha de Finalización",
285
289
  "PROGRAMS_TABLE_HEADER_OUTCOME": "Resultado",
@@ -293,6 +297,7 @@
293
297
  "RADIOLOGY_RESULTS": "Resultados",
294
298
  "RADIOLOGY_INVESTIGATION_NAME": "Nombre de la Procedimiento",
295
299
  "RADIOLOGY_VIEW_IMAGES": "Ver Imágenes",
300
+ "RADIOLOGY_VIEW_REPORT": "Ver Informe",
296
301
  "REACTIONS": "Reacción(es)",
297
302
  "REVOKED_STATUS": "Cancelado",
298
303
  "SELECT_ENCOUNTER_TYPE": "Seleccionar tipo de encuentro",
@@ -311,6 +316,7 @@
311
316
  "SIDE_NAVIGATION": "Navegación lateral",
312
317
  "UNEXPECTED_ERROR": "Se produjo un error inesperado",
313
318
  "UNKNOWN_STATUS": "Cancelado",
319
+ "UPDATE_PROGRAM_STATE_BUTTON": "Actualizar Estado",
314
320
  "VACCINATION_ADD_NOTE": "Agregar Nota",
315
321
  "VACCINATION_ADD_NOTE_PLACEHOLDER": "Agregar notas para la vacuna",
316
322
  "VACCINATION_ADDED_VACCINATIONS": "Vacunas agregadas",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/clinical-app",
3
- "version": "0.0.1-dev.146",
3
+ "version": "0.0.1-dev.148",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,337 +0,0 @@
1
- import { jsxs as _, jsx as b } from "react/jsx-runtime";
2
- import { V as F, c as U, u as I, f as k, X as Q, a as x, g as G, $ as K, G as H, C as w, J as X, i as j, T as J, O as P, Q as Y } from "./index-BJ3OpmgT.js";
3
- import { useRef as Z, useEffect as S, useMemo as h } from "react";
4
- const z = "normal", W = "http://terminology.hl7.org/CodeSystem/referencerange-meaning", ee = "A", te = "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation", ne = (e, n) => e?.date ? H(e.date, n).formattedResult : n("DATE_ERROR_PARSE"), re = (e) => {
5
- if (!e.observationValue?.value)
6
- return "";
7
- const { value: n, unit: t } = e.observationValue;
8
- return t ? `${n} ${t}` : String(n);
9
- }, oe = (e) => {
10
- const n = e.display;
11
- if (!e.observationValue)
12
- return String(n);
13
- const { unit: t, referenceRange: a } = e.observationValue;
14
- if (!a)
15
- return String(n);
16
- const { low: r, high: o } = a;
17
- if (r && o) {
18
- const i = r.unit ? `${r.value} ${r.unit}` : t ? `${r.value} ${t}` : String(r.value), s = o.unit ? `${o.value} ${o.unit}` : t ? `${o.value} ${t}` : String(o.value);
19
- return `${n} (${i} - ${s})`;
20
- }
21
- if (r) {
22
- const i = r.unit ? `${r.value} ${r.unit}` : t ? `${r.value} ${t}` : String(r.value);
23
- return `${n} (>${i})`;
24
- }
25
- if (o) {
26
- const i = o.unit ? `${o.value} ${o.unit}` : t ? `${o.value} ${t}` : String(o.value);
27
- return `${n} (<${i})`;
28
- }
29
- return n;
30
- }, ae = (e, n) => ({
31
- index: n,
32
- header: oe(e),
33
- value: re(e),
34
- provider: e.encounter?.provider
35
- }), $ = (e) => (typeof e == "string" ? e : e?.reference)?.split("/")?.pop();
36
- function ie(e) {
37
- return !e.interpretation || e.interpretation.length === 0 ? !1 : e.interpretation.some(
38
- (n) => n.coding?.some(
39
- (t) => t.system === te && t.code === ee
40
- )
41
- );
42
- }
43
- function se(e) {
44
- const {
45
- valueQuantity: n,
46
- valueCodeableConcept: t,
47
- valueString: a,
48
- valueBoolean: r,
49
- valueInteger: o,
50
- referenceRange: i
51
- } = e, s = ie(e);
52
- if (n) {
53
- const u = {
54
- value: n.value ?? "",
55
- unit: n.unit,
56
- type: "quantity",
57
- isAbnormal: s
58
- };
59
- if (i && i.length > 0) {
60
- const l = i.find(
61
- (v) => v.type?.coding?.some(
62
- (c) => c.system === W && c.code === z
63
- )
64
- );
65
- l && (l.low || l.high) && (u.referenceRange = {
66
- low: l.low ? {
67
- value: l.low.value,
68
- unit: l.low.unit
69
- } : void 0,
70
- high: l.high ? {
71
- value: l.high.value,
72
- unit: l.high.unit
73
- } : void 0
74
- });
75
- }
76
- return u;
77
- }
78
- if (t)
79
- return {
80
- value: t.text ?? t.coding[0].display,
81
- type: "codeable",
82
- isAbnormal: s
83
- };
84
- if (a)
85
- return {
86
- value: a,
87
- type: "string",
88
- isAbnormal: s
89
- };
90
- if (r !== void 0)
91
- return {
92
- value: r,
93
- type: "boolean",
94
- isAbnormal: s
95
- };
96
- if (o !== void 0)
97
- return {
98
- value: o,
99
- type: "integer",
100
- isAbnormal: s
101
- };
102
- }
103
- function ue(e, n) {
104
- const t = n.get(e);
105
- if (t)
106
- return {
107
- id: t.id ?? e,
108
- type: t.type?.[0]?.coding?.[0]?.display ?? "Unknown",
109
- date: t.period?.start ?? "",
110
- provider: t.participant?.[0]?.individual?.display,
111
- location: t.location?.[0]?.location?.display
112
- };
113
- }
114
- function A(e, n, t) {
115
- const a = $(e.encounter), r = (e.hasMember ?? []).map((o) => $(o)).map((o) => o ? t.get(o) : void 0).filter((o) => !!o).map(
116
- (o) => A(o, n, t)
117
- );
118
- return {
119
- id: e.id,
120
- display: e.code?.text ?? e.code?.coding?.[0]?.display ?? "",
121
- observationValue: se(e),
122
- effectiveDateTime: e.effectiveDateTime,
123
- issued: e.issued,
124
- encounter: a ? ue(a, n) : void 0,
125
- members: r.length > 0 ? r : void 0
126
- };
127
- }
128
- function le(e) {
129
- const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
130
- e.entry?.forEach(({ resource: i }) => {
131
- i?.id && (i.resourceType === "Encounter" ? n.set(i.id, i) : i.resourceType === "Observation" && (t.set(i.id, i), i.hasMember?.forEach((s) => {
132
- const u = $(s);
133
- u && a.add(u);
134
- })));
135
- });
136
- const r = [], o = [];
137
- return t.forEach((i, s) => {
138
- if (a.has(s)) return;
139
- const u = A(
140
- i,
141
- n,
142
- t
143
- );
144
- u.members?.length ? o.push({ ...u, children: u.members }) : r.push(u);
145
- }), { observations: r, groupedObservations: o };
146
- }
147
- function de(e) {
148
- const n = /* @__PURE__ */ new Map();
149
- return e.observations.forEach((t) => {
150
- if (!t.encounter?.id) return;
151
- const a = t.encounter.id;
152
- n.has(a) || n.set(a, {
153
- observations: [],
154
- groupedObservations: []
155
- }), n.get(a).observations.push(t);
156
- }), e.groupedObservations.forEach((t) => {
157
- if (!t.encounter?.id) return;
158
- const a = t.encounter.id;
159
- n.has(a) || n.set(a, {
160
- observations: [],
161
- groupedObservations: []
162
- }), n.get(a).groupedObservations.push(t);
163
- }), Array.from(n.entries()).map(([t, a]) => {
164
- const r = a.observations[0]?.encounter ?? a.groupedObservations[0]?.encounter;
165
- return {
166
- encounterId: t,
167
- encounterDetails: r,
168
- observations: a.observations,
169
- groupedObservations: a.groupedObservations
170
- };
171
- });
172
- }
173
- function ce(e) {
174
- return [...e].sort((n, t) => {
175
- const a = n.encounterDetails?.date, r = t.encounterDetails?.date;
176
- return !a && !r ? 0 : a ? r ? new Date(r).getTime() - new Date(a).getTime() : -1 : 1;
177
- });
178
- }
179
- const D = (e, n, t, a, r) => {
180
- const o = ae(e, n), i = o.value, s = X(i);
181
- let u = i;
182
- s === "Image" && (u = /* @__PURE__ */ b(J, { imageSrc: i, alt: i, id: `${i}-img` })), s === "Video" && (u = /* @__PURE__ */ b(P, { id: `${i}-video`, videoSrc: i }));
183
- const l = r("OBSERVATIONS_RECORDED_BY", {
184
- provider: o.provider
185
- }), v = e.display, c = e.observationValue?.isAbnormal ? "abnormal-obs" : "obs", p = a ? `${a}-${c}-${v}-${t}-${n}` : `${c}-${v}-${t}-${n}`;
186
- return /* @__PURE__ */ b(
187
- j,
188
- {
189
- header: o.header,
190
- value: u,
191
- info: l,
192
- id: p,
193
- testId: p,
194
- ariaLabel: p
195
- },
196
- `obs-${e.id}`
197
- );
198
- }, ve = (e, n, t, a, r, o) => /* @__PURE__ */ b(
199
- w,
200
- {
201
- title: e.display,
202
- id: `grouped-obs-${e.display}-${a}`,
203
- open: t,
204
- children: e.children.map(
205
- (i, s) => D(i, s, r, o, n)
206
- )
207
- },
208
- `grouped-obs-${e.id}`
209
- ), pe = ({
210
- groupedData: e,
211
- title: n = ""
212
- }) => {
213
- const { t } = I(), a = (r, o, i) => {
214
- const s = ne(r.encounterDetails, t);
215
- return /* @__PURE__ */ _(
216
- w,
217
- {
218
- title: s,
219
- id: `encounter-${r.encounterId}`,
220
- open: o,
221
- children: [
222
- r.observations.map(
223
- (u, l) => D(u, l, i, n, t)
224
- ),
225
- r.groupedObservations.map(
226
- (u, l) => ve(
227
- u,
228
- t,
229
- o,
230
- l,
231
- i,
232
- n
233
- )
234
- )
235
- ]
236
- },
237
- `encounter-${r.encounterId}`
238
- );
239
- };
240
- return /* @__PURE__ */ b(
241
- "div",
242
- {
243
- id: "obs-by-encounter",
244
- "data-testid": "obs-by-encounter-test-id",
245
- "aria-label": "obs-by-encounter-aria-label",
246
- children: e.map(
247
- (r, o) => a(r, o === 0, o)
248
- )
249
- }
250
- );
251
- }, be = "_observations_kfbhq_1", ge = "_title_kfbhq_12", T = {
252
- observations: be,
253
- title: ge
254
- }, me = (e) => ["conceptUuid", e], fe = (e, n) => ["observations", e, ...n], Ee = ({ config: e }) => {
255
- const n = e, { conceptNames: t = [], conceptUuid: a = [] } = n, r = Z(/* @__PURE__ */ new Set()), o = F(), { addNotification: i } = U(), { t: s } = I(), u = k({
256
- queries: t.map((d) => ({
257
- queryKey: me(d),
258
- queryFn: () => Q(d),
259
- enabled: !!d
260
- }))
261
- });
262
- S(() => {
263
- u.forEach((d, g) => {
264
- if (d.isError && !r.current.has(g)) {
265
- const B = t[g];
266
- i({
267
- title: s("ERROR_DEFAULT_TITLE"),
268
- message: s("ERROR_FETCHING_CONCEPT", { conceptName: B }),
269
- type: "error"
270
- }), r.current.add(g);
271
- } else d.isError || r.current.delete(g);
272
- });
273
- }, [u, t]);
274
- const l = h(() => u.map((d) => d.data?.uuid).filter((d) => !!d), [u]), v = h(() => [.../* @__PURE__ */ new Set([...l, ...a])], [l, a]), c = h(() => t.length === 0 ? !0 : u.every((d) => !d.isLoading), [u, t.length]), {
275
- data: p,
276
- isLoading: N,
277
- isError: y
278
- } = x({
279
- queryKey: fe(o, v),
280
- queryFn: () => Y(o, v),
281
- enabled: !!o && v.length > 0 && c
282
- });
283
- S(() => {
284
- y && i({
285
- title: s("ERROR_DEFAULT_TITLE"),
286
- message: s("ERROR_FETCHING_OBSERVATIONS"),
287
- type: "error"
288
- });
289
- }, [y]);
290
- const E = h(() => {
291
- if (!p) return [];
292
- const d = le(p), g = de(d);
293
- return ce(g);
294
- }, [p]), V = [
295
- { key: "name", header: "name" },
296
- { key: "value", header: "value" },
297
- { key: "form", header: "form" }
298
- ], O = N || !c, R = y && c, C = (!p || p.entry?.length === 0 || v.length === 0) && c, L = R ? s("ERROR_FETCHING_OBSERVATIONS") : null, M = C ? s("NO_OBSERVATIONS_FOUND") : void 0, q = E.length > 0 && !O && !R, f = n.titleTranslationKey, m = f ? s(f) : "";
299
- return /* @__PURE__ */ _(
300
- "div",
301
- {
302
- id: "observations",
303
- "data-testid": f ? `observations-${m}` : "observations",
304
- "aria-label": "observations-aria-label",
305
- className: T.observations,
306
- children: [
307
- /* @__PURE__ */ b(
308
- G,
309
- {
310
- id: "observations-title",
311
- testId: f ? `observations-title-${m}` : "observations-title",
312
- title: m,
313
- className: T.title,
314
- children: /* @__PURE__ */ b("p", { children: m })
315
- }
316
- ),
317
- q ? /* @__PURE__ */ b(pe, { groupedData: E, title: m }) : /* @__PURE__ */ b(
318
- K,
319
- {
320
- headers: V,
321
- rows: [],
322
- ariaLabel: s("OBSERVATIONS"),
323
- loading: O,
324
- errorStateMessage: L,
325
- emptyStateMessage: M,
326
- dataTestId: "observations-table"
327
- }
328
- )
329
- ]
330
- }
331
- );
332
- };
333
- export {
334
- me as conceptUuidQueryKeys,
335
- Ee as default,
336
- fe as observationsQueryKeys
337
- };