santempi@1.0.0
This adaptor exports the following namespaced functions:
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
| 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 HTTP server, including headers, statusCode, body, etc |
| references | an 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
| 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 HTTP server, including headers, statusCode, body, etc |
| references | an 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
| 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 HTTP server, including headers, statusCode, body, etc |
| references | an 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
| Name | Type | Description |
|---|---|---|
| query | object | An object of query parameters to be encoded into the URL. |
| headers | object | An object of headers to append to the request. |
SanteMPIHttpState
State object
Properties
| Name | Description |
|---|---|
| data | the parsed response body |
| response | the response from the HTTP server, including headers, statusCode, body, etc |
| references | an array of all previous data objects used in the Job |