@medplum/core 0.5.2 → 0.9.2
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 +158 -29
- package/dist/cjs/index.js +1047 -89
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +1 -15
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/esm/index.js +1034 -90
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +1 -15
- package/dist/esm/index.min.js.map +1 -1
- package/dist/types/client.d.ts +427 -13
- package/dist/types/fix-ro-iddentifiers.d.ts +0 -0
- package/dist/types/hl7.d.ts +43 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/repo.d.ts +116 -0
- package/dist/types/search.d.ts +10 -12
- package/dist/types/utils.d.ts +48 -3
- package/package.json +3 -2
package/dist/types/search.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
export declare const DEFAULT_SEARCH_COUNT = 20;
|
|
1
2
|
export interface SearchRequest {
|
|
2
3
|
readonly resourceType: string;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
filters?: Filter[];
|
|
5
|
+
sortRules?: SortRule[];
|
|
6
|
+
offset?: number;
|
|
7
|
+
count?: number;
|
|
8
|
+
fields?: string[];
|
|
9
|
+
name?: string;
|
|
10
|
+
total?: 'none' | 'estimate' | 'accurate';
|
|
10
11
|
}
|
|
11
12
|
export interface Filter {
|
|
12
13
|
code: string;
|
|
@@ -48,13 +49,10 @@ export declare enum Operator {
|
|
|
48
49
|
*
|
|
49
50
|
* See the FHIR search spec: http://hl7.org/fhir/r4/search.html
|
|
50
51
|
*
|
|
51
|
-
* @param
|
|
52
|
+
* @param url The URL to parse.
|
|
52
53
|
* @returns Parsed search definition.
|
|
53
54
|
*/
|
|
54
|
-
export declare function parseSearchDefinition(
|
|
55
|
-
pathname: string;
|
|
56
|
-
search?: string;
|
|
57
|
-
}): SearchRequest;
|
|
55
|
+
export declare function parseSearchDefinition(url: string): SearchRequest;
|
|
58
56
|
/**
|
|
59
57
|
* Formats a search definition object into a query string.
|
|
60
58
|
* Note: The return value does not include the resource type.
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Patient, Practitioner, Reference, RelatedPerson, Resource } from '@medplum/fhirtypes';
|
|
1
|
+
import { Patient, Practitioner, QuestionnaireResponse, QuestionnaireResponseItemAnswer, Reference, RelatedPerson, Resource } from '@medplum/fhirtypes';
|
|
2
2
|
export declare type ProfileResource = Patient | Practitioner | RelatedPerson;
|
|
3
3
|
/**
|
|
4
4
|
* Creates a reference resource.
|
|
@@ -44,6 +44,40 @@ export declare function getImageSrc(resource: Resource): string | undefined;
|
|
|
44
44
|
* @returns A Date object.
|
|
45
45
|
*/
|
|
46
46
|
export declare function getDateProperty(date: string | undefined): Date | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Calculates the age in years from the birth date.
|
|
49
|
+
* @param birthDateStr The birth date or start date in ISO-8601 format YYYY-MM-DD.
|
|
50
|
+
* @param endDateStr Optional end date in ISO-8601 format YYYY-MM-DD. Default value is today.
|
|
51
|
+
* @returns The age in years, months, and days.
|
|
52
|
+
*/
|
|
53
|
+
export declare function calculateAge(birthDateStr: string, endDateStr?: string): {
|
|
54
|
+
years: number;
|
|
55
|
+
months: number;
|
|
56
|
+
days: number;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Calculates the age string for display using the age appropriate units.
|
|
60
|
+
* If the age is greater than or equal to 2 years, then the age is displayed in years.
|
|
61
|
+
* If the age is greater than or equal to 1 month, then the age is displayed in months.
|
|
62
|
+
* Otherwise, the age is displayed in days.
|
|
63
|
+
* @param birthDateStr The birth date or start date in ISO-8601 format YYYY-MM-DD.
|
|
64
|
+
* @param endDateStr Optional end date in ISO-8601 format YYYY-MM-DD. Default value is today.
|
|
65
|
+
* @returns The age string.
|
|
66
|
+
*/
|
|
67
|
+
export declare function calculateAgeString(birthDateStr: string, endDateStr?: string): string | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Returns all questionnaire answers as a map by link ID.
|
|
70
|
+
* @param response The questionnaire response resource.
|
|
71
|
+
* @returns Questionnaire answers mapped by link ID.
|
|
72
|
+
*/
|
|
73
|
+
export declare function getQuestionnaireAnswers(response: QuestionnaireResponse): Record<string, QuestionnaireResponseItemAnswer>;
|
|
74
|
+
/**
|
|
75
|
+
* Returns an extension value by extension URLs.
|
|
76
|
+
* @param resource The base resource.
|
|
77
|
+
* @param urls Array of extension URLs. Each entry represents a nested extension.
|
|
78
|
+
* @returns The extension value if found; undefined otherwise.
|
|
79
|
+
*/
|
|
80
|
+
export declare function getExtensionValue(resource: Resource, ...urls: string[]): string | undefined;
|
|
47
81
|
/**
|
|
48
82
|
* FHIR JSON stringify.
|
|
49
83
|
* Removes properties with empty string values.
|
|
@@ -57,12 +91,23 @@ export declare function stringify(value: any, pretty?: boolean): string;
|
|
|
57
91
|
/**
|
|
58
92
|
* Resource equality.
|
|
59
93
|
* Ignores meta.versionId and meta.lastUpdated.
|
|
60
|
-
* See: https://dmitripavlutin.com/how-to-compare-objects-in-javascript/#4-deep-equality
|
|
61
94
|
* @param object1 The first object.
|
|
62
95
|
* @param object2 The second object.
|
|
63
96
|
* @returns True if the objects are equal.
|
|
64
97
|
*/
|
|
65
|
-
export declare function deepEquals(object1:
|
|
98
|
+
export declare function deepEquals(object1: unknown, object2: unknown, path?: string): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Returns true if the input is an object.
|
|
101
|
+
* @param object The candidate object.
|
|
102
|
+
* @returns True if the input is a non-null non-undefined object.
|
|
103
|
+
*/
|
|
104
|
+
export declare function isObject(obj: unknown): obj is Record<string, unknown>;
|
|
105
|
+
/**
|
|
106
|
+
* Returns true if the input array is an array of strings.
|
|
107
|
+
* @param arr Input array.
|
|
108
|
+
* @returns True if the input array is an array of strings.
|
|
109
|
+
*/
|
|
110
|
+
export declare function isStringArray(arr: any[]): arr is string[];
|
|
66
111
|
/**
|
|
67
112
|
* Converts an ArrayBuffer to hex string.
|
|
68
113
|
* See: https://stackoverflow.com/a/55200387
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medplum/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Medplum TS/JS Library",
|
|
5
5
|
"author": "Medplum <hello@medplum.com>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"test": "jest"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@medplum/fhirtypes": "0.
|
|
20
|
+
"@medplum/fhirtypes": "0.9.2",
|
|
21
|
+
"fast-json-patch": "3.1.1"
|
|
21
22
|
},
|
|
22
23
|
"main": "dist/cjs/index.js",
|
|
23
24
|
"module": "dist/esm/index.js",
|