@nuralogix.ai/dfx-api-client / HTTP / Measurements

Measurements

Measurements end points

Measurements are individual one-time captures of blood flow data. A single measurement record could represent multiple models of data analysis, hence this data structure supports lookup parameters to filter them.

Note: A valid License is required in order to create Measurements and submit data chunks for processing. Please make sure to call Register License endpoint first to receive a Device Token that grants access to these functions. Next, in order to have your user information associated with the measurements, you can use User Login endpoint to obtain a User Token, which can be used to take measurements as well.

Important: If your License Type is SDK_DEVICE, you must login and obtain a User Token as this License Type only allows to perform a login operation.

Sample code

const apiClient = client();
const response = await apiClient.http.measurements.retrieve('your-measurement-id');
const { status, body } = response;
if (status !== '200') {
    /**
     * TypeScript knows that once we are inside this block, the only response
     * shape that matches a non "200" response is the ErrorResponse
    */
    throw body;
}
/** Otherwise the shape of the response is MeasurementRetrieved200Response */
console.log(body.StatusID);

Methods

create

create(data)

Begins a new data capture session and returns a measurement ID property, which should be referenced for adding data chunks and retreiving results.

Resolution: currently can be either 0 or 100. (default is 100)

  • 100 means the result set will have 100% of the original size

  • 0 returns 1 value per signal

PartnerID is mandatory or optional (based on License policy).

Endpoint Action ID = 504

Parameters

NameType
dataMeasurementCreateRequest

Returns

Promise<ErrorResponse | MeasurementCreated200Response>


data

data(id, data)

Adds collected blood-flow data to a specific measurement. Upon submitting a chunk of data, the API will return a MeasurementDataID value representing the received chunk. Data must be sent to the server in the order produced by the DFX SDK. If a chunk it sent out of order, the server will return an error. Please ensure that new chunks are only sent after the server responds with a MeasurementDataID.

Submitting measurements has three stages:

a) starting,

b) measurement body,

c) closing a measurement.

Each of these phases have the same payload structure however a different Action flag is to be sent with each request and must follow the CHUNK::ACTION format.

Measurement Actions | Description

FIRST::PROCESS | Start a new measurement (drop any existing), Process results

FIRST::IGNORE | Start a new measurement (drop any existing), Do not process

CHUNK::PROCESS | Arbitrary block of TOI data and process results

CHUNK::IGNORE | Arbitrary block of TOI data and do not process results

LAST::PROCESS | Finish a measurement cycle and process results

LAST::IGNORE | Finish a measurement cycle and do not process

Payload is binary data that can currently only be obtained by using our SDK. The Payload (binary content) field must be base64-encoded.

Note: This endpoint is a subject to request throttling, you must not submit more data than can be obtained in real time. i.e., do not send more than five seconds of chunk data over the course of five seconds of real time.

Response Error Codes Explanation:

  • "RATE_LIMIT": You have sent too many chunks in a given time period. See the Note above.
  • "MEASUREMENT_CLOSED": Requested Measurement is already finished. You need to create a new Measurement.
  • "MISALIGNED_CHUNK": Chunk Order was mismatched. i.e., ChunkOrder 2 was sent before ChunkOrder 1.
  • "INVALID_MEASUREMENT": Requested Measurement ID was not found.
  • "UNPACKER_RPC_ERROR": Payload validation has been failed. Reason(s) will be provided in error message.

Endpoint Action ID = 506

Parameters

NameType
idstring
dataMeasurementAddDataRequest

Returns

Promise<ErrorResponse | MeasurementAddData200Response>


delete

delete(id)

Only DFX_ORG_ADMIN has permission to delete a specific measurment by measurement ID for its own organization.

Endpoint Action ID = 507

Parameters

NameType
idstring

Returns

Promise<ErrorResponse | MeasurementDelete200Response>


list

list(data)

Provides a historical list of measurements captured by the API store. The results of the measurements are captured and only displayed for the current application providers token designator. Each record has a status representing its cycle in the system:

Status Message | Description

  • CAPTURING | A new record was created and results are being received.
  • PROCESSING | Capture is complete and the record is processing.
  • COMPLETE | The analysis is complete and ready for consumption.
  • ERROR | An error occurred during processing.
  • INCOMPLETE | Capturing process returned as incomplete/not enough data.

Endpoint Action ID = 501

Parameters

NameType
dataMeasurementListRequest

Returns

Promise<ErrorResponse | MeasurementList200Response>


retrieve

retrieve(id)

Returns the results of a measurement request specified by the UUID in the endpoint request. This payload will change according to the different requested signals.

Endpoint Action ID = 500

Parameters

NameType
idstring

Returns

Promise<ErrorResponse | MeasurementRetrieved200Response>