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
| Param | Type | Description |
|---|---|---|
| path | string | Path to resource |
| options | RequestOptions | Optional 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
| Param | Type | Description |
|---|---|---|
| data | object | Object containing siteid and sample_uids array |
| options | RequestOptions | Optional request options |
This operation writes the following keys to state:
| State Key | Description |
|---|---|
| data | the parsed response body |
| response | the response from the HTTP server, including headers, statusCode, body, etc |
| references | an 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
| Param | Type | Description |
|---|---|---|
| path | string | Path to resource |
| body | object | Body data |
| options | RequestOptions | Optional 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
| Param | Type | Description |
|---|---|---|
| data | object | Object containing siteid and samples array |
| options | RequestOptions | Optional request options |
This operation writes the following keys to state:
| State Key | Description |
|---|---|
| data | the parsed response body |
| response | the response from the HTTP server, including headers, statusCode, body, etc |
| references | an 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
| Param | Type | Description |
|---|---|---|
| processor | function | Function that receives (state, processResults) where processResults transforms IBIPIMO response into structured format |
This operation writes the following keys to state:
| State Key | Description |
|---|---|
| data | the parsed response body |
| response | the response from the HTTP server, including headers, statusCode, body, etc |
| references | an 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
| Param | Type | Description |
|---|---|---|
| processor | function | Function that receives (state, processSubmission) where processSubmission transforms IBIPIMO submission response |
This operation writes the following keys to state:
| State Key | Description |
|---|---|
| data | the parsed response body |
| response | the response from the HTTP server, including headers, statusCode, body, etc |
| references | an 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
| Param | Type | Description |
|---|---|---|
| method | string | HTTP method to use |
| path | string | Path to resource (include /api/v1/ if needed) |
| options | RequestOptions | Optional request options |
This operation writes the following keys to state:
| State Key | Description |
|---|---|
| data | the parsed response body |
| response | the response from the HTTP server, including headers, statusCode, body, etc |
| references | an 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
| Name | Description |
|---|---|
| data | the parsed response body |
| response | the response from the HTTP server, including headers, statusCode, body, etc |
| references | an array of all previous data objects used in the Job |
RequestOptions
Options provided to the HTTP request
Properties
| Name | Type | Description |
|---|---|---|
| body | object | string | body 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). |
| errors | object | Map of errorCodes -> error messages, ie, { 404: 'Resource not found;' }. Pass false to suppress errors for this code. |
| form | object | Pass a JSON object to be serialised into a multipart HTML form (as FormData) in the body. |
| query | object | An object of query parameters to be encoded into the URL. |
| headers | object | An object of headers to append to the request. |
| parseAs | string | Parse the response body as json, text or stream. By default will use the response headers. |
| timeout | number | Request timeout in ms. Default: 300 seconds. |
| tls | object | TLS/SSL authentication options. See https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions |