Skip to main content

fhir@3.1.0

Functions

create(path, params, callback)
createTransactionBundle(params, callback)
get(path, query, callback)
getClaim(claimId, query, callback)

The following functions are exported from the common adaptor:

alterState()
dataPath()
dataValue()
dateFns()
each()
field()
fields()
fn()
lastReferenceValue()
merge()
sourceValue()

create

create(path, params, callback) ⇒ Operation

Creates a resource in a destination system using a POST request

ParamTypeDescription
pathstringPath to resource
paramsobjectdata to create the new resource
callbackfunction(Optional) callback function

Example

create("Bundle", {...state.data: type: "collection"})

createTransactionBundle

createTransactionBundle(params, callback) ⇒ Operation

Creates a transactionBundle for HAPI FHIR

ParamTypeDescription
paramsobjectdata to create the new transaction
callbackfunction(Optional) callback function

Example

createTransactionBundle({
resourceType: "Bundle",
type: "transaction",
entry: [
{
fullUrl: "https://hapi.fhir.org/baseR4/Patient/592442",
resource: {
resourceType: "Patient",
id: "592442",
name: [{ given: "Caleb", family: "Cushing" }],
},
request: {
method: "POST",
url: "Patient",
},
},
],
});

get

get(path, query, callback) ⇒ Operation

Get a resource in a FHIR system

ParamTypeDescription
pathstringPath to resource
queryobjectdata to get the new resource
callbackfunction(Optional) callback function

Example (Get Claim from FHIR with optional query)

get("Claim", { _include: "Claim:patient", _sort: "-_lastUpdated", _count: 200 })

Example (Get Patient from FHIR)

get('Patient');

getClaim

getClaim(claimId, query, callback) ⇒ Operation

Get Claim in a FHIR system

ParamTypeDescription
claimIdstring(optional) claim id
queryobject(optinal) query parameters
callbackfunction(Optional) callback function

Example

getClaim({ _include: "Claim:patient", _sort: "-_lastUpdated", _count: 200 });

request

request ⇒

This is an asynchronous function that sends a request to a specified URL with optional parameters and headers, and returns the response data in JSON format.

Returns: The request function is returning the parsed JSON data from the response of the HTTP request made to the specified url with the given params and method. If there is an error in the response, the function will throw an error.

ParamTypeDefaultDescription
urlstringThe URL of the API endpoint that the request is being made to.
[params]objectAn object containing any additional parameters to be sent with the request, such as query parameters or request body data. It is an optional parameter and defaults to an empty object if not provided.
[method]string"GET"The HTTP method to be used for the request. It defaults to 'GET' if not specified.