openhim@1.0.0
- createChannel(body)
- createTask(body)
- getChannels(channelId)
- getClients(clientId)
- getTasks(options)
- getTransactions(options)
- registerClient(body)
- updateClient(body)
This adaptor exports the following namespaced functions:
- http.delete(path, options)
- http.get(path, options)
- http.post(path, body, options)
- http.put(path, body, options)
- http.request(method, path, body, options)
This adaptor exports the following from common:
- as()
- cursor()
- dataPath()
- dataValue()
- dateFns
- each()
- field()
- fields()
- fn()
- fnIf()
- lastReferenceValue()
- map()
- merge()
- sourceValue()
Functions
createChannel
createChannel(body) ⇒ Operation
Make a request to OpenHIM to create a new channel. See OpenHIM Channels docs
Param | Type | Description |
---|---|---|
body | object | The channel data to create. |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the OpenHIM server, including headers, statusCode, etc |
references | an array of all previous data objects used in the Job |
Example: Create a channel
createChannel({
type: 'http',
authType: 'public',
status: 'enabled',
routes: [
{
name: 'FHIR Server Testing',
secured: false,
host: 'localhost',
port: '3447',
primary: true,
},
],
requestBody: true,
responseBody: true,
name: 'FHIR Server Testing',
urlPattern: '^/fhir/.*$',
methods: [
'GET',
'POST',
],
});
createTask
createTask(body) ⇒ Operation
Make a request to OpenHIM to create a new task
Param | Type | Description |
---|---|---|
body | object | The task data to create. |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the OpenHIM server, including headers, statusCode, etc |
references | an array of all previous data objects used in the Job |
Example: Create a task record
createTask({
tids: [
'5bb777777bbb66cc5d4444ee',
'5ceec0bb3ca344f9a30df633',
'5af732d1cbf94ba88b8f0bc0',
],
batchSize: 2,
paused: true,
});
getChannels
getChannels(channelId) ⇒ Operation
Make a request to OpenHIM to get all channel records
Param | Type | Description |
---|---|---|
channelId | string | Optional channelId to return a specific channel. |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the OpenHIM server, including headers, statusCode, etc |
references | an array of all previous data objects used in the Job |
Example: Get all channels
getChannels()
Example: Get a specific channel
getChannels('67dac5fd70b851d7a26d1274');
getClients
getClients(clientId) ⇒ Operation
Make a request to OpenHIM to get all registered client records
Param | Type | Description |
---|---|---|
clientId | string | Optional clientID to return a specific client. |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the OpenHIM server, including headers, statusCode, etc |
references | an array of all previous data objects used in the Job |
Example: Get all clients
getClients()
Example: Get a specific client
getClients('6823172670b851d7a222075a');
getTasks
getTasks(options) ⇒ Operation
Make a request to OpenHIM to get all tasks
Param | Type | Description |
---|---|---|
options | OpenHIMGetTasksOptions | Required request options for each request. See OpenHIM Tasks docs |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the OpenHIM server, including headers, statusCode, etc |
references | an array of all previous data objects used in the Job |
Example: Get all tasks
getTasks({
filterLimit: 10,
filterPage: 0,
filters: '{}',
});
Example: Get a specific task
getTasks({
taskId: '6870fbf470b851d7a22e9f05',
filterLimit: 10,
filterPage: 0,
filters: '{}',
});
getTransactions
getTransactions(options) ⇒ Operation
Make a request to OpenHIM to get transactions
Param | Type | Description |
---|---|---|
options | OpenHIMGetTransactionsOptions | Optional request options. See OpenHIM Transactions docs |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the OpenHIM server, including headers, statusCode, etc |
references | an array of all previous data objects used in the Job |
Example: Get all transactions
getTransactions()
Example: Get a specific transaction
getTransactions({transactionId:"686f56e070b851d7a21898f5"})
Example: Get transactions with filters
getTransactions({
filterLimit: 5,
filterPage: 0,
filterRepresentation: 'full',
filters: '{"response.status":"200"}',
});
registerClient
registerClient(body) ⇒ Operation
Make a request to OpenHIM to create a new client record
Param | Type | Description |
---|---|---|
body | object | The client data to register. |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the OpenHIM server, including headers, statusCode, etc |
references | an array of all previous data objects used in the Job |
Example: Create a client record
registerClient({
roles: ['fhir'],
clientID: 'fhir-server-7',
name: 'FHIR Server',
passwordAlgorithm: 'sha512',
passwordSalt: '3e74a280c568f27241e48e938edf21bf',
passwordHash:
'9a5158dc87a25da9d8822d48ed831a88bb4ba7fa636ddb6d6a725f73688546052cb7f2c355758e4839f9416e6cc0e37e1e3070f597af2836d39768a5ecc050db',
});
updateClient
updateClient(body) ⇒ Operation
Make a request to OpenHIM to update a client record
Param | Type | Description |
---|---|---|
body | object | The client data to update. |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the OpenHIM server, including headers, statusCode, etc |
references | an array of all previous data objects used in the Job |
Example: Update a client record
updateClient({
_id:'6870c19870b851d7a22b8d27',
roles: ['fhir', 'testing'],
clientID: 'fhir-server-7',
name: 'FHIR Server Testing',
passwordAlgorithm: 'sha512',
passwordSalt: '3e74a280c568f27241e48e938edf21bf',
passwordHash:
'9a5158dc87a25da9d8822d48ed831a88bb4ba7fa636ddb6d6a725f73688546052cb7f2c355758e4839f9416e6cc0e37e1e3070f597af2836d39768a5ecc050db',
});
http
These functions belong to the http namespace.
http.delete
delete(path, options) ⇒ Operation
Make a DELETE request to OpenHIM
Param | Type | Description |
---|---|---|
path | string | Path to resource with the id of the resource to delete |
options | RequestOptions | Optional request options |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the OpenHIM server, including headers, statusCode, etc |
references | an array of all previous data objects used in the Job |
Example: Delete an existing client
http.delete('/clients/686fb65870b851d7a21d9ca0', {
parseAs: 'text',
});
http.get
get(path, options) ⇒ Operation
Make a GET request to OpenHIM
Param | Type | Description |
---|---|---|
path | string | Path to resource |
options | RequestOptions | Optional request options |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the OpenHIM server, including headers, statusCode, etc |
references | an array of all previous data objects used in the Job |
Example: Get all transactions
http.get('/transactions')
http.post
post(path, body, options) ⇒ Operation
Make a POST request to OpenHIM
Param | Type | Description |
---|---|---|
path | string | Path to resource |
body | object | Object which will be attached to the POST body |
options | RequestOptions | Optional request options |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the OpenHIM server, including headers, statusCode, etc |
references | an array of all previous data objects used in the Job |
Example: Create a client
http.post(
'/clients',
{
roles: ['fhir'],
clientID: 'fhir-server-5',
name: 'FHIR Server',
passwordAlgorithm: 'sha512',
passwordSalt: '3e74a280c568f27241e48e938edf21bf',
passwordHash:
'9a5158dc87a25da9d8822d48ed831a88bb4ba7fa636ddb6d6a725f73688546052cb7f2c355758e4839f9416e6cc0e37e1e3070f597af2836d39768a5ecc050db',
},
{
parseAs: 'text',
}
);
http.put
put(path, body, options) ⇒ Operation
Make a PUT request to OpenHIM
Param | Type | Description |
---|---|---|
path | string | Path to resource with the id of the resource to update |
body | object | Object which will be attached to the PUT body |
options | RequestOptions | Optional request options |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the OpenHIM server, including headers, statusCode, etc |
references | an array of all previous data objects used in the Job |
Example: Update an existing client
http.put(
'/clients/686fb79470b851d7a21dad76',
{
_id: '686fb79470b851d7a21dad76',
roles: ['fhir', 'testing'],
clientID: 'fhir-server-5',
name: 'FHIR Server',
passwordAlgorithm: 'sha512',
passwordSalt: '3e74a280c568f27241e48e938edf21bf',
passwordHash:
'9a5158dc87a25da9d8822d48ed831a88bb4ba7fa636ddb6d6a725f73688546052cb7f2c355758e4839f9416e6cc0e37e1e3070f597af2836d39768a5ecc050db',
},
{
parseAs: 'text',
}
);
http.request
request(method, path, body, options) ⇒ Operation
Make a general HTTP request to OpenHIM
Param | Type | Description |
---|---|---|
method | string | HTTP method to use |
path | string | Path to resource |
body | object | Object which will be attached to the POST body |
options | RequestOptions | Optional request options |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the OpenHIM server, including headers, statusCode, etc |
references | an array of all previous data objects used in the Job |
Example: Create a client
http.request(
'POST',
'/clients',
{
roles: ['fhir'],
clientID: 'fhir-server-2',
name: 'FHIR Server',
passwordAlgorithm: 'sha512',
passwordSalt: '3e74a280c568f27241e48e938edf21bf',
passwordHash:
'9a5158dc87a25da9d8822d48ed831a88bb4ba7fa636ddb6d6a725f73688546052cb7f2c355758e4839f9416e6cc0e37e1e3070f597af2836d39768a5ecc050db',
},
{
parseAs: 'text',
}
);
Example: Get all transactions
http.request('GET','/transactions')
Interfaces
OpenHIMGetTasksOptions
Get tasks query options
Properties
Name | Type | Description |
---|---|---|
taskId | string | The ID of the task to retrieve. If provided, only this task will be returned. |
filterLimit | number | The maximum number of tasks to return. Defaults to 100. |
filterPage | number | The page to return (used in conjunction with filterLimit). |
filters | object | Advanced filters to apply to the tasks. This is a JSON object that can include properties like response.status or properties.prop . |
OpenHIMGetTransactionsOptions
Get transactions query options
Properties
Name | Type | Description |
---|---|---|
transactionId | string | The ID of the transaction to retrieve. If provided, only this transaction will be returned. |
filterLimit | number | The maximum number of transactions to return. Defaults to 100. |
filterPage | number | The page to return (used in conjunction with filterLimit). |
filterRepresentation | object | Determines how much information for a transaction to return. |
filters | object | Advanced filters to apply to the transactions. This is a JSON object that can include properties like response.status or properties.prop . |
RequestOptions
Options provided to the OpenHIM request
Properties
Name | Type | Description |
---|---|---|
body | object | string | body data to append to the request. JSON will be converted to a string. |
errors | object | Map of errorCodes -> error messages, ie, { 404: 'Resource not found;' } . Pass false to suppress errors for this code. |
query | object | An object of query parameters to be encoded into the URL. |
headers | object | An object of headers to append to the request. |
parseAs | string | The format to parse the response body as. Defaults to json . Accepted values: json , stream , and text . |