fhir@5.0.3
- create(resourceType, resource, params, callback)
- createTransactionBundle(entries, callback)
- get(path, params, options, callback)
- getClaim(claimId, params, callback)
- post(path, data, options, callback)
This adaptor exports the following from common:
- alterState()
- dataPath()
- dataValue()
- dateFns
- each()
- field()
- fields()
- fn()
- fnIf()
- lastReferenceValue()
- merge()
- sourceValue()
Functions
create
create(resourceType, resource, params, callback) ⇒ Operation
Creates a new resource with a server assigned resourceType. The resource object doesn't need resourceType or id
Param | Type | Description |
---|---|---|
resourceType | string | The resource type to create |
resource | object | The resource to create |
params | object | (Optional) FHIR parameters to control and configure resource creation |
callback | function | (Optional) callback function |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the FHIR HTTP server (with the body removed) |
references | an array of all the previous data values |
Example: Create a new patient
create('Patient', {
name: [
{
use: 'official',
family: 'La Paradisio',
given: ['Josephine', 'Nessa'],
},
],
});
createTransactionBundle
createTransactionBundle(entries, callback) ⇒ Operation
Create a transaction bundle to process multiple requests at once
Param | Type | Description |
---|---|---|
entries | array | array of transactions |
callback | function | (Optional) callback function |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the FHIR HTTP server (with the body removed) |
references | an array of all the previous data values |
Example
createTransactionBundle([
{
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, params, options, callback) ⇒ Operation
Send a HTTP GET request to the baseURL defined in config
Param | Type | Description |
---|---|---|
path | string | Path to resource |
params | object | (Optional) Parameters to encode into the URL query |
options | GetOptions | (Optional) Options to control the request |
callback | function | (Optional) callback function |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the FHIR HTTP server (with the body removed) |
references | an array of all the previous data values |
Example: Get a Patient resource by id
get('Patient/0bd0038b-8aad-4719-8d55-ff94bd3de5d0');
Example: Get a resource with query parameters
get("Claim", { _include: "Claim:patient", _sort: "-_lastUpdated", _count: 200 })
getClaim
getClaim(claimId, params, callback) ⇒ Operation
Get Claim in a FHIR system
Param | Type | Description |
---|---|---|
claimId | string | claim id |
params | object | query parameters |
callback | function | callback function |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the FHIR HTTP server (with the body removed) |
references | an array of all the previous data values |
Example
getClaim('',{ _include: "Claim:patient", _sort: "-_lastUpdated", _count: 200 });
post
post(path, data, options, callback) ⇒ Operation
Send a HTTP POST request to the baseURL defined in config
Param | Type | Description |
---|---|---|
path | string | Path to resource |
data | object | JSON data to append to the POST body |
options | RequestOptions | (Optional) Additional options for the request |
callback | function | (Optional) callback function |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the FHIR HTTP server (with the body removed) |
references | an array of all the previous data values |
Example: Create bundle
post("Bundle",{
"resourceType": "Bundle"
})
Interfaces
GetOptions
Options provided to a GET HTTP request
Properties
Name | Type | Description |
---|---|---|
errors | object | Map of errorCodes -> error messages, ie, { 404: 'Resource not found;' } . Pass false to suppress errors for this code. |
timeout | number | Request timeout in ms. Default: 300 seconds. |
RequestOptions
Options provided to a HTTP request
Properties
Name | Type | Description |
---|---|---|
headers | object | Object of headers to append to the request |
body | object | JSON payload to attach to the request |
query | object | Query parameters for the request. Will be encoded into the URL |
errors | object | Map of errorCodes -> error messages, ie, { 404: 'Resource not found;' } . Pass false to suppress errors for this code. |
timeout | number | Request timeout in ms. Default: 300 seconds. |