Skip to content

Template

cognite.neat.session._template.TemplateAPI #

Create a template for a new data model.

enterprise_model(data_model_id, org_name='CopyOf', dummy_property='GUID') #

Creates a template for an enterprise model based on the current data model in the session. An enterprise data model is a model that is used for read and write of instances. In addition, it is governed by the organization. The basis for an enterprise data model should be a Cognite Data Model.

Parameters:

Name Type Description Default
data_model_id DataModelIdentifier

The enterprise data model id that is being created

required
org_name str

Organization name to use for the views in the enterprise data model.

'CopyOf'
dummy_property str

The dummy property to use as placeholder for the views in the new data model.

'GUID'

What does this function do? 1. It creates a new view for each view in the current data model that implements the view it is based on. 2. If dummy_property is set, it will create a container with one property for each view and connect the view to the container. 3. It will repeat all connection properties in the new views and update the ValueTypes to match the new views.

Enterprise Data Model Creation

Always create an enterprise data model from a Cognite Data Model as this will assure all the Cognite Data Fusion applications to run smoothly, such as - Search - Atlas AI - Infield - Canvas - Maintain - Charts

data_product_model(data_model_id, include='same-space') #

Creates a template for a data product model based on the current data model in the session. A data product model is only used for reading of instances. It can be based on any data model, but typically it is based on an enterprise or solution data model.

A data product model is a data model that ONLY maps to containers and do not use implements. This is typically used for defining the data in a data product.

What does this function do? 1. It creates a new view for each view in the current data model. The new views uses the same filter as the view it is based on. 2. It will repeat all connection properties in the new views and update the ValueTypes to match the new views.

Parameters:

Name Type Description Default
data_model_id DataModelIdentifier

The data product data model id that is being created.

required
include Literal['same-space', 'all']

The views to include in the data product data model. Can be either "same-space" or "all". If you set same-space, only the properties of the views in the same space as the data model will be included.

'same-space'

conceptual_model(io, base_model='CogniteCore', total_concepts=None) #

This method will create a template for a conceptual data modeling

Parameters:

Name Type Description Default
io Any

file path to the Excel sheet

required
base_model BASE_MODEL

The base model to use for implements in the conceptual data model. Currently only supporting CogniteCore.

'CogniteCore'
total_concepts int | None

The total number of concepts to provide in implements for selection. Default is None, meaning all concepts will be provided.

None

expand(io, output=None, dummy_property='GUID') #

Creates a template for an extension of a Cognite model by expanding properties from CDM.

The input is a spreadsheet of a conceptual model in which the concepts are defined and marked with the Cognite concept they are extending. For example, if you have a pump in the Classes sheet you will see

Class: Pump
Implements: cdf_cdm:CogniteAsset(version=v1)
The output will be a spreadsheet in which all the properties from the Cognite concept model is added to the spreadsheet. In the example above, the pump concept will have all the properties it inherits from the CogniteAsset concept added to the Properties spreadsheet.

Parameters:

Name Type Description Default
io Any

The input spreadsheet.

required
output str | Path | None

The output spreadsheet. If None, the output will be the same as the input with _extension added to the name.

None
dummy_property str

The dummy property to use as placeholder for user-defined properties for each user-defined concept, and to alleviate need for usage of filters in physical data model. When converting a data model, it is recommended to have at least one property for each concept. This ensures that you follow that recommendation.

'GUID'