Skip to main content

ibipimo@1.0.0

get(path, options)
getViralLoadResults(data, options)
post(path, body, options)
postViralLoadRequest(data, options)
processViralLoadResults(processor)
processViralLoadSubmission(processor)
request(method, path, 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

get

get(path, options) ⇒ Operation

Make a GET request

ParamTypeDescription
pathstringPath to resource
optionsRequestOptionsOptional request options (query params, headers, etc.)

Example

get("/api/v1/samples/status");

Example

get("/api/v1/sites", { query: { active: true } });

getViralLoadResults

getViralLoadResults(data, options) ⇒ Operation

Get viral load test results from IBIPIMO

ParamTypeDescription
dataobjectObject containing siteid and sample_uids array
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

getViralLoadResults({
siteid: "77889900",
sample_uids: ["2026010401", "IBI-2024-000001"]
});

post

post(path, body, options) ⇒ Operation

Make a POST request

ParamTypeDescription
pathstringPath to resource
bodyobjectBody data
optionsRequestOptionsOptional request options

Example

post("/api/v1/ask-for-vl-results", { siteid: "77889900", sample_uids: ["2026010401"]});

postViralLoadRequest

postViralLoadRequest(data, options) ⇒ Operation

Post viral load test requests to IBIPIMO

ParamTypeDescription
dataobjectObject containing siteid and samples array
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

postViralLoadRequest({
siteid: "77889900",
samples: [{
sidainfo_uid: "147460",
p_code: "000003",
p_name: "Magara",
p_prename: "Mahire",
p_sex: "M",
p_dob: "1950-01-15",
// ... other required fields
}]
});

processViralLoadResults

processViralLoadResults(processor) ⇒ Operation

The processResults function returns an object with:

  • totalRequested: Number of samples requested
  • totalFound: Number of results available
  • totalPending: Number of samples without published results
  • availableResults: Array of sample results ready for processing
  • pendingSamples: Array of sample UIDs still being processed
  • sampleStatuses: Object with detailed status info per sample
  • notFoundSamples: Array of sample UIDs not found in system
ParamTypeDescription
processorfunctionFunction that receives (state, processResults) where processResults transforms IBIPIMO response into structured format

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

// After getting results from IBIPIMO
getViralLoadResults({
siteid: "77889900",
sample_uids: ["634R", "634W"]
});

// Process the response
processViralLoadResults((state, processResults) => {
const processed = processResults(state.data);

console.log(`Found ${processed.totalFound}/${processed.totalRequested} results`);
console.log(`${processed.totalPending} samples still pending`);

// Use processed data for SIDAInfo integration
return {
...state,
readyForSidaInfo: processed.availableResults,
pendingSamples: processed.pendingSamples
};
});

processViralLoadSubmission

processViralLoadSubmission(processor) ⇒ Operation

The processSubmission function returns: savedSamples, savedCount, errors, errorCount, hasErrors, sampleIds

ParamTypeDescription
processorfunctionFunction that receives (state, processSubmission) where processSubmission transforms IBIPIMO submission response

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

postViralLoadRequest({
siteid: "77889900",
samples: [{ sidainfo_uid: "147460", p_name: "Test" }]
});

processViralLoadSubmission((state, processSubmission) => {
const result = processSubmission(state.data);
if (result.hasErrors) {
return { ...state, submissionFailed: true, errors: result.errors };
}
return { ...state, newSampleIds: result.sampleIds };
});

request

request(method, path, options) ⇒ Operation

Make a general HTTP request

ParamTypeDescription
methodstringHTTP method to use
pathstringPath to resource (include /api/v1/ if needed)
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", "/api/v1/ask-for-vl-results", { siteid: "77889900", sample_uids: ["2026010401"]});

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