Skip to main content

ihris@1.1.1

This adaptor exports the following namespaced functions:

fhir.get(path, query)
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

fhir

These functions belong to the fhir namespace.

fhir.get

get(path, query) ⇒ Operation

Make a get request to any FHIR endpoint in iHRIS

ParamTypeDescription
pathstringPath to resource
queryFhirParametersRequest parameters

This operation writes the following keys to state:

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

Example: Get encounters based on lastUpdated field

fhir.get('Encounter', { count: 100, lastUpdated: 'ge2024-01-01T00:00:00Z' })

Example: Get all active practitioner roles for a location

fhir.get('PractitionerRole', {
count: 500,
active: true,
location: 1234,
include: 'PractitionerRole:practitioner',
})

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

FhirParameters

iHRIS FHIR requests parameters options. This combines FHIR search parameters, resource-specific parameters, and pagination options.

Properties

NameTypeDescription
countstringNumber of results to return (_count in FHIR)
sortstringSorting criteria for the results (_sort in FHIR)
includestringResources to include in the response (_include in FHIR)
revincludestringReverse includes to include in the response (_revinclude in FHIR)
summarystringSummary mode for the response (_summary in FHIR)
totalstringWhether to include a total count of matching resources (_total in FHIR)
elementsstringList of elements to include in the response (_elements in FHIR)
containedstringWhether to include contained resources (_contained in FHIR)
containedTypestringType of contained resources (_containedType in FHIR)
idstringLogical ID of the resource to filter on (_id in FHIR)
lastUpdatedstringTimestamp to filter resources last updated after this date (_lastUpdated in FHIR)
tagstringTag to filter resources by (_tag in FHIR)
profilestringProfile URL to filter resources by (_profile in FHIR)
securitystringSecurity labels to filter resources by (_security in FHIR)
textstringText search on narrative content (_text in FHIR)
contentstringFull-text search on resource content (_content in FHIR)
liststringSearch resources included in a particular list (_list in FHIR)
hasstringPerform search based on reference chains (_has in FHIR)
getPagesOffsetstringOffset for pagination, used to skip a number of results (_getpagesoffset in iHRIS)
getPagesstringGet specific pages of resources (_getpages in iHRIS)
bundleTypestringType of bundle to return (e.g., searchset, batch, history) (_bundleType in FHIR)

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.