website logo
IntelliProve
Insights & Biomarkers
API documentation
SDK Documentation
Navigate through spaces
⌘K
Python SDK
NodeJS SDK
JavaScript Streaming SDK
Docs powered by archbee 

NodeJS SDK

The NodeJS SDK enables you to use IntelliProves features with ease.

Requirements

  • NodeJS

This SDK only provides tools for back-end servers. This is due to the requirement of File IO. Our front-end SDK can be found here: https://docs.intelliprove.com/sdk

Tested on

  • NodeJS 16.x
  • NodeJS 18.x
  • NodeJS 19.x

Support is guaranteed for the NodeJS versions mentioned above. Other versions are most likely supported but not tested.

Recommendations

We recommend the use of TypeScript as it provides type hints and a better developer experience. However our SDK works as CommonJS as well.

Installation

You can find our SDK on the node package manager repository for easy installation:

https://www.npmjs.com/package/intelliprove-sdk

Shell
|
npm add intelliprove-sdk


Updating the sdk

Shell
|
npm update intelliprove-sdk


Authentication

More info on authentication and the API key can be found here: API docs .

Functionality

Check conditions

Check the quality of a given image before upload. Returns a QualityResponse object with feedback on whether your video/image is usable and why it might not be usable.

Parameters:

  • path: string - path to the a image you want to run the quality check on
JS
Node.js
|
const APIKEY = "";
const IMAGE_PATH = "/path/to/image.jpg";

const intelliprove = new IntelliProveSDK(APIKEY);

intelliprove.check(IMAGE_PATH)
.then(response => {
  console.log(response.success());
}).catch(message => {
  console.log(message);
});




Upload a video

Easily upload a video to IntelliProve for analysis of the subject's biomarkers. Returns the uuid of the uploaded video, which can be used to get the results.

NOTE: The quality check needs to be successful before you can upload a video.

Parameters:

  • path: str - path to the video you want to process
  • quality_response: QualityResponse - the response from the quality check method
  • patient: string - An optional field to set the patient reference
  • performer: string - An optional field to set the performer reference
JS
Node.js
|
const VIDEO_PATH = "/path/to/video.mp4";
const performer = "Dr. John Doe";
const patient = "John Doe";

intelliprove.upload(VIDEO_PATH, quality_response, performer, patient)
.then(uuid => {
  console.log(uuid);
}).catch(message => {
  console.log(message);
});




Get the results of a video

Returns the results of a processed video for a given uuid as a Biomarkers object.

NOTE: This uses long polling, when demand is high this call can take a while.

Parameters:

  • uuid: string - The UUID returned by the upload method
JS
Node.js
|
const uuid = "";

intelliprove.results(uuid)
.then(biomarkers => {
  console.log(biomarkers);
}).catch(message => {
  console.log(message);
});




Get the current customers info

Get the current customers information by API key.

JS
Node.js
|
intelliprove.userInfo()
.then(userInfo => {
  console.log(userInfo);
});




Models

Those are simple representations of the models accessible through the SDK and their helper functions. All models have a .json() method to convert it to a normal JS object in case this is preferred.

QualityResponse

Describes the quality of an image.

JS
|
class QualityResponse {
    score: number;
    error_type: number;
    message: string;
    signature: string;
}


Helpers

  • success(): boolean - Has the quality check succeeded

BiomarkersResponse

Holds the results of an analysed video after upload.

JS
|
class BiomarkersResponse {
    epoch: string;
    timestamp: Date;
    heart_rate: string;
    respiratory_rate: string;
    heart_rate_variability: string;
    ans_balance: string;
    resonant_breathing_score: string;
    morning_readiness: string;
    acute_mental_stress_score: string;
    mental_health_risk: string;
}


UserInfo

Contains information of the current user.

JS
|
class UserInfo {
    email: string;
    group: string;
    customer: string;
}


Helpers

  • hasEmail(): boolean - Has the customer a valid email
  • isAdmin(): boolean - Is the current customer an administrator for their organisation
  • isContributor(): boolean - Is the current customer a contributor
  • isUser(): boolean - Is the current customer a regular user



Example usage

Provided with a valid API key and a valid image and video path, this code snippet runs from start to finish and prints out each intermediate result to the console.

JS
Node.js
|
import IntelliProveSDK from 'intelliprove-sdk';

const APIKEY = "";

const IMAGE_PATH = "/path/to/image.jpg";
const VIDEO_PATH = "/path/to/video.mp4";

const intelliprove = new IntelliProveSDK(APIKEY);

try {
    // Do a quality check on an image saved to disk
    const quality_response = await intelliprove.check(IMAGE_PATH);
    // Upload a video for processing
    const uuid = await intelliprove.upload(VIDEO_PATH, quality_response);
    
    // Get the results of the uploaded video for the first time
    const results = await intelliprove.results(uuid);
    console.log(results);

    // Get the current user/customer by authentication credentials
    const user = await intelliprove.userInfo();
    console.log(user);

} catch (error) {
    console.error(error);
}

// You can also use 'then' and 'catch'
intelliprove.results(uuid).then(biomarkers => {
    console.log(biomarkers);
}).catch(err => {
    console.error(err);
});




PREVIOUS
Python SDK
NEXT
JavaScript Streaming SDK
Docs powered by archbee 
TABLE OF CONTENTS
Requirements
Tested on
Recommendations
Installation
Updating the sdk
Authentication
Functionality
Check conditions
Upload a video
Get the results of a video
Get the current customers info
Models
QualityResponse
Helpers
BiomarkersResponse
UserInfo
Helpers
Example usage