@openmrs/esm-patient-common-lib 7.0.2-pre.3949 → 7.0.2-pre.3959
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/package.json +2 -2
- package/src/index.ts +0 -1
- package/src/useVitalsConceptMetadata.tsx +0 -62
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-patient-common-lib",
|
|
3
|
-
"version": "7.0.2-pre.
|
|
3
|
+
"version": "7.0.2-pre.3959",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Library for common patient chart components",
|
|
6
6
|
"browser": "dist/openmrs-esm-patient-common-lib.js",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"react": "18.x",
|
|
39
39
|
"single-spa": "6.x"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "05251f10e8e7aac2a5d0262d9b114383174f5670"
|
|
42
42
|
}
|
package/src/index.ts
CHANGED
|
@@ -18,7 +18,6 @@ export * from './time-helper';
|
|
|
18
18
|
export * from './types';
|
|
19
19
|
export * from './useLaunchWorkspaceRequiringVisit';
|
|
20
20
|
export * from './useSystemVisitSetting';
|
|
21
|
-
export * from './useVitalsConceptMetadata';
|
|
22
21
|
export * from './workspaces';
|
|
23
22
|
export * from './siderail-nav-button';
|
|
24
23
|
export * from './form-entry-interop';
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import useSWRImmutable from 'swr/immutable';
|
|
2
|
-
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
3
|
-
|
|
4
|
-
export function useVitalsConceptMetadata() {
|
|
5
|
-
const customRepresentation =
|
|
6
|
-
'custom:(setMembers:(uuid,display,hiNormal,hiAbsolute,hiCritical,lowNormal,lowAbsolute,lowCritical,units))';
|
|
7
|
-
|
|
8
|
-
const apiUrl = `${restBaseUrl}/concept/?q=VITALS SIGNS&v=${customRepresentation}`;
|
|
9
|
-
|
|
10
|
-
const { data, error, isLoading } = useSWRImmutable<{ data: VitalsConceptMetadataResponse }, Error>(
|
|
11
|
-
apiUrl,
|
|
12
|
-
openmrsFetch,
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
const conceptMetadata = data?.data?.results[0]?.setMembers;
|
|
16
|
-
|
|
17
|
-
const conceptUnits = conceptMetadata?.length
|
|
18
|
-
? new Map<string, string>(conceptMetadata.map((concept) => [concept.uuid, concept.units]))
|
|
19
|
-
: new Map<string, string>([]);
|
|
20
|
-
|
|
21
|
-
const conceptRanges = conceptMetadata?.length
|
|
22
|
-
? new Map<string, { lowAbsolute: number | null; highAbsolute: number | null }>(
|
|
23
|
-
conceptMetadata.map((concept) => [
|
|
24
|
-
concept.uuid,
|
|
25
|
-
{
|
|
26
|
-
lowAbsolute: concept.lowAbsolute ?? null,
|
|
27
|
-
highAbsolute: concept.hiAbsolute ?? null,
|
|
28
|
-
},
|
|
29
|
-
]),
|
|
30
|
-
)
|
|
31
|
-
: new Map<string, { lowAbsolute: number | null; highAbsolute: number | null }>([]);
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
data: conceptUnits,
|
|
35
|
-
isError: error,
|
|
36
|
-
isLoading,
|
|
37
|
-
conceptMetadata,
|
|
38
|
-
conceptRanges,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export const withUnit = (label: string, unit: string | null | undefined) => {
|
|
43
|
-
return `${label} ${unit ? `(${unit})` : ''}`;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export interface ConceptMetadata {
|
|
47
|
-
uuid: string;
|
|
48
|
-
display: string;
|
|
49
|
-
hiNormal: number | null;
|
|
50
|
-
hiAbsolute: number | null;
|
|
51
|
-
hiCritical: number | null;
|
|
52
|
-
lowNormal: number | null;
|
|
53
|
-
lowAbsolute: number | null;
|
|
54
|
-
lowCritical: number | null;
|
|
55
|
-
units: string | null;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
interface VitalsConceptMetadataResponse {
|
|
59
|
-
results: Array<{
|
|
60
|
-
setMembers: Array<ConceptMetadata>;
|
|
61
|
-
}>;
|
|
62
|
-
}
|