Accessing KPI metrics

There are several queries you can use to get KPI metrics.

1) query statisticData

Returns single value for one object for specified time interval. For example: Number of visitors from store XY last week. If you are not sure whether to use query statisticData or statisticDataMetric, use statisticDataMetric. This function return raw data stored in database. You have to query the data source directly (camera not the store).

Some available metrics:

  • peopleCountIn - number of of people coming into the store.

  • transactionCountIn - number of positive payment transactions

  • transactionCountOut - number of negative payment transactions 

  • peopleCountPassBy - number of people passing by the store.

More metric types are available in GraphQL scheme / explorer. See StatisticDataMetricType.


2) statisticDataMetric

It is similar to statisticData but it can provide more useful data.

  • It summarizes data for the whole store, not only for one camera

  • It calculates conversion ratios etc.

For example: Number of visitors from one store where all store cameras are in location (folder) "San Diego Store" for January 2022.

Available metrics:

  • peopleCountAverage - number of visitors 

  • peopleCountPassBy - number of visitors passing by the store

  • transactionCountPositive - number of positive transactions

  • transactionCountNegative - number of negative transactions

  • conversionCount - conversion rate: (number of positive transactions / number of visitors) * 100

More metric types are available in GraphQL scheme / explorer. See StatisticDataMetricType.


3) statisticDataMetricByGranularity

It is similar to statisticDataMetric but it can return more values in a single query. For example: Number of visitors from one folder "San Diego Store" each day separately for January 2022. (granularity for this example is D).

Granularity:

  1. HQ - 15 minutes

  2. H - hour

  3. H4 - 4 hours

  4. H8 - 8 hours

  5. H12 - 12 hours

  6. D - day

  7. W - week

  8. M - month

 

All metrics in the system are stored with 15 minutes resolution. If query does not align to 15 minutes interval, API will calculate the result using nearby intervals.

Parameters "from" and "to" are in Unix Timestamp format. For testing purposes you can use Unix Time Stamp - Epoch Converter .

 

Example 1 - Fetching single value:

Query to a folder returns aggregated peopleCountAverage for all cameras in the folder:

query { statisticDataMetric(from:1589186000, to:1589186780, type:peopleCountAverage,node_id:140094) }​

Response:

{ "data": { "statisticDataMetric": 57 } }

 

Example 2 - Fetching multiple values (time series):

Query to a folder returns an aggregated peopleCountAverage in 15 minutes granularity:

{ statisticDataMetricByGranularity(from: 1589186000, to: 1589186780, type: peopleCountAverage, node_id: 63575, granularity: HQ) { from to value } }

Response:

 

 Related articles