Using a data file data source

You can use raw data stored in a file using the data_file datasource.

It works this way :

  1. You upload a data file in the platform using the data_file API

  2. You reference this file in the dashboard as a dataset

  3. This source can then be transformed and display like all other data sources.

Upload your raw data in the platform

Use the data_file API to upload any JSON file containing your raw data. Its structure is not fixed.

Sample JSON
  {
      "id": "1",
      "name": "Demographics",
      "other_metadata_as_you_wish": "SEGMENT",
      "genders": [
          {
            "key": "male",
            "value": 358
          },
          {
            "key": "female",
            "value": 66
          }
      ],
      "ages": [
        {
          "key": "18-24",
          "count": 277
        },
        {
          "key": "45-54",
          "count": 8
        },
        {
          "key": "65+",
          "count": 9
        },
        {
          "key": "25-34",
          "count": 12
        },
        {
          "key": "35-44",
          "count": 9
        },
        {
          "key": "55-64",
          "count": 3
        }
    ],
    "total": 666
}

There are two types of datasets that you can use :

Key / value dataset

A default key / value dataset is an array of key / value objects.

The value property could be named differently, such as count or value-1 by using the series_title property of the data source.

Number dataset

Reference this file in your charts

The whole structure of the dashboard is exactly the same as with other data sources.

The data source declaration is :

Here is an example with the JSON file we used previously

You can use a {SEGMENT_ID} token in uri and/or JSON_path properties. It will be replaced by the current segment if the dashboard is loaded on a segment's page. If the dashboard is loaded at any other scope, the token will not be replaced.

Last updated

Was this helpful?