Skip to main content

santempi@1.0.0

This adaptor exports the following namespaced functions:

http.get(path, options)
http.post(path, body, options)
http.request(method, path, body, options)

This adaptor exports the following from common:

as()
combine()
cursor()
dataPath()
dataValue()
dateFns
each()
field()
fields()
fn()
fnIf()
group()
lastReferenceValue()
map()
merge()
scrubEmojis()
sourceValue()
util

http

These functions belong to the http namespace.

http.get

get(path, options) ⇒ Operation

Make a GET request

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 HTTP server, including headers, statusCode, body, etc
referencesan array of all previous data objects used in the Job

Example: Search for a FHIR Patient by identifier

http.get('/fhir/Patient', {
headers: { Accept: 'application/fhir+json' },
query: { identifier: 'http://ohie.org/National_Id|NIN-001-TEST' }
});

Example: Get an HDSI concept by reference term

http.get('/hdsi/Concept', {
query: {
'referenceTerm.mnemonic': 'id_category',
'referenceTerm.codeSystem.url': 'http://test.ohie.org/'
}
});

http.post

post(path, body, options) ⇒ Operation

Make a POST request

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 HTTP server, including headers, statusCode, body, etc
referencesan array of all previous data objects used in the Job

Example: Register a new Patient built with openfn's fhir-4 builders

http.post('/fhir/Patient', state => builders.patient({
identifier: [
builders.identifier({
use: 'official',
system: 'http://ohie.org/National_Id',
value: 'NIN-001-TEST',
}),
],
name: [{ use: 'official', family: 'Nakamura', given: ['Aiko'] }],
gender: 'female',
birthDate: '1992-04-10',
}), {
headers: {
Accept: 'application/fhir+json',
'Content-Type': 'application/fhir+json'
}
});

Example: Create an Assigning Authority on the AMI surface

http.post('/ami/AssigningAuthority', {
$type: 'AssigningAuthority',
name: 'Test National ID Authority',
domainName: 'TEST-NIN',
oid: '2.16.800.1.113883.3.9999.5.1',
url: 'http://test.ohie.org/National_Id',
isUnique: false,
});

http.request

request(method, path, body, options) ⇒ Operation

Make a general HTTP request

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 HTTP server, including headers, statusCode, body, etc
referencesan array of all previous data objects used in the Job

Example: Match a patient using the FHIR $match operation

http.request('POST', '/fhir/Patient/$match', {
resourceType: 'Parameters',
parameter: [
{
name: 'resource',
resource: {
resourceType: 'Patient',
identifier: [{ system: 'http://ohie.org/National_Id', value: 'NIN-001-TEST' }],
name: [{ family: 'Nakamura', given: ['Aiko'] }],
gender: 'female',
birthDate: '1992-04-10',
}
},
{ name: 'count', valueInteger: 5 }
]
}, {
headers: {
Accept: 'application/fhir+json',
'Content-Type': 'application/fhir+json'
}
});

Example: Get all AMI match configurations

http.request('GET', '/ami/MatchConfiguration');

Interfaces

RequestOptions

Options provided to santeMPI HTTP requests

Properties

NameTypeDescription
queryobjectAn object of query parameters to be encoded into the URL.
headersobjectAn object of headers to append to the request.

SanteMPIHttpState

State object

Properties

NameDescription
datathe parsed response body
responsethe response from the HTTP server, including headers, statusCode, body, etc
referencesan array of all previous data objects used in the Job