Skip to main content

lamisplus@0.1.1

getPatients(query)

This adaptor exports the following namespaced functions:

http.post(path, data, [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

Functions

getPatients

getPatients(query) ⇒ Operation

Get Patient resources from LAMISPlus

ParamTypeDescription
querystringQuery params, eg size, page

Example

Get all patients
getPatients()

Example

Get a single patient
getPatients({ size: 1})

http

These functions belong to the http namespace.

http.post

post(path, data, [options]) ⇒ operation

Make a POST request to a LAMISPlus endpoint

ParamTypeDefaultDescription
pathstringpath to resource
dataanythe body data in JSON format
[options]HTTPRequestOptions{}An object containing query params and headers for the request

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 patient

http.post(
'/plugin/ehr/api/v1/patient/',
{
name: 'John doe',
},
);

http.request

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

Make a general HTTP request

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

request("POST", "patient", { "name": "Bukayo" });

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
bodyobject | stringbody data to append to the request. JSON will be converted to a string (but a content-type header will not be attached to the request).
errorsobjectMap of errorCodes -> error messages, ie, { 404: 'Resource not found;' }. Pass false to suppress errors for this code.
formobjectPass a JSON object to be serialised into a multipart HTML form (as FormData) in the body.
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.
timeoutnumberRequest timeout in ms. Default: 300 seconds.
tlsobjectTLS/SSL authentication options. See https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions