Structure of digital Entities

The Entity Type structure is defined in JSON format. JSON stands for Java Script Object Notation, and simply put, JSON is a javascript object written as a text string. Thanks to this feature, the structure can be modified at any time with minimal restrictions. Another major advantage is that it can be done during normal system operation.

A sample structure for an entity type

Sample attribute structure (web editor jsoneditoronline.org)

In the textual detail of the JSON definition it looks like this.

{
  "status": {
    "type": "telemetry",
    "unit": null,
    "trans": {
      "cs": "Stav",
      "de": "Status",
      "en": "Status",
      "sk": "Stav"
    },
    "value_type": "string",
    "value_default": "virtual",
    "attribute_rules": {
      "fill_color": [
        {
          "value": "#adadad",
          "condition": "virtual"
        },
        {
          "value": "#1eff00",
          "condition": "OK"
        },
        {
          "value": "#ff2a00",
          "condition": "NOK"
        }
      ]
    }
  },
  "icon_name": {
    "type": "static",
    "unit": "",
    "trans": {
      "cs": "Méno ikony",
      "de": "Symbolname",
      "en": "Icon name",
      "sk": "Meno ikony"
    },
    "value_type": "string",
    "value_default": "first-aid-kit"
  },
  "fill_color": {
    "type": "static",
    "unit": null,
    "trans": {
      "cs": "Barva výplně",
      "de": "Füllfarbe",
      "en": "Fill color",
      "sk": "Farba vyplnenia"
    },
    "rich_type": "color",
    "value_type": "string",
    "value_default": "#ff2a00"
  },
  "atribut_1": {
    "type": "static",
    "unit": "",
    "trans": {
      "cs": "Popis attributu 1 v cs jazyku",
      "de": "Popis attributu 1 v de jazyku",
      "en": "Popis attributu 1 v en jazyku",
      "sk": "Popis attributu 1 v sk jazyku"
    },
    "value_type": "string",
    "value_default": ""
  },
  "atribut_2": {
    "type": "telemetry",
    "unit": "",
    "trans": {
      "cs": "Popis attributu 2 v cs jazyku",
      "de": "Popis attributu 2 v de jazyku",
      "en": "Popis attributu 2 v en jazyku",
      "sk": "Popis attributu 2 v sk jazyku"
    },
    "value_type": "string",
    "value_default": ""
  },
  "atribute_date": {
    "type": "telemetry",
    "unit": " ",
    "trans": {
      "cs": "Popis attribute_date v cs jazyku",
      "de": "Popis attribute_date v de jazyku",
      "en": "Popis attribute_date v en jazyku",
      "sk": "Popis attribute_date v sk jazyku"
    },
    "rich_type": "datetime",
    "value_type": "number",
    "value_default": 0
  },
  "atribute_flow": {
    "type": "static",
    "unit": "",
    "trans": {
      "cs": "Popis attribute_flow v cs jazyku",
      "de": "Popis attribute_flow v de jazyku",
      "en": "Popis attribute_flow v en jazyku",
      "sk": "Popis attribute_flow v sk jazyku"
    },
    "value_type": "number",
    "value_default": "0.001"
  },
  "atribute_url": {
    "type": "static",
    "unit": " ",
    "trans": {
      "cs": "Popis attribute_url v cs jazyku",
      "de": "Popis attribute_url v de jazyku",
      "en": "Popis attribute_url v en jazyku",
      "sk": "Popis attribute_url v sk jazyku"
    },
    "rich_type": "url",
    "value_type": "string",
    "value_default": ""
  }
}

List of mandatory Attributes

Each Type of Entity has a so-called mandatory attributes so that everything works reliably in the system despite its enormous genetics and adaptability. Mandatory attributes are:

status

This attribute represents the state of objects from the point of view of operation. Its values can be as follows:

  • virtual – represents a ready digital object that is not yet connected to any incoming telemetry. The virtual value is also the default value
  • OK – represents a telemetry-recorded value representing a properly functioning digital object
  • NOK – represents a telemetry-recorded value representing a malfunctioning digital object (i.e. an object showing an anomaly with respect to the OK state)

icon_anme

This attribute expresses the technical name of the icon representing the given Entity Type.

fill_color

This attribute expresses the color value in hexadecimal representation of the given digital object. And it doesn’t matter if it’s an icon or a polygon.

Technically, the definition of mandatory fields in JSON format looks like this.

{
  "status": {
    "type": "telemetry",
    "unit": null,
    "trans": {
      "cs": "Stav",
      "de": "Status",
      "en": "Status",
      "sk": "Stav"
    },
    "value_type": "string",
    "value_default": "virtual",
    "attribute_rules": {
      "fill_color": [
        {
          "value": "#adadad",
          "condition": "virtual"
        },
        {
          "value": "#1eff00",
          "condition": "OK"
        },
        {
          "value": "#ff2a00",
          "condition": "NOK"
        }
      ]
    }
  },
  "icon_name": {
    "type": "static",
    "unit": "",
    "trans": {
      "cs": "Méno ikony",
      "de": "Symbolname",
      "en": "Icon name",
      "sk": "Meno ikony"
    },
    "value_type": "string",
    "value_default": "first-aid-kit"
  },
  "fill_color": {
    "type": "static",
    "unit": null,
    "trans": {
      "cs": "Barva výplně",
      "de": "Füllfarbe",
      "en": "Fill color",
      "sk": "Farba vyplnenia"
    },
    "rich_type": "color",
    "value_type": "string",
    "value_default": "#ff2a00"
   },
//  ...
// ďalšie atribúty
//  ...
  }

Due to the effort to keep incoming data to individual Entities in a flawless state, it is not yet possible to change the structure of the Entity Type through the user interface. The new or modified Entity Type created by you will be uploaded to the system by the platform operator via the help desk request you entered. The change will be made free of charge, and this activity is already part of the monthly fee. At the same time, it will check the consistency of the changes and, if discrepancies are detected, it will alert you to potential risks and at the same time help you eliminate them.

Attribute structure

Parameters are used to define the attribute, with the help of which we can “model” the attribute in such a way that its use is simple and intuitive. In the following section, we will describe the individual parameters of the attribute:

type

(mandatory parameter)

This parameter defines the type of the Attribute from the point of view of the data acquisition method. It can have the following values:

  • static – data is entered and changed manually via City Studio
  • telemetry – the data will be sent as input telemetry from the device or software integration
  • computed – the field will be calculated from other parameters of Attributes and Attributes of other Entities in the system defined by type static or telemetry.

unit

(mandatory parameter)

This parameter defines the unit of the physical quantity of the given Attribute (e.g. pcs, %, €, etc.)

value_type

(mandatory parameter)

This parameter defines the type of variable stored in the given Attribute. It can acquire the following values:

  • string – text string
  • number – An integer or a number with decimal places.
  • bool – status flag i.e. boolean (true, false)

value_default

(mandatory parameter)

This parameter specifies the initial value of the attribute at creation. If the value_type is a number, then through the initial value we can set whether it is a whole number or a decimal. For example if the initial value is 0, it will be whole numbers. If the initial value is 0.01, it will be a value with decimal places.

trans

(mandatory parameter)

This parameter acts as an object and allows specifying translations of the Attribute name. For each language it is translated through language tags ( ISO 639-1)

"trans": {
  "cs": "Méno ikony",
  "de": "Symbolname",
  "en": "Icon name",
  "sk": "Meno ikony"
},

value_min

(optional parameter)

It represents the setting of the lower limit of the possible value of the field in the case of input by the user via the web interface. This restriction only applies if the field type is numeric (integer).

value_max

(optional parameter)

It represents the setting of the upper limit of the possible value of the field in the case of input by the user via the web interface. This restriction only applies if the field type is numeric (integer).

rich_type

(optional parameter)

Extending the value_type parameter allows you to display a special UI element or formatting.

You can see more about this in the Digital Entity Attribute Types section.