@openfn/language-googlehealthcare 0.0.1 → 1.0.0
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/ast.json +49 -3
- package/configuration-schema.json +5 -22
- package/dist/index.cjs +18 -10
- package/dist/index.js +18 -10
- package/package.json +2 -2
- package/types/Adaptor.d.ts +52 -25
package/ast.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
{
|
|
4
4
|
"name": "createFhirResource",
|
|
5
5
|
"params": [
|
|
6
|
+
"fhirStore",
|
|
6
7
|
"resource",
|
|
7
8
|
"callback"
|
|
8
9
|
],
|
|
@@ -16,11 +17,11 @@
|
|
|
16
17
|
},
|
|
17
18
|
{
|
|
18
19
|
"title": "example",
|
|
19
|
-
"description": "createFhirResource({\n name: [{ use: \"official\", family: \"Smith\", given: [\"Darcy\"] }],\n
|
|
20
|
+
"description": "createFhirResource(\n {\n cloudRegion: \"us-central1\",\n projectId: \"adjective-noun-123\",\n datasetId: \"my-dataset\",\n fhirStoreId: \"my-fhir-store\",\n },\n {\n resourceType: \"Patient\",\n name: [{ use: \"official\", family: \"Smith\", given: [\"Darcy\"] }],\n gender: \"female\",\n birthDate: \"1970-01-01\",\n }\n);"
|
|
20
21
|
},
|
|
21
22
|
{
|
|
22
23
|
"title": "example",
|
|
23
|
-
"description": "createFhirResource(state => ({\n
|
|
24
|
+
"description": "createFhirResource(\n {\n cloudRegion: \"us-central1\",\n projectId: \"adjective-noun-123\",\n datasetId: \"my-dataset\",\n fhirStoreId: \"my-fhir-store\",\n },\n (state) => ({\n resourceType: \"Encounter\",\n status: \"finished\",\n class: {\n system: \"http://hl7.org/fhir/v3/ActCode\",\n code: \"IMP\",\n display: \"inpatient encounter\",\n },\n reasonCode: [\n {\n text: \"The patient had an abnormal heart rate. She was concerned about this.\",\n },\n ],\n subject: {\n reference: `Patient/${state.data.id}`,\n },\n })\n);"
|
|
24
25
|
},
|
|
25
26
|
{
|
|
26
27
|
"title": "function",
|
|
@@ -29,7 +30,52 @@
|
|
|
29
30
|
},
|
|
30
31
|
{
|
|
31
32
|
"title": "param",
|
|
32
|
-
"description": "The
|
|
33
|
+
"description": "The FHIR store information.\n - `cloudRegion` (string): The cloud region where the FHIR store is located.\n - `projectId` (string): The ID of the project that contains the FHIR store.\n - `datasetId` (string): The ID of the dataset that contains the FHIR store.\n - `fhirStoreId` (string): The ID of the FHIR store.",
|
|
34
|
+
"type": {
|
|
35
|
+
"type": "OptionalType",
|
|
36
|
+
"expression": {
|
|
37
|
+
"type": "RecordType",
|
|
38
|
+
"fields": [
|
|
39
|
+
{
|
|
40
|
+
"type": "FieldType",
|
|
41
|
+
"key": "cloudRegion",
|
|
42
|
+
"value": {
|
|
43
|
+
"type": "NameExpression",
|
|
44
|
+
"name": "string"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"type": "FieldType",
|
|
49
|
+
"key": "projectId",
|
|
50
|
+
"value": {
|
|
51
|
+
"type": "NameExpression",
|
|
52
|
+
"name": "string"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"type": "FieldType",
|
|
57
|
+
"key": "datasetId",
|
|
58
|
+
"value": {
|
|
59
|
+
"type": "NameExpression",
|
|
60
|
+
"name": "string"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"type": "FieldType",
|
|
65
|
+
"key": "fhirStoreId",
|
|
66
|
+
"value": {
|
|
67
|
+
"type": "NameExpression",
|
|
68
|
+
"name": "string"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"name": "fhirStore"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"title": "param",
|
|
78
|
+
"description": "The FHIR resource data to be created",
|
|
33
79
|
"type": {
|
|
34
80
|
"type": "NameExpression",
|
|
35
81
|
"name": "object"
|
|
@@ -18,30 +18,13 @@
|
|
|
18
18
|
"type": "string",
|
|
19
19
|
"description": "The API version",
|
|
20
20
|
"default": "v1",
|
|
21
|
-
"examples": [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"examples": ["us-central1"]
|
|
26
|
-
},
|
|
27
|
-
"projectId": {
|
|
28
|
-
"type": "string",
|
|
29
|
-
"examples": ["adjective-noun-123"]
|
|
30
|
-
},
|
|
31
|
-
"datasetId": {
|
|
32
|
-
"type": "string",
|
|
33
|
-
"examples": ["my-dataset"]
|
|
34
|
-
},
|
|
35
|
-
"fhirStoreId": {
|
|
36
|
-
"type": "string",
|
|
37
|
-
"examples": ["my-fhir-store"]
|
|
21
|
+
"examples": [
|
|
22
|
+
"v1",
|
|
23
|
+
"v1beta1"
|
|
24
|
+
]
|
|
38
25
|
}
|
|
39
26
|
},
|
|
40
27
|
"required": [
|
|
41
|
-
"cloudRegion",
|
|
42
|
-
"projectId",
|
|
43
|
-
"datasetId",
|
|
44
|
-
"fhirStoreId",
|
|
45
28
|
"access_token"
|
|
46
29
|
]
|
|
47
|
-
}
|
|
30
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -134,18 +134,26 @@ function execute(...operations) {
|
|
|
134
134
|
});
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
|
-
function createFhirResource(resource, callback) {
|
|
137
|
+
function createFhirResource(fhirStore, resource, callback) {
|
|
138
138
|
return async (state) => {
|
|
139
|
-
const {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
accessToken
|
|
146
|
-
} = state.configuration;
|
|
147
|
-
const [resolvedResource] = (0, import_util.expandReferences)(state, resource);
|
|
139
|
+
const { apiVersion, accessToken } = state.configuration;
|
|
140
|
+
const [resolvedFhirStore, resolvedResource] = (0, import_util.expandReferences)(
|
|
141
|
+
state,
|
|
142
|
+
fhirStore,
|
|
143
|
+
resource
|
|
144
|
+
);
|
|
148
145
|
const { resourceType } = resolvedResource;
|
|
146
|
+
const { cloudRegion, projectId, datasetId, fhirStoreId } = resolvedFhirStore;
|
|
147
|
+
const requiredKeys = [
|
|
148
|
+
"cloudRegion",
|
|
149
|
+
"projectId",
|
|
150
|
+
"datasetId",
|
|
151
|
+
"fhirStoreId"
|
|
152
|
+
];
|
|
153
|
+
const missingKeys = requiredKeys.filter((key) => !(key in resolvedFhirStore));
|
|
154
|
+
if (missingKeys.length > 0) {
|
|
155
|
+
throw new Error(`Missing key(s) in fhirStore: ${missingKeys.join(", ")}`);
|
|
156
|
+
}
|
|
149
157
|
const url = buildUrl({
|
|
150
158
|
apiVersion,
|
|
151
159
|
projectId,
|
package/dist/index.js
CHANGED
|
@@ -119,18 +119,26 @@ function execute(...operations) {
|
|
|
119
119
|
});
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
function createFhirResource(resource, callback) {
|
|
122
|
+
function createFhirResource(fhirStore, resource, callback) {
|
|
123
123
|
return async (state) => {
|
|
124
|
-
const {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
accessToken
|
|
131
|
-
} = state.configuration;
|
|
132
|
-
const [resolvedResource] = expandReferences(state, resource);
|
|
124
|
+
const { apiVersion, accessToken } = state.configuration;
|
|
125
|
+
const [resolvedFhirStore, resolvedResource] = expandReferences(
|
|
126
|
+
state,
|
|
127
|
+
fhirStore,
|
|
128
|
+
resource
|
|
129
|
+
);
|
|
133
130
|
const { resourceType } = resolvedResource;
|
|
131
|
+
const { cloudRegion, projectId, datasetId, fhirStoreId } = resolvedFhirStore;
|
|
132
|
+
const requiredKeys = [
|
|
133
|
+
"cloudRegion",
|
|
134
|
+
"projectId",
|
|
135
|
+
"datasetId",
|
|
136
|
+
"fhirStoreId"
|
|
137
|
+
];
|
|
138
|
+
const missingKeys = requiredKeys.filter((key) => !(key in resolvedFhirStore));
|
|
139
|
+
if (missingKeys.length > 0) {
|
|
140
|
+
throw new Error(`Missing key(s) in fhirStore: ${missingKeys.join(", ")}`);
|
|
141
|
+
}
|
|
134
142
|
const url = buildUrl({
|
|
135
143
|
apiVersion,
|
|
136
144
|
projectId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-googlehealthcare",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A Google Health Care language package for use with Open Function",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"configuration-schema.json"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@openfn/language-common": "^1.
|
|
22
|
+
"@openfn/language-common": "^1.10.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@openfn/buildtools": "^1.0.2",
|
package/types/Adaptor.d.ts
CHANGED
|
@@ -15,35 +15,62 @@ export function execute(...operations: Operations): Operation;
|
|
|
15
15
|
* Create some resource in Google Cloud Healthcare
|
|
16
16
|
* @public
|
|
17
17
|
* @example
|
|
18
|
-
* createFhirResource(
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
18
|
+
* createFhirResource(
|
|
19
|
+
* {
|
|
20
|
+
* cloudRegion: "us-central1",
|
|
21
|
+
* projectId: "adjective-noun-123",
|
|
22
|
+
* datasetId: "my-dataset",
|
|
23
|
+
* fhirStoreId: "my-fhir-store",
|
|
24
|
+
* },
|
|
25
|
+
* {
|
|
26
|
+
* resourceType: "Patient",
|
|
27
|
+
* name: [{ use: "official", family: "Smith", given: ["Darcy"] }],
|
|
28
|
+
* gender: "female",
|
|
29
|
+
* birthDate: "1970-01-01",
|
|
30
|
+
* }
|
|
31
|
+
* );
|
|
24
32
|
* @example
|
|
25
|
-
* createFhirResource(
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
33
|
+
* createFhirResource(
|
|
34
|
+
* {
|
|
35
|
+
* cloudRegion: "us-central1",
|
|
36
|
+
* projectId: "adjective-noun-123",
|
|
37
|
+
* datasetId: "my-dataset",
|
|
38
|
+
* fhirStoreId: "my-fhir-store",
|
|
39
|
+
* },
|
|
40
|
+
* (state) => ({
|
|
41
|
+
* resourceType: "Encounter",
|
|
42
|
+
* status: "finished",
|
|
43
|
+
* class: {
|
|
44
|
+
* system: "http://hl7.org/fhir/v3/ActCode",
|
|
45
|
+
* code: "IMP",
|
|
46
|
+
* display: "inpatient encounter",
|
|
47
|
+
* },
|
|
48
|
+
* reasonCode: [
|
|
49
|
+
* {
|
|
50
|
+
* text: "The patient had an abnormal heart rate. She was concerned about this.",
|
|
51
|
+
* },
|
|
52
|
+
* ],
|
|
53
|
+
* subject: {
|
|
54
|
+
* reference: `Patient/${state.data.id}`,
|
|
55
|
+
* },
|
|
56
|
+
* })
|
|
57
|
+
* );
|
|
58
|
+
*
|
|
42
59
|
* @function
|
|
43
|
-
* @param {
|
|
60
|
+
* @param {{cloudRegion: string, projectId: string, datasetId: string, fhirStoreId: string}} [fhirStore] - The FHIR store information.
|
|
61
|
+
* - `cloudRegion` (string): The cloud region where the FHIR store is located.
|
|
62
|
+
* - `projectId` (string): The ID of the project that contains the FHIR store.
|
|
63
|
+
* - `datasetId` (string): The ID of the dataset that contains the FHIR store.
|
|
64
|
+
* - `fhirStoreId` (string): The ID of the FHIR store.
|
|
65
|
+
* @param {object} resource - The FHIR resource data to be created
|
|
44
66
|
* @param {function} callback - An optional callback function
|
|
45
67
|
* @returns {Operation}
|
|
46
68
|
*/
|
|
47
|
-
export function createFhirResource(
|
|
69
|
+
export function createFhirResource(fhirStore?: {
|
|
70
|
+
cloudRegion: string;
|
|
71
|
+
projectId: string;
|
|
72
|
+
datasetId: string;
|
|
73
|
+
fhirStoreId: string;
|
|
74
|
+
}, resource: object, callback: Function): Operation;
|
|
48
75
|
export { request } from "./Utils";
|
|
49
76
|
export { dataPath, dataValue, dateFns, each, field, fields, fn, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";
|