Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Current »

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 calculate 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 https://www.unixtimestamp.com/index.php .

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)
}​
API Explorer will be opened

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
  }
}
API Explorer will be opened

Response:

{
  "data": {
    "statisticDataMetricByGranularity": [
      {
        "from": 1589185800,
        "to": 1589186700,
        "value": 20
      },
      {
        "from": 1589186700,
        "to": 1589187600,
        "value": 12
      }
      ...
    ]
  }
}

  • No labels