Constructor
new Behavior()
- Source:
Methods
(async) getBehaviors(documentDb, input) → {Promise.<Object>}
- Description:
- returns an object containing an array of behaviors.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
let input = {sensorId: "abc", fromTimestamp: "2023-01-12T11:20:10.000Z", toTimestamp: "2023-01-12T14:20:10.000Z"};
let behaviorMetadata = new mdx.Services.Behavior();
let behaviorResult = await behaviorMetadata.getBehaviors(elastic,input);
Parameters:
Name |
Type |
Description |
documentDb |
Database
|
Database Object |
input |
Object
|
Input object.
Properties
Name |
Type |
Attributes |
Default |
Description |
sensorId |
string
|
<optional>
|
|
Either sensorId or place should be present. |
place |
string
|
<optional>
|
|
Either sensorId or place should be present. |
objectId |
string
|
<optional>
<nullable>
|
null
|
objectId can be present only if (sensorId, fromTimestamp and toTimestamp) are present. objectId can't be used together with either queryString or maxResultSize. |
fromTimestamp |
string
|
<optional>
|
|
Either queryString or (fromTimestamp and toTimestamp) or (queryString, fromTimestamp and toTimestamp) should be present. |
toTimestamp |
string
|
<optional>
|
|
Either queryString or (fromTimestamp and toTimestamp) or (queryString, fromTimestamp and toTimestamp) should be present. |
queryString |
string
|
<optional>
|
|
queryString follows lucene syntax. Either queryString or (fromTimestamp and toTimestamp) or (queryString, fromTimestamp and toTimestamp) should be present. queryString and objectId can't occur together. |
maxResultSize |
number
|
<optional>
|
25
|
maxResultSize must be an integer. objectId and maxResultSize can't occur together. If objectId is not null, then maxResultSize is set to 1. |
|
Returns:
An object containing an array of behaviors is returned
-
Type
-
Promise.<Object>
(async) getBehaviorsUsingIdsAndTimestamp(documentDb, input) → {Promise.<Object>}
- Description:
- returns an object containing an array of behaviors.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
let input = {behaviorInfo:[{sensorId: "abc", objectId: "200", timestamp: "2023-01-12T14:20:10.000Z"},{sensorId: "def", objectId: "210", timestamp: "2023-01-12T14:24:10.000Z"}]};
let behaviorMetadata = new mdx.Services.Behavior();
let behaviorResult = await behaviorMetadata.getBehaviorsUsingIdsAndTimestamp(elastic,input);
Parameters:
Name |
Type |
Description |
documentDb |
Database
|
Database Object |
input |
Object
|
Input object.
Properties
Name |
Type |
Description |
behaviorInfo |
Array.<{sensorId:string, objectId:string, timestamp:string}>
|
|
|
Returns:
An object containing an array of behaviors is returned
-
Type
-
Promise.<Object>
(async) getLocationsOfBehaviors(documentDb, input) → {Promise.<Object>}
- Description:
- returns the locations of a given set of input behaviors.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
let input = {fromTimestamp: "2023-01-12T11:20:10.000Z", toTimestamp: "2023-01-12T14:20:10.000Z", behaviorIds: ["abc #-# 272","def #-# 2152"]};
let behaviorMetadata = new mdx.Services.Behavior();
let behaviorPts = await behaviorMetadata.getLocationsOfBehaviors(elastic,input);
Parameters:
Name |
Type |
Description |
documentDb |
Database
|
Database Object |
input |
Object
|
Input object.
Properties
Name |
Type |
Description |
fromTimestamp |
string
|
|
toTimestamp |
string
|
|
behaviorIds |
Array.<string>
|
|
|
Returns:
An object containing locations of the input behaviors is returned
-
Type
-
Promise.<Object>
(async) getPts(documentDb, input) → {Promise.<Object>}
- Description:
- returns the start and end pts of a behavior.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
let input = {sensorId: "abc", endFrameId: 200, behaviorTimeInterval: 20};
let behaviorMetadata = new mdx.Services.Behavior();
let behaviorPts = await behaviorMetadata.getPts(elastic,input);
Parameters:
Name |
Type |
Description |
documentDb |
Database
|
Database Object |
input |
Object
|
Input object.
Properties
Name |
Type |
Description |
sensorId |
string
|
|
endFrameId |
number
|
endFrameId must be an integer. |
behaviorTimeInterval |
number
|
|
|
Returns:
Start and end pts of a behavior is returned
-
Type
-
Promise.<Object>
(async) getTimestampOfBehavior(documentDb, input) → {Promise.<?string>}
- Description:
- returns the start timestamp of a behavior.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
let input = {sensorId: "abc", objectId: "200", timestampWithinBehavior: "2023-01-12T14:20:10.000Z"};
let behaviorObject = new mdx.Services.Behavior();
let timestamp = await behaviorObject.getTimestampOfBehavior(elastic,input);
Parameters:
Name |
Type |
Description |
documentDb |
Database
|
Database Object |
input |
Object
|
Input object.
Properties
Name |
Type |
Description |
sensorId |
string
|
|
objectId |
string
|
|
timestampWithinBehavior |
string
|
|
|
Returns:
Start timestamp of a behavior is returned
-
Type
-
Promise.<?string>
(static) getMaxBehaviorsInLocationQuery() → {number}
- Description:
- returns the max behaviors that can be present in location query.
- Source:
Example
let result = mdx.Services.Behavior.getMaxBehaviorsInLocationQuery();
Returns:
Max behaviors that can be present in location query is returned. The returned value must be an integer.
-
Type
-
number