@openfn/language-ihris 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/LICENSE +674 -0
- package/LICENSE.LESSER +165 -0
- package/README.md +27 -0
- package/ast.json +870 -0
- package/configuration-schema.json +36 -0
- package/dist/index.cjs +241 -0
- package/dist/index.js +217 -0
- package/package.json +48 -0
- package/types/Adaptor.d.ts +2 -0
- package/types/Utils.d.ts +3 -0
- package/types/http.d.ts +199 -0
- package/types/index.d.ts +4 -0
package/types/http.d.ts
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State object
|
|
3
|
+
* @typedef {Object} HttpState
|
|
4
|
+
* @property data - the parsed response body
|
|
5
|
+
* @property response - the response from the HTTP server, including headers, statusCode, body, etc
|
|
6
|
+
* @property references - an array of all previous data objects used in the Job
|
|
7
|
+
**/
|
|
8
|
+
/**
|
|
9
|
+
* Get a FHIR resource by ID or list all resources of a type
|
|
10
|
+
* @example <caption>List all practitioners</caption>
|
|
11
|
+
* http.get('/fhir/Practitioner');
|
|
12
|
+
* @example <caption> List a specific practitioner by ID</caption>
|
|
13
|
+
* http.get('/fhir/Practitioner/P10004');
|
|
14
|
+
* @example <caption>Get active practitioners, limit to 1 result</caption>
|
|
15
|
+
* http.get('/fhir/Practitioner', {
|
|
16
|
+
* query: {
|
|
17
|
+
* active: true,
|
|
18
|
+
* _count: 1,
|
|
19
|
+
* },
|
|
20
|
+
* });
|
|
21
|
+
* @function
|
|
22
|
+
* @public
|
|
23
|
+
* @param {string} resource - FHIR resource type
|
|
24
|
+
* @param {object} options - Options including headers and query parameters
|
|
25
|
+
* @returns {Operation}
|
|
26
|
+
* @state {HttpState}
|
|
27
|
+
*/
|
|
28
|
+
export function get(resource: string, options?: object): Operation;
|
|
29
|
+
/**
|
|
30
|
+
* Create a new FHIR resource
|
|
31
|
+
* @example <caption>Create a new Practitioner resource</caption>
|
|
32
|
+
* http.post('/fhir/Practitioner', {
|
|
33
|
+
* "resourceType": "Practitioner",
|
|
34
|
+
* "meta": {
|
|
35
|
+
* "versionId": "1",
|
|
36
|
+
* "lastUpdated": "2024-08-06T06:13:10.163+00:00",
|
|
37
|
+
* "source": "#m5UGgxqUFEI7qIRF",
|
|
38
|
+
* "profile": [
|
|
39
|
+
* "http://ihris.org/fhir/StructureDefinition/ihris-practitioner"
|
|
40
|
+
* ]
|
|
41
|
+
* },
|
|
42
|
+
* "extension": [
|
|
43
|
+
* // ... extension data
|
|
44
|
+
* ],
|
|
45
|
+
* "active": true,
|
|
46
|
+
* "name": [
|
|
47
|
+
* {
|
|
48
|
+
* "use": "official",
|
|
49
|
+
* "text": "Tekiokion Traifrop",
|
|
50
|
+
* "family": "Traifrop",
|
|
51
|
+
* "given": [
|
|
52
|
+
* "Tekiokion"
|
|
53
|
+
* ]
|
|
54
|
+
* }
|
|
55
|
+
* ],
|
|
56
|
+
* "gender": "male",
|
|
57
|
+
* "birthDate": "1979-01-01",
|
|
58
|
+
* "qualification": [
|
|
59
|
+
* {
|
|
60
|
+
* "code": {
|
|
61
|
+
* "coding": [
|
|
62
|
+
* {
|
|
63
|
+
* "system": "http://terminology.hl7.org/CodeSystem/v2-0360|2.7",
|
|
64
|
+
* "code": "BA"
|
|
65
|
+
* }
|
|
66
|
+
* ],
|
|
67
|
+
* "text": "Bachelor of Arts"
|
|
68
|
+
* }
|
|
69
|
+
* }
|
|
70
|
+
* ]
|
|
71
|
+
* });
|
|
72
|
+
* @function
|
|
73
|
+
* @public
|
|
74
|
+
* @param {string} resource - FHIR resource type
|
|
75
|
+
* @param {object} body - FHIR resource data
|
|
76
|
+
* @param {object} options - Optional request options
|
|
77
|
+
* @returns {Operation}
|
|
78
|
+
* @state {HttpState}
|
|
79
|
+
*/
|
|
80
|
+
export function post(resource: string, body: object, options?: object): Operation;
|
|
81
|
+
/**
|
|
82
|
+
* Update an existing FHIR resource
|
|
83
|
+
* @example <caption>Update a Practitioner resource</caption>
|
|
84
|
+
* http.put('/fhir/Practitioner/6462', {
|
|
85
|
+
* resourceType: 'Practitioner',
|
|
86
|
+
* id: '6462',
|
|
87
|
+
* meta: {
|
|
88
|
+
* versionId: '1',
|
|
89
|
+
* lastUpdated: '2025-11-03T07:06:59.309+00:00',
|
|
90
|
+
* source: '#m5UGgxqUFEI7qIRF',
|
|
91
|
+
* profile: ['http://ihris.org/fhir/StructureDefinition/ihris-practitioner'],
|
|
92
|
+
* },
|
|
93
|
+
* extension: [
|
|
94
|
+
* {
|
|
95
|
+
* url: 'http://ihris.org/fhir/StructureDefinition/ihris-practitioner-nationality',
|
|
96
|
+
* valueCoding: {
|
|
97
|
+
* system: 'urn:iso:std:iso:3166',
|
|
98
|
+
* code: 'TF',
|
|
99
|
+
* },
|
|
100
|
+
* },
|
|
101
|
+
* {
|
|
102
|
+
* url: 'http://ihris.org/fhir/StructureDefinition/ihris-practitioner-residence',
|
|
103
|
+
* valueReference: {
|
|
104
|
+
* reference: 'Location/TF.W.GAS',
|
|
105
|
+
* },
|
|
106
|
+
* },
|
|
107
|
+
* {
|
|
108
|
+
* url: 'http://ihris.org/fhir/StructureDefinition/ihris-practitioner-marital-status',
|
|
109
|
+
* valueCoding: {
|
|
110
|
+
* system: 'http://terminology.hl7.org/CodeSystem/v3-MaritalStatus',
|
|
111
|
+
* code: 'S',
|
|
112
|
+
* },
|
|
113
|
+
* },
|
|
114
|
+
* ],
|
|
115
|
+
* active: true,
|
|
116
|
+
* name: [
|
|
117
|
+
* {
|
|
118
|
+
* use: 'official',
|
|
119
|
+
* text: 'Tekiokionses Traifrop',
|
|
120
|
+
* family: 'Traifrop',
|
|
121
|
+
* given: ['Tekiokionses'],
|
|
122
|
+
* },
|
|
123
|
+
* ],
|
|
124
|
+
* gender: 'male',
|
|
125
|
+
* birthDate: '1979-01-01',
|
|
126
|
+
* qualification: [
|
|
127
|
+
* {
|
|
128
|
+
* code: {
|
|
129
|
+
* coding: [
|
|
130
|
+
* {
|
|
131
|
+
* system: 'http://terminology.hl7.org/CodeSystem/v2-0360|2.7',
|
|
132
|
+
* code: 'BA',
|
|
133
|
+
* },
|
|
134
|
+
* ],
|
|
135
|
+
* text: 'Bachelor of Arts',
|
|
136
|
+
* },
|
|
137
|
+
* },
|
|
138
|
+
* ],
|
|
139
|
+
* });
|
|
140
|
+
* @function
|
|
141
|
+
* @public
|
|
142
|
+
* @param {string} resource - Path to FHIR resource
|
|
143
|
+
* @param {object} body - Updated FHIR resource data
|
|
144
|
+
* @param {object} options - Optional request options
|
|
145
|
+
* @returns {Operation}
|
|
146
|
+
* @state {HttpState}
|
|
147
|
+
*/
|
|
148
|
+
export function put(resource: string, body: object, options?: object): Operation;
|
|
149
|
+
/**
|
|
150
|
+
* Options provided to the HTTP request
|
|
151
|
+
* @typedef {Object} RequestOptions
|
|
152
|
+
* @public
|
|
153
|
+
* @property {object} body - body data to append to the request.
|
|
154
|
+
* @property {object} query - An object of query parameters to be encoded into the URL.
|
|
155
|
+
* @property {object} headers - An object of headers to append to the request.
|
|
156
|
+
* @property {string} parseAs - Parse the response body as json, text or stream. By default will use the response headers.
|
|
157
|
+
*/
|
|
158
|
+
/**
|
|
159
|
+
* Make a general HTTP request to iHRIS
|
|
160
|
+
* @example <caption>Make a GET request with query parameters</caption>
|
|
161
|
+
* http.request(
|
|
162
|
+
* 'GET',
|
|
163
|
+
* '/fhir/Practitioner',
|
|
164
|
+
* {},
|
|
165
|
+
* {
|
|
166
|
+
* query: { active: 'true', _count: '10' },
|
|
167
|
+
* }
|
|
168
|
+
* );
|
|
169
|
+
* @function
|
|
170
|
+
* @public
|
|
171
|
+
* @param {string} method - HTTP method to use
|
|
172
|
+
* @param {string} path - Path to resource
|
|
173
|
+
* @param {object} body - Object which will be attached to the POST body
|
|
174
|
+
* @param {RequestOptions} options - Optional request options
|
|
175
|
+
* @returns {Operation}
|
|
176
|
+
* @state {HttpState}
|
|
177
|
+
*/
|
|
178
|
+
export function request(method: string, path: string, body: object, options?: RequestOptions): Operation;
|
|
179
|
+
/**
|
|
180
|
+
* State object
|
|
181
|
+
*/
|
|
182
|
+
export type HttpState = {
|
|
183
|
+
/**
|
|
184
|
+
* - the parsed response body
|
|
185
|
+
*/
|
|
186
|
+
data: any;
|
|
187
|
+
/**
|
|
188
|
+
* - the response from the HTTP server, including headers, statusCode, body, etc
|
|
189
|
+
*/
|
|
190
|
+
response: any;
|
|
191
|
+
/**
|
|
192
|
+
* - an array of all previous data objects used in the Job
|
|
193
|
+
*/
|
|
194
|
+
references: any;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Options provided to the HTTP request
|
|
198
|
+
*/
|
|
199
|
+
export type RequestOptions = any;
|
package/types/index.d.ts
ADDED