Skip to main content

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

ParamTypeDescription
bodyobjectThe channel data to create.

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the OpenHIM server, including headers, statusCode, etc
referencesan 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

ParamTypeDescription
bodyobjectThe task data to create.

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the OpenHIM server, including headers, statusCode, etc
referencesan 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

ParamTypeDescription
channelIdstringOptional channelId to return a specific channel.

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the OpenHIM server, including headers, statusCode, etc
referencesan 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

ParamTypeDescription
clientIdstringOptional clientID to return a specific client.

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the OpenHIM server, including headers, statusCode, etc
referencesan 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

ParamTypeDescription
optionsOpenHIMGetTasksOptionsRequired request options for each request. See OpenHIM Tasks docs

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the OpenHIM server, including headers, statusCode, etc
referencesan 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

ParamTypeDescription
optionsOpenHIMGetTransactionsOptionsOptional request options. See OpenHIM Transactions docs

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the OpenHIM server, including headers, statusCode, etc
referencesan 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

ParamTypeDescription
bodyobjectThe client data to register.

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the OpenHIM server, including headers, statusCode, etc
referencesan 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

ParamTypeDescription
bodyobjectThe client data to update.

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the OpenHIM server, including headers, statusCode, etc
referencesan 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

ParamTypeDescription
pathstringPath to resource with the id of the resource to delete
optionsRequestOptionsOptional request options

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the OpenHIM server, including headers, statusCode, etc
referencesan 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

ParamTypeDescription
pathstringPath to resource
optionsRequestOptionsOptional request options

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the OpenHIM server, including headers, statusCode, etc
referencesan 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

ParamTypeDescription
pathstringPath to resource
bodyobjectObject which will be attached to the POST body
optionsRequestOptionsOptional request options

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the OpenHIM server, including headers, statusCode, etc
referencesan 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

ParamTypeDescription
pathstringPath to resource with the id of the resource to update
bodyobjectObject which will be attached to the PUT body
optionsRequestOptionsOptional request options

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the OpenHIM server, including headers, statusCode, etc
referencesan 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

ParamTypeDescription
methodstringHTTP method to use
pathstringPath to resource
bodyobjectObject which will be attached to the POST body
optionsRequestOptionsOptional request options

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the OpenHIM server, including headers, statusCode, etc
referencesan 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

NameTypeDescription
taskIdstringThe ID of the task to retrieve. If provided, only this task will be returned.
filterLimitnumberThe maximum number of tasks to return. Defaults to 100.
filterPagenumberThe page to return (used in conjunction with filterLimit).
filtersobjectAdvanced 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

NameTypeDescription
transactionIdstringThe ID of the transaction to retrieve. If provided, only this transaction will be returned.
filterLimitnumberThe maximum number of transactions to return. Defaults to 100.
filterPagenumberThe page to return (used in conjunction with filterLimit).
filterRepresentationobjectDetermines how much information for a transaction to return.
filtersobjectAdvanced 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

NameTypeDescription
bodyobject | stringbody data to append to the request. JSON will be converted to a string.
errorsobjectMap of errorCodes -> error messages, ie, { 404: 'Resource not found;' }. Pass false to suppress errors for this code.
queryobjectAn object of query parameters to be encoded into the URL.
headersobjectAn object of headers to append to the request.
parseAsstringThe format to parse the response body as. Defaults to json. Accepted values: json, stream, and text.