Skip to main content

ihris@1.0.0

This adaptor exports the following namespaced functions:

http.get(resource, options)
http.post(resource, body, options)
http.put(resource, 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(resource, options) ⇒ Operation

Get a FHIR resource by ID or list all resources of a type

ParamTypeDescription
resourcestringFHIR resource type
optionsobjectOptions including headers and query parameters

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: List all practitioners

http.get('/fhir/Practitioner');

Example: List a specific practitioner by ID

http.get('/fhir/Practitioner/P10004');

Example: Get active practitioners, limit to 1 result

http.get('/fhir/Practitioner', {
query: {
active: true,
_count: 1,
},
});

http.post

post(resource, body, options) ⇒ Operation

Create a new FHIR resource

ParamTypeDescription
resourcestringFHIR resource type
bodyobjectFHIR resource data
optionsobjectOptional 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: Create a new Practitioner resource

 http.post('/fhir/Practitioner',  {
"resourceType": "Practitioner",
"meta": {
"versionId": "1",
"lastUpdated": "2024-08-06T06:13:10.163+00:00",
"source": "#m5UGgxqUFEI7qIRF",
"profile": [
"http://ihris.org/fhir/StructureDefinition/ihris-practitioner"
]
},
"extension": [
// ... extension data
],
"active": true,
"name": [
{
"use": "official",
"text": "Tekiokion Traifrop",
"family": "Traifrop",
"given": [
"Tekiokion"
]
}
],
"gender": "male",
"birthDate": "1979-01-01",
"qualification": [
{
"code": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0360|2.7",
"code": "BA"
}
],
"text": "Bachelor of Arts"
}
}
]
});

http.put

put(resource, body, options) ⇒ Operation

Update an existing FHIR resource

ParamTypeDescription
resourcestringPath to FHIR resource
bodyobjectUpdated FHIR resource data
optionsobjectOptional 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: Update a Practitioner resource

http.put('/fhir/Practitioner/6462', {
resourceType: 'Practitioner',
id: '6462',
meta: {
versionId: '1',
lastUpdated: '2025-11-03T07:06:59.309+00:00',
source: '#m5UGgxqUFEI7qIRF',
profile: ['http://ihris.org/fhir/StructureDefinition/ihris-practitioner'],
},
extension: [
{
url: 'http://ihris.org/fhir/StructureDefinition/ihris-practitioner-nationality',
valueCoding: {
system: 'urn:iso:std:iso:3166',
code: 'TF',
},
},
{
url: 'http://ihris.org/fhir/StructureDefinition/ihris-practitioner-residence',
valueReference: {
reference: 'Location/TF.W.GAS',
},
},
{
url: 'http://ihris.org/fhir/StructureDefinition/ihris-practitioner-marital-status',
valueCoding: {
system: 'http://terminology.hl7.org/CodeSystem/v3-MaritalStatus',
code: 'S',
},
},
],
active: true,
name: [
{
use: 'official',
text: 'Tekiokionses Traifrop',
family: 'Traifrop',
given: ['Tekiokionses'],
},
],
gender: 'male',
birthDate: '1979-01-01',
qualification: [
{
code: {
coding: [
{
system: 'http://terminology.hl7.org/CodeSystem/v2-0360|2.7',
code: 'BA',
},
],
text: 'Bachelor of Arts',
},
},
],
});

http.request

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

Make a general HTTP request to iHRIS

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: Make a GET request with query parameters

http.request(
'GET',
'/fhir/Practitioner',
{},
{
query: { active: 'true', _count: '10' },
}
);

Interfaces

HttpState

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

RequestOptions

Options provided to the HTTP request

Properties

NameTypeDescription
bodyobjectbody data to append to the request.
queryobjectAn object of query parameters to be encoded into the URL.
headersobjectAn object of headers to append to the request.
parseAsstringParse the response body as json, text or stream. By default will use the response headers.