Configuring an Entity Extension¶
In this optional step you can add a new column to those that already exist for the project entities. Every extension is specific to the project. The following workflow is recommended:
- Create an Entity Extension.
- Select a source for the Entity Extension.
- Load custom scripts.
- Deploy the Environment.
- Run a Flow:
- If the data warehouse is empty, run an initial flow to load custom entities.
- If the data warehouse has already been populated (by means of an initial flow and possibly a number of incremental flows) you can launch a "Run single entity" operation to retrieve the extension data.
Procedure¶
- On the Project page, select the "Entity Extensions" tab.
- Click "Create Entity Extension".
- From the "Entity" drop-down list, select an entity.
- In the "Column Name" field, insert a name for the column.
- Select the "Column Type" from the available list, whose elements depend on the characteristics of the entity you have previously selected. Depending on the type of entity you have selected, the "Column Type" drop-down list may contain columns of type "datetime".
- Select the** "Relationship" (only if the selected entity is a fact).
- Click "Add Column".
- Click "Save".
If the extended entity has already been selected in a smart view and you add relations to existing contexts in the extension, you must save measures again to display these relations in the "Attributes" tab of the smart view.
Column types¶
Entity Type: Fact and Generic Entity¶
Relationship: To set a relationship with another entity. If you have added a Relationship column to an extension of analytical fact type, you can only set a relationship with an analytical context. On the contrary, if you have created an extension of analytical context type, you cannot set any relationship. If a Relationship column is added, the name of the column always ends with the name of the unique identifier of the target context (e.g. if the target context is Equipment, the name always ends with EquipmentId) and the name provided for the user is used as a prefix.
Quantity: Numeric value (float) that can be aggregated by any type of aggregation (for example by a sum, average, min, max...) on the basis of a time dimension and of any other type of dimension.
Level Quantity: Numeric value (float) that implicitly expresses the Sum aggregation based on time from the moment 0 to NOW. Therefore it provides the total quantity compared to the latest check. The Sum aggregation can only be used for non-time dimensions. All other aggregations can be performed on the basis of all possible dimensions (including time dimensions). For example, this value can express the liters of liquid in a tank at a certain moment.
Example
In a plant, two different tanks contain a liquid which can be either added to the tank or removed from it.
- Tank 1 contains 5 liters at 10 a.m. and 7 liters at 11 a.m.
- Tank 2 contains 8 liters at 10 a.m. and 4 liters at 11 a.m.
If you add 5 to 7, the result is not meaningful, because you would aggregate the values by a sum on the basis of a time dimension. However, if you add 5 to 8, you can obtain the average number of liters available in the plant at 10 a.m., i.e. the aggregation is based on a non-time dimension.
Unitary Quantity: Numeric value (float). The two following types exist:
- Measures that express a value compared to another unitary quantity (pieces per second, Euros per piece, etc.).
- Measures that can never be added together (for example temperature, humidity, etc.).
These measures can never be aggregated by a sum, neither for time dimensions nor for non-time dimensions. Other aggregation functions, such as Average, Min and Max, can however be used for any type of dimension (including time dimensions). These types of quantity can be aggregated using a Sum when they are multiplied by a numeric value they have a relationship with.
Example 1
The unitary quantity "pieces per second" can be aggregated for time and non-time dimensions after you have multiplied it by the time required for the analysis. If a piece of equipment produces 5 items per second and you multiply it by 10 seconds you obtain 50 pieces, which is a quantity value that can be used for any type of dimension and aggregation.
Example 2
The temperature of two different equipment units (ovens) is measured by means of two sensors. You can calculate the Average, Min or Max temperature at a specific time, but it would make no sense to add the temperatures together.
Duration: Numeric value that contains information about the duration.
Entity Type: Context and Generic Entity¶
Name: Field of "nvarchar" type that is used to create a column in the data warehouse to manage specific types of textual information. Identifies a property of 255 characters in length.
If you modify an entity extension that was already deployed and on which data was stored, you cannot use mandatory column types such as Name, otherwise the next deployment will fail because the system will not automatically add a value for that column. The recommended alternative is to use the TextAttribute or Note column types.
Description: Field of "nvarchar" type that is used to create a column in the data warehouse to manage specific types of textual information. Identifies a property of 1000 characters in length.
Note: Field of "nvarchar" type that is used to create a column in the data warehouse to manage specific types of textual information. Identifies a property of 4000 characters in length.
TextAttribute: Field of "nvarchar" type that is used to create a column in the data warehouse to manage specific types of textual information. Identifies a property of 255 characters in length.
Entity Type: Generic Entity¶
StartDateTime: Starting date and time of an event. For this field the UTC format must be applied. Local time columns are automatically added by the system for each UTC time column.
EndDateTime: Ending date and time of an event. For this field the UTC format must be applied. Local time columns are automatically added by the system for each UTC time column.
EventDateTime: Precise date and time of an event. For this field the UTC format must be applied. Local time columns are automatically added by the system for each UTC time column.
Selecting the Entity Extension source¶
- In the "Entity Extensions" tab, select an entity extension for which you want to select a source.
- Click "Open".
- In the "Extension Sources" page, click "Create Extension Source".
- In the "Create Extension Source" panel, select one or more sources among those you have already created.
- Click "Save".
Deleting an Entity Extension¶
You can delete an entity extension when it is no longer used in dashboards nor reports. Before you delete it, you can choose whether you want to remove it permanently from the Manufacturing Data Warehouse or not. If you choose the first option, at the next deploy of the Environment the entity is physically deleted from the data warehouse and views and stored procedures are removed from the data source contract. If you remove the entity permanently, all data related to that specific entity saved in the Manufacturing Data Warehouse are lost.
- In the "Entity Extensions" tab, select an entity extension and click "Delete Entity Extension".
- In the "Delete Entity Extension" panel, do either of the following:
- Leave the "Delete from Data Warehouse" checkbox selected if you want to remove the entity from the MDW.
- Deselect the "Delete from Data Warehouse" checkbox if you only want to remove the views from the data source contracts.
- Click "Delete".