Create filter insight¶
UI • interface
Create a new insight from a selection of nodes.
Usage¶
The following are the step's expected inputs and outputs and their specific types.
create_filter_insight({"param": value})
where the object {"param": value}
is optional in most cases and if present may contain any of the parameters described in the
corresponding section below.
Example¶
The following example is the most simple way to create a new insight. It just create an insight of the "age" variable by adding its chart and a title.
create_filter_insight({
"column": "age",
"title": "Age distribution"
})
More examples
The following example creates an insight of the "age" variable by adding its chart, a title and making a filter selection from its 75 percentil to its maximum value.
create_filter_insight({
"column": "age",
"title": "Most aged people",
"selection": "age: >= P75 AND <= MAX"
})
The following example creates an insight of the "cluster" variable by representing it as list.
create_filter_insight({
"column": "cluster",
"title": "Cluster segments",
"columnViewModes": {
"cluster": "list"
}
})
Parameters¶
title: string
Title of the insight.
replayDisabled: string | boolean = False
Indicates if the insight can replay its original state or not.
Must be one of:
"drillDown"
,
"directSelectionInGraph"
,
"nonPersistedColumn"
,
True
,
False
colorColumn: string | null
Column used to color the UI.
relative: boolean
Sets the visualization type to absolute or relative.
statsVisibility: boolean
Useful to shown or not the statistics of the main variable/column.
selection: string
A filter query. See Advanced query filters for more information.
categoricalColumnsOrdering: object
The order in which a variable's categories are displayed. An object configuring for each column a method determining the order of its categories.
Items in categoricalColumnsOrdering
*param: string
Order of the categories in a specific column. Note that all parameters should have the same type.
Must be one of:
"BACKGROUND"
,
"FOREGROUND"
,
"UPLIFT"
,
"TFIDF"
,
"ORDINAL"
categoricalColumnsThreshold: object
Configure categories to hide in the filter view of categorical variables. Categories less frequent than the configured threshold will not appear in the UI.
Items in categoricalColumnsThreshold
thresholds: array[object] | array[object] | array[object] | array[object]
A list of threshold configurations. A categorical column can have two kinds of thresholds determining whether specific categories will be hidden from its view in the UI: a minimum number of rows in the current selection below which a category will be hidden, or a minimum number of rows in the whole dataset (everything).
The thresholds
parameter should be a list containing 1 or 2 objects: the configuration of a selection
threshold, and/or the configuration of a threshold for everything.
Items in thresholds
isDefault: boolean = False
Flag for internal usage identifying non-user configurations.
column: string | null
Main column from which the insight is created.
columnViewModes: object
Visual representation mode of the insight's columns. For each column select whether to show it as a list or bar chart. By default, all column representations are "barChart".
Items in columnViewModes
*param: string
One or more additional parameters. Note that all parameters should have the same type.
Must be one of:
"barChart"
,
"list"
Example parameter values:
{"country": "list", "vote intention": "list", "cluster": "barChart"}
elements: array[object]
Type and appearance of an insight's elements. A list in which each item is an object configuring the appearance of a particular insight element.
Items in elements
kind: string
Specify the type of element.
Must be one of:
"TITLE"
,
"DESCRIPTION"
,
"CHART"
,
"GRAPH"
,
"STATS"
,
"LEGEND"
,
"LEGEND_COLOR_SCALE"
text: string
The text shown for this insight element.
layout: object
The element's position and size. The position refers to the top-left corner of the rectangle representing the insight element, while the size is given by its width and height. For reference, the entire insight is 12 units wide and 9 units high, and the origin (0, 0) of the x/y coordinates is in its top-left corner.
Items in layout
x: integer
Horizontal position of the element's top-left corner. In increments of 1; 0 being the left-most and 8 the right-most position.
Range: -1 ≤ x ≤ 11
y: integer
Vertical position of the element's top-left corner. In increments of 1; 0 being the top-most and 11 the bottom-most position.
Range: 0 ≤ y ≤ 11
w: integer
The width of the element (in increments of 1).
Range: 1 ≤ w ≤ 12
h: integer
The height of the element (in increments of 1).
Range: 1 ≤ h ≤ 9
column: string
Name of the column containing the data to be used in this insight element. Required if the element is of type CHART or STATS.