BRAINCUBE ACTIONTYPE

Description

The ActionType enum can be seen as a dictionary of all the actions that can be applied to objects through the web services.

Some of them only apply to a subset of entities. Please refer to the web service documentation to know which ones can be used.

Objects used in actions

BraincubeObject

Attribute Description Type Required?
bcId Braincube ID of the object Number Yes
{
    "bcId": 200004
}

ComputedContext

Attribute Description Type Required?
formulas Array of ConditionalFormula Yes
variables Map of placeholder => BraincubeObject Map<String, BraincubeObject} Yes

Example:

{
    "formulas": [
        {
            "formula": "[V1] * [V2]",
            "condition": "[V1] < [V2]"
        },
        {
            "formula": "[V1]"
        }
    ],
    "variables": {
        "V1": {
            "bcId": 200004
        },
        "V2": {
            "bcId": 200005
        }
    }
}

Condition

Attribute Description Type Required?
variable The variable on which to add the condition. BraincubeObject Yes
data Braincube ID of the variable. Number DEPRECATED
minimum Minimum value. Number No
maximum Maximum value. Number No
positive Indicates if the condition is positive or negative. Boolean No
active Indicates if the condition is active or not. Boolean No
modalities List of modalities. Array of String No

ConditionalFormula

Attribute Description Type Required?
formula Formula String Yes
condition Condition used to know if the formula should be executed String No

Example:

{
    "formula": "-35.2 + 2.5 * [V1] - 0.8 * [V2]",
    "condition": "[V1] < [V2]"
}

IdentifiableObject

Attribute Description Type Required?
bcId Braincube ID of the object Number No
uuid Identifier of the object String No

One of bcId or uuid has to be set.

{
    "bcId": 200004,
    "uuid": "c6b46995-6e17-4081-9617-733227319d00"
}

ModelEntry

Attribute Description Type Required?
conditions conditions of model Array of Condition Yes
category category of model ("GOOD" or "BAD") String Yes

Style

Attribute Description Type Required?
color Color to apply (an hexa color, starting with #) String No
plotType Type of plot. One of: * CURVE * INTERPOLATION_CURVE * STEP * AREA * BAR String No
pointType Type of points. One of: * CIRCLE * SQUARE * TRIANGLE * DIAMOND * CROSS String No
pointSize Size of points Number No
lineType Type of lines. One of: * SOLID * DOTTED * DASHED Number No
lineSize Size of lines Number No

VariableFilter

Attribute Description Type Required?
pattern Pattern used to filter variables on their names (it should match its tag or local or standard) String No
visibility Variable visibility. One of: * ALL * VISIBLE * HIDDEN String No
dataTypes Array of data types. Available values are: * TRACEABILITY * DATETIME * DISCRETE * NUMERICAL String[] No
controlTypes Control types. Available values are: * SETTING * OBJECTIVE * INDICATOR String[] No
families Families Array of { label: String, subLabel: String } No
locations Locations Array of { label: String, subLabel: String } No
types Types Array of { label: String, subLabel: String } No
dataGroup Data group (deprecated - use dataGroups instead) { uuid: String } or { bcId: Integer } No
dataGroups Data groups Array of { uuid: String } or { bcId: Integer } No
excludedVariables Variables that should not pass the filter Array of { bcId: Integer } No

List of actions

ADD_CONDITION

Add a Condition to the object.

Example

{
  "type": "ADD_CONDITION",
  "data": {
    "variable": {
      "bcId": 200009
    },
    "positive": false,
    "modalities": ["MODALITY 1", "OTHER MODALITY"]
  }
}

ADD_EVENT

Add a Event to the object. | Attribute | Description | Type | Required? | | --- | --- | --- | --- | | event | Event to add to EventGroup | BraincubeObject | No | | included | Event is included (visible) in eventGroup or is excluded (not visible)| Boolean | No |

Example

{
  "type": "ADD_EVENT",
  "data": {
    "event": {
          "bcId": 12
        },
    "status": "EXCLUDED"
  }
}

ADD_VARIABLE

Add a variable to the object.

Attribute Description Type Required?
data Variable BraincubeObject No (because it can be a computed variable)
conditions Variable conditions (used to split the variable) Array of Condition No
style Style to apply to the variable Style object No
computedContext Context that defines a calculated variable ComputedContext object No
name Name of the calculated variable String No
unit Unit of the calculated variable String No

One of the following is required:

  • data
  • computedContext, name, and unit

Both cannot be used simultaneously.

Examples

// With data attribute
{
  "type": "ADD_VARIABLE",
  "data": {
    "data": {
      "bcId": 200009
    },
    "conditions": [
      {
        "variable": {
          "bcId": 200009
        },
        "maximum": 20,
        "active": true,
        "positive": true,
        "minimum": 10
      }
    ],
    "style": {
      "color": "#00ff00",
      "pointType": "DIAMOND"
    }
  }
}
// With computed context and name attributes
{
  "type": "ADD_VARIABLE",
  "data": {
    "name": "Test formula",
    "unit": "g",
    "computedContext": {
      "formulas": [
        {
          "formula": "-35.2 + 2.5 * [v1] - 0.8 * [v2]"
        }
      ],
      "variables": {
        "v1": {
          "bcId": 200004
        },
        "v2": {
          "bcId": 200005
        }
      }
    },
    "style": {
      "color": "#0066cc",
      "pointType": "CIRCLE"
    }
  }
}

SET_EVENTS

Set events to the object.

Attribute Description Type Required?
positiveEvents List of positive events. Array of IdentifiableObject No
negativeEvents List of negative events. Array of IdentifiableObject No

Example

{
  "type": "SET_EVENTS",
  "data": {
    "positiveEvents": [
      { "bcId": 478 }
    ],
    "negativeEvents": [
      { "bcId": 201 },
      { "uuid": "" }
    ]
  }
}

SET_LIMIT

Set limit (customerSpecMin, customerSpecMax, internalSpecMin, internalSpecMax, target) to a spcData.

Attribute Description Type Required?
spcData ID of the spcData of the Specification Double Yes
customerSpecMin Lower bound of customer Limit Double No
customerSpecMax Upper bound of customer Limit Double No
internalSpecMin Lower bound of internal Limit Double No
internalSpecMax Upper bound of internal Limit Double No
target Target Double No
{
  "type": "SET_LIMIT",
  "data": {
    "spcData": 226,
    "customerSpecMin": 10,
    "customerSpecMax": 20
  }
}

SET_MODEL

Set the model of the object.

Attribute Description Type Required?
modelEntries The model to apply. Array of ModelEntry Yes

Examples

{
  "type": "SET_MODEL",
  "data": {
    "modelEntries": [
      {
        "conditions": [
          {
            "variable": {
              "bcId": 200687
            },
            "minimum": 15,
            "maximum": 20,
            "modalities": []
          },
          {
            "variable": {
              "bcId": 200687
            },
            "minimum": 15,
            "maximum": 15.5,
            "modalities": []
          }
        ],
        "category": "GOOD"
      }
    ]
  }
}

Note :

  • We can do AND on the variables of the same category.
  • We can do OR on the variables of 2 distinct categories.

SET_PERIOD

Set the period of the object.

Attribute Description Type Required?
periodUnitType Type of period unit (one of HOUR, DAY, WEEK, MONTH, QUARTER, YEAR, CUSTOM or ALL) String Yes
quantity Number of period units. If 0, it takes the current period (e.g. from 01/02/18 to 14/02/18), if 1 it takes a complete period (e.g. from 14/01/18 to 14/02/18), and so on. Number No
calendarQuantity Same as quantity, but it always takes the current period (from ... to now). Min value is 1 (e.g. from 01/02/18 to 14/02/18). Example for 2: from 01/01/18 to 14/02/18). If both quantity and calendarQuantity are set, only calendarQuantity is considered. Number Yes
offset Period offset. Example with offset -1, MONTH and calendarQuantity 2, current date 14/02/18: from 01/12/17 to 01/02/18 Number No
offsetQuantity Offset used to slide the period quantity month by month. Number No
begin Beginning date. Number (timestamp in ms) No
end Ending date. Number (timestamp in ms) No

Examples

{
  "type": "SET_PERIOD",
  "data": {
    "periodUnitType": "MONTH",
    "calendarQuantity": 2,
    "offset": -1
  }
}
{
  "type": "SET_PERIOD",
  "data": {
    "periodUnitType": "CUSTOM",
    "begin": 1515542400000,
    "end": 1528100485000
  }
}

SET_TYPE

Set the type of the object.

Attribute Description Type Required?
There are no attributes

This action does not take attributes: its data is the type.
Types allowed are:

  • INDEXPLOT
  • LOADPLOT
  • TIMEPLOT
  • MULTIPLOT
  • HISTOGRAM
  • BOXPLOT
  • HYPERLIFT
  • AGGREGATEPLOT
  • HEATMAP

Example

{
  "type": "SET_TYPE",
  "data": "INDEXPLOT"
}

SORT

(1) Sort objects.

Attribute Description Type Required?
formula Braindata formula used to sort objects. Object Yes
filter Braindata filter used to filter objects. Object No
filterPredicate When sorting variables, you can define a predicate that will be used to filter variables (so not all variables will be sorted). VariableFilter No

Example (1) Sort objects

{
  "type" : "SORT",
  "data" : {
    "formula" : {
      "SUM" : [
        {
          "placeholder": "[$1]"
        }
      ]
    },
    "filter" : {
      "BETWEEN": ["mb1/d100001", "20060101_160000", "20060101_170000"]
    }
  }
}

SET_REFERENCE

Sort objects.

Attribute Description Type Required?
variable Data used for the object reference . IBraincubeObject Yes

Example

{
  "type": "SET_REFERENCE",
  "data": {
    "variable": {
      "bcId": 200687
    }
  }
}

ADD_VARIABLE

Add a variable to the object.

Attribute Description Type Required?
data Variable BraincubeObject No (because it can be a computed variable)
conditions Variable conditions (used to split the variable) Array of Condition No
style Style to apply to the variable Style object No
computedContext Context that defines a calculated variable ComputedContext object No
name Name of the calculated variable String No
unit Unit of the calculated variable String No

One of the following is required:

  • data
  • computedContext, name, and unit

Both cannot be used simultaneously.

Examples

// With data attribute
{
  "type": "ADD_VARIABLE",
  "data": {
    "data": {
      "bcId": 200009
    },
    "conditions": [
      {
        "variable": {
          "bcId": 200009
        },
        "maximum": 20,
        "active": true,
        "positive": true,
        "minimum": 10
      }
    ],
    "style": {
      "color": "#00ff00",
      "pointType": "DIAMOND"
    }
  }
}

REMOVE_VARIABLE

Remove a variable to the object.

Attribute Description Type Required?
data Variable BraincubeObject No (because it can be a computed variable)
conditions Variable conditions (used to split the variable) Array of Condition No
computedContext Context that defines a calculated variable ComputedContext object No
name Name of the calculated variable String No
unit Unit of the calculated variable String No

One of the following is required:

  • data
  • computedContext, name, and unit

Both cannot be used simultaneously.

Examples

// With data attribute
{
  "type": "REMOVE_VARIABLE",
  "data": {
    "data": {
      "bcId": 200009
    },
    "conditions": [
      {
        "variable": {
          "bcId": 200009
        },
        "maximum": 20,
        "active": true,
        "positive": true,
        "minimum": 10
      }
    ]
  }
}

REPLACE_VARIABLE

Replaces a variable in a chart with another one. If the variable to replace has splits it replaces the mother node and recreates the same splits from the new variable

Attribute Description Type Required?
data Variable BraincubeObject Yes

Examples

// With data attribute
{
  "type": "REPLACE_VARIABLE",
  "data": {
    "blocUuid": "the-uuid-of-the-bloc",
    "variable": {
      "data": {
        "bcId": 200010
      }
    }
  }
}

SET_VARIABLE

Sets a variable in a chart modifying some of its attributes

Attribute Description Type Required?
data Variable BraincubeObject Yes

Examples

// With data attribute
{
  "type": "SET_VARIABLE",
  "data": {
    "blocUuid": "the-uuid-of-the-bloc",
    "visible": true
  }
}

Was this article helpful?

Powered by Zendesk